From 72f0f0ad2a9f869092b889779e2e9baed0fe7a85 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sat, 26 Dec 2015 21:54:09 -0500 Subject: Add generalized KEM interface Convert McEliece KEM to use it Add RSA-KEM --- src/tests/test_rsa.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/tests/test_rsa.cpp') diff --git a/src/tests/test_rsa.cpp b/src/tests/test_rsa.cpp index 2720ae49a..6c89a5b29 100644 --- a/src/tests/test_rsa.cpp +++ b/src/tests/test_rsa.cpp @@ -38,6 +38,25 @@ class RSA_ES_KAT_Tests : public PK_Encryption_Decryption_Test } }; +class RSA_KEM_Tests : public PK_KEM_Test + { + public: + RSA_KEM_Tests() : PK_KEM_Test("RSA", "pubkey/rsa_kem.vec", + {"E", "P", "Q", "R", "C0", "KDF", "OutLen", "K"}) + {} + + std::unique_ptr load_private_key(const VarMap& vars) override + { + const BigInt p = get_req_bn(vars, "P"); + const BigInt q = get_req_bn(vars, "Q"); + const BigInt e = get_req_bn(vars, "E"); + + std::unique_ptr key(new Botan::RSA_PrivateKey(Test::rng(), p, q, e)); + return key; + } + + }; + class RSA_Signature_KAT_Tests : public PK_Signature_Generation_Test { public: @@ -100,6 +119,7 @@ class RSA_Keygen_Tests : public PK_Key_Generation_Test BOTAN_REGISTER_TEST("rsa_encrypt", RSA_ES_KAT_Tests); BOTAN_REGISTER_TEST("rsa_sign", RSA_Signature_KAT_Tests); BOTAN_REGISTER_TEST("rsa_verify", RSA_Signature_Verify_Tests); +BOTAN_REGISTER_TEST("rsa_kem", RSA_KEM_Tests); BOTAN_REGISTER_TEST("rsa_keygen", RSA_Keygen_Tests); #endif -- cgit v1.2.3