- c.setTimes( from, to );
- signlog << "FINE: Setting extensions." << std::endl;
- c.setExtensions( ca->ca, cert->SANs, prof );
- signlog << "FINE: Signed" << std::endl;
- std::shared_ptr<SignedCertificate> output = c.sign( ca->caKey, cert->md );
- signlog << "FINE: all went well" << std::endl;
- signlog << "FINE: crt went to: " << writeBackFile( num, output->certificate, ca->path ) << std::endl;
- output->ca_name = ca->name;
- output->log = signlog.str();
- return output;
+ logger::note( "INFO: Setting extensions:" );
+ c.setExtensions( ca->ca, cert->SANs, prof, ca->crlURL, ca->crtURL );
+ logger::note( "FINE: Setting extensions successful." );
+
+ logger::note( "INFO: Generating next Serial Number ..." );
+ std::shared_ptr<BIGNUM> ser;
+ std::string num;
+ std::tie( ser, num ) = nextSerial( prof, ca );
+ c.setSerialNumber( ser.get() );
+ logger::note( "FINE: Certificate Serial Number set to: ", num );
+
+ {
+ logger::note( "INFO: Trying to sign Certificate:" );
+ std::shared_ptr<SignedCertificate> output = c.sign( ca->caKey, cert->md );
+ logger::note( "INFO: Writing certificate to local file." );
+ std::string fn = writeBackFile( num, output->certificate, ca->path );
+
+ if( fn.empty() ) {
+ logger::error( "ERROR: failed to get filename for storage of signed certificate." );
+ throw "Storage location could not be determined";
+ }
+
+ logger::note( "FINE: Certificate signed successfully." );
+ logger::note( "FINE: - Certificate written to: ", fn );
+
+ output->ca_name = ca->name;
+ output->log = signlog.str();
+ return output;
+ }