X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fcrypto%2FCRL.cpp;h=1a31cdd3be24627e1694144188958d4367d63247;hb=5880a76d92f96db6f94ebdf0bdfebd989f10b232;hp=7c3eb866dfff7be87521bb1ec349a4c0bd471104;hpb=3305c4fdc8845fc3d17ea1bd49548073bb9111fe;p=cassiopeia.git diff --git a/src/crypto/CRL.cpp b/src/crypto/CRL.cpp index 7c3eb86..1a31cdd 100644 --- a/src/crypto/CRL.cpp +++ b/src/crypto/CRL.cpp @@ -122,3 +122,17 @@ void CRL::setSignature( std::string signature ) { d2i_ASN1_TIME( &crl->crl->lastUpdate, &buffer, signature.size() + data - buffer ); d2i_ASN1_TIME( &crl->crl->nextUpdate, &buffer, signature.size() + data - buffer ); } + +bool CRL::needsResign() { + time_t current; + time( ¤t ); + current += 60 * 60;// 1 hour + auto time = X509_CRL_get_nextUpdate( crl.get() ); + + if( !time ) { + return true; + } + + int cmp = X509_cmp_time( time, ¤t ); + return cmp < 0; +}