mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibCrypto+LibWeb: Support passing parameters to ASN.1 wrappers
Add support for encoding parameters in `wrap_in_private_key_info` and `wrap_in_subject_public_key_info` as well as turn `Span<int>` into `Span<int const>`.
This commit is contained in:
parent
1647893fc8
commit
9eea94aa14
Notes:
github-actions[bot]
2024-11-27 10:02:00 +00:00
Author: https://github.com/devgianlu
Commit: 9eea94aa14
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2598
Reviewed-by: https://github.com/stelar7
3 changed files with 21 additions and 25 deletions
|
@ -126,7 +126,7 @@ c8yGzl89pYST
|
|||
auto keypair = Crypto::PK::RSA::parse_rsa_key(decoded);
|
||||
auto priv_der = MUST(keypair.private_key.export_as_der());
|
||||
auto rsa_encryption_oid = Array<int, 7> { 1, 2, 840, 113549, 1, 1, 1 };
|
||||
auto wrapped_priv_der = MUST(Crypto::PK::wrap_in_private_key_info(keypair.private_key, rsa_encryption_oid));
|
||||
auto wrapped_priv_der = MUST(Crypto::PK::wrap_in_private_key_info(keypair.private_key, rsa_encryption_oid, nullptr));
|
||||
auto priv_pem = MUST(Crypto::encode_pem(wrapped_priv_der, Crypto::PEMType::PrivateKey));
|
||||
auto rsa_from_pair = Crypto::PK::RSA(keypair.public_key, keypair.private_key);
|
||||
auto rsa_from_pem = Crypto::PK::RSA(priv_pem);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue