]> WPIA git - cassiopeia.git/blobdiff - src/crypto/remoteSigner.cpp
add: signing of OCSP certificates
[cassiopeia.git] / src / crypto / remoteSigner.cpp
index f0cf105fb1c5d24fcfe49629711fd348b39bbe81..c06af91bc3a48700300c6cd89fdb774d1e1289cb 100644 (file)
@@ -44,7 +44,13 @@ std::shared_ptr<SignedCertificate> RemoteSigner::sign( std::shared_ptr<TBSCertif
     }
 
     send( conn, head, RecordHeader::SignerCommand::SET_SIGNATURE_TYPE, cert->md );
-    send( conn, head, RecordHeader::SignerCommand::SET_PROFILE, cert->profile );
+
+    if( !cert->ocspCA.empty() ) {
+        send( conn, head, RecordHeader::SignerCommand::SET_OCSP_TARGET_CA, cert->ocspCA );
+    } else {
+        send( conn, head, RecordHeader::SignerCommand::SET_PROFILE, cert->profile );
+    }
+
     send( conn, head, RecordHeader::SignerCommand::SET_WISH_FROM, cert->wishFrom );
     send( conn, head, RecordHeader::SignerCommand::SET_WISH_TO, cert->wishTo );
 
@@ -121,11 +127,10 @@ std::shared_ptr<SignedCertificate> RemoteSigner::sign( std::shared_ptr<TBSCertif
         }
 
         std::shared_ptr<BIGNUM> ser( ASN1_INTEGER_to_BN( X509_get_serialNumber( pem.get() ), NULL ), BN_free );
-        std::shared_ptr<char> serStr(
-            BN_bn2hex( ser.get() ),
-            []( char* p ) {
-                OPENSSL_free( p );
-            } ); // OPENSSL_free is a macro...
+        auto freeMem = []( char *p ) {
+            OPENSSL_free( p );
+        }; // OPENSSL_free is a macro...
+        std::shared_ptr<char> serStr( BN_bn2hex( ser.get() ), freeMem );
 
         extractTimes( pem, result );