1
0
Fork 0
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:
devgianlu 2024-12-23 17:41:37 +01:00 committed by Ali Mohammad Pur
parent d5e3a557fd
commit 9e08f71fd9
Notes: github-actions[bot] 2025-01-12 00:15:00 +00:00
4 changed files with 33 additions and 24 deletions

View file

@ -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());