generated from EVerest/everest-template
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose OpenSSL handles so that other code can create objects
Previously X509HandleOpenSSL and KeyHandleOpenSSL were defined in openssl_supplier.cpp this made it difficult to create Handles from other OpenSSL code and use the methods in evse-security. Signed-off-by: James Chapman <[email protected]>
- Loading branch information
Showing
2 changed files
with
37 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright Pionix GmbH and Contributors to EVerest | ||
#pragma once | ||
|
||
#include <evse_security/crypto/interface/crypto_types.hpp> | ||
#include <evse_security/detail/openssl/openssl_types.hpp> | ||
#include <openssl/evp.h> | ||
#include <openssl/x509.h> | ||
|
||
namespace evse_security { | ||
|
||
struct X509HandleOpenSSL : public X509Handle { | ||
X509HandleOpenSSL(X509* certificate) : x509(certificate) { | ||
Check notice on line 13 in include/evse_security/detail/openssl/openssl_handles.hpp Codacy Production / Codacy Static Code Analysisinclude/evse_security/detail/openssl/openssl_handles.hpp#L13
|
||
} | ||
|
||
X509* get() { | ||
return x509.get(); | ||
} | ||
|
||
private: | ||
X509_ptr x509; | ||
}; | ||
|
||
struct KeyHandleOpenSSL : public KeyHandle { | ||
KeyHandleOpenSSL(EVP_PKEY* key) : key(key) { | ||
Check notice on line 25 in include/evse_security/detail/openssl/openssl_handles.hpp Codacy Production / Codacy Static Code Analysisinclude/evse_security/detail/openssl/openssl_handles.hpp#L25
|
||
} | ||
|
||
EVP_PKEY* get() { | ||
return key.get(); | ||
} | ||
|
||
private: | ||
EVP_PKEY_ptr key; | ||
}; | ||
|
||
} // namespace evse_security |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters