def active_cert(key):
    """
    Verifies that a key is active that is present time is after not_before
    and before not_after.

    :param key: The Key
    :return: True if the key is active else False
    """
    try:
        cert_str = pem_format(key)
        cert = crypto.load_certificate(crypto.FILETYPE_PEM, cert_str)
        assert cert.has_expired() == 0
        assert not OpenSSLWrapper().certificate_not_valid_yet(cert)
        return True
    except AssertionError:
        return False
    except AttributeError:
        return False
def active_cert ( key ) : try : cert_str = pem_format ( key ) cert = crypto . load_certificate ( crypto . FILETYPE_PEM , cert_str ) assert cert . has_expired ( ) == 0 assert not OpenSSLWrapper ( ) . certificate_not_valid_yet ( cert ) 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.

    :param key: The Key
    :return: True if the key is active else False