mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibCrypto: Make RSA::generate_key_pair
return ErrorOr
Not currently needed as it cannot fail, but useful for future commits.
This commit is contained in:
parent
d5e3a557fd
commit
9e08f71fd9
Notes:
github-actions[bot]
2025-01-12 00:15:00 +00:00
Author: https://github.com/devgianlu
Commit: 9e08f71fd9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3225
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/gmta ✅
4 changed files with 33 additions and 24 deletions
|
@ -36,7 +36,9 @@ TEST_CASE(test_RSA_raw_encrypt)
|
|||
TEST_CASE(test_RSA_PKCS_1_encrypt)
|
||||
{
|
||||
ByteBuffer data { "hellohellohellohellohellohellohellohellohello123-"_b };
|
||||
Crypto::PK::RSA_PKCS1_EME rsa(Crypto::PK::RSA::generate_key_pair(1024));
|
||||
|
||||
auto keypair = TRY_OR_FAIL(Crypto::PK::RSA::generate_key_pair(1024));
|
||||
Crypto::PK::RSA_PKCS1_EME rsa(keypair);
|
||||
ByteBuffer buffer = {};
|
||||
buffer.resize(rsa.output_size());
|
||||
auto buf = buffer.bytes();
|
||||
|
@ -155,7 +157,8 @@ c8yGzl89pYST
|
|||
|
||||
TEST_CASE(test_RSA_encrypt_decrypt)
|
||||
{
|
||||
Crypto::PK::RSA rsa(Crypto::PK::RSA::generate_key_pair(1024));
|
||||
auto keypair = TRY_OR_FAIL(Crypto::PK::RSA::generate_key_pair(1024));
|
||||
Crypto::PK::RSA rsa(keypair);
|
||||
|
||||
ByteBuffer enc_buffer = {};
|
||||
enc_buffer.resize(rsa.output_size());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue