mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-15 08:17:07 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
from typing import List, Optional, Text, Union
|
||||
from typing import List, Text
|
||||
|
||||
class InvalidToken(Exception): ...
|
||||
|
||||
class Fernet(object):
|
||||
def __init__(self, key: Union[bytes, Text]) -> None: ...
|
||||
def decrypt(self, token: bytes, ttl: Optional[int] = ...) -> bytes: ...
|
||||
def __init__(self, key: bytes | Text) -> None: ...
|
||||
def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ...
|
||||
# decrypt_at_time accepts None ttl at runtime but it's an implementtion detail and it doesn't really
|
||||
# make sense for the client code to use it like that, so the parameter is typed as int as opposed to
|
||||
# Optional[int].
|
||||
# int | None.
|
||||
def decrypt_at_time(self, token: bytes, ttl: int, current_time: int) -> bytes: ...
|
||||
def encrypt(self, data: bytes) -> bytes: ...
|
||||
def encrypt_at_time(self, data: bytes, current_time: int) -> bytes: ...
|
||||
@@ -17,7 +17,7 @@ class Fernet(object):
|
||||
|
||||
class MultiFernet(object):
|
||||
def __init__(self, fernets: List[Fernet]) -> None: ...
|
||||
def decrypt(self, token: bytes, ttl: Optional[int] = ...) -> bytes: ...
|
||||
def decrypt(self, token: bytes, ttl: int | None = ...) -> bytes: ...
|
||||
# See a note above on the typing of the ttl parameter.
|
||||
def decrypt_at_time(self, token: bytes, ttl: int, current_time: int) -> bytes: ...
|
||||
def encrypt(self, data: bytes) -> bytes: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric.dh import (
|
||||
DHParameterNumbers,
|
||||
@@ -60,13 +60,13 @@ class DERSerializationBackend(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def load_der_parameters(self, data: bytes) -> Any: ...
|
||||
@abstractmethod
|
||||
def load_der_private_key(self, data: bytes, password: Optional[bytes]) -> Any: ...
|
||||
def load_der_private_key(self, data: bytes, password: bytes | None) -> Any: ...
|
||||
@abstractmethod
|
||||
def load_der_public_key(self, data: bytes) -> Any: ...
|
||||
|
||||
class DHBackend(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def dh_parameters_supported(self, p: int, g: int, q: Optional[int]) -> bool: ...
|
||||
def dh_parameters_supported(self, p: int, g: int, q: int | None) -> bool: ...
|
||||
@abstractmethod
|
||||
def dh_x942_serialization_supported(self) -> bool: ...
|
||||
@abstractmethod
|
||||
@@ -140,7 +140,7 @@ class PEMSerializationBackend(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def load_pem_parameters(self, data: bytes) -> Any: ...
|
||||
@abstractmethod
|
||||
def load_pem_private_key(self, data: bytes, password: Optional[bytes]) -> Any: ...
|
||||
def load_pem_private_key(self, data: bytes, password: bytes | None) -> Any: ...
|
||||
@abstractmethod
|
||||
def load_pem_public_key(self, data: bytes) -> Any: ...
|
||||
|
||||
@@ -165,21 +165,21 @@ class X509Backend(metaclass=ABCMeta):
|
||||
def create_x509_certificate(
|
||||
self,
|
||||
builder: CertificateBuilder,
|
||||
private_key: Union[DSAPrivateKey, EllipticCurvePrivateKey, RSAPrivateKey],
|
||||
private_key: DSAPrivateKey | EllipticCurvePrivateKey | RSAPrivateKey,
|
||||
algorithm: HashAlgorithm,
|
||||
) -> Certificate: ...
|
||||
@abstractmethod
|
||||
def create_x509_crl(
|
||||
self,
|
||||
builder: CertificateRevocationListBuilder,
|
||||
private_key: Union[DSAPrivateKey, EllipticCurvePrivateKey, RSAPrivateKey],
|
||||
private_key: DSAPrivateKey | EllipticCurvePrivateKey | RSAPrivateKey,
|
||||
algorithm: HashAlgorithm,
|
||||
) -> CertificateRevocationList: ...
|
||||
@abstractmethod
|
||||
def create_x509_csr(
|
||||
self,
|
||||
builder: CertificateSigningRequestBuilder,
|
||||
private_key: Union[DSAPrivateKey, EllipticCurvePrivateKey, RSAPrivateKey],
|
||||
private_key: DSAPrivateKey | EllipticCurvePrivateKey | RSAPrivateKey,
|
||||
algorithm: HashAlgorithm,
|
||||
) -> CertificateSigningRequest: ...
|
||||
@abstractmethod
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any
|
||||
|
||||
class Binding(object):
|
||||
ffi: Optional[Any]
|
||||
lib: Optional[Any]
|
||||
ffi: Any | None
|
||||
lib: Any | None
|
||||
def init_static_locks(self) -> None: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import DHBackend
|
||||
from cryptography.hazmat.primitives.serialization import (
|
||||
@@ -27,8 +26,8 @@ class DHParameterNumbers(object):
|
||||
def g(self) -> int: ...
|
||||
@property
|
||||
def q(self) -> int: ...
|
||||
def __init__(self, p: int, g: int, q: Optional[int]) -> None: ...
|
||||
def parameters(self, backend: Optional[DHBackend] = ...) -> DHParameters: ...
|
||||
def __init__(self, p: int, g: int, q: int | None) -> None: ...
|
||||
def parameters(self, backend: DHBackend | None = ...) -> DHParameters: ...
|
||||
|
||||
class DHPrivateKey(metaclass=ABCMeta):
|
||||
key_size: int
|
||||
@@ -53,7 +52,7 @@ class DHPrivateNumbers(object):
|
||||
@property
|
||||
def x(self) -> int: ...
|
||||
def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None: ...
|
||||
def private_key(self, backend: Optional[DHBackend] = ...) -> DHPrivateKey: ...
|
||||
def private_key(self, backend: DHBackend | None = ...) -> DHPrivateKey: ...
|
||||
|
||||
class DHPublicKey(metaclass=ABCMeta):
|
||||
@property
|
||||
@@ -74,6 +73,6 @@ class DHPublicNumbers(object):
|
||||
@property
|
||||
def y(self) -> int: ...
|
||||
def __init__(self, y: int, parameter_numbers: DHParameterNumbers) -> None: ...
|
||||
def public_key(self, backend: Optional[DHBackend] = ...) -> DHPublicKey: ...
|
||||
def public_key(self, backend: DHBackend | None = ...) -> DHPublicKey: ...
|
||||
|
||||
def generate_parameters(generator: int, key_size: int, backend: Optional[DHBackend] = ...) -> DHParameters: ...
|
||||
def generate_parameters(generator: int, key_size: int, backend: DHBackend | None = ...) -> DHParameters: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Optional, Union
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import DSABackend
|
||||
from cryptography.hazmat.primitives.asymmetric import AsymmetricVerificationContext
|
||||
@@ -23,7 +22,7 @@ class DSAParameterNumbers(object):
|
||||
@property
|
||||
def g(self) -> int: ...
|
||||
def __init__(self, p: int, q: int, g: int) -> None: ...
|
||||
def parameters(self, backend: Optional[DSABackend] = ...) -> DSAParameters: ...
|
||||
def parameters(self, backend: DSABackend | None = ...) -> DSAParameters: ...
|
||||
|
||||
class DSAPrivateKey(metaclass=ABCMeta):
|
||||
@property
|
||||
@@ -34,7 +33,7 @@ class DSAPrivateKey(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def public_key(self) -> DSAPublicKey: ...
|
||||
@abstractmethod
|
||||
def sign(self, data: bytes, algorithm: Union[HashAlgorithm, Prehashed]) -> bytes: ...
|
||||
def sign(self, data: bytes, algorithm: HashAlgorithm | Prehashed) -> bytes: ...
|
||||
|
||||
class DSAPrivateKeyWithSerialization(DSAPrivateKey):
|
||||
@abstractmethod
|
||||
@@ -60,11 +59,9 @@ class DSAPublicKey(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def public_numbers(self) -> DSAPublicNumbers: ...
|
||||
@abstractmethod
|
||||
def verifier(
|
||||
self, signature: bytes, signature_algorithm: Union[HashAlgorithm, Prehashed]
|
||||
) -> AsymmetricVerificationContext: ...
|
||||
def verifier(self, signature: bytes, signature_algorithm: HashAlgorithm | Prehashed) -> AsymmetricVerificationContext: ...
|
||||
@abstractmethod
|
||||
def verify(self, signature: bytes, data: bytes, algorithm: Union[HashAlgorithm, Prehashed]) -> None: ...
|
||||
def verify(self, signature: bytes, data: bytes, algorithm: HashAlgorithm | Prehashed) -> None: ...
|
||||
|
||||
DSAPublicKeyWithSerialization = DSAPublicKey
|
||||
|
||||
@@ -75,5 +72,5 @@ class DSAPublicNumbers(object):
|
||||
def parameter_numbers(self) -> DSAParameterNumbers: ...
|
||||
def __init__(self, y: int, parameter_numbers: DSAParameterNumbers) -> None: ...
|
||||
|
||||
def generate_parameters(key_size: int, backend: Optional[DSABackend] = ...) -> DSAParameters: ...
|
||||
def generate_private_key(key_size: int, backend: Optional[DSABackend] = ...) -> DSAPrivateKey: ...
|
||||
def generate_parameters(key_size: int, backend: DSABackend | None = ...) -> DSAParameters: ...
|
||||
def generate_private_key(key_size: int, backend: DSABackend | None = ...) -> DSAPrivateKey: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import ClassVar, Optional, Union
|
||||
from typing import ClassVar
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import EllipticCurveBackend
|
||||
from cryptography.hazmat.primitives.asymmetric import AsymmetricVerificationContext
|
||||
@@ -141,7 +141,7 @@ class EllipticCurvePrivateNumbers(object):
|
||||
@property
|
||||
def public_numbers(self) -> EllipticCurvePublicNumbers: ...
|
||||
def __init__(self, private_value: int, public_numbers: EllipticCurvePublicNumbers) -> None: ...
|
||||
def private_key(self, backend: Optional[EllipticCurveBackend] = ...) -> EllipticCurvePrivateKey: ...
|
||||
def private_key(self, backend: EllipticCurveBackend | None = ...) -> EllipticCurvePrivateKey: ...
|
||||
|
||||
class EllipticCurvePublicKey(metaclass=ABCMeta):
|
||||
@property
|
||||
@@ -175,22 +175,22 @@ class EllipticCurvePublicNumbers(object):
|
||||
def __init__(self, x: int, y: int, curve: EllipticCurve) -> None: ...
|
||||
@classmethod
|
||||
def from_encoded_point(cls, curve: EllipticCurve, data: bytes) -> EllipticCurvePublicNumbers: ...
|
||||
def public_key(self, backend: Optional[EllipticCurveBackend] = ...) -> EllipticCurvePublicKey: ...
|
||||
def public_key(self, backend: EllipticCurveBackend | None = ...) -> EllipticCurvePublicKey: ...
|
||||
|
||||
class EllipticCurveSignatureAlgorithm(metaclass=ABCMeta):
|
||||
@property
|
||||
@abstractmethod
|
||||
def algorithm(self) -> Union[HashAlgorithm, Prehashed]: ...
|
||||
def algorithm(self) -> HashAlgorithm | Prehashed: ...
|
||||
|
||||
class ECDH(object): ...
|
||||
|
||||
class ECDSA(EllipticCurveSignatureAlgorithm):
|
||||
def __init__(self, algorithm: Union[HashAlgorithm, Prehashed]): ...
|
||||
def __init__(self, algorithm: HashAlgorithm | Prehashed): ...
|
||||
@property
|
||||
def algorithm(self) -> Union[HashAlgorithm, Prehashed]: ...
|
||||
def algorithm(self) -> HashAlgorithm | Prehashed: ...
|
||||
|
||||
def derive_private_key(
|
||||
private_value: int, curve: EllipticCurve, backend: Optional[EllipticCurveBackend] = ...
|
||||
private_value: int, curve: EllipticCurve, backend: EllipticCurveBackend | None = ...
|
||||
) -> EllipticCurvePrivateKey: ...
|
||||
def generate_private_key(curve: EllipticCurve, backend: Optional[EllipticCurveBackend] = ...) -> EllipticCurvePrivateKey: ...
|
||||
def generate_private_key(curve: EllipticCurve, backend: EllipticCurveBackend | None = ...) -> EllipticCurvePrivateKey: ...
|
||||
def get_curve_for_oid(oid: ObjectIdentifier) -> EllipticCurve: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import ClassVar, Optional, Union
|
||||
from typing import ClassVar
|
||||
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
|
||||
@@ -12,7 +12,7 @@ class MGF1(object):
|
||||
def __init__(self, algorithm: HashAlgorithm) -> None: ...
|
||||
|
||||
class OAEP(AsymmetricPadding):
|
||||
def __init__(self, mgf: MGF1, algorithm: HashAlgorithm, label: Optional[bytes]) -> None: ...
|
||||
def __init__(self, mgf: MGF1, algorithm: HashAlgorithm, label: bytes | None) -> None: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
|
||||
@@ -22,6 +22,6 @@ class PKCS1v15(AsymmetricPadding):
|
||||
|
||||
class PSS(AsymmetricPadding):
|
||||
MAX_LENGTH: ClassVar[object]
|
||||
def __init__(self, mgf: MGF1, salt_length: Union[int, object]) -> None: ...
|
||||
def __init__(self, mgf: MGF1, salt_length: int | object) -> None: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Optional, Tuple, Union
|
||||
from typing import Tuple
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import RSABackend
|
||||
from cryptography.hazmat.primitives.asymmetric import AsymmetricVerificationContext
|
||||
@@ -17,7 +17,7 @@ class RSAPrivateKey(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def public_key(self) -> RSAPublicKey: ...
|
||||
@abstractmethod
|
||||
def sign(self, data: bytes, padding: AsymmetricPadding, algorithm: Union[HashAlgorithm, Prehashed]) -> bytes: ...
|
||||
def sign(self, data: bytes, padding: AsymmetricPadding, algorithm: HashAlgorithm | Prehashed) -> bytes: ...
|
||||
|
||||
class RSAPrivateKeyWithSerialization(RSAPrivateKey):
|
||||
@abstractmethod
|
||||
@@ -39,17 +39,15 @@ class RSAPublicKey(metaclass=ABCMeta):
|
||||
def public_numbers(self) -> RSAPublicNumbers: ...
|
||||
@abstractmethod
|
||||
def verifier(
|
||||
self, signature: bytes, padding: AsymmetricPadding, algorithm: Union[HashAlgorithm, Prehashed]
|
||||
self, signature: bytes, padding: AsymmetricPadding, algorithm: HashAlgorithm | Prehashed
|
||||
) -> AsymmetricVerificationContext: ...
|
||||
@abstractmethod
|
||||
def verify(
|
||||
self, signature: bytes, data: bytes, padding: AsymmetricPadding, algorithm: Union[HashAlgorithm, Prehashed]
|
||||
) -> None: ...
|
||||
def verify(self, signature: bytes, data: bytes, padding: AsymmetricPadding, algorithm: HashAlgorithm | Prehashed) -> None: ...
|
||||
|
||||
RSAPublicKeyWithSerialization = RSAPublicKey
|
||||
|
||||
def generate_private_key(
|
||||
public_exponent: int, key_size: int, backend: Optional[RSABackend] = ...
|
||||
public_exponent: int, key_size: int, backend: RSABackend | None = ...
|
||||
) -> RSAPrivateKeyWithSerialization: ...
|
||||
def rsa_crt_iqmp(p: int, q: int) -> int: ...
|
||||
def rsa_crt_dmp1(private_exponent: int, p: int) -> int: ...
|
||||
@@ -72,7 +70,7 @@ class RSAPrivateNumbers(object):
|
||||
def iqmp(self) -> int: ...
|
||||
@property
|
||||
def public_numbers(self) -> RSAPublicNumbers: ...
|
||||
def private_key(self, backend: Optional[RSABackend] = ...) -> RSAPrivateKey: ...
|
||||
def private_key(self, backend: RSABackend | None = ...) -> RSAPrivateKey: ...
|
||||
|
||||
class RSAPublicNumbers(object):
|
||||
def __init__(self, e: int, n: int) -> None: ...
|
||||
@@ -80,4 +78,4 @@ class RSAPublicNumbers(object):
|
||||
def e(self) -> int: ...
|
||||
@property
|
||||
def n(self) -> int: ...
|
||||
def public_key(self, backend: Optional[RSABackend] = ...) -> RSAPublicKey: ...
|
||||
def public_key(self, backend: RSABackend | None = ...) -> RSAPublicKey: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import CipherBackend
|
||||
from cryptography.hazmat.primitives.ciphers.modes import Mode
|
||||
@@ -23,7 +22,7 @@ class BlockCipherAlgorithm(metaclass=ABCMeta):
|
||||
def block_size(self) -> int: ...
|
||||
|
||||
class Cipher(object):
|
||||
def __init__(self, algorithm: CipherAlgorithm, mode: Optional[Mode], backend: Optional[CipherBackend] = ...) -> None: ...
|
||||
def __init__(self, algorithm: CipherAlgorithm, mode: Mode | None, backend: CipherBackend | None = ...) -> None: ...
|
||||
def decryptor(self) -> CipherContext: ...
|
||||
def encryptor(self) -> CipherContext: ...
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
from typing import Optional
|
||||
|
||||
class AESCCM(object):
|
||||
def __init__(self, key: bytes, tag_length: Optional[int]) -> None: ...
|
||||
def decrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ...
|
||||
def encrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ...
|
||||
def __init__(self, key: bytes, tag_length: int | None) -> None: ...
|
||||
def decrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ...
|
||||
def encrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ...
|
||||
@classmethod
|
||||
def generate_key(cls, bit_length: int) -> bytes: ...
|
||||
|
||||
class AESGCM(object):
|
||||
def __init__(self, key: bytes) -> None: ...
|
||||
def decrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ...
|
||||
def encrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ...
|
||||
def decrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ...
|
||||
def encrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ...
|
||||
@classmethod
|
||||
def generate_key(cls, bit_length: int) -> bytes: ...
|
||||
|
||||
class ChaCha20Poly1305(object):
|
||||
def __init__(self, key: bytes) -> None: ...
|
||||
def decrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ...
|
||||
def encrypt(self, nonce: bytes, data: bytes, associated_data: Optional[bytes]) -> bytes: ...
|
||||
def decrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ...
|
||||
def encrypt(self, nonce: bytes, data: bytes, associated_data: bytes | None) -> bytes: ...
|
||||
@classmethod
|
||||
def generate_key(cls) -> bytes: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.primitives.ciphers import CipherAlgorithm
|
||||
|
||||
@@ -68,7 +67,7 @@ class ECB(Mode):
|
||||
def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None: ...
|
||||
|
||||
class GCM(Mode, ModeWithInitializationVector, ModeWithAuthenticationTag):
|
||||
def __init__(self, initialization_vector: bytes, tag: Optional[bytes], min_tag_length: Optional[int]) -> None: ...
|
||||
def __init__(self, initialization_vector: bytes, tag: bytes | None, min_tag_length: int | None) -> None: ...
|
||||
@property
|
||||
def initialization_vector(self) -> bytes: ...
|
||||
@property
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import CMACBackend
|
||||
from cryptography.hazmat.primitives.ciphers import BlockCipherAlgorithm
|
||||
|
||||
class CMAC(object):
|
||||
def __init__(self, algorithm: BlockCipherAlgorithm, backend: Optional[CMACBackend] = ...) -> None: ...
|
||||
def __init__(self, algorithm: BlockCipherAlgorithm, backend: CMACBackend | None = ...) -> None: ...
|
||||
def copy(self) -> CMAC: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
def update(self, data: bytes) -> None: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HashBackend
|
||||
|
||||
@@ -38,7 +37,7 @@ class SHAKE256(HashAlgorithm):
|
||||
def __init__(self, digest_size: int) -> None: ...
|
||||
|
||||
class Hash(HashContext):
|
||||
def __init__(self, algorithm: HashAlgorithm, backend: Optional[HashBackend] = ...): ...
|
||||
def __init__(self, algorithm: HashAlgorithm, backend: HashBackend | None = ...): ...
|
||||
def copy(self) -> Hash: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
def update(self, data: bytes) -> None: ...
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HMACBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
|
||||
class HMAC(object):
|
||||
def __init__(self, key: bytes, algorithm: HashAlgorithm, backend: Optional[HMACBackend] = ...) -> None: ...
|
||||
def __init__(self, key: bytes, algorithm: HashAlgorithm, backend: HMACBackend | None = ...) -> None: ...
|
||||
def copy(self) -> HMAC: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
def update(self, msg: bytes) -> None: ...
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HashBackend, HMACBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
|
||||
|
||||
class ConcatKDFHash(KeyDerivationFunction):
|
||||
def __init__(
|
||||
self, algorithm: HashAlgorithm, length: int, otherinfo: Optional[bytes], backend: Optional[HashBackend] = ...
|
||||
): ...
|
||||
def __init__(self, algorithm: HashAlgorithm, length: int, otherinfo: bytes | None, backend: HashBackend | None = ...): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
@@ -16,9 +12,9 @@ class ConcatKDFHMAC(KeyDerivationFunction):
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
salt: Optional[bytes],
|
||||
otherinfo: Optional[bytes],
|
||||
backend: Optional[HMACBackend] = ...,
|
||||
salt: bytes | None,
|
||||
otherinfo: bytes | None,
|
||||
backend: HMACBackend | None = ...,
|
||||
): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
@@ -1,22 +1,15 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HMACBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
|
||||
|
||||
class HKDF(KeyDerivationFunction):
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
salt: Optional[bytes],
|
||||
info: Optional[bytes],
|
||||
backend: Optional[HMACBackend] = ...,
|
||||
self, algorithm: HashAlgorithm, length: int, salt: bytes | None, info: bytes | None, backend: HMACBackend | None = ...
|
||||
): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class HKDFExpand(KeyDerivationFunction):
|
||||
def __init__(self, algorithm: HashAlgorithm, length: int, info: Optional[bytes], backend: Optional[HMACBackend] = ...): ...
|
||||
def __init__(self, algorithm: HashAlgorithm, length: int, info: bytes | None, backend: HMACBackend | None = ...): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HMACBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
@@ -21,10 +20,10 @@ class KBKDFHMAC(KeyDerivationFunction):
|
||||
rlen: int,
|
||||
llen: int,
|
||||
location: CounterLocation,
|
||||
label: Optional[bytes],
|
||||
context: Optional[bytes],
|
||||
fixed: Optional[bytes],
|
||||
backend: Optional[HMACBackend] = ...,
|
||||
label: bytes | None,
|
||||
context: bytes | None,
|
||||
fixed: bytes | None,
|
||||
backend: HMACBackend | None = ...,
|
||||
): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import PBKDF2HMACBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
|
||||
|
||||
class PBKDF2HMAC(KeyDerivationFunction):
|
||||
def __init__(
|
||||
self, algorithm: HashAlgorithm, length: int, salt: bytes, iterations: int, backend: Optional[PBKDF2HMACBackend] = ...
|
||||
self, algorithm: HashAlgorithm, length: int, salt: bytes, iterations: int, backend: PBKDF2HMACBackend | None = ...
|
||||
): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import ScryptBackend
|
||||
from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
|
||||
|
||||
class Scrypt(KeyDerivationFunction):
|
||||
def __init__(self, salt: bytes, length: int, n: int, r: int, p: int, backend: Optional[ScryptBackend] = ...): ...
|
||||
def __init__(self, salt: bytes, length: int, n: int, r: int, p: int, backend: ScryptBackend | None = ...): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HashBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
|
||||
|
||||
class X963KDF(KeyDerivationFunction):
|
||||
def __init__(
|
||||
self, algorithm: HashAlgorithm, length: int, sharedinfo: Optional[bytes], backend: Optional[HashBackend] = ...
|
||||
): ...
|
||||
def __init__(self, algorithm: HashAlgorithm, length: int, sharedinfo: bytes | None, backend: HashBackend | None = ...): ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import CipherBackend
|
||||
|
||||
def aes_key_wrap(wrapping_key: bytes, key_to_wrap: bytes, backend: Optional[CipherBackend] = ...) -> bytes: ...
|
||||
def aes_key_wrap_with_padding(wrapping_key: bytes, key_to_wrap: bytes, backend: Optional[CipherBackend] = ...) -> bytes: ...
|
||||
def aes_key_unwrap(wrapping_key: bytes, wrapped_key: bytes, backend: Optional[CipherBackend] = ...) -> bytes: ...
|
||||
def aes_key_unwrap_with_padding(wrapping_key: bytes, wrapped_key: bytes, backend: Optional[CipherBackend] = ...) -> bytes: ...
|
||||
def aes_key_wrap(wrapping_key: bytes, key_to_wrap: bytes, backend: CipherBackend | None = ...) -> bytes: ...
|
||||
def aes_key_wrap_with_padding(wrapping_key: bytes, key_to_wrap: bytes, backend: CipherBackend | None = ...) -> bytes: ...
|
||||
def aes_key_unwrap(wrapping_key: bytes, wrapped_key: bytes, backend: CipherBackend | None = ...) -> bytes: ...
|
||||
def aes_key_unwrap_with_padding(wrapping_key: bytes, wrapped_key: bytes, backend: CipherBackend | None = ...) -> bytes: ...
|
||||
|
||||
class InvalidUnwrap(Exception): ...
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from abc import ABCMeta
|
||||
from enum import Enum
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import (
|
||||
DERSerializationBackend,
|
||||
@@ -11,20 +11,20 @@ from cryptography.hazmat.backends.interfaces import (
|
||||
)
|
||||
|
||||
def load_pem_private_key(
|
||||
data: bytes, password: Optional[bytes], backend: Optional[PEMSerializationBackend] = ...
|
||||
) -> Any: ... # actually Union[RSAPrivateKey, DSAPrivateKey, DHPrivateKey, EllipticCurvePrivateKey]
|
||||
data: bytes, password: bytes | None, backend: PEMSerializationBackend | None = ...
|
||||
) -> Any: ... # actually RSAPrivateKey | DSAPrivateKey | DHPrivateKey | EllipticCurvePrivateKey
|
||||
def load_pem_public_key(
|
||||
data: bytes, backend: Optional[PEMSerializationBackend] = ...
|
||||
) -> Any: ... # actually Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey]
|
||||
data: bytes, backend: PEMSerializationBackend | None = ...
|
||||
) -> Any: ... # actually RSAPublicKey | DSAPublicKey | DHPublicKey | EllipticCurvePublicKey
|
||||
def load_der_private_key(
|
||||
data: bytes, password: Optional[bytes], backend: Optional[DERSerializationBackend] = ...
|
||||
) -> Any: ... # actually Union[RSAPrivateKey, DSAPrivateKey, DHPrivateKey, EllipticCurvePrivateKey]
|
||||
data: bytes, password: bytes | None, backend: DERSerializationBackend | None = ...
|
||||
) -> Any: ... # actually RSAPrivateKey | DSAPrivateKey | DHPrivateKey | EllipticCurvePrivateKey
|
||||
def load_der_public_key(
|
||||
data: bytes, backend: Optional[DERSerializationBackend] = ...
|
||||
) -> Any: ... # actually Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey]
|
||||
data: bytes, backend: DERSerializationBackend | None = ...
|
||||
) -> Any: ... # actually RSAPublicKey | DSAPublicKey | DHPublicKey | EllipticCurvePublicKey
|
||||
def load_ssh_public_key(
|
||||
data: bytes, backend: Union[RSABackend, DSABackend, EllipticCurveBackend, None] = ...
|
||||
) -> Any: ... # actually Union[RSAPublicKey, DSAPublicKey, DHPublicKey, EllipticCurvePublicKey, Ed25519PublicKey]
|
||||
data: bytes, backend: RSABackend | DSABackend | EllipticCurveBackend | None = ...
|
||||
) -> Any: ... # actually RSAPublicKey | DSAPublicKey | DHPublicKey | EllipticCurvePublicKey | Ed25519PublicKey
|
||||
|
||||
class Encoding(Enum):
|
||||
PEM: str
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, List, Optional, Tuple, Union
|
||||
from typing import Any, List, Tuple
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKeyWithSerialization
|
||||
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKeyWithSerialization
|
||||
@@ -7,12 +7,12 @@ from cryptography.hazmat.primitives.serialization import KeySerializationEncrypt
|
||||
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]]: ...
|
||||
data: bytes, password: bytes | None, backend: Any | None = ...
|
||||
) -> Tuple[Any | None, Certificate | None, List[Certificate]]: ...
|
||||
def serialize_key_and_certificates(
|
||||
name: bytes,
|
||||
key: Union[RSAPrivateKeyWithSerialization, EllipticCurvePrivateKeyWithSerialization, DSAPrivateKeyWithSerialization],
|
||||
cert: Optional[Certificate],
|
||||
cas: Optional[List[Certificate]],
|
||||
key: RSAPrivateKeyWithSerialization | EllipticCurvePrivateKeyWithSerialization | DSAPrivateKeyWithSerialization,
|
||||
cert: Certificate | None,
|
||||
cas: List[Certificate] | None,
|
||||
enc: KeySerializationEncryption,
|
||||
) -> bytes: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from enum import Enum
|
||||
from typing import Any, Iterable, List, Optional, Union
|
||||
from typing import Any, Iterable, List
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKey
|
||||
from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKey
|
||||
@@ -23,8 +23,8 @@ class PKCS7SignatureBuilder:
|
||||
def add_signer(
|
||||
self,
|
||||
certificate: Certificate,
|
||||
private_key: Union[RSAPrivateKey, EllipticCurvePrivateKey],
|
||||
hash_algorithm: Union[SHA1, SHA224, SHA256, SHA384, SHA512],
|
||||
private_key: RSAPrivateKey | EllipticCurvePrivateKey,
|
||||
hash_algorithm: SHA1 | SHA224 | SHA256 | SHA384 | SHA512,
|
||||
) -> PKCS7SignatureBuilder: ...
|
||||
def add_certificate(self, certificate: Certificate) -> PKCS7SignatureBuilder: ...
|
||||
def sign(self, encoding: Encoding, options: Iterable[PKCS7Options], backend: Optional[Any] = ...) -> bytes: ...
|
||||
def sign(self, encoding: Encoding, options: Iterable[PKCS7Options], backend: Any | None = ...) -> bytes: ...
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HMACBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
|
||||
class HOTP(object):
|
||||
def __init__(
|
||||
self,
|
||||
key: bytes,
|
||||
length: int,
|
||||
algorithm: HashAlgorithm,
|
||||
backend: Optional[HMACBackend] = ...,
|
||||
enforce_key_length: bool = ...,
|
||||
self, key: bytes, length: int, algorithm: HashAlgorithm, backend: HMACBackend | None = ..., enforce_key_length: bool = ...
|
||||
): ...
|
||||
def generate(self, counter: int) -> bytes: ...
|
||||
def get_provisioning_uri(self, account_name: str, counter: int, issuer: Optional[str]) -> str: ...
|
||||
def get_provisioning_uri(self, account_name: str, counter: int, issuer: str | None) -> str: ...
|
||||
def verify(self, hotp: bytes, counter: int) -> None: ...
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
from typing import Optional
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import HMACBackend
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
|
||||
@@ -10,9 +8,9 @@ class TOTP(object):
|
||||
length: int,
|
||||
algorithm: HashAlgorithm,
|
||||
time_step: int,
|
||||
backend: Optional[HMACBackend] = ...,
|
||||
backend: HMACBackend | None = ...,
|
||||
enforce_key_length: bool = ...,
|
||||
): ...
|
||||
def generate(self, time: int) -> bytes: ...
|
||||
def get_provisioning_uri(self, account_name: str, issuer: Optional[str]) -> str: ...
|
||||
def get_provisioning_uri(self, account_name: str, issuer: str | None) -> str: ...
|
||||
def verify(self, totp: bytes, time: int) -> None: ...
|
||||
|
||||
@@ -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, Generic, Iterable, List, Optional, Sequence, Text, Type, TypeVar, Union
|
||||
from typing import Any, ClassVar, Generator, Generic, Iterable, List, Sequence, Text, Type, TypeVar
|
||||
|
||||
from cryptography.hazmat.backends.interfaces import X509Backend
|
||||
from cryptography.hazmat.primitives.asymmetric.dsa import DSAPrivateKey, DSAPublicKey
|
||||
@@ -119,11 +119,11 @@ class RelativeDistinguishedName(object):
|
||||
|
||||
class Name(object):
|
||||
rdns: List[RelativeDistinguishedName]
|
||||
def __init__(self, attributes: Sequence[Union[NameAttribute, RelativeDistinguishedName]]) -> None: ...
|
||||
def __init__(self, attributes: Sequence[NameAttribute | RelativeDistinguishedName]) -> None: ...
|
||||
def __iter__(self) -> Generator[NameAttribute, None, None]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def get_attributes_for_oid(self, oid: ObjectIdentifier) -> List[NameAttribute]: ...
|
||||
def public_bytes(self, backend: Optional[X509Backend] = ...) -> bytes: ...
|
||||
def public_bytes(self, backend: X509Backend | None = ...) -> bytes: ...
|
||||
def rfc4514_string(self) -> str: ...
|
||||
|
||||
class Version(Enum):
|
||||
@@ -147,32 +147,32 @@ class Certificate(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def public_bytes(self, encoding: Encoding) -> bytes: ...
|
||||
@abstractmethod
|
||||
def public_key(self) -> Union[DSAPublicKey, Ed25519PublicKey, Ed448PublicKey, EllipticCurvePublicKey, RSAPublicKey]: ...
|
||||
def public_key(self) -> DSAPublicKey | Ed25519PublicKey | Ed448PublicKey | EllipticCurvePublicKey | RSAPublicKey: ...
|
||||
|
||||
class CertificateBuilder(object):
|
||||
def __init__(
|
||||
self,
|
||||
issuer_name: Optional[Name] = ...,
|
||||
subject_name: Optional[Name] = ...,
|
||||
public_key: Union[DSAPublicKey, Ed25519PublicKey, Ed448PublicKey, EllipticCurvePublicKey, RSAPublicKey, None] = ...,
|
||||
serial_number: Optional[int] = ...,
|
||||
not_valid_before: Optional[datetime.datetime] = ...,
|
||||
not_valid_after: Optional[datetime.datetime] = ...,
|
||||
extensions: Optional[Iterable[ExtensionType]] = ...,
|
||||
issuer_name: Name | None = ...,
|
||||
subject_name: Name | None = ...,
|
||||
public_key: DSAPublicKey | Ed25519PublicKey | Ed448PublicKey | EllipticCurvePublicKey | RSAPublicKey | None = ...,
|
||||
serial_number: int | None = ...,
|
||||
not_valid_before: datetime.datetime | None = ...,
|
||||
not_valid_after: datetime.datetime | None = ...,
|
||||
extensions: Iterable[ExtensionType] | None = ...,
|
||||
) -> None: ...
|
||||
def add_extension(self, extension: ExtensionType, critical: bool) -> CertificateBuilder: ...
|
||||
def issuer_name(self, name: Name) -> CertificateBuilder: ...
|
||||
def not_valid_after(self, time: datetime.datetime) -> CertificateBuilder: ...
|
||||
def not_valid_before(self, time: datetime.datetime) -> CertificateBuilder: ...
|
||||
def public_key(
|
||||
self, public_key: Union[DSAPublicKey, Ed25519PublicKey, Ed448PublicKey, EllipticCurvePublicKey, RSAPublicKey]
|
||||
self, public_key: DSAPublicKey | Ed25519PublicKey | Ed448PublicKey | EllipticCurvePublicKey | RSAPublicKey
|
||||
) -> CertificateBuilder: ...
|
||||
def serial_number(self, serial_number: int) -> CertificateBuilder: ...
|
||||
def sign(
|
||||
self,
|
||||
private_key: Union[DSAPrivateKey, Ed25519PrivateKey, Ed448PrivateKey, EllipticCurvePrivateKey, RSAPrivateKey],
|
||||
algorithm: Optional[HashAlgorithm],
|
||||
backend: Optional[X509Backend] = ...,
|
||||
private_key: DSAPrivateKey | Ed25519PrivateKey | Ed448PrivateKey | EllipticCurvePrivateKey | RSAPrivateKey,
|
||||
algorithm: HashAlgorithm | None,
|
||||
backend: X509Backend | None = ...,
|
||||
) -> Certificate: ...
|
||||
def subject_name(self, name: Name) -> CertificateBuilder: ...
|
||||
|
||||
@@ -191,7 +191,7 @@ class CertificateRevocationList(metaclass=ABCMeta):
|
||||
def get_revoked_certificate_by_serial_number(self, serial_number: int) -> RevokedCertificate: ...
|
||||
@abstractmethod
|
||||
def is_signature_valid(
|
||||
self, public_key: Union[DSAPublicKey, Ed25519PublicKey, Ed448PublicKey, EllipticCurvePublicKey, RSAPublicKey]
|
||||
self, public_key: DSAPublicKey | Ed25519PublicKey | Ed448PublicKey | EllipticCurvePublicKey | RSAPublicKey
|
||||
) -> bool: ...
|
||||
@abstractmethod
|
||||
def public_bytes(self, encoding: Encoding) -> bytes: ...
|
||||
@@ -204,9 +204,9 @@ class CertificateRevocationListBuilder(object):
|
||||
def next_update(self, time: datetime.datetime) -> CertificateRevocationListBuilder: ...
|
||||
def sign(
|
||||
self,
|
||||
private_key: Union[DSAPrivateKey, Ed25519PrivateKey, Ed448PrivateKey, EllipticCurvePrivateKey, RSAPrivateKey],
|
||||
algorithm: Optional[HashAlgorithm],
|
||||
backend: Optional[X509Backend] = ...,
|
||||
private_key: DSAPrivateKey | Ed25519PrivateKey | Ed448PrivateKey | EllipticCurvePrivateKey | RSAPrivateKey,
|
||||
algorithm: HashAlgorithm | None,
|
||||
backend: X509Backend | None = ...,
|
||||
) -> CertificateRevocationList: ...
|
||||
|
||||
class CertificateSigningRequest(metaclass=ABCMeta):
|
||||
@@ -220,16 +220,16 @@ class CertificateSigningRequest(metaclass=ABCMeta):
|
||||
@abstractmethod
|
||||
def public_bytes(self, encoding: Encoding) -> bytes: ...
|
||||
@abstractmethod
|
||||
def public_key(self) -> Union[DSAPublicKey, Ed25519PublicKey, Ed448PublicKey, EllipticCurvePublicKey, RSAPublicKey]: ...
|
||||
def public_key(self) -> DSAPublicKey | Ed25519PublicKey | Ed448PublicKey | EllipticCurvePublicKey | RSAPublicKey: ...
|
||||
|
||||
class CertificateSigningRequestBuilder(object):
|
||||
def add_extension(self, extension: ExtensionType, critical: bool) -> CertificateSigningRequestBuilder: ...
|
||||
def subject_name(self, name: Name) -> CertificateSigningRequestBuilder: ...
|
||||
def sign(
|
||||
self,
|
||||
private_key: Union[DSAPrivateKey, Ed25519PrivateKey, Ed448PrivateKey, EllipticCurvePrivateKey, RSAPrivateKey],
|
||||
algorithm: Optional[HashAlgorithm],
|
||||
backend: Optional[X509Backend] = ...,
|
||||
private_key: DSAPrivateKey | Ed25519PrivateKey | Ed448PrivateKey | EllipticCurvePrivateKey | RSAPrivateKey,
|
||||
algorithm: HashAlgorithm | None,
|
||||
backend: X509Backend | None = ...,
|
||||
) -> CertificateSigningRequest: ...
|
||||
|
||||
class RevokedCertificate(metaclass=ABCMeta):
|
||||
@@ -239,7 +239,7 @@ class RevokedCertificate(metaclass=ABCMeta):
|
||||
|
||||
class RevokedCertificateBuilder(object):
|
||||
def add_extension(self, extension: ExtensionType, critical: bool) -> RevokedCertificateBuilder: ...
|
||||
def build(self, backend: Optional[X509Backend] = ...) -> RevokedCertificate: ...
|
||||
def build(self, backend: X509Backend | None = ...) -> RevokedCertificate: ...
|
||||
def revocation_date(self, time: datetime.datetime) -> RevokedCertificateBuilder: ...
|
||||
def serial_number(self, serial_number: int) -> RevokedCertificateBuilder: ...
|
||||
|
||||
@@ -257,8 +257,8 @@ class DNSName(GeneralName):
|
||||
def __init__(self, value: Text) -> None: ...
|
||||
|
||||
class IPAddress(GeneralName):
|
||||
value: Union[IPv4Address, IPv6Address, IPv4Network, IPv6Network]
|
||||
def __init__(self, value: Union[IPv4Address, IPv6Address, IPv4Network, IPv6Network]) -> None: ...
|
||||
value: IPv4Address | IPv6Address | IPv4Network | IPv6Network
|
||||
def __init__(self, value: IPv4Address | IPv6Address | IPv4Network | IPv6Network) -> None: ...
|
||||
|
||||
class OtherName(GeneralName):
|
||||
type_id: ObjectIdentifier
|
||||
@@ -317,18 +317,15 @@ class AuthorityKeyIdentifier(ExtensionType):
|
||||
@property
|
||||
def key_identifier(self) -> bytes: ...
|
||||
@property
|
||||
def authority_cert_issuer(self) -> Optional[List[GeneralName]]: ...
|
||||
def authority_cert_issuer(self) -> List[GeneralName] | None: ...
|
||||
@property
|
||||
def authority_cert_serial_number(self) -> Optional[int]: ...
|
||||
def authority_cert_serial_number(self) -> int | None: ...
|
||||
def __init__(
|
||||
self,
|
||||
key_identifier: bytes,
|
||||
authority_cert_issuer: Optional[Iterable[GeneralName]],
|
||||
authority_cert_serial_number: Optional[int],
|
||||
self, key_identifier: bytes, authority_cert_issuer: Iterable[GeneralName] | None, authority_cert_serial_number: int | None
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def from_issuer_public_key(
|
||||
cls, public_key: Union[RSAPublicKey, DSAPublicKey, EllipticCurvePublicKey, Ed25519PublicKey, Ed448PublicKey]
|
||||
cls, public_key: RSAPublicKey | DSAPublicKey | EllipticCurvePublicKey | Ed25519PublicKey | Ed448PublicKey
|
||||
) -> AuthorityKeyIdentifier: ...
|
||||
@classmethod
|
||||
def from_issuer_subject_key_identifier(cls, ski: SubjectKeyIdentifier) -> AuthorityKeyIdentifier: ...
|
||||
@@ -339,7 +336,7 @@ class SubjectKeyIdentifier(ExtensionType):
|
||||
def __init__(self, digest: bytes) -> None: ...
|
||||
@classmethod
|
||||
def from_public_key(
|
||||
cls, public_key: Union[RSAPublicKey, DSAPublicKey, EllipticCurvePublicKey, Ed25519PublicKey, Ed448PublicKey]
|
||||
cls, public_key: RSAPublicKey | DSAPublicKey | EllipticCurvePublicKey | Ed25519PublicKey | Ed448PublicKey
|
||||
) -> SubjectKeyIdentifier: ...
|
||||
|
||||
class AccessDescription:
|
||||
@@ -365,8 +362,8 @@ class BasicConstraints(ExtensionType):
|
||||
@property
|
||||
def ca(self) -> bool: ...
|
||||
@property
|
||||
def path_length(self) -> Optional[int]: ...
|
||||
def __init__(self, ca: bool, path_length: Optional[int]) -> None: ...
|
||||
def path_length(self) -> int | None: ...
|
||||
def __init__(self, ca: bool, path_length: int | None) -> None: ...
|
||||
|
||||
class KeyUsage(ExtensionType):
|
||||
@property
|
||||
@@ -411,10 +408,10 @@ class UnrecognizedExtension(ExtensionType):
|
||||
def value(self) -> bytes: ...
|
||||
def __init__(self, oid: ObjectIdentifier, value: bytes) -> None: ...
|
||||
|
||||
def load_der_x509_certificate(data: bytes, backend: Optional[X509Backend] = ...) -> Certificate: ...
|
||||
def load_pem_x509_certificate(data: bytes, backend: Optional[X509Backend] = ...) -> Certificate: ...
|
||||
def load_der_x509_crl(data: bytes, backend: Optional[X509Backend] = ...) -> CertificateRevocationList: ...
|
||||
def load_pem_x509_crl(data: bytes, backend: Optional[X509Backend] = ...) -> CertificateRevocationList: ...
|
||||
def load_der_x509_csr(data: bytes, backend: Optional[X509Backend] = ...) -> CertificateSigningRequest: ...
|
||||
def load_pem_x509_csr(data: bytes, backend: Optional[X509Backend] = ...) -> CertificateSigningRequest: ...
|
||||
def load_der_x509_certificate(data: bytes, backend: X509Backend | None = ...) -> Certificate: ...
|
||||
def load_pem_x509_certificate(data: bytes, backend: X509Backend | None = ...) -> Certificate: ...
|
||||
def load_der_x509_crl(data: bytes, backend: X509Backend | None = ...) -> CertificateRevocationList: ...
|
||||
def load_pem_x509_crl(data: bytes, backend: X509Backend | None = ...) -> CertificateRevocationList: ...
|
||||
def load_der_x509_csr(data: bytes, backend: X509Backend | None = ...) -> CertificateSigningRequest: ...
|
||||
def load_pem_x509_csr(data: bytes, backend: X509Backend | None = ...) -> CertificateSigningRequest: ...
|
||||
def __getattr__(name: str) -> Any: ... # incomplete
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Dict, Optional
|
||||
from typing import Dict
|
||||
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
from cryptography.x509 import ObjectIdentifier
|
||||
@@ -103,4 +103,4 @@ class CertificatePoliciesOID:
|
||||
|
||||
_OID_NAMES: Dict[ObjectIdentifier, str] = ...
|
||||
|
||||
_SIG_OIDS_TO_HASH: Dict[ObjectIdentifier, Optional[HashAlgorithm]] = ...
|
||||
_SIG_OIDS_TO_HASH: Dict[ObjectIdentifier, HashAlgorithm | None] = ...
|
||||
|
||||
Reference in New Issue
Block a user