cryptography: make oid attributes readonly (#7731)

This commit is contained in:
Alex Waygood
2022-04-28 00:58:49 -06:00
committed by GitHub
parent 1deb9cb806
commit 59c346d031
2 changed files with 7 additions and 2 deletions

View File

@@ -25,6 +25,7 @@ cryptography.x509.CertificateRevocationListBuilder.last_update
cryptography.x509.CertificateRevocationListBuilder.next_update
cryptography.x509.CertificateSigningRequestBuilder.__init__
cryptography.x509.Extension.__init__
cryptography.x509.ExtensionType.oid # is a property at runtime, but a different descriptor on subclasses, easier just to pretend it's writeable
cryptography.x509.Extensions.__init__
cryptography.x509.NameAttribute.__init__
cryptography.x509.OCSPExtensionOID

View File

@@ -109,7 +109,8 @@ class ExtendedKeyUsageOID:
ANY_EXTENDED_KEY_USAGE: ClassVar[ObjectIdentifier]
class NameAttribute:
oid: ObjectIdentifier
@property
def oid(self) -> ObjectIdentifier: ...
@property
def value(self) -> str: ...
def __init__(self, oid: ObjectIdentifier, value: str) -> None: ...
@@ -332,7 +333,8 @@ _T = TypeVar("_T", bound=ExtensionType)
class Extension(Generic[_T]):
@property
def critical(self) -> bool: ...
oid: ObjectIdentifier
@property
def oid(self) -> ObjectIdentifier: ...
@property
def value(self) -> _T: ...
@@ -453,6 +455,8 @@ class ExtendedKeyUsage(ExtensionType):
class UnrecognizedExtension(ExtensionType):
@property
def value(self) -> bytes: ...
@property
def oid(self) -> ObjectIdentifier: ... # type: ignore[override]
def __init__(self, oid: ObjectIdentifier, value: bytes) -> None: ...
def load_der_x509_certificate(data: bytes, backend: X509Backend | None = ...) -> Certificate: ...