mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
LibCrypto: Add support for raw EC keys and SECPxxxr1 signatures
This commit is contained in:
parent
b374322e38
commit
3dd246a8e1
Notes:
github-actions[bot]
2025-06-11 16:18:13 +00:00
Author: https://github.com/alimpfard
Commit: 3dd246a8e1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4709
Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 35 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue