add_ext( caCert, target, NID_info_access, "OCSP;URI:http://ocsp.cacert.org" );
add_ext( caCert, target, NID_crl_distribution_points, "URI:http://crl.cacert.org/class3-revoke.crl" );
- if( sans.size() == 0 ) {
+ if( sans.empty() ) {
return;
}
//X509_print_fp( stdout, target.get() );
std::shared_ptr<BIO> mem = std::shared_ptr<BIO>( BIO_new( BIO_s_mem() ), BIO_free );
+
if( !mem ) {
throw "Failed to allocate memory for the signed certificate.";
}
+
PEM_write_bio_X509( mem.get(), target.get() );
BUF_MEM* buf = NULL;
res->certificate = std::string( buf->data, buf->data + buf->length );
std::shared_ptr<BIGNUM> ser( ASN1_INTEGER_to_BN( target->cert_info->serialNumber, NULL ), BN_free );
+
if( !ser ) {
throw "Failed to retrieve certificate serial of signed certificate.";
}