LibCrypto: Add support for raw EC keys and SECPxxxr1 signatures

This commit is contained in:
Ali Mohammad Pur 2025-05-13 12:08:29 +02:00 committed by Ali Mohammad Pur
commit 3dd246a8e1
Notes: github-actions[bot] 2025-06-11 16:18:13 +00:00
2 changed files with 35 additions and 2 deletions

View file

@ -61,9 +61,19 @@ static ErrorOr<ECPublicKey<>> read_ec_public_key(ReadonlyBytes bytes, Vector<Str
UnsignedBigInteger::import_data(bytes.slice(1 + half_size, half_size)),
half_size,
};
} else {
ERROR_WITH_SCOPE("Unsupported public key format");
}
if (bytes.size() % 2 == 0) {
// Raw public key, without the 0x04 prefix
auto half_size = bytes.size() / 2;
return ::Crypto::PK::ECPublicKey<> {
UnsignedBigInteger::import_data(bytes.slice(0, half_size)),
UnsignedBigInteger::import_data(bytes.slice(half_size, half_size)),
half_size,
};
}
ERROR_WITH_SCOPE("Unsupported public key format");
}
// https://www.rfc-editor.org/rfc/rfc5915#section-3