fix(plugin): bundle Python dependencies for standalone deployment
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.bindings._rust.openssl import (
|
||||
aead,
|
||||
ciphers,
|
||||
cmac,
|
||||
dh,
|
||||
dsa,
|
||||
ec,
|
||||
ed448,
|
||||
ed25519,
|
||||
hashes,
|
||||
hmac,
|
||||
hpke,
|
||||
kdf,
|
||||
keys,
|
||||
keywrap,
|
||||
mldsa,
|
||||
mlkem,
|
||||
poly1305,
|
||||
rsa,
|
||||
x448,
|
||||
x25519,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"aead",
|
||||
"ciphers",
|
||||
"cmac",
|
||||
"dh",
|
||||
"dsa",
|
||||
"ec",
|
||||
"ed448",
|
||||
"ed25519",
|
||||
"hashes",
|
||||
"hmac",
|
||||
"hpke",
|
||||
"kdf",
|
||||
"keys",
|
||||
"keywrap",
|
||||
"mldsa",
|
||||
"mlkem",
|
||||
"openssl_version",
|
||||
"openssl_version_text",
|
||||
"poly1305",
|
||||
"raise_openssl_error",
|
||||
"rsa",
|
||||
"x448",
|
||||
"x25519",
|
||||
]
|
||||
|
||||
CRYPTOGRAPHY_IS_LIBRESSL: bool
|
||||
CRYPTOGRAPHY_IS_BORINGSSL: bool
|
||||
CRYPTOGRAPHY_IS_AWSLC: bool
|
||||
CRYPTOGRAPHY_OPENSSL_309_OR_GREATER: bool
|
||||
CRYPTOGRAPHY_OPENSSL_320_OR_GREATER: bool
|
||||
CRYPTOGRAPHY_OPENSSL_330_OR_GREATER: bool
|
||||
CRYPTOGRAPHY_OPENSSL_350_OR_GREATER: bool
|
||||
|
||||
class Providers: ...
|
||||
|
||||
_legacy_provider_loaded: bool
|
||||
_providers: Providers
|
||||
|
||||
def openssl_version() -> int: ...
|
||||
def openssl_version_text() -> str: ...
|
||||
def raise_openssl_error() -> typing.NoReturn: ...
|
||||
def capture_error_stack() -> list[OpenSSLError]: ...
|
||||
def is_fips_enabled() -> bool: ...
|
||||
def enable_fips(providers: Providers) -> None: ...
|
||||
|
||||
class OpenSSLError:
|
||||
@property
|
||||
def lib(self) -> int: ...
|
||||
@property
|
||||
def reason(self) -> int: ...
|
||||
@property
|
||||
def reason_text(self) -> bytes: ...
|
||||
@@ -0,0 +1,189 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class AESGCM:
|
||||
def __init__(self, key: Buffer) -> None: ...
|
||||
@staticmethod
|
||||
def generate_key(bit_length: int) -> bytes: ...
|
||||
def encrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def decrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def encrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
def decrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
|
||||
class ChaCha20Poly1305:
|
||||
def __init__(self, key: Buffer) -> None: ...
|
||||
@staticmethod
|
||||
def generate_key() -> bytes: ...
|
||||
def encrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def encrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
def decrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def decrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
|
||||
class AESCCM:
|
||||
def __init__(self, key: Buffer, tag_length: int = 16) -> None: ...
|
||||
@staticmethod
|
||||
def generate_key(bit_length: int) -> bytes: ...
|
||||
def encrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def encrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
def decrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def decrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
|
||||
class AESSIV:
|
||||
def __init__(self, key: Buffer) -> None: ...
|
||||
@staticmethod
|
||||
def generate_key(bit_length: int) -> bytes: ...
|
||||
def encrypt(
|
||||
self,
|
||||
data: Buffer,
|
||||
associated_data: Sequence[Buffer] | None,
|
||||
) -> bytes: ...
|
||||
def encrypt_into(
|
||||
self,
|
||||
data: Buffer,
|
||||
associated_data: Sequence[Buffer] | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
def decrypt(
|
||||
self,
|
||||
data: Buffer,
|
||||
associated_data: Sequence[Buffer] | None,
|
||||
) -> bytes: ...
|
||||
def decrypt_into(
|
||||
self,
|
||||
data: Buffer,
|
||||
associated_data: Sequence[Buffer] | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
|
||||
class AESOCB3:
|
||||
def __init__(self, key: Buffer) -> None: ...
|
||||
@staticmethod
|
||||
def generate_key(bit_length: int) -> bytes: ...
|
||||
def encrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def encrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
def decrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def decrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
|
||||
class AESGCMSIV:
|
||||
def __init__(self, key: Buffer) -> None: ...
|
||||
@staticmethod
|
||||
def generate_key(bit_length: int) -> bytes: ...
|
||||
def encrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def encrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
def decrypt(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
) -> bytes: ...
|
||||
def decrypt_into(
|
||||
self,
|
||||
nonce: Buffer,
|
||||
data: Buffer,
|
||||
associated_data: Buffer | None,
|
||||
buf: Buffer,
|
||||
) -> int: ...
|
||||
@@ -0,0 +1,38 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives import ciphers
|
||||
from cryptography.hazmat.primitives.ciphers import modes
|
||||
|
||||
@typing.overload
|
||||
def create_encryption_ctx(
|
||||
algorithm: ciphers.CipherAlgorithm, mode: modes.ModeWithAuthenticationTag
|
||||
) -> ciphers.AEADEncryptionContext: ...
|
||||
@typing.overload
|
||||
def create_encryption_ctx(
|
||||
algorithm: ciphers.CipherAlgorithm, mode: modes.Mode | None
|
||||
) -> ciphers.CipherContext: ...
|
||||
@typing.overload
|
||||
def create_decryption_ctx(
|
||||
algorithm: ciphers.CipherAlgorithm, mode: modes.ModeWithAuthenticationTag
|
||||
) -> ciphers.AEADDecryptionContext: ...
|
||||
@typing.overload
|
||||
def create_decryption_ctx(
|
||||
algorithm: ciphers.CipherAlgorithm, mode: modes.Mode | None
|
||||
) -> ciphers.CipherContext: ...
|
||||
def cipher_supported(
|
||||
algorithm: ciphers.CipherAlgorithm, mode: modes.Mode
|
||||
) -> bool: ...
|
||||
def _advance(
|
||||
ctx: ciphers.AEADEncryptionContext | ciphers.AEADDecryptionContext, n: int
|
||||
) -> None: ...
|
||||
def _advance_aad(
|
||||
ctx: ciphers.AEADEncryptionContext | ciphers.AEADDecryptionContext, n: int
|
||||
) -> None: ...
|
||||
|
||||
class CipherContext: ...
|
||||
class AEADEncryptionContext: ...
|
||||
class AEADDecryptionContext: ...
|
||||
@@ -0,0 +1,18 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives import ciphers
|
||||
|
||||
class CMAC:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: ciphers.BlockCipherAlgorithm,
|
||||
backend: typing.Any = None,
|
||||
) -> None: ...
|
||||
def update(self, data: bytes) -> None: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
def verify(self, signature: bytes) -> None: ...
|
||||
def copy(self) -> CMAC: ...
|
||||
@@ -0,0 +1,51 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import dh
|
||||
|
||||
MIN_MODULUS_SIZE: int
|
||||
|
||||
class DHPrivateKey: ...
|
||||
class DHPublicKey: ...
|
||||
class DHParameters: ...
|
||||
|
||||
class DHPrivateNumbers:
|
||||
def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None: ...
|
||||
def private_key(self, backend: typing.Any = None) -> dh.DHPrivateKey: ...
|
||||
@property
|
||||
def x(self) -> int: ...
|
||||
@property
|
||||
def public_numbers(self) -> DHPublicNumbers: ...
|
||||
|
||||
class DHPublicNumbers:
|
||||
def __init__(
|
||||
self, y: int, parameter_numbers: DHParameterNumbers
|
||||
) -> None: ...
|
||||
def public_key(self, backend: typing.Any = None) -> dh.DHPublicKey: ...
|
||||
@property
|
||||
def y(self) -> int: ...
|
||||
@property
|
||||
def parameter_numbers(self) -> DHParameterNumbers: ...
|
||||
|
||||
class DHParameterNumbers:
|
||||
def __init__(self, p: int, g: int, q: int | None = None) -> None: ...
|
||||
def parameters(self, backend: typing.Any = None) -> dh.DHParameters: ...
|
||||
@property
|
||||
def p(self) -> int: ...
|
||||
@property
|
||||
def g(self) -> int: ...
|
||||
@property
|
||||
def q(self) -> int | None: ...
|
||||
|
||||
def generate_parameters(
|
||||
generator: int, key_size: int, backend: typing.Any = None
|
||||
) -> dh.DHParameters: ...
|
||||
def from_pem_parameters(
|
||||
data: bytes, backend: typing.Any = None
|
||||
) -> dh.DHParameters: ...
|
||||
def from_der_parameters(
|
||||
data: bytes, backend: typing.Any = None
|
||||
) -> dh.DHParameters: ...
|
||||
@@ -0,0 +1,41 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import dsa
|
||||
|
||||
class DSAPrivateKey: ...
|
||||
class DSAPublicKey: ...
|
||||
class DSAParameters: ...
|
||||
|
||||
class DSAPrivateNumbers:
|
||||
def __init__(self, x: int, public_numbers: DSAPublicNumbers) -> None: ...
|
||||
@property
|
||||
def x(self) -> int: ...
|
||||
@property
|
||||
def public_numbers(self) -> DSAPublicNumbers: ...
|
||||
def private_key(self, backend: typing.Any = None) -> dsa.DSAPrivateKey: ...
|
||||
|
||||
class DSAPublicNumbers:
|
||||
def __init__(
|
||||
self, y: int, parameter_numbers: DSAParameterNumbers
|
||||
) -> None: ...
|
||||
@property
|
||||
def y(self) -> int: ...
|
||||
@property
|
||||
def parameter_numbers(self) -> DSAParameterNumbers: ...
|
||||
def public_key(self, backend: typing.Any = None) -> dsa.DSAPublicKey: ...
|
||||
|
||||
class DSAParameterNumbers:
|
||||
def __init__(self, p: int, q: int, g: int) -> None: ...
|
||||
@property
|
||||
def p(self) -> int: ...
|
||||
@property
|
||||
def q(self) -> int: ...
|
||||
@property
|
||||
def g(self) -> int: ...
|
||||
def parameters(self, backend: typing.Any = None) -> dsa.DSAParameters: ...
|
||||
|
||||
def generate_parameters(key_size: int) -> dsa.DSAParameters: ...
|
||||
@@ -0,0 +1,52 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import ec
|
||||
|
||||
class ECPrivateKey: ...
|
||||
class ECPublicKey: ...
|
||||
|
||||
class EllipticCurvePrivateNumbers:
|
||||
def __init__(
|
||||
self, private_value: int, public_numbers: EllipticCurvePublicNumbers
|
||||
) -> None: ...
|
||||
def private_key(
|
||||
self, backend: typing.Any = None
|
||||
) -> ec.EllipticCurvePrivateKey: ...
|
||||
@property
|
||||
def private_value(self) -> int: ...
|
||||
@property
|
||||
def public_numbers(self) -> EllipticCurvePublicNumbers: ...
|
||||
|
||||
class EllipticCurvePublicNumbers:
|
||||
def __init__(self, x: int, y: int, curve: ec.EllipticCurve) -> None: ...
|
||||
def public_key(
|
||||
self, backend: typing.Any = None
|
||||
) -> ec.EllipticCurvePublicKey: ...
|
||||
@property
|
||||
def x(self) -> int: ...
|
||||
@property
|
||||
def y(self) -> int: ...
|
||||
@property
|
||||
def curve(self) -> ec.EllipticCurve: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
def curve_supported(curve: ec.EllipticCurve) -> bool: ...
|
||||
def generate_private_key(
|
||||
curve: ec.EllipticCurve, backend: typing.Any = None
|
||||
) -> ec.EllipticCurvePrivateKey: ...
|
||||
def from_private_numbers(
|
||||
numbers: ec.EllipticCurvePrivateNumbers,
|
||||
) -> ec.EllipticCurvePrivateKey: ...
|
||||
def from_public_numbers(
|
||||
numbers: ec.EllipticCurvePublicNumbers,
|
||||
) -> ec.EllipticCurvePublicKey: ...
|
||||
def from_public_bytes(
|
||||
curve: ec.EllipticCurve, data: bytes
|
||||
) -> ec.EllipticCurvePublicKey: ...
|
||||
def derive_private_key(
|
||||
private_value: int, curve: ec.EllipticCurve
|
||||
) -> ec.EllipticCurvePrivateKey: ...
|
||||
@@ -0,0 +1,13 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import ed25519
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class Ed25519PrivateKey: ...
|
||||
class Ed25519PublicKey: ...
|
||||
|
||||
def generate_key() -> ed25519.Ed25519PrivateKey: ...
|
||||
def from_private_bytes(data: Buffer) -> ed25519.Ed25519PrivateKey: ...
|
||||
def from_public_bytes(data: bytes) -> ed25519.Ed25519PublicKey: ...
|
||||
@@ -0,0 +1,13 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import ed448
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class Ed448PrivateKey: ...
|
||||
class Ed448PublicKey: ...
|
||||
|
||||
def generate_key() -> ed448.Ed448PrivateKey: ...
|
||||
def from_private_bytes(data: Buffer) -> ed448.Ed448PrivateKey: ...
|
||||
def from_public_bytes(data: bytes) -> ed448.Ed448PublicKey: ...
|
||||
@@ -0,0 +1,30 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class Hash(hashes.HashContext):
|
||||
def __init__(
|
||||
self, algorithm: hashes.HashAlgorithm, backend: typing.Any = None
|
||||
) -> None: ...
|
||||
@property
|
||||
def algorithm(self) -> hashes.HashAlgorithm: ...
|
||||
def update(self, data: Buffer) -> None: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
def copy(self) -> Hash: ...
|
||||
@staticmethod
|
||||
def hash(algorithm: hashes.HashAlgorithm, data: Buffer) -> bytes: ...
|
||||
|
||||
def hash_supported(algorithm: hashes.HashAlgorithm) -> bool: ...
|
||||
|
||||
class XOFHash:
|
||||
def __init__(self, algorithm: hashes.ExtendableOutputFunction) -> None: ...
|
||||
@property
|
||||
def algorithm(self) -> hashes.ExtendableOutputFunction: ...
|
||||
def update(self, data: Buffer) -> None: ...
|
||||
def squeeze(self, length: int) -> bytes: ...
|
||||
def copy(self) -> XOFHash: ...
|
||||
@@ -0,0 +1,22 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class HMAC(hashes.HashContext):
|
||||
def __init__(
|
||||
self,
|
||||
key: Buffer,
|
||||
algorithm: hashes.HashAlgorithm,
|
||||
backend: typing.Any = None,
|
||||
) -> None: ...
|
||||
@property
|
||||
def algorithm(self) -> hashes.HashAlgorithm: ...
|
||||
def update(self, data: Buffer) -> None: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
def verify(self, signature: bytes) -> None: ...
|
||||
def copy(self) -> HMAC: ...
|
||||
@@ -0,0 +1,109 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import ec, mlkem, x25519
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class KEM:
|
||||
X25519: KEM
|
||||
P256: KEM
|
||||
P384: KEM
|
||||
P521: KEM
|
||||
MLKEM768: KEM
|
||||
MLKEM1024: KEM
|
||||
MLKEM768_X25519: KEM
|
||||
MLKEM1024_P384: KEM
|
||||
def enc_length(self) -> int: ...
|
||||
|
||||
class KDF:
|
||||
HKDF_SHA256: KDF
|
||||
HKDF_SHA384: KDF
|
||||
HKDF_SHA512: KDF
|
||||
SHAKE128: KDF
|
||||
SHAKE256: KDF
|
||||
|
||||
class AEAD:
|
||||
AES_128_GCM: AEAD
|
||||
AES_256_GCM: AEAD
|
||||
CHACHA20_POLY1305: AEAD
|
||||
|
||||
class MLKEM768X25519PrivateKey:
|
||||
def __init__(
|
||||
self,
|
||||
mlkem_key: mlkem.MLKEM768PrivateKey,
|
||||
x25519_key: x25519.X25519PrivateKey,
|
||||
) -> None: ...
|
||||
def public_key(self) -> MLKEM768X25519PublicKey: ...
|
||||
|
||||
class MLKEM768X25519PublicKey:
|
||||
def __init__(
|
||||
self,
|
||||
mlkem_key: mlkem.MLKEM768PublicKey,
|
||||
x25519_key: x25519.X25519PublicKey,
|
||||
) -> None: ...
|
||||
|
||||
class MLKEM1024P384PrivateKey:
|
||||
def __init__(
|
||||
self,
|
||||
mlkem_key: mlkem.MLKEM1024PrivateKey,
|
||||
p384_key: ec.EllipticCurvePrivateKey,
|
||||
) -> None: ...
|
||||
def public_key(self) -> MLKEM1024P384PublicKey: ...
|
||||
|
||||
class MLKEM1024P384PublicKey:
|
||||
def __init__(
|
||||
self,
|
||||
mlkem_key: mlkem.MLKEM1024PublicKey,
|
||||
p384_key: ec.EllipticCurvePublicKey,
|
||||
) -> None: ...
|
||||
|
||||
class Suite:
|
||||
def __init__(self, kem: KEM, kdf: KDF, aead: AEAD) -> None: ...
|
||||
def encrypt(
|
||||
self,
|
||||
plaintext: Buffer,
|
||||
public_key: x25519.X25519PublicKey
|
||||
| ec.EllipticCurvePublicKey
|
||||
| mlkem.MLKEM768PublicKey
|
||||
| mlkem.MLKEM1024PublicKey
|
||||
| MLKEM768X25519PublicKey
|
||||
| MLKEM1024P384PublicKey,
|
||||
info: Buffer | None = None,
|
||||
) -> bytes: ...
|
||||
def decrypt(
|
||||
self,
|
||||
ciphertext: Buffer,
|
||||
private_key: x25519.X25519PrivateKey
|
||||
| ec.EllipticCurvePrivateKey
|
||||
| mlkem.MLKEM768PrivateKey
|
||||
| mlkem.MLKEM1024PrivateKey
|
||||
| MLKEM768X25519PrivateKey
|
||||
| MLKEM1024P384PrivateKey,
|
||||
info: Buffer | None = None,
|
||||
) -> bytes: ...
|
||||
|
||||
def _encrypt_with_aad(
|
||||
suite: Suite,
|
||||
plaintext: Buffer,
|
||||
public_key: x25519.X25519PublicKey
|
||||
| ec.EllipticCurvePublicKey
|
||||
| mlkem.MLKEM768PublicKey
|
||||
| mlkem.MLKEM1024PublicKey
|
||||
| MLKEM768X25519PublicKey
|
||||
| MLKEM1024P384PublicKey,
|
||||
info: Buffer | None = None,
|
||||
aad: Buffer | None = None,
|
||||
) -> bytes: ...
|
||||
def _decrypt_with_aad(
|
||||
suite: Suite,
|
||||
ciphertext: Buffer,
|
||||
private_key: x25519.X25519PrivateKey
|
||||
| ec.EllipticCurvePrivateKey
|
||||
| mlkem.MLKEM768PrivateKey
|
||||
| mlkem.MLKEM1024PrivateKey
|
||||
| MLKEM768X25519PrivateKey
|
||||
| MLKEM1024P384PrivateKey,
|
||||
info: Buffer | None = None,
|
||||
aad: Buffer | None = None,
|
||||
) -> bytes: ...
|
||||
@@ -0,0 +1,205 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives.hashes import HashAlgorithm
|
||||
from cryptography.hazmat.primitives.kdf.kbkdf import CounterLocation, Mode
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class PBKDF2HMAC:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
salt: bytes,
|
||||
iterations: int,
|
||||
backend: typing.Any = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class Scrypt:
|
||||
def __init__(
|
||||
self,
|
||||
salt: bytes,
|
||||
length: int,
|
||||
n: int,
|
||||
r: int,
|
||||
p: int,
|
||||
backend: typing.Any = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class Argon2d:
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
salt: bytes,
|
||||
length: int,
|
||||
iterations: int,
|
||||
lanes: int,
|
||||
memory_cost: int,
|
||||
ad: bytes | None = None,
|
||||
secret: bytes | None = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def derive_into(self, key_material: bytes, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
def derive_phc_encoded(self, key_material: bytes) -> str: ...
|
||||
@classmethod
|
||||
def verify_phc_encoded(
|
||||
cls, key_material: bytes, phc_encoded: str, secret: bytes | None = None
|
||||
) -> None: ...
|
||||
|
||||
class Argon2i:
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
salt: bytes,
|
||||
length: int,
|
||||
iterations: int,
|
||||
lanes: int,
|
||||
memory_cost: int,
|
||||
ad: bytes | None = None,
|
||||
secret: bytes | None = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def derive_into(self, key_material: bytes, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
def derive_phc_encoded(self, key_material: bytes) -> str: ...
|
||||
@classmethod
|
||||
def verify_phc_encoded(
|
||||
cls, key_material: bytes, phc_encoded: str, secret: bytes | None = None
|
||||
) -> None: ...
|
||||
|
||||
class Argon2id:
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
salt: bytes,
|
||||
length: int,
|
||||
iterations: int,
|
||||
lanes: int,
|
||||
memory_cost: int,
|
||||
ad: bytes | None = None,
|
||||
secret: bytes | None = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: bytes) -> bytes: ...
|
||||
def derive_into(self, key_material: bytes, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
def derive_phc_encoded(self, key_material: bytes) -> str: ...
|
||||
@classmethod
|
||||
def verify_phc_encoded(
|
||||
cls, key_material: bytes, phc_encoded: str, secret: bytes | None = None
|
||||
) -> None: ...
|
||||
|
||||
class HKDF:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
salt: bytes | None,
|
||||
info: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
): ...
|
||||
@staticmethod
|
||||
def extract(
|
||||
algorithm: HashAlgorithm, salt: bytes | None, key_material: Buffer
|
||||
) -> bytes: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class HKDFExpand:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
info: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
): ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class X963KDF:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
sharedinfo: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class ConcatKDFHash:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
otherinfo: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class ConcatKDFHMAC:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
length: int,
|
||||
salt: bytes | None,
|
||||
otherinfo: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class KBKDFHMAC:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: HashAlgorithm,
|
||||
mode: Mode,
|
||||
length: int,
|
||||
rlen: int,
|
||||
llen: int | None,
|
||||
location: CounterLocation,
|
||||
label: bytes | None,
|
||||
context: bytes | None,
|
||||
fixed: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
*,
|
||||
break_location: int | None = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
|
||||
class KBKDFCMAC:
|
||||
def __init__(
|
||||
self,
|
||||
algorithm: typing.Any,
|
||||
mode: Mode,
|
||||
length: int,
|
||||
rlen: int,
|
||||
llen: int | None,
|
||||
location: CounterLocation,
|
||||
label: bytes | None,
|
||||
context: bytes | None,
|
||||
fixed: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
*,
|
||||
break_location: int | None = None,
|
||||
) -> None: ...
|
||||
def derive(self, key_material: Buffer) -> bytes: ...
|
||||
def derive_into(self, key_material: Buffer, buffer: Buffer) -> int: ...
|
||||
def verify(self, key_material: bytes, expected_key: bytes) -> None: ...
|
||||
@@ -0,0 +1,34 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric.types import (
|
||||
PrivateKeyTypes,
|
||||
PublicKeyTypes,
|
||||
)
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
def load_der_private_key(
|
||||
data: Buffer,
|
||||
password: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
*,
|
||||
unsafe_skip_rsa_key_validation: bool = False,
|
||||
) -> PrivateKeyTypes: ...
|
||||
def load_pem_private_key(
|
||||
data: Buffer,
|
||||
password: bytes | None,
|
||||
backend: typing.Any = None,
|
||||
*,
|
||||
unsafe_skip_rsa_key_validation: bool = False,
|
||||
) -> PrivateKeyTypes: ...
|
||||
def load_der_public_key(
|
||||
data: bytes,
|
||||
backend: typing.Any = None,
|
||||
) -> PublicKeyTypes: ...
|
||||
def load_pem_public_key(
|
||||
data: bytes,
|
||||
backend: typing.Any = None,
|
||||
) -> PublicKeyTypes: ...
|
||||
@@ -0,0 +1,28 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
def aes_key_wrap(
|
||||
wrapping_key: Buffer,
|
||||
key_to_wrap: Buffer,
|
||||
backend: typing.Any = None,
|
||||
) -> bytes: ...
|
||||
def aes_key_unwrap(
|
||||
wrapping_key: Buffer,
|
||||
wrapped_key: Buffer,
|
||||
backend: typing.Any = None,
|
||||
) -> bytes: ...
|
||||
def aes_key_wrap_with_padding(
|
||||
wrapping_key: Buffer,
|
||||
key_to_wrap: Buffer,
|
||||
backend: typing.Any = None,
|
||||
) -> bytes: ...
|
||||
def aes_key_unwrap_with_padding(
|
||||
wrapping_key: Buffer,
|
||||
wrapped_key: Buffer,
|
||||
backend: typing.Any = None,
|
||||
) -> bytes: ...
|
||||
@@ -0,0 +1,35 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import mldsa
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class MLDSA44PrivateKey: ...
|
||||
class MLDSA44PublicKey: ...
|
||||
class MLDSA65PrivateKey: ...
|
||||
class MLDSA65PublicKey: ...
|
||||
class MLDSA87PrivateKey: ...
|
||||
class MLDSA87PublicKey: ...
|
||||
|
||||
class MLDSAMuHasher:
|
||||
def __init__(
|
||||
self,
|
||||
public_key: mldsa.MLDSA44PublicKey
|
||||
| mldsa.MLDSA65PublicKey
|
||||
| mldsa.MLDSA87PublicKey,
|
||||
context: Buffer | None = None,
|
||||
) -> None: ...
|
||||
def update(self, data: Buffer) -> None: ...
|
||||
def copy(self) -> MLDSAMuHasher: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
|
||||
def generate_mldsa44_key() -> mldsa.MLDSA44PrivateKey: ...
|
||||
def from_mldsa44_public_bytes(data: bytes) -> mldsa.MLDSA44PublicKey: ...
|
||||
def from_mldsa44_seed_bytes(data: Buffer) -> mldsa.MLDSA44PrivateKey: ...
|
||||
def generate_mldsa65_key() -> mldsa.MLDSA65PrivateKey: ...
|
||||
def from_mldsa65_public_bytes(data: bytes) -> mldsa.MLDSA65PublicKey: ...
|
||||
def from_mldsa65_seed_bytes(data: Buffer) -> mldsa.MLDSA65PrivateKey: ...
|
||||
def generate_mldsa87_key() -> mldsa.MLDSA87PrivateKey: ...
|
||||
def from_mldsa87_public_bytes(data: bytes) -> mldsa.MLDSA87PublicKey: ...
|
||||
def from_mldsa87_seed_bytes(data: Buffer) -> mldsa.MLDSA87PrivateKey: ...
|
||||
@@ -0,0 +1,18 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import mlkem
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class MLKEM768PrivateKey: ...
|
||||
class MLKEM768PublicKey: ...
|
||||
class MLKEM1024PrivateKey: ...
|
||||
class MLKEM1024PublicKey: ...
|
||||
|
||||
def generate_mlkem768_key() -> mlkem.MLKEM768PrivateKey: ...
|
||||
def from_mlkem768_seed_bytes(data: Buffer) -> mlkem.MLKEM768PrivateKey: ...
|
||||
def from_mlkem768_public_bytes(data: Buffer) -> mlkem.MLKEM768PublicKey: ...
|
||||
def generate_mlkem1024_key() -> mlkem.MLKEM1024PrivateKey: ...
|
||||
def from_mlkem1024_seed_bytes(data: Buffer) -> mlkem.MLKEM1024PrivateKey: ...
|
||||
def from_mlkem1024_public_bytes(data: Buffer) -> mlkem.MLKEM1024PublicKey: ...
|
||||
@@ -0,0 +1,15 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class Poly1305:
|
||||
def __init__(self, key: Buffer) -> None: ...
|
||||
@staticmethod
|
||||
def generate_tag(key: Buffer, data: Buffer) -> bytes: ...
|
||||
@staticmethod
|
||||
def verify_tag(key: Buffer, data: Buffer, tag: bytes) -> None: ...
|
||||
def update(self, data: Buffer) -> None: ...
|
||||
def finalize(self) -> bytes: ...
|
||||
def verify(self, tag: bytes) -> None: ...
|
||||
@@ -0,0 +1,55 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
import typing
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
|
||||
class RSAPrivateKey: ...
|
||||
class RSAPublicKey: ...
|
||||
|
||||
class RSAPrivateNumbers:
|
||||
def __init__(
|
||||
self,
|
||||
p: int,
|
||||
q: int,
|
||||
d: int,
|
||||
dmp1: int,
|
||||
dmq1: int,
|
||||
iqmp: int,
|
||||
public_numbers: RSAPublicNumbers,
|
||||
) -> None: ...
|
||||
@property
|
||||
def p(self) -> int: ...
|
||||
@property
|
||||
def q(self) -> int: ...
|
||||
@property
|
||||
def d(self) -> int: ...
|
||||
@property
|
||||
def dmp1(self) -> int: ...
|
||||
@property
|
||||
def dmq1(self) -> int: ...
|
||||
@property
|
||||
def iqmp(self) -> int: ...
|
||||
@property
|
||||
def public_numbers(self) -> RSAPublicNumbers: ...
|
||||
def private_key(
|
||||
self,
|
||||
backend: typing.Any = None,
|
||||
*,
|
||||
unsafe_skip_rsa_key_validation: bool = False,
|
||||
) -> rsa.RSAPrivateKey: ...
|
||||
|
||||
class RSAPublicNumbers:
|
||||
def __init__(self, e: int, n: int) -> None: ...
|
||||
@property
|
||||
def n(self) -> int: ...
|
||||
@property
|
||||
def e(self) -> int: ...
|
||||
def public_key(self, backend: typing.Any = None) -> rsa.RSAPublicKey: ...
|
||||
|
||||
def generate_private_key(
|
||||
public_exponent: int,
|
||||
key_size: int,
|
||||
) -> rsa.RSAPrivateKey: ...
|
||||
@@ -0,0 +1,13 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import x25519
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class X25519PrivateKey: ...
|
||||
class X25519PublicKey: ...
|
||||
|
||||
def generate_key() -> x25519.X25519PrivateKey: ...
|
||||
def from_private_bytes(data: Buffer) -> x25519.X25519PrivateKey: ...
|
||||
def from_public_bytes(data: bytes) -> x25519.X25519PublicKey: ...
|
||||
@@ -0,0 +1,13 @@
|
||||
# This file is dual licensed under the terms of the Apache License, Version
|
||||
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
||||
# for complete details.
|
||||
|
||||
from cryptography.hazmat.primitives.asymmetric import x448
|
||||
from cryptography.utils import Buffer
|
||||
|
||||
class X448PrivateKey: ...
|
||||
class X448PublicKey: ...
|
||||
|
||||
def generate_key() -> x448.X448PrivateKey: ...
|
||||
def from_private_bytes(data: Buffer) -> x448.X448PrivateKey: ...
|
||||
def from_public_bytes(data: bytes) -> x448.X448PublicKey: ...
|
||||
Reference in New Issue
Block a user