|
|
|
@ -205,7 +205,7 @@ namespace openssl { |
|
|
|
|
if (!len) throw x509_copy_failed(); |
|
|
|
|
const unsigned char* d2(d); |
|
|
|
|
_x509 = d2i_X509(0, &d2, len); |
|
|
|
|
free(d); |
|
|
|
|
OPENSSL_free(d); |
|
|
|
|
if (!_x509) throw x509_copy_failed(); |
|
|
|
|
} |
|
|
|
|
//! Take over OpenSSL allocated certificate.
|
|
|
|
@ -226,6 +226,14 @@ namespace openssl { |
|
|
|
|
_x509 = d2i_X509(0, &d2, len); |
|
|
|
|
if (!_x509) throw x509_copy_failed(); |
|
|
|
|
} |
|
|
|
|
//! Get DER encoded subject.
|
|
|
|
|
std::string subjectDER() const { |
|
|
|
|
char* c(0); |
|
|
|
|
int len(i2d_X509_NAME(X509_get_subject_name(_x509), &c)); |
|
|
|
|
std::String res(c, len); |
|
|
|
|
OPENSSL_free(c); |
|
|
|
|
return res; |
|
|
|
|
} |
|
|
|
|
private: |
|
|
|
|
::X509* _x509; |
|
|
|
|
}; |
|
|
|
|