std::unique_ptr<Botan::Private_Key> load_private_key(const VarMap& vars) override { const std::string group_id = get_req_str(vars, "Group"); const BigInt x = get_req_bn(vars, "X"); Botan::EC_Group group(Botan::OIDS::lookup(group_id)); std::unique_ptr<Botan::Private_Key> key(new Botan::ECDSA_PrivateKey(Test::rng(), group, x)); return key; }
Test::Result run_one_test(const std::string&, const VarMap& vars) override { const Botan::BigInt modulus = get_req_bn(vars, "Mod"); const Botan::BigInt input = get_req_bn(vars, "In"); const Botan::BigInt expected = get_req_bn(vars, "Out"); const std::vector<uint8_t> key = get_req_bin(vars, "Key"); const std::vector<uint8_t> tweak = get_req_bin(vars, "Tweak"); Test::Result result("FPE_FE1"); const Botan::BigInt got = Botan::FPE::fe1_encrypt(modulus, input, key, tweak); result.test_eq("ciphertext", got, expected); const Botan::BigInt decry = Botan::FPE::fe1_decrypt(modulus, got, key, tweak); result.test_eq("decrypted", decry, input); return result; }