(extensions, allowed_extensions=None)
Ensure only accepted extensions are used.
Ensure only accepted extensions are used.
Ensure only accepted extensions are used .
def filter_allowed_extensions(extensions, allowed_extensions=None):
    """Ensure only accepted extensions are used."""
    allowed_extensions = allowed_extensions or []

    for ext in extensions:
        ext_name = OID_NAMES.get(ext.oid, None)
        if ext_name in allowed_extensions:
            yield ext
        else:
            if ext.critical:
                raise exception.CertificateValidationError(extension=ext)
def filter_allowed_extensions ( extensions , allowed_extensions = None ) : allowed_extensions = allowed_extensions or [ ] for ext in extensions : ext_name = OID_NAMES . get ( ext . oid , None ) if ext_name in allowed_extensions : yield ext else : if ext . critical : raise exception . CertificateValidationError ( extension = ext )