public void printWarning ( int daysBeforeExpireWarning , String keyStoreName , String alias , X509Certificate cert ) { try { long millisDelta = ( ( ( ( daysBeforeExpireWarning * 24L ) * 60L ) * 60L ) * 1000L ) ; long millisBeforeExpiration = cert . getNotAfter ( ) . getTime ( ) - System . currentTimeMillis ( ) ; long daysLeft = ( ( ( ( millisBeforeExpiration / 1000L ) / 60L ) / 60L ) / 24L ) ; // cert is already expired if ( millisBeforeExpiration < 0 ) { Tr . error ( tc , "ssl.expiration.expired.CWPKI0017E" , new Object [ ] { alias , keyStoreName } ) ; } else if ( millisBeforeExpiration < millisDelta ) { Tr . warning ( tc , "ssl.expiration.warning.CWPKI0016W" , new Object [ ] { alias , keyStoreName , Long . valueOf ( daysLeft ) } ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "The certificate with alias " + alias + " from keyStore " + keyStoreName + " has " + daysLeft + " days left before expiring." ) ; } } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Exception reading KeyStore certificates during expiration check; " + e ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) , "printWarning" , this ) ; } }
Print a warning about a certificate being expired or soon to be expired in the keystore .