diff --git a/include/evse_security/crypto/openssl/openssl_supplier.hpp b/include/evse_security/crypto/openssl/openssl_supplier.hpp index cd34813..b0fe169 100644 --- a/include/evse_security/crypto/openssl/openssl_supplier.hpp +++ b/include/evse_security/crypto/openssl/openssl_supplier.hpp @@ -3,7 +3,6 @@ #pragma once #include -#include namespace evse_security { @@ -52,9 +51,6 @@ class OpenSSLSupplier : public AbstractCryptoSupplier { static bool base64_encode_from_bytes(const std::vector& bytes, std::string& out_encoded); static bool base64_encode_from_string(const std::string& string, std::string& out_encoded); - - static X509Handle X509Handle_from_X509(X509* certificate); - static X509Handle_ptr X509Handle_ptr_from_X509(X509* certificate); }; } // namespace evse_security \ No newline at end of file diff --git a/include/evse_security/detail/openssl/openssl_types.hpp b/include/evse_security/detail/openssl/openssl_types.hpp index 554e63b..43d152d 100644 --- a/include/evse_security/detail/openssl/openssl_types.hpp +++ b/include/evse_security/detail/openssl/openssl_types.hpp @@ -90,4 +90,31 @@ using BIO_ptr = std::unique_ptr; using EVP_MD_CTX_ptr = std::unique_ptr; using EVP_ENCODE_CTX_ptr = std::unique_ptr; +struct X509Handle; +struct KeyHandle; + +struct X509HandleOpenSSL : public X509Handle { + X509HandleOpenSSL(X509* certificate) : x509(certificate) { + } + + X509* get() { + return x509.get(); + } + +private: + X509_ptr x509; +}; + +struct KeyHandleOpenSSL : public KeyHandle { + KeyHandleOpenSSL(EVP_PKEY* key) : key(key) { + } + + EVP_PKEY* get() { + return key.get(); + } + +private: + EVP_PKEY_ptr key; +}; + } // namespace evse_security diff --git a/lib/evse_security/crypto/openssl/openssl_supplier.cpp b/lib/evse_security/crypto/openssl/openssl_supplier.cpp index 6f48b2d..b011609 100644 --- a/lib/evse_security/crypto/openssl/openssl_supplier.cpp +++ b/lib/evse_security/crypto/openssl/openssl_supplier.cpp @@ -26,30 +26,6 @@ namespace evse_security { -struct X509HandleOpenSSL : public X509Handle { - X509HandleOpenSSL(X509* certificate) : x509(certificate) { - } - - X509* get() { - return x509.get(); - } - -private: - X509_ptr x509; -}; - -struct KeyHandleOpenSSL : public KeyHandle { - KeyHandleOpenSSL(EVP_PKEY* key) : key(key) { - } - - EVP_PKEY* get() { - return key.get(); - } - -private: - EVP_PKEY_ptr key; -}; - static X509* get(X509Handle* handle) { if (X509HandleOpenSSL* ssl_handle = dynamic_cast(handle)) { return ssl_handle->get(); @@ -924,12 +900,4 @@ bool OpenSSLSupplier::base64_encode_from_string(const std::string& string, std:: return base64_encode(reinterpret_cast(string.data()), string.size(), out_encoded); } -X509Handle OpenSSLSupplier::X509Handle_from_X509(X509* certificate) { - return X509HandleOpenSSL(certificate); -} - -X509Handle_ptr OpenSSLSupplier::X509Handle_ptr_from_X509(X509* certificate) { - return std::make_unique(certificate); -} - } // namespace evse_security