Add EMMG to carry fingerprinting and service blocking info
This commit is contained in:
@@ -143,39 +143,6 @@ bool ECPrivateKey::DeriveSharedSessionKey(
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ECPrivateKey::GenerateSignature(const std::string& message,
|
||||
std::string* signature) const {
|
||||
if (message.empty()) {
|
||||
LOG(ERROR) << "|message| cannot be empty";
|
||||
return false;
|
||||
}
|
||||
if (signature == nullptr) {
|
||||
LOG(ERROR) << "|signature| cannot be nullptr";
|
||||
return false;
|
||||
}
|
||||
std::string message_digest = Sha256_Hash(message);
|
||||
size_t max_signature_size = ECDSA_size(key());
|
||||
if (max_signature_size == 0) {
|
||||
LOG(ERROR) << "key_ does not have a group set";
|
||||
return false;
|
||||
}
|
||||
signature->resize(max_signature_size);
|
||||
unsigned int bytes_written = 0;
|
||||
int result = ECDSA_sign(
|
||||
0 /* unused type */,
|
||||
reinterpret_cast<const uint8_t*>(message_digest.data()),
|
||||
message_digest.size(),
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(signature->data())),
|
||||
&bytes_written, key());
|
||||
if (result != 1) {
|
||||
LOG(ERROR) << "Could not calculate signature: "
|
||||
<< OpenSSLErrorString(ERR_get_error());
|
||||
return false;
|
||||
}
|
||||
signature->resize(bytes_written);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ECPrivateKey::GenerateSignature(const std::string& message,
|
||||
HashAlgorithm hash_algorithm,
|
||||
std::string* signature) const {
|
||||
@@ -287,31 +254,6 @@ std::unique_ptr<ECPublicKey> ECPublicKey::CreateFromKeyPoint(
|
||||
return absl::make_unique<ECPublicKey>(scoped_ec_key.release());
|
||||
}
|
||||
|
||||
bool ECPublicKey::VerifySignature(const std::string& message,
|
||||
const std::string& signature) const {
|
||||
if (message.empty()) {
|
||||
LOG(ERROR) << "|message| cannot be empty";
|
||||
return false;
|
||||
}
|
||||
if (signature.empty()) {
|
||||
LOG(ERROR) << "|signature| cannot be empty";
|
||||
return false;
|
||||
}
|
||||
std::string message_digest = Sha256_Hash(message);
|
||||
int result = ECDSA_verify(
|
||||
0 /* unused type */,
|
||||
reinterpret_cast<const uint8_t*>(message_digest.data()),
|
||||
message_digest.size(),
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(signature.data())),
|
||||
signature.size(), key());
|
||||
if (result != 1) {
|
||||
LOG(ERROR) << "Could not verify signature: "
|
||||
<< OpenSSLErrorString(ERR_get_error());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ECPublicKey::VerifySignature(const std::string& message,
|
||||
HashAlgorithm hash_algorithm,
|
||||
const std::string& signature) const {
|
||||
|
||||
Reference in New Issue
Block a user