Minor fixes to cryptography (x509) (#3520)

This commit is contained in:
toppk
2019-12-03 12:29:05 -05:00
committed by Sebastian Rittau
parent 97f830030c
commit 86775c803e

View File

@@ -2,7 +2,7 @@ import datetime
from abc import ABCMeta, abstractmethod
from enum import Enum
from ipaddress import IPv4Address, IPv4Network, IPv6Address, IPv6Network
from typing import Any, ClassVar, Generator, List, Optional, Union, Text, Iterable, Sequence
from typing import Any, ClassVar, Generator, List, Optional, Union, Text, Iterable, Sequence, Type
from cryptography.hazmat.backends.interfaces import X509Backend
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
@@ -205,7 +205,7 @@ class CertificateSigningRequest(metaclass=ABCMeta):
subject: Name
tbs_certrequest_bytes: bytes
@abstractmethod
def public_bytes(self) -> bytes: ...
def public_bytes(self, encoding: Encoding) -> bytes: ...
@abstractmethod
def public_key(self) -> Union[DSAPublicKey, Ed25519PublicKey, Ed448PublicKey, EllipticCurvePublicKey, RSAPublicKey]: ...
@@ -232,7 +232,8 @@ class RevokedCertificateBuilder(object):
# General Name Classes
class GeneralName(metaclass=ABCMeta): ...
class GeneralName(metaclass=ABCMeta):
value: Any
class DirectoryName(GeneralName):
value: Name
@@ -277,15 +278,17 @@ class Extensions(object):
def __init__(self, general_names: List[Extension]) -> None: ...
def __iter__(self) -> Generator[Extension, None, None]: ...
def get_extension_for_oid(self, oid: ObjectIdentifier) -> Extension: ...
def get_extension_for_class(self, extclass: ExtensionType) -> Extension: ...
def get_extension_for_class(self, extclass: Type[ExtensionType]) -> Extension: ...
class IssuerAlternativeName(ExtensionType):
def __init__(self, general_names: List[GeneralName]) -> None: ...
def __iter__(self) -> Generator[GeneralName, None, None]: ...
def get_values_for_type(self, type: Type[GeneralName]) -> List[Any]: ...
class SubjectAlternativeName(ExtensionType):
def __init__(self, general_names: List[GeneralName]) -> None: ...
def __iter__(self) -> Generator[GeneralName, None, None]: ...
def get_values_for_type(self, type: Type[GeneralName]) -> List[Any]: ...
def load_der_x509_certificate(data: bytes, backend: X509Backend) -> Certificate: ...
def load_pem_x509_certificate(data: bytes, backend: X509Backend) -> Certificate: ...