#include <PrivateKey.h>
Definition at line 25 of file PrivateKey.h.
◆ unique_ptr
◆ PrivateKey() [1/3]
OpenDDS::Security::SSL::PrivateKey::PrivateKey |
( |
const std::string & |
uri, |
|
|
const std::string & |
password = "" |
|
) |
| |
|
explicit |
Definition at line 22 of file PrivateKey.cpp.
References load().
void load(const std::string &uri, const std::string &password="")
◆ PrivateKey() [2/3]
OpenDDS::Security::SSL::PrivateKey::PrivateKey |
( |
| ) |
|
◆ ~PrivateKey()
OpenDDS::Security::SSL::PrivateKey::~PrivateKey |
( |
| ) |
|
|
virtual |
◆ PrivateKey() [3/3]
OpenDDS::Security::SSL::PrivateKey::PrivateKey |
( |
const PrivateKey & |
| ) |
|
|
private |
◆ EVP_PKEY_from_pem()
EVP_PKEY * OpenDDS::Security::SSL::PrivateKey::EVP_PKEY_from_pem |
( |
const std::string & |
path, |
|
|
const std::string & |
password = "" |
|
) |
| |
|
staticprivate |
Definition at line 164 of file PrivateKey.cpp.
References OPENDDS_SSL_LOG_ERR.
Referenced by load().
169 BIO* filebuf = BIO_new_file(path.c_str(),
"r");
171 result = PEM_read_bio_PrivateKey(filebuf, 0, 0,
172 password.empty() ? 0 : (
void*)password.c_str());
180 std::stringstream errmsg;
181 errmsg <<
"failed to read file '" << path <<
"' using BIO_new_file";
struct evp_pkey_st EVP_PKEY
#define OPENDDS_SSL_LOG_ERR(MSG)
◆ EVP_PKEY_from_pem_data()
EVP_PKEY * OpenDDS::Security::SSL::PrivateKey::EVP_PKEY_from_pem_data |
( |
const std::string & |
data, |
|
|
const std::string & |
password |
|
) |
| |
|
staticprivate |
Definition at line 188 of file PrivateKey.cpp.
References OPENDDS_SSL_LOG_ERR.
Referenced by load().
195 original_bytes.length(static_cast<unsigned int>(data.size() - 1));
196 std::memcpy(original_bytes.get_buffer(), &data[1],
197 original_bytes.length());
201 original_bytes.length(original_bytes.length() + 1);
202 original_bytes[original_bytes.length() - 1] = 0;
205 BIO* filebuf = BIO_new(BIO_s_mem());
208 if (0 >= BIO_write(filebuf, original_bytes.get_buffer(),
209 original_bytes.length())) {
213 result = PEM_read_bio_PrivateKey(filebuf, 0, 0,
214 password.empty() ? 0 : (
void*)password.c_str());
223 std::stringstream errmsg;
224 errmsg <<
"failed to create data '" << data <<
"' using BIO_new";
struct evp_pkey_st EVP_PKEY
sequence< octet > OctetSeq
#define OPENDDS_SSL_LOG_ERR(MSG)
◆ load()
void OpenDDS::Security::SSL::PrivateKey::load |
( |
const std::string & |
uri, |
|
|
const std::string & |
password = "" |
|
) |
| |
Definition at line 40 of file PrivateKey.cpp.
References ACE_ERROR, ACE_TEXT(), OpenDDS::Security::CommonUtilities::URI::everything_else, EVP_PKEY_from_pem(), EVP_PKEY_from_pem_data(), k_, LM_WARNING, OpenDDS::Security::CommonUtilities::URI::scheme, OpenDDS::Security::CommonUtilities::URI::URI_DATA, OpenDDS::Security::CommonUtilities::URI::URI_FILE, OpenDDS::Security::CommonUtilities::URI::URI_PKCS11, and OpenDDS::Security::CommonUtilities::URI::URI_UNKNOWN.
Referenced by PrivateKey().
42 using namespace CommonUtilities;
48 switch (uri_info.scheme) {
61 ACE_TEXT(
"(%P|%t) SSL::PrivateKey::load: WARNING: Unsupported URI scheme in cert path '%C'\n"),
static EVP_PKEY * EVP_PKEY_from_pem(const std::string &path, const std::string &password="")
static EVP_PKEY * EVP_PKEY_from_pem_data(const std::string &data, const std::string &password)
◆ operator=()
◆ sign()
◆ operator==
Definition at line 231 of file PrivateKey.cpp.
233 if (lhs.k_ && rhs.k_) {
235 return 1 == EVP_PKEY_eq(lhs.k_, rhs.k_);
237 return 1 == EVP_PKEY_cmp(lhs.k_, rhs.k_);
240 return lhs.k_ == rhs.k_;
◆ k_
EVP_PKEY* OpenDDS::Security::SSL::PrivateKey::k_ |
|
private |
The documentation for this class was generated from the following files: