/* * Copyright (c) 2024, stelar7 * Copyright (c) 2025, Altomani Gianluca * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include // https://www.inf.pucrs.br/~calazans/graduate/TPVLSI_I/RSA-oaep_spec.pdf TEST_CASE(test_oaep) { auto msg = "WellHelloFriendsWellHelloFriendsWellHelloFriendsWellHelloFriends"sv.bytes(); auto keypair = TRY_OR_FAIL(Crypto::PK::RSA::generate_key_pair(1024)); auto rsa = Crypto::PK::RSA_OAEP_EME(Crypto::Hash::HashKind::SHA1, keypair); rsa.set_label("LABEL"sv.bytes()); auto enc = TRY_OR_FAIL(rsa.encrypt(msg)); auto dec = TRY_OR_FAIL(rsa.decrypt(enc)); EXPECT_EQ(msg, dec); }