diff options
author | Jack Lloyd <[email protected]> | 2017-06-07 16:16:42 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-06-07 16:18:06 -0400 |
commit | a8e784972b10d41bfd49aeb3650f4ee03d449f55 (patch) | |
tree | f01297aa90423e2c4fdf93bad05445c06992eabb /src/lib/pubkey/pk_algs.cpp | |
parent | aab41a7cb801f5d569597fc93951ba42879f8b6e (diff) |
Add Ed25519 key type and tests
This work was sponsored by Ribose Inc
Diffstat (limited to 'src/lib/pubkey/pk_algs.cpp')
-rw-r--r-- | src/lib/pubkey/pk_algs.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/pubkey/pk_algs.cpp b/src/lib/pubkey/pk_algs.cpp index 52e2e3be9..45e88f2a3 100644 --- a/src/lib/pubkey/pk_algs.cpp +++ b/src/lib/pubkey/pk_algs.cpp @@ -32,6 +32,10 @@ #include <botan/eckcdsa.h> #endif +#if defined(BOTAN_HAS_ED25519) + #include <botan/ed25519.h> +#endif + #if defined(BOTAN_HAS_GOST_34_10_2001) #include <botan/gost_3410.h> #endif @@ -120,6 +124,11 @@ load_public_key(const AlgorithmIdentifier& alg_id, return std::unique_ptr<Public_Key>(new ECKCDSA_PublicKey(alg_id, key_bits)); #endif +#if defined(BOTAN_HAS_ED25519) + if(alg_name == "Ed25519") + return std::unique_ptr<Public_Key>(new Ed25519_PublicKey(alg_id, key_bits)); +#endif + #if defined(BOTAN_HAS_GOST_34_10_2001) if(alg_name == "GOST-34.10") return std::unique_ptr<Public_Key>(new GOST_3410_PublicKey(alg_id, key_bits)); @@ -186,6 +195,11 @@ load_private_key(const AlgorithmIdentifier& alg_id, return std::unique_ptr<Private_Key>(new ECKCDSA_PrivateKey(alg_id, key_bits)); #endif +#if defined(BOTAN_HAS_ED25519) + if(alg_name == "Ed25519") + return std::unique_ptr<Private_Key>(new Ed25519_PrivateKey(alg_id, key_bits)); +#endif + #if defined(BOTAN_HAS_GOST_34_10_2001) if(alg_name == "GOST-34.10") return std::unique_ptr<Private_Key>(new GOST_3410_PrivateKey(alg_id, key_bits)); @@ -262,6 +276,13 @@ create_private_key(const std::string& alg_name, } #endif +#if defined(BOTAN_HAS_ED25519) + if(alg_name == "Ed25519") + { + return std::unique_ptr<Private_Key>(new Ed25519_PrivateKey(rng)); + } +#endif + // ECC crypto #if defined(BOTAN_HAS_ECC_PUBLIC_KEY_CRYPTO) |