diff options
Diffstat (limited to 'src/cli/tls_utils.cpp')
-rw-r--r-- | src/cli/tls_utils.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/cli/tls_utils.cpp b/src/cli/tls_utils.cpp index ef590ff3f..b24af1656 100644 --- a/src/cli/tls_utils.cpp +++ b/src/cli/tls_utils.cpp @@ -18,7 +18,8 @@ class TLS_All_Policy : public Botan::TLS::Policy public: std::vector<std::string> allowed_ciphers() const override { - return std::vector<std::string>{ + return std::vector<std::string> + { "ChaCha20Poly1305", "AES-256/OCB(12)", "AES-128/OCB(12)", @@ -41,8 +42,7 @@ class TLS_All_Policy : public Botan::TLS::Policy std::vector<std::string> allowed_key_exchange_methods() const override { - return { "SRP_SHA", "ECDHE_PSK", "DHE_PSK", "PSK", - "CECPQ1", "ECDH", "DH", "RSA" }; + return { "SRP_SHA", "ECDHE_PSK", "DHE_PSK", "PSK", "CECPQ1", "ECDH", "DH", "RSA" }; } std::vector<std::string> allowed_signature_methods() const override @@ -54,22 +54,35 @@ class TLS_All_Policy : public Botan::TLS::Policy class TLS_Ciphersuites final : public Command { public: - TLS_Ciphersuites() : Command("tls_ciphers --policy=default --version=tls1.2") {} + TLS_Ciphersuites() + : Command("tls_ciphers --policy=default --version=tls1.2") {} static Botan::TLS::Protocol_Version::Version_Code tls_version_from_str(const std::string& str) { if(str == "tls1.2" || str == "TLS1.2" || str == "TLS-1.2") + { return Botan::TLS::Protocol_Version::TLS_V12; + } else if(str == "tls1.1" || str == "TLS1.1" || str == "TLS-1.1") + { return Botan::TLS::Protocol_Version::TLS_V11; + } else if(str == "tls1.0" || str == "TLS1.1" || str == "TLS-1.1") + { return Botan::TLS::Protocol_Version::TLS_V10; + } if(str == "dtls1.2" || str == "DTLS1.2" || str == "DTLS-1.2") + { return Botan::TLS::Protocol_Version::DTLS_V12; + } else if(str == "dtls1.0" || str == "DTLS1.0" || str == "DTLS-1.0") + { return Botan::TLS::Protocol_Version::DTLS_V10; + } else + { throw CLI_Error("Unknown TLS version '" + str + "'"); + } } void go() override @@ -101,8 +114,7 @@ class TLS_Ciphersuites final : public Command std::ifstream policy_file(policy_type); if(!policy_file.good()) { - throw CLI_Error("Error TLS policy '" + policy_type + - "' is neither a file nor a known policy type"); + throw CLI_Error("Error TLS policy '" + policy_type + "' is neither a file nor a known policy type"); } policy.reset(new Botan::TLS::Text_Policy(policy_file)); |