24#if OPENSSL_VERSION_NUMBER < 0x30000000L
41 explicit DH(
const std::string &dh_txt)
52 DH(
DH &&other) noexcept
80 return dh_ !=
nullptr;
82 ::EVP_PKEY *
obj()
const
92 ::EVP_PKEY *obj_release()
101 BIO *bio = ::BIO_new_mem_buf(
const_cast<char *
>(dh_txt.c_str()), numeric_cast<int>(dh_txt.length()));
103 throw OpenSSLException();
105 ::EVP_PKEY *dh = ::PEM_read_bio_Parameters_ex(bio,
nullptr,
nullptr,
nullptr);
108 throw OpenSSLException(
"DH::parse_pem");
118 BIO *bio = ::BIO_new(BIO_s_mem());
119 const int ret = ::PEM_write_bio_Parameters(bio,
dh_);
123 throw OpenSSLException(
"DH::render_pem");
128 const size_t buf_len = ::BIO_get_mem_data(bio, &temp);
129 std::string
ret = std::string(temp, buf_len);
147 ::EVP_PKEY_free(
dh_);
150 void dup(const ::EVP_PKEY *dh)
153 dh_ = EVP_PKEY_dup(
const_cast<EVP_PKEY *
>(dh));
void parse_pem(const std::string &dh_txt)
void operator=(const DH &other)
std::string render_pem() const