try {
std::vector<std::string> serials;
std::pair<std::shared_ptr<CRL>, std::string> rev = sign->revoke( x.second, serials );
- } catch( const std::exception &e ) {
+ } catch( const std::exception& e ) {
logger::error( "Exception: ", e.what() );
}
}
}
-int main( int argc, const char* argv[] ) {
+int main( int argc, const char *argv[] ) {
bool once = false;
bool resetOnly = false;
std::shared_ptr<BIO> b = openSerial( serialPath );
std::shared_ptr<BIO_METHOD> m( toBio<SlipBIO>(), BIO_meth_free );
std::shared_ptr<BIO> slip1( BIO_new( m.get() ), BIO_free );
- static_cast<SlipBIO*>( slip1->ptr )->setTarget( std::make_shared<OpensslBIOWrapper>( b ), false );
+ static_cast<SlipBIO *>( slip1->ptr )->setTarget( std::make_shared<OpensslBIOWrapper>( b ), false );
auto sign = std::make_shared<RemoteSigner>( slip1, generateSSLContext( false ) );
// std::shared_ptr<Signer> sign( new SimpleOpensslSigner() );
try {
job = jp->fetchJob();
- } catch ( std::exception &e ){
+ } catch( std::exception& e ) {
logger::errorf( "Exception while fetchJob: %s", e.what() );
}
if( job->task == "sign" ) {
try {
std::shared_ptr<TBSCertificate> cert = jp->fetchTBSCert( job );
+
+ if( !cert ) {
+ logger::error( "Unable to load CSR" );
+ jp->failJob( job );
+ continue;
+ }
+
cert->wishFrom = job->from;
cert->wishTo = job->to;
logger::note( "INFO: Message Digest: ", cert->md );
logger::notef( "INFO: AVA %s: %s", AVA->name, AVA->value );
}
- if( !cert ) {
- logger::error( "Unable to load CSR" );
- jp->failJob( job );
- continue;
- }
-
logger::notef( "FINE: Found the CSR at '%s'", cert->csr );
cert->csr_content = readFile( keyDir + "/../" + cert->csr );
logger::note( "FINE: CSR content:\n", cert->csr_content );
logger::note( "revoking" );
std::pair<std::shared_ptr<CRL>, std::string> rev = sign->revoke( CAs.at( data.second ), serials );
std::string date = rev.second;
- const unsigned char* pos = ( const unsigned char* ) date.data();
+ const unsigned char *pos = ( const unsigned char * ) date.data();
std::shared_ptr<ASN1_TIME> time( d2i_ASN1_TIME( NULL, &pos, date.size() ), ASN1_TIME_free );
jp->writeBackRevocation( job, timeToString( time ) );
if( !DAEMON || once ) {
return 0;
}
- } catch ( std::exception &e ){
+ } catch( std::exception& e ) {
logger::errorf( "std::exception in mainloop: %s", e.what() );
}