private boolean isCached ( List < SFPair < Certificate , Certificate > > pairIssuerSubjectList ) { long currentTimeSecond = new Date ( ) . getTime ( ) / 1000L ; boolean isCached = true ; try { for ( SFPair < Certificate , Certificate > pairIssuerSubject : pairIssuerSubjectList ) { OCSPReq req = createRequest ( pairIssuerSubject ) ; CertificateID certificateId = req . getRequestList ( ) [ 0 ] . getCertID ( ) ; LOGGER . debug ( CertificateIDToString ( certificateId ) ) ; CertID cid = certificateId . toASN1Primitive ( ) ; OcspResponseCacheKey k = new OcspResponseCacheKey ( cid . getIssuerNameHash ( ) . getEncoded ( ) , cid . getIssuerKeyHash ( ) . getEncoded ( ) , cid . getSerialNumber ( ) . getValue ( ) ) ; SFPair < Long , String > res = OCSP_RESPONSE_CACHE . get ( k ) ; if ( res == null ) { LOGGER . debug ( "Not all OCSP responses for the certificate is in the cache." ) ; isCached = false ; break ; } else if ( currentTimeSecond - CACHE_EXPIRATION_IN_SECONDS > res . left ) { LOGGER . debug ( "Cache for CertID expired." ) ; isCached = false ; break ; } else { try { validateRevocationStatusMain ( pairIssuerSubject , res . right ) ; } catch ( CertificateException ex ) { LOGGER . debug ( "Cache includes invalid OCSPResponse. " + "Will download the OCSP cache from Snowflake OCSP server" ) ; isCached = false ; } } } } catch ( IOException ex ) { LOGGER . debug ( "Failed to encode CertID." ) ; } return isCached ; }
Is OCSP Response cached?