X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fio%2FrecordHandler.cpp;h=c46c84560d511c0f7ab338804210e27038769600;hb=3ea4de25c712971a35dbad27d8834d75933daa08;hp=5055d5c7b823cae75bb976943d6457cb3f79b68e;hpb=5200bfb6a5d60618edfa62fa99c85155d913269f;p=cassiopeia.git diff --git a/src/io/recordHandler.cpp b/src/io/recordHandler.cpp index 5055d5c..c46c845 100644 --- a/src/io/recordHandler.cpp +++ b/src/io/recordHandler.cpp @@ -35,6 +35,7 @@ public: std::shared_ptr signer; std::shared_ptr log; + std::vector serials; RecordHandlerSession( DefaultRecordHandler* parent, std::shared_ptr signer, std::shared_ptr ctx, std::shared_ptr output ) : tbs( new TBSCertificate() ) { @@ -127,6 +128,14 @@ public: tbs->profile = data; break; + case RecordHeader::SignerCommand::SET_WISH_FROM: + tbs->wishFrom = data; + break; + + case RecordHeader::SignerCommand::SET_WISH_TO: + tbs->wishTo = data; + break; + case RecordHeader::SignerCommand::ADD_SAN: { size_t pos = data.find( "," ); @@ -167,6 +176,7 @@ public: case RecordHeader::SignerCommand::LOG_SAVED: if( result ) { + respondCommand( RecordHeader::SignerResult::SIGNING_CA, result->ca_name ); respondCommand( RecordHeader::SignerResult::CERTIFICATE, result->certificate ); } @@ -176,34 +186,17 @@ public: break; - case RecordHeader::SignerCommand::REVOKE: { - ( *log ) << "got revoking command: " << data.size() << std::endl; - std::string nullstr( "\0", 1 ); - size_t t = data.find( nullstr ); - - if( t == std::string::npos ) { - // error - ( *log ) << "error while parsing revoking command." << data << std::endl; - break; - } - - std::string ca = data.substr( 0, t ); - std::string serial = data.substr( t + 1 ); - ( *log ) << "revoking " << ca << "<->" << serial << std::endl; - - ( *log ) << "["; - - for( auto x : CAs ) { - ( *log ) << x.first << ", "; - } - - ( *log ) << "]" << std::endl; + case RecordHeader::SignerCommand::ADD_SERIAL: + serials.push_back( data ); + break; + case RecordHeader::SignerCommand::REVOKE: { + std::string ca = data; auto reqCA = CAs.at( ca ); ( *log ) << "CA found" << std::endl; std::shared_ptr crl; std::string date; - std::tie, std::string>( crl, date ) = signer->revoke( reqCA, serial ); + std::tie, std::string>( crl, date ) = signer->revoke( reqCA, serials ); respondCommand( RecordHeader::SignerResult::REVOKED, date + crl->getSignature() ); @@ -228,14 +221,8 @@ public: } }; -DefaultRecordHandler::DefaultRecordHandler( std::shared_ptr signer, std::shared_ptr bio ) : - currentSession() { - - this->signer = signer; - - ctx = generateSSLContext( true ); - - this->bio = bio; +DefaultRecordHandler::DefaultRecordHandler( std::shared_ptr signer, std::shared_ptr bio ) + : bio( bio ), ctx( generateSSLContext( true ) ), signer( signer ), currentSession() { } void DefaultRecordHandler::reset() {