[cr140] SignatureCreator deleted
This change removes the only use in Brave for `SignatureCreator`, and replaces it with `crypto::sign::Sign`. Chromium changes: https://chromium.googlesource.com/chromium/src/+/cb74f0799e82a75b96c414272adbeddf48db0a6b https://chromium.googlesource.com/chromium/src/+/7e517f85c0974949ee096e089e65dcdd8173f587 commit cb74f0799e82a75b96c414272adbeddf48db0a6b Author: Elly <ellyjones@chromium.org> Date: Tue Jul 8 20:24:53 2025 -0700 crypto: get rid of SignatureCreator All the remaining deps on it are gone now. Bug: 406190025 Change-Id: I10b9f37007c5308b98b64c02756d9d382eb1d838 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6711257 Reviewed-by: David Benjamin <davidben@chromium.org> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Commit-Queue: Elly FJ <ellyjones@chromium.org> Reviewed-by: Sergey Poromov <poromov@chromium.org> Cr-Commit-Position: refs/heads/main@{#1484137} commit 7e517f85c0974949ee096e089e65dcdd8173f587 Author: Elly <ellyjones@chromium.org> Date: Thu Jul 3 08:33:14 2025 -0700 components/policy: stop using SignatureCreator Instead, use crypto::sign::Sign(), which is functionally identical but not deprecated. Bug: 428657808 Change-Id: I50ffd6a84d31bd34221302c38c177ac7948954a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6692471 Commit-Queue: Elly FJ <ellyjones@chromium.org> Reviewed-by: Sylvain Defresne <sdefresne@chromium.org> Cr-Commit-Position: refs/heads/main@{#1482292}
This commit is contained in:
@@ -11,8 +11,9 @@
|
||||
#include "base/base64.h"
|
||||
#include "base/check.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "crypto/keypair.h"
|
||||
#include "crypto/rsa_private_key.h"
|
||||
#include "crypto/signature_creator.h"
|
||||
#include "crypto/sign.h"
|
||||
|
||||
namespace web_discovery {
|
||||
|
||||
@@ -81,20 +82,11 @@ std::optional<std::string> RSASign(crypto::RSAPrivateKey* key,
|
||||
base::AssertLongCPUWorkAllowed();
|
||||
CHECK(key);
|
||||
|
||||
std::vector<uint8_t> signature;
|
||||
auto signature_creator = crypto::SignatureCreator::Create(
|
||||
key, crypto::SignatureCreator::HashAlgorithm::SHA256);
|
||||
if (!signature_creator) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if (!signature_creator->Update(message.data(), message.size())) {
|
||||
return std::nullopt;
|
||||
}
|
||||
if (!signature_creator->Final(&signature)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return base::Base64Encode(signature);
|
||||
auto wrapped_key =
|
||||
crypto::keypair::PrivateKey::FromDeprecatedRSAPrivateKey(key);
|
||||
std::vector<uint8_t> signature_bytes = crypto::sign::Sign(
|
||||
crypto::sign::SignatureKind::RSA_PKCS1_SHA256, wrapped_key, message);
|
||||
return base::Base64Encode(signature_bytes);
|
||||
}
|
||||
|
||||
} // namespace web_discovery
|
||||
|
||||
Reference in New Issue
Block a user