def active_cert(key):
 cert_str = pem_format(key)
 certificate = importKey(cert_str)
 try:
  not_before = to_time(str(certificate.get_not_before()))
  not_after = to_time(str(certificate.get_not_after()))
  assert (not_before < utc_now())
  assert (not_after > utc_now())
  return True
 except AssertionError:
  return False
 except AttributeError:
  return False

def active_cert ( key ) : cert_str = pem_format ( key ) certificate = importKey ( cert_str ) try : not_before = to_time ( str ( certificate . get_not_before ( ) ) ) not_after = to_time ( str ( certificate . get_not_after ( ) ) ) assert ( not_before < utc_now ( ) ) assert ( not_after > utc_now ( ) ) return True except AssertionError : return False except AttributeError : return False
verifies that a key is active that is present time is after not_before and before not_after .