|
|
@ -724,7 +724,7 @@ namespace openssl { |
|
|
|
//! Initialize from DER encoded cerificate.
|
|
|
|
//! Initialize from DER encoded cerificate.
|
|
|
|
X509(const std::string& der): _x509(0) { |
|
|
|
X509(const std::string& der): _x509(0) { |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
OPENSSL_LOG("log"); |
|
|
|
const unsigned char* c((const unsigned char*)der.begin().operator->()); |
|
|
|
unsigned char* c((unsigned char*)der.begin().operator->()); |
|
|
|
if (!(_x509=d2i_X509(0, &c, der.size())) || |
|
|
|
if (!(_x509=d2i_X509(0, &c, der.size())) || |
|
|
|
(const char*)c!=der.begin().operator->()+der.size()) |
|
|
|
(const char*)c!=der.begin().operator->()+der.size()) |
|
|
|
throw x509_decoding_failed(der); |
|
|
|
throw x509_decoding_failed(der); |
|
|
@ -734,7 +734,7 @@ namespace openssl { |
|
|
|
unsigned char* d(0); |
|
|
|
unsigned char* d(0); |
|
|
|
int len(i2d_X509(o._x509, &d)); |
|
|
|
int len(i2d_X509(o._x509, &d)); |
|
|
|
if (!len) throw x509_copy_failed(); |
|
|
|
if (!len) throw x509_copy_failed(); |
|
|
|
const unsigned char* d2(d); |
|
|
|
unsigned char* d2(d); |
|
|
|
_x509 = d2i_X509(0, &d2, len); |
|
|
|
_x509 = d2i_X509(0, &d2, len); |
|
|
|
OPENSSL_free(d); |
|
|
|
OPENSSL_free(d); |
|
|
|
if (!_x509) throw x509_copy_failed(); |
|
|
|
if (!_x509) throw x509_copy_failed(); |
|
|
@ -755,7 +755,7 @@ namespace openssl { |
|
|
|
unsigned char* d(0); |
|
|
|
unsigned char* d(0); |
|
|
|
int len(i2d_X509(o._x509, &d)); |
|
|
|
int len(i2d_X509(o._x509, &d)); |
|
|
|
if (!len) throw x509_copy_failed(); |
|
|
|
if (!len) throw x509_copy_failed(); |
|
|
|
const unsigned char* d2(d); |
|
|
|
unsigned char* d2(d); |
|
|
|
_x509 = d2i_X509(0, &d2, len); |
|
|
|
_x509 = d2i_X509(0, &d2, len); |
|
|
|
OPENSSL_free(d); |
|
|
|
OPENSSL_free(d); |
|
|
|
if (!_x509) throw x509_copy_failed(); |
|
|
|
if (!_x509) throw x509_copy_failed(); |
|
|
|