mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 04:04:25 +08:00
Some missing stubs for cryptography.x509 (#4761)
This commit is contained in:
@@ -41,4 +41,4 @@ class CipherContext(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def update(self, data: bytes) -> bytes: ...
|
||||
@abstractmethod
|
||||
def update_into(self, data: bytes, buf) -> int: ...
|
||||
def update_into(self, data: bytes, buf: bytearray) -> int: ...
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
from abc import ABCMeta
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
from typing import Optional, Union
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import DERSerializationBackend, PEMSerializationBackend
|
||||
from cryptography.hazmat.backends.interfaces import (
|
||||
DERSerializationBackend,
|
||||
DSABackend,
|
||||
EllipticCurveBackend,
|
||||
PEMSerializationBackend,
|
||||
RSABackend,
|
||||
)
|
||||
from cryptography.hazmat.primitives.asymmetric.dh import DHPrivateKey, DHPublicKey
|
||||
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
|
||||
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey, EllipticCurvePublicKey
|
||||
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
|
||||
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey, RSAPublicKey
|
||||
|
||||
def load_pem_private_key(data: bytes, password: Optional[bytes], backend: Optional[PEMSerializationBackend] = ...): ...
|
||||
def load_pem_public_key(data: bytes, backend: Optional[PEMSerializationBackend] = ...): ...
|
||||
def load_der_private_key(data: bytes, password: Optional[bytes], backend: Optional[DERSerializationBackend] = ...): ...
|
||||
def load_der_public_key(data: bytes, backend: Optional[DERSerializationBackend] = ...): ...
|
||||
def load_ssh_public_key(data: bytes, backend): ...
|
||||
def load_pem_private_key(
|
||||
data: bytes, password: Optional[bytes], backend: Optional[PEMSerializationBackend] = ...
|
||||
) -> Union[RSAPrivateKey, DSAPrivateKey, DHPrivateKey, EllipticCurvePrivateKey]: ...
|
||||
def load_pem_public_key(
|
||||
data: bytes, backend: Optional[PEMSerializationBackend] = ...
|
||||
) -> Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey]: ...
|
||||
def load_der_private_key(
|
||||
data: bytes, password: Optional[bytes], backend: Optional[DERSerializationBackend] = ...
|
||||
) -> Union[RSAPrivateKey, DSAPrivateKey, DHPrivateKey, EllipticCurvePrivateKey]: ...
|
||||
def load_der_public_key(
|
||||
data: bytes, backend: Optional[DERSerializationBackend] = ...
|
||||
) -> Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey]: ...
|
||||
def load_ssh_public_key(
|
||||
data: bytes, backend: Union[RSABackend, DSABackend, EllipticCurveBackend, None]
|
||||
) -> Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey, Ed25519PublicKey]: ...
|
||||
|
||||
class Encoding(Enum):
|
||||
PEM: str
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any, List, Optional, Tuple
|
||||
|
||||
def load_key_and_certificates(data: bytes, password: Optional[bytes], backend: Optional[Any] = ...): ...
|
||||
from cryptography.x509 import Certificate
|
||||
|
||||
def load_key_and_certificates(
|
||||
data: bytes, password: Optional[bytes], backend: Optional[Any] = ...
|
||||
) -> Tuple[Optional[Any], Optional[Certificate], List[Certificate]]: ...
|
||||
|
||||
@@ -290,11 +290,19 @@ class Extension(Generic[_T]):
|
||||
value: _T
|
||||
|
||||
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 __init__(self, general_names: List[Extension[Any]]) -> None: ...
|
||||
def __iter__(self) -> Generator[Extension[Any], None, None]: ...
|
||||
def get_extension_for_oid(self, oid: ObjectIdentifier) -> Extension[Any]: ...
|
||||
def get_extension_for_class(self, extclass: Type[_T]) -> Extension[_T]: ...
|
||||
|
||||
class DuplicateExtension(Exception):
|
||||
oid: ObjectIdentifier
|
||||
def __init__(self, msg: str, oid: ObjectIdentifier) -> None: ...
|
||||
|
||||
class ExtensionNotFound(Exception):
|
||||
oid: ObjectIdentifier
|
||||
def __init__(self, msg: str, oid: ObjectIdentifier) -> None: ...
|
||||
|
||||
class IssuerAlternativeName(ExtensionType):
|
||||
def __init__(self, general_names: List[GeneralName]) -> None: ...
|
||||
def __iter__(self) -> Generator[GeneralName, None, None]: ...
|
||||
22
third_party/2and3/cryptography/x509/extensions.pyi
vendored
Normal file
22
third_party/2and3/cryptography/x509/extensions.pyi
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
from typing import Any, Iterator
|
||||
|
||||
from cryptography.x509 import GeneralName, ObjectIdentifier
|
||||
|
||||
class Extension:
|
||||
value: Any = ...
|
||||
|
||||
class GeneralNames:
|
||||
def __iter__(self) -> Iterator[GeneralName]: ...
|
||||
|
||||
class DistributionPoint:
|
||||
full_name: GeneralNames = ...
|
||||
|
||||
class CRLDistributionPoints:
|
||||
def __iter__(self) -> Iterator[DistributionPoint]: ...
|
||||
|
||||
class AccessDescription:
|
||||
access_method: ObjectIdentifier = ...
|
||||
access_location: GeneralName = ...
|
||||
|
||||
class AuthorityInformationAccess:
|
||||
def __iter__(self) -> Iterator[AccessDescription]: ...
|
||||
106
third_party/2and3/cryptography/x509/oid.pyi
vendored
Normal file
106
third_party/2and3/cryptography/x509/oid.pyi
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
from typing import Dict, Optional
|
||||
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
from cryptography.x509 import ObjectIdentifier
|
||||
|
||||
class ExtensionOID:
|
||||
SUBJECT_DIRECTORY_ATTRIBUTES: ObjectIdentifier = ...
|
||||
SUBJECT_KEY_IDENTIFIER: ObjectIdentifier = ...
|
||||
KEY_USAGE: ObjectIdentifier = ...
|
||||
SUBJECT_ALTERNATIVE_NAME: ObjectIdentifier = ...
|
||||
ISSUER_ALTERNATIVE_NAME: ObjectIdentifier = ...
|
||||
BASIC_CONSTRAINTS: ObjectIdentifier = ...
|
||||
NAME_CONSTRAINTS: ObjectIdentifier = ...
|
||||
CRL_DISTRIBUTION_POINTS: ObjectIdentifier = ...
|
||||
CERTIFICATE_POLICIES: ObjectIdentifier = ...
|
||||
POLICY_MAPPINGS: ObjectIdentifier = ...
|
||||
AUTHORITY_KEY_IDENTIFIER: ObjectIdentifier = ...
|
||||
POLICY_CONSTRAINTS: ObjectIdentifier = ...
|
||||
EXTENDED_KEY_USAGE: ObjectIdentifier = ...
|
||||
FRESHEST_CRL: ObjectIdentifier = ...
|
||||
INHIBIT_ANY_POLICY: ObjectIdentifier = ...
|
||||
ISSUING_DISTRIBUTION_POINT: ObjectIdentifier = ...
|
||||
AUTHORITY_INFORMATION_ACCESS: ObjectIdentifier = ...
|
||||
SUBJECT_INFORMATION_ACCESS: ObjectIdentifier = ...
|
||||
OCSP_NO_CHECK: ObjectIdentifier = ...
|
||||
TLS_FEATURE: ObjectIdentifier = ...
|
||||
CRL_NUMBER: ObjectIdentifier = ...
|
||||
DELTA_CRL_INDICATOR: ObjectIdentifier = ...
|
||||
PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS: ObjectIdentifier = ...
|
||||
PRECERT_POISON: ObjectIdentifier = ...
|
||||
|
||||
class OCSPExtensionOID:
|
||||
NONCE: ObjectIdentifier = ...
|
||||
|
||||
class CRLEntryExtensionOID:
|
||||
CERTIFICATE_ISSUER: ObjectIdentifier = ...
|
||||
CRL_REASON: ObjectIdentifier = ...
|
||||
INVALIDITY_DATE: ObjectIdentifier = ...
|
||||
|
||||
class NameOID:
|
||||
COMMON_NAME: ObjectIdentifier = ...
|
||||
COUNTRY_NAME: ObjectIdentifier = ...
|
||||
LOCALITY_NAME: ObjectIdentifier = ...
|
||||
STATE_OR_PROVINCE_NAME: ObjectIdentifier = ...
|
||||
STREET_ADDRESS: ObjectIdentifier = ...
|
||||
ORGANIZATION_NAME: ObjectIdentifier = ...
|
||||
ORGANIZATIONAL_UNIT_NAME: ObjectIdentifier = ...
|
||||
SERIAL_NUMBER: ObjectIdentifier = ...
|
||||
SURNAME: ObjectIdentifier = ...
|
||||
GIVEN_NAME: ObjectIdentifier = ...
|
||||
TITLE: ObjectIdentifier = ...
|
||||
GENERATION_QUALIFIER: ObjectIdentifier = ...
|
||||
X500_UNIQUE_IDENTIFIER: ObjectIdentifier = ...
|
||||
DN_QUALIFIER: ObjectIdentifier = ...
|
||||
PSEUDONYM: ObjectIdentifier = ...
|
||||
USER_ID: ObjectIdentifier = ...
|
||||
DOMAIN_COMPONENT: ObjectIdentifier = ...
|
||||
EMAIL_ADDRESS: ObjectIdentifier = ...
|
||||
JURISDICTION_COUNTRY_NAME: ObjectIdentifier = ...
|
||||
JURISDICTION_LOCALITY_NAME: ObjectIdentifier = ...
|
||||
JURISDICTION_STATE_OR_PROVINCE_NAME: ObjectIdentifier = ...
|
||||
BUSINESS_CATEGORY: ObjectIdentifier = ...
|
||||
POSTAL_ADDRESS: ObjectIdentifier = ...
|
||||
POSTAL_CODE: ObjectIdentifier = ...
|
||||
|
||||
class SignatureAlgorithmOID:
|
||||
RSA_WITH_MD5: ObjectIdentifier = ...
|
||||
RSA_WITH_SHA1: ObjectIdentifier = ...
|
||||
_RSA_WITH_SHA1: ObjectIdentifier = ...
|
||||
RSA_WITH_SHA224: ObjectIdentifier = ...
|
||||
RSA_WITH_SHA256: ObjectIdentifier = ...
|
||||
RSA_WITH_SHA384: ObjectIdentifier = ...
|
||||
RSA_WITH_SHA512: ObjectIdentifier = ...
|
||||
RSASSA_PSS: ObjectIdentifier = ...
|
||||
ECDSA_WITH_SHA1: ObjectIdentifier = ...
|
||||
ECDSA_WITH_SHA224: ObjectIdentifier = ...
|
||||
ECDSA_WITH_SHA256: ObjectIdentifier = ...
|
||||
ECDSA_WITH_SHA384: ObjectIdentifier = ...
|
||||
ECDSA_WITH_SHA512: ObjectIdentifier = ...
|
||||
DSA_WITH_SHA1: ObjectIdentifier = ...
|
||||
DSA_WITH_SHA224: ObjectIdentifier = ...
|
||||
DSA_WITH_SHA256: ObjectIdentifier = ...
|
||||
ED25519: ObjectIdentifier = ...
|
||||
ED448: ObjectIdentifier = ...
|
||||
|
||||
class ExtendedKeyUsageOID:
|
||||
SERVER_AUTH: ObjectIdentifier = ...
|
||||
CLIENT_AUTH: ObjectIdentifier = ...
|
||||
CODE_SIGNING: ObjectIdentifier = ...
|
||||
EMAIL_PROTECTION: ObjectIdentifier = ...
|
||||
TIME_STAMPING: ObjectIdentifier = ...
|
||||
OCSP_SIGNING: ObjectIdentifier = ...
|
||||
ANY_EXTENDED_KEY_USAGE: ObjectIdentifier = ...
|
||||
|
||||
class AuthorityInformationAccessOID:
|
||||
CA_ISSUERS: ObjectIdentifier = ...
|
||||
OCSP: ObjectIdentifier = ...
|
||||
|
||||
class CertificatePoliciesOID:
|
||||
CPS_QUALIFIER: ObjectIdentifier = ...
|
||||
CPS_USER_NOTICE: ObjectIdentifier = ...
|
||||
ANY_POLICY: ObjectIdentifier = ...
|
||||
|
||||
_OID_NAMES: Dict[ObjectIdentifier, str] = ...
|
||||
|
||||
_SIG_OIDS_TO_HASH: Dict[ObjectIdentifier, Optional[HashAlgorithm]] = ...
|
||||
Reference in New Issue
Block a user