- switch( ( RecordHeader::SignerResult ) head.command ) {
- case RecordHeader::SignerResult::REVOKED:
- std::cout << "CRL: " << std::endl << payload << std::endl;
- break;
+ if( ok ) {
+ logger::note( "CRL verificated successfully" );
+ writeFile( ca->path + std::string( "/ca.crl" ), crl->toString() );
+ } else {
+ logger::warn( "CRL is broken, trying to recover" );
+ send( conn, head, RecordHeader::SignerCommand::GET_FULL_CRL, ca->name );
+
+ payload = parseCommand( head, conn->readLine() );
+
+ if( static_cast<RecordHeader::SignerResult>( head.command ) != RecordHeader::SignerResult::FULL_CRL ) {
+ throw "Protocol violation";
+ }
+
+ writeFile( ca->path + std::string( "/ca.crl.bak" ), payload );
+ crl = std::make_shared<CRL>( ca->path + std::string( "/ca.crl.bak" ) );