Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- lib/python3.11/site-packages/cryptography/__about__.py +17 -0
- lib/python3.11/site-packages/cryptography/__init__.py +13 -0
- lib/python3.11/site-packages/cryptography/exceptions.py +52 -0
- lib/python3.11/site-packages/cryptography/fernet.py +224 -0
- lib/python3.11/site-packages/cryptography/hazmat/__init__.py +13 -0
- lib/python3.11/site-packages/cryptography/hazmat/_oid.py +356 -0
- lib/python3.11/site-packages/cryptography/hazmat/asn1/__init__.py +43 -0
- lib/python3.11/site-packages/cryptography/hazmat/asn1/__pycache__/__init__.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/cryptography/hazmat/asn1/__pycache__/asn1.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/cryptography/hazmat/asn1/asn1.py +419 -0
- lib/python3.11/site-packages/cryptography/hazmat/backends/__init__.py +13 -0
- lib/python3.11/site-packages/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__init__.py +9 -0
- lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/backend.py +312 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/__init__.py +3 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi +67 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi +8 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi +7 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/declarative_asn1.pyi +127 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi +17 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi +117 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi +80 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/aead.pyi +189 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ciphers.pyi +38 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/cmac.pyi +18 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi +51 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi +41 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ec.pyi +52 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi +13 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi +13 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi +30 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/pkcs12.pyi +52 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi +50 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/test_support.pyi +23 -0
- lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi +312 -0
- lib/python3.11/site-packages/cryptography/py.typed +0 -0
- lib/python3.11/site-packages/cryptography/utils.py +135 -0
- lib/python3.11/site-packages/httpx-0.28.1.dist-info/INSTALLER +1 -0
- lib/python3.11/site-packages/httpx-0.28.1.dist-info/METADATA +203 -0
- lib/python3.11/site-packages/httpx-0.28.1.dist-info/RECORD +54 -0
- lib/python3.11/site-packages/httpx-0.28.1.dist-info/WHEEL +4 -0
- lib/python3.11/site-packages/httpx-0.28.1.dist-info/entry_points.txt +2 -0
- lib/python3.11/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md +12 -0
- lib/python3.11/site-packages/httpx/__init__.py +105 -0
- lib/python3.11/site-packages/httpx/__pycache__/__init__.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/httpx/__pycache__/__version__.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/httpx/__pycache__/_api.cpython-311.pyc +0 -0
- lib/python3.11/site-packages/httpx/__pycache__/_auth.cpython-311.pyc +0 -0
lib/python3.11/site-packages/cryptography/__about__.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
__all__ = [
|
| 8 |
+
"__author__",
|
| 9 |
+
"__copyright__",
|
| 10 |
+
"__version__",
|
| 11 |
+
]
|
| 12 |
+
|
| 13 |
+
__version__ = "48.0.0"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
__author__ = "The Python Cryptographic Authority and individual contributors"
|
| 17 |
+
__copyright__ = f"Copyright 2013-2026 {__author__}"
|
lib/python3.11/site-packages/cryptography/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from cryptography.__about__ import __author__, __copyright__, __version__
|
| 8 |
+
|
| 9 |
+
__all__ = [
|
| 10 |
+
"__author__",
|
| 11 |
+
"__copyright__",
|
| 12 |
+
"__version__",
|
| 13 |
+
]
|
lib/python3.11/site-packages/cryptography/exceptions.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import typing
|
| 8 |
+
|
| 9 |
+
from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
|
| 10 |
+
|
| 11 |
+
if typing.TYPE_CHECKING:
|
| 12 |
+
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
|
| 13 |
+
|
| 14 |
+
_Reasons = rust_exceptions._Reasons
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class UnsupportedAlgorithm(Exception):
|
| 18 |
+
def __init__(self, message: str, reason: _Reasons | None = None) -> None:
|
| 19 |
+
super().__init__(message)
|
| 20 |
+
self._reason = reason
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class AlreadyFinalized(Exception):
|
| 24 |
+
pass
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
class AlreadyUpdated(Exception):
|
| 28 |
+
pass
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class NotYetFinalized(Exception):
|
| 32 |
+
pass
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class InvalidTag(Exception):
|
| 36 |
+
pass
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class InvalidSignature(Exception):
|
| 40 |
+
pass
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class InternalError(Exception):
|
| 44 |
+
def __init__(
|
| 45 |
+
self, msg: str, err_code: list[rust_openssl.OpenSSLError]
|
| 46 |
+
) -> None:
|
| 47 |
+
super().__init__(msg)
|
| 48 |
+
self.err_code = err_code
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class InvalidKey(Exception):
|
| 52 |
+
pass
|
lib/python3.11/site-packages/cryptography/fernet.py
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import base64
|
| 8 |
+
import binascii
|
| 9 |
+
import os
|
| 10 |
+
import time
|
| 11 |
+
import typing
|
| 12 |
+
from collections.abc import Iterable
|
| 13 |
+
|
| 14 |
+
from cryptography import utils
|
| 15 |
+
from cryptography.exceptions import InvalidSignature
|
| 16 |
+
from cryptography.hazmat.primitives import hashes, padding
|
| 17 |
+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
| 18 |
+
from cryptography.hazmat.primitives.hmac import HMAC
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class InvalidToken(Exception):
|
| 22 |
+
pass
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
_MAX_CLOCK_SKEW = 60
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
class Fernet:
|
| 29 |
+
def __init__(
|
| 30 |
+
self,
|
| 31 |
+
key: bytes | str,
|
| 32 |
+
backend: typing.Any = None,
|
| 33 |
+
) -> None:
|
| 34 |
+
try:
|
| 35 |
+
key = base64.urlsafe_b64decode(key)
|
| 36 |
+
except binascii.Error as exc:
|
| 37 |
+
raise ValueError(
|
| 38 |
+
"Fernet key must be 32 url-safe base64-encoded bytes."
|
| 39 |
+
) from exc
|
| 40 |
+
if len(key) != 32:
|
| 41 |
+
raise ValueError(
|
| 42 |
+
"Fernet key must be 32 url-safe base64-encoded bytes."
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
self._signing_key = key[:16]
|
| 46 |
+
self._encryption_key = key[16:]
|
| 47 |
+
|
| 48 |
+
@classmethod
|
| 49 |
+
def generate_key(cls) -> bytes:
|
| 50 |
+
return base64.urlsafe_b64encode(os.urandom(32))
|
| 51 |
+
|
| 52 |
+
def encrypt(self, data: bytes) -> bytes:
|
| 53 |
+
return self.encrypt_at_time(data, int(time.time()))
|
| 54 |
+
|
| 55 |
+
def encrypt_at_time(self, data: bytes, current_time: int) -> bytes:
|
| 56 |
+
iv = os.urandom(16)
|
| 57 |
+
return self._encrypt_from_parts(data, current_time, iv)
|
| 58 |
+
|
| 59 |
+
def _encrypt_from_parts(
|
| 60 |
+
self, data: bytes, current_time: int, iv: bytes
|
| 61 |
+
) -> bytes:
|
| 62 |
+
utils._check_bytes("data", data)
|
| 63 |
+
|
| 64 |
+
padder = padding.PKCS7(algorithms.AES.block_size).padder()
|
| 65 |
+
padded_data = padder.update(data) + padder.finalize()
|
| 66 |
+
encryptor = Cipher(
|
| 67 |
+
algorithms.AES(self._encryption_key),
|
| 68 |
+
modes.CBC(iv),
|
| 69 |
+
).encryptor()
|
| 70 |
+
ciphertext = encryptor.update(padded_data) + encryptor.finalize()
|
| 71 |
+
|
| 72 |
+
basic_parts = (
|
| 73 |
+
b"\x80"
|
| 74 |
+
+ current_time.to_bytes(length=8, byteorder="big")
|
| 75 |
+
+ iv
|
| 76 |
+
+ ciphertext
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
h = HMAC(self._signing_key, hashes.SHA256())
|
| 80 |
+
h.update(basic_parts)
|
| 81 |
+
hmac = h.finalize()
|
| 82 |
+
return base64.urlsafe_b64encode(basic_parts + hmac)
|
| 83 |
+
|
| 84 |
+
def decrypt(self, token: bytes | str, ttl: int | None = None) -> bytes:
|
| 85 |
+
timestamp, data = Fernet._get_unverified_token_data(token)
|
| 86 |
+
if ttl is None:
|
| 87 |
+
time_info = None
|
| 88 |
+
else:
|
| 89 |
+
time_info = (ttl, int(time.time()))
|
| 90 |
+
return self._decrypt_data(data, timestamp, time_info)
|
| 91 |
+
|
| 92 |
+
def decrypt_at_time(
|
| 93 |
+
self, token: bytes | str, ttl: int, current_time: int
|
| 94 |
+
) -> bytes:
|
| 95 |
+
if ttl is None:
|
| 96 |
+
raise ValueError(
|
| 97 |
+
"decrypt_at_time() can only be used with a non-None ttl"
|
| 98 |
+
)
|
| 99 |
+
timestamp, data = Fernet._get_unverified_token_data(token)
|
| 100 |
+
return self._decrypt_data(data, timestamp, (ttl, current_time))
|
| 101 |
+
|
| 102 |
+
def extract_timestamp(self, token: bytes | str) -> int:
|
| 103 |
+
timestamp, data = Fernet._get_unverified_token_data(token)
|
| 104 |
+
# Verify the token was not tampered with.
|
| 105 |
+
self._verify_signature(data)
|
| 106 |
+
return timestamp
|
| 107 |
+
|
| 108 |
+
@staticmethod
|
| 109 |
+
def _get_unverified_token_data(token: bytes | str) -> tuple[int, bytes]:
|
| 110 |
+
if not isinstance(token, (str, bytes)):
|
| 111 |
+
raise TypeError("token must be bytes or str")
|
| 112 |
+
|
| 113 |
+
try:
|
| 114 |
+
data = base64.urlsafe_b64decode(token)
|
| 115 |
+
except (TypeError, binascii.Error):
|
| 116 |
+
raise InvalidToken
|
| 117 |
+
|
| 118 |
+
if not data or data[0] != 0x80:
|
| 119 |
+
raise InvalidToken
|
| 120 |
+
|
| 121 |
+
if len(data) < 9:
|
| 122 |
+
raise InvalidToken
|
| 123 |
+
|
| 124 |
+
timestamp = int.from_bytes(data[1:9], byteorder="big")
|
| 125 |
+
return timestamp, data
|
| 126 |
+
|
| 127 |
+
def _verify_signature(self, data: bytes) -> None:
|
| 128 |
+
h = HMAC(self._signing_key, hashes.SHA256())
|
| 129 |
+
h.update(data[:-32])
|
| 130 |
+
try:
|
| 131 |
+
h.verify(data[-32:])
|
| 132 |
+
except InvalidSignature:
|
| 133 |
+
raise InvalidToken
|
| 134 |
+
|
| 135 |
+
def _decrypt_data(
|
| 136 |
+
self,
|
| 137 |
+
data: bytes,
|
| 138 |
+
timestamp: int,
|
| 139 |
+
time_info: tuple[int, int] | None,
|
| 140 |
+
) -> bytes:
|
| 141 |
+
if time_info is not None:
|
| 142 |
+
ttl, current_time = time_info
|
| 143 |
+
if timestamp + ttl < current_time:
|
| 144 |
+
raise InvalidToken
|
| 145 |
+
|
| 146 |
+
if current_time + _MAX_CLOCK_SKEW < timestamp:
|
| 147 |
+
raise InvalidToken
|
| 148 |
+
|
| 149 |
+
self._verify_signature(data)
|
| 150 |
+
|
| 151 |
+
iv = data[9:25]
|
| 152 |
+
ciphertext = data[25:-32]
|
| 153 |
+
decryptor = Cipher(
|
| 154 |
+
algorithms.AES(self._encryption_key), modes.CBC(iv)
|
| 155 |
+
).decryptor()
|
| 156 |
+
plaintext_padded = decryptor.update(ciphertext)
|
| 157 |
+
try:
|
| 158 |
+
plaintext_padded += decryptor.finalize()
|
| 159 |
+
except ValueError:
|
| 160 |
+
raise InvalidToken
|
| 161 |
+
unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
|
| 162 |
+
|
| 163 |
+
unpadded = unpadder.update(plaintext_padded)
|
| 164 |
+
try:
|
| 165 |
+
unpadded += unpadder.finalize()
|
| 166 |
+
except ValueError:
|
| 167 |
+
raise InvalidToken
|
| 168 |
+
return unpadded
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
class MultiFernet:
|
| 172 |
+
def __init__(self, fernets: Iterable[Fernet]):
|
| 173 |
+
fernets = list(fernets)
|
| 174 |
+
if not fernets:
|
| 175 |
+
raise ValueError(
|
| 176 |
+
"MultiFernet requires at least one Fernet instance"
|
| 177 |
+
)
|
| 178 |
+
self._fernets = fernets
|
| 179 |
+
|
| 180 |
+
def encrypt(self, msg: bytes) -> bytes:
|
| 181 |
+
return self.encrypt_at_time(msg, int(time.time()))
|
| 182 |
+
|
| 183 |
+
def encrypt_at_time(self, msg: bytes, current_time: int) -> bytes:
|
| 184 |
+
return self._fernets[0].encrypt_at_time(msg, current_time)
|
| 185 |
+
|
| 186 |
+
def rotate(self, msg: bytes | str) -> bytes:
|
| 187 |
+
timestamp, data = Fernet._get_unverified_token_data(msg)
|
| 188 |
+
for f in self._fernets:
|
| 189 |
+
try:
|
| 190 |
+
p = f._decrypt_data(data, timestamp, None)
|
| 191 |
+
break
|
| 192 |
+
except InvalidToken:
|
| 193 |
+
pass
|
| 194 |
+
else:
|
| 195 |
+
raise InvalidToken
|
| 196 |
+
|
| 197 |
+
iv = os.urandom(16)
|
| 198 |
+
return self._fernets[0]._encrypt_from_parts(p, timestamp, iv)
|
| 199 |
+
|
| 200 |
+
def decrypt(self, msg: bytes | str, ttl: int | None = None) -> bytes:
|
| 201 |
+
for f in self._fernets:
|
| 202 |
+
try:
|
| 203 |
+
return f.decrypt(msg, ttl)
|
| 204 |
+
except InvalidToken:
|
| 205 |
+
pass
|
| 206 |
+
raise InvalidToken
|
| 207 |
+
|
| 208 |
+
def decrypt_at_time(
|
| 209 |
+
self, msg: bytes | str, ttl: int, current_time: int
|
| 210 |
+
) -> bytes:
|
| 211 |
+
for f in self._fernets:
|
| 212 |
+
try:
|
| 213 |
+
return f.decrypt_at_time(msg, ttl, current_time)
|
| 214 |
+
except InvalidToken:
|
| 215 |
+
pass
|
| 216 |
+
raise InvalidToken
|
| 217 |
+
|
| 218 |
+
def extract_timestamp(self, msg: bytes | str) -> int:
|
| 219 |
+
for f in self._fernets:
|
| 220 |
+
try:
|
| 221 |
+
return f.extract_timestamp(msg)
|
| 222 |
+
except InvalidToken:
|
| 223 |
+
pass
|
| 224 |
+
raise InvalidToken
|
lib/python3.11/site-packages/cryptography/hazmat/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
"""
|
| 8 |
+
Hazardous Materials
|
| 9 |
+
|
| 10 |
+
This is a "Hazardous Materials" module. You should ONLY use it if you're
|
| 11 |
+
100% absolutely sure that you know what you're doing because this module
|
| 12 |
+
is full of land mines, dragons, and dinosaurs with laser guns.
|
| 13 |
+
"""
|
lib/python3.11/site-packages/cryptography/hazmat/_oid.py
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.bindings._rust import (
|
| 8 |
+
ObjectIdentifier as ObjectIdentifier,
|
| 9 |
+
)
|
| 10 |
+
from cryptography.hazmat.primitives import hashes
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class ExtensionOID:
|
| 14 |
+
SUBJECT_DIRECTORY_ATTRIBUTES = ObjectIdentifier("2.5.29.9")
|
| 15 |
+
SUBJECT_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.14")
|
| 16 |
+
KEY_USAGE = ObjectIdentifier("2.5.29.15")
|
| 17 |
+
PRIVATE_KEY_USAGE_PERIOD = ObjectIdentifier("2.5.29.16")
|
| 18 |
+
SUBJECT_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.17")
|
| 19 |
+
ISSUER_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.18")
|
| 20 |
+
BASIC_CONSTRAINTS = ObjectIdentifier("2.5.29.19")
|
| 21 |
+
NAME_CONSTRAINTS = ObjectIdentifier("2.5.29.30")
|
| 22 |
+
CRL_DISTRIBUTION_POINTS = ObjectIdentifier("2.5.29.31")
|
| 23 |
+
CERTIFICATE_POLICIES = ObjectIdentifier("2.5.29.32")
|
| 24 |
+
POLICY_MAPPINGS = ObjectIdentifier("2.5.29.33")
|
| 25 |
+
AUTHORITY_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.35")
|
| 26 |
+
POLICY_CONSTRAINTS = ObjectIdentifier("2.5.29.36")
|
| 27 |
+
EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37")
|
| 28 |
+
FRESHEST_CRL = ObjectIdentifier("2.5.29.46")
|
| 29 |
+
INHIBIT_ANY_POLICY = ObjectIdentifier("2.5.29.54")
|
| 30 |
+
ISSUING_DISTRIBUTION_POINT = ObjectIdentifier("2.5.29.28")
|
| 31 |
+
AUTHORITY_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.1")
|
| 32 |
+
SUBJECT_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.11")
|
| 33 |
+
OCSP_NO_CHECK = ObjectIdentifier("1.3.6.1.5.5.7.48.1.5")
|
| 34 |
+
TLS_FEATURE = ObjectIdentifier("1.3.6.1.5.5.7.1.24")
|
| 35 |
+
CRL_NUMBER = ObjectIdentifier("2.5.29.20")
|
| 36 |
+
DELTA_CRL_INDICATOR = ObjectIdentifier("2.5.29.27")
|
| 37 |
+
PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier(
|
| 38 |
+
"1.3.6.1.4.1.11129.2.4.2"
|
| 39 |
+
)
|
| 40 |
+
PRECERT_POISON = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.3")
|
| 41 |
+
SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.5")
|
| 42 |
+
MS_CERTIFICATE_TEMPLATE = ObjectIdentifier("1.3.6.1.4.1.311.21.7")
|
| 43 |
+
ADMISSIONS = ObjectIdentifier("1.3.36.8.3.3")
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
class OCSPExtensionOID:
|
| 47 |
+
NONCE = ObjectIdentifier("1.3.6.1.5.5.7.48.1.2")
|
| 48 |
+
ACCEPTABLE_RESPONSES = ObjectIdentifier("1.3.6.1.5.5.7.48.1.4")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class CRLEntryExtensionOID:
|
| 52 |
+
CERTIFICATE_ISSUER = ObjectIdentifier("2.5.29.29")
|
| 53 |
+
CRL_REASON = ObjectIdentifier("2.5.29.21")
|
| 54 |
+
INVALIDITY_DATE = ObjectIdentifier("2.5.29.24")
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
class NameOID:
|
| 58 |
+
COMMON_NAME = ObjectIdentifier("2.5.4.3")
|
| 59 |
+
COUNTRY_NAME = ObjectIdentifier("2.5.4.6")
|
| 60 |
+
LOCALITY_NAME = ObjectIdentifier("2.5.4.7")
|
| 61 |
+
STATE_OR_PROVINCE_NAME = ObjectIdentifier("2.5.4.8")
|
| 62 |
+
STREET_ADDRESS = ObjectIdentifier("2.5.4.9")
|
| 63 |
+
ORGANIZATION_IDENTIFIER = ObjectIdentifier("2.5.4.97")
|
| 64 |
+
ORGANIZATION_NAME = ObjectIdentifier("2.5.4.10")
|
| 65 |
+
ORGANIZATIONAL_UNIT_NAME = ObjectIdentifier("2.5.4.11")
|
| 66 |
+
SERIAL_NUMBER = ObjectIdentifier("2.5.4.5")
|
| 67 |
+
SURNAME = ObjectIdentifier("2.5.4.4")
|
| 68 |
+
GIVEN_NAME = ObjectIdentifier("2.5.4.42")
|
| 69 |
+
TITLE = ObjectIdentifier("2.5.4.12")
|
| 70 |
+
INITIALS = ObjectIdentifier("2.5.4.43")
|
| 71 |
+
GENERATION_QUALIFIER = ObjectIdentifier("2.5.4.44")
|
| 72 |
+
X500_UNIQUE_IDENTIFIER = ObjectIdentifier("2.5.4.45")
|
| 73 |
+
DN_QUALIFIER = ObjectIdentifier("2.5.4.46")
|
| 74 |
+
PSEUDONYM = ObjectIdentifier("2.5.4.65")
|
| 75 |
+
USER_ID = ObjectIdentifier("0.9.2342.19200300.100.1.1")
|
| 76 |
+
DOMAIN_COMPONENT = ObjectIdentifier("0.9.2342.19200300.100.1.25")
|
| 77 |
+
EMAIL_ADDRESS = ObjectIdentifier("1.2.840.113549.1.9.1")
|
| 78 |
+
JURISDICTION_COUNTRY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.3")
|
| 79 |
+
JURISDICTION_LOCALITY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.1")
|
| 80 |
+
JURISDICTION_STATE_OR_PROVINCE_NAME = ObjectIdentifier(
|
| 81 |
+
"1.3.6.1.4.1.311.60.2.1.2"
|
| 82 |
+
)
|
| 83 |
+
BUSINESS_CATEGORY = ObjectIdentifier("2.5.4.15")
|
| 84 |
+
POSTAL_ADDRESS = ObjectIdentifier("2.5.4.16")
|
| 85 |
+
POSTAL_CODE = ObjectIdentifier("2.5.4.17")
|
| 86 |
+
INN = ObjectIdentifier("1.2.643.3.131.1.1")
|
| 87 |
+
OGRN = ObjectIdentifier("1.2.643.100.1")
|
| 88 |
+
SNILS = ObjectIdentifier("1.2.643.100.3")
|
| 89 |
+
UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2")
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
class SignatureAlgorithmOID:
|
| 93 |
+
RSA_WITH_MD5 = ObjectIdentifier("1.2.840.113549.1.1.4")
|
| 94 |
+
RSA_WITH_SHA1 = ObjectIdentifier("1.2.840.113549.1.1.5")
|
| 95 |
+
# This is an alternate OID for RSA with SHA1 that is occasionally seen
|
| 96 |
+
_RSA_WITH_SHA1 = ObjectIdentifier("1.3.14.3.2.29")
|
| 97 |
+
RSA_WITH_SHA224 = ObjectIdentifier("1.2.840.113549.1.1.14")
|
| 98 |
+
RSA_WITH_SHA256 = ObjectIdentifier("1.2.840.113549.1.1.11")
|
| 99 |
+
RSA_WITH_SHA384 = ObjectIdentifier("1.2.840.113549.1.1.12")
|
| 100 |
+
RSA_WITH_SHA512 = ObjectIdentifier("1.2.840.113549.1.1.13")
|
| 101 |
+
RSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.13")
|
| 102 |
+
RSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.14")
|
| 103 |
+
RSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.15")
|
| 104 |
+
RSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.16")
|
| 105 |
+
RSASSA_PSS = ObjectIdentifier("1.2.840.113549.1.1.10")
|
| 106 |
+
ECDSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10045.4.1")
|
| 107 |
+
ECDSA_WITH_SHA224 = ObjectIdentifier("1.2.840.10045.4.3.1")
|
| 108 |
+
ECDSA_WITH_SHA256 = ObjectIdentifier("1.2.840.10045.4.3.2")
|
| 109 |
+
ECDSA_WITH_SHA384 = ObjectIdentifier("1.2.840.10045.4.3.3")
|
| 110 |
+
ECDSA_WITH_SHA512 = ObjectIdentifier("1.2.840.10045.4.3.4")
|
| 111 |
+
ECDSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.9")
|
| 112 |
+
ECDSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.10")
|
| 113 |
+
ECDSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.11")
|
| 114 |
+
ECDSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.12")
|
| 115 |
+
DSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10040.4.3")
|
| 116 |
+
DSA_WITH_SHA224 = ObjectIdentifier("2.16.840.1.101.3.4.3.1")
|
| 117 |
+
DSA_WITH_SHA256 = ObjectIdentifier("2.16.840.1.101.3.4.3.2")
|
| 118 |
+
DSA_WITH_SHA384 = ObjectIdentifier("2.16.840.1.101.3.4.3.3")
|
| 119 |
+
DSA_WITH_SHA512 = ObjectIdentifier("2.16.840.1.101.3.4.3.4")
|
| 120 |
+
ED25519 = ObjectIdentifier("1.3.101.112")
|
| 121 |
+
ED448 = ObjectIdentifier("1.3.101.113")
|
| 122 |
+
GOSTR3411_94_WITH_3410_2001 = ObjectIdentifier("1.2.643.2.2.3")
|
| 123 |
+
GOSTR3410_2012_WITH_3411_2012_256 = ObjectIdentifier("1.2.643.7.1.1.3.2")
|
| 124 |
+
GOSTR3410_2012_WITH_3411_2012_512 = ObjectIdentifier("1.2.643.7.1.1.3.3")
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
_SIG_OIDS_TO_HASH: dict[ObjectIdentifier, hashes.HashAlgorithm | None] = {
|
| 128 |
+
SignatureAlgorithmOID.RSA_WITH_MD5: hashes.MD5(),
|
| 129 |
+
SignatureAlgorithmOID.RSA_WITH_SHA1: hashes.SHA1(),
|
| 130 |
+
SignatureAlgorithmOID._RSA_WITH_SHA1: hashes.SHA1(),
|
| 131 |
+
SignatureAlgorithmOID.RSA_WITH_SHA224: hashes.SHA224(),
|
| 132 |
+
SignatureAlgorithmOID.RSA_WITH_SHA256: hashes.SHA256(),
|
| 133 |
+
SignatureAlgorithmOID.RSA_WITH_SHA384: hashes.SHA384(),
|
| 134 |
+
SignatureAlgorithmOID.RSA_WITH_SHA512: hashes.SHA512(),
|
| 135 |
+
SignatureAlgorithmOID.RSA_WITH_SHA3_224: hashes.SHA3_224(),
|
| 136 |
+
SignatureAlgorithmOID.RSA_WITH_SHA3_256: hashes.SHA3_256(),
|
| 137 |
+
SignatureAlgorithmOID.RSA_WITH_SHA3_384: hashes.SHA3_384(),
|
| 138 |
+
SignatureAlgorithmOID.RSA_WITH_SHA3_512: hashes.SHA3_512(),
|
| 139 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA1: hashes.SHA1(),
|
| 140 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA224: hashes.SHA224(),
|
| 141 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA256: hashes.SHA256(),
|
| 142 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA384: hashes.SHA384(),
|
| 143 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA512: hashes.SHA512(),
|
| 144 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA3_224: hashes.SHA3_224(),
|
| 145 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA3_256: hashes.SHA3_256(),
|
| 146 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA3_384: hashes.SHA3_384(),
|
| 147 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA3_512: hashes.SHA3_512(),
|
| 148 |
+
SignatureAlgorithmOID.DSA_WITH_SHA1: hashes.SHA1(),
|
| 149 |
+
SignatureAlgorithmOID.DSA_WITH_SHA224: hashes.SHA224(),
|
| 150 |
+
SignatureAlgorithmOID.DSA_WITH_SHA256: hashes.SHA256(),
|
| 151 |
+
SignatureAlgorithmOID.ED25519: None,
|
| 152 |
+
SignatureAlgorithmOID.ED448: None,
|
| 153 |
+
SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: None,
|
| 154 |
+
SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: None,
|
| 155 |
+
SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: None,
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
class HashAlgorithmOID:
|
| 160 |
+
SHA1 = ObjectIdentifier("1.3.14.3.2.26")
|
| 161 |
+
SHA224 = ObjectIdentifier("2.16.840.1.101.3.4.2.4")
|
| 162 |
+
SHA256 = ObjectIdentifier("2.16.840.1.101.3.4.2.1")
|
| 163 |
+
SHA384 = ObjectIdentifier("2.16.840.1.101.3.4.2.2")
|
| 164 |
+
SHA512 = ObjectIdentifier("2.16.840.1.101.3.4.2.3")
|
| 165 |
+
SHA3_224 = ObjectIdentifier("1.3.6.1.4.1.37476.3.2.1.99.7.224")
|
| 166 |
+
SHA3_256 = ObjectIdentifier("1.3.6.1.4.1.37476.3.2.1.99.7.256")
|
| 167 |
+
SHA3_384 = ObjectIdentifier("1.3.6.1.4.1.37476.3.2.1.99.7.384")
|
| 168 |
+
SHA3_512 = ObjectIdentifier("1.3.6.1.4.1.37476.3.2.1.99.7.512")
|
| 169 |
+
SHA3_224_NIST = ObjectIdentifier("2.16.840.1.101.3.4.2.7")
|
| 170 |
+
SHA3_256_NIST = ObjectIdentifier("2.16.840.1.101.3.4.2.8")
|
| 171 |
+
SHA3_384_NIST = ObjectIdentifier("2.16.840.1.101.3.4.2.9")
|
| 172 |
+
SHA3_512_NIST = ObjectIdentifier("2.16.840.1.101.3.4.2.10")
|
| 173 |
+
|
| 174 |
+
|
| 175 |
+
class PublicKeyAlgorithmOID:
|
| 176 |
+
DSA = ObjectIdentifier("1.2.840.10040.4.1")
|
| 177 |
+
EC_PUBLIC_KEY = ObjectIdentifier("1.2.840.10045.2.1")
|
| 178 |
+
RSAES_PKCS1_v1_5 = ObjectIdentifier("1.2.840.113549.1.1.1")
|
| 179 |
+
RSASSA_PSS = ObjectIdentifier("1.2.840.113549.1.1.10")
|
| 180 |
+
X25519 = ObjectIdentifier("1.3.101.110")
|
| 181 |
+
X448 = ObjectIdentifier("1.3.101.111")
|
| 182 |
+
ED25519 = ObjectIdentifier("1.3.101.112")
|
| 183 |
+
ED448 = ObjectIdentifier("1.3.101.113")
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
class ExtendedKeyUsageOID:
|
| 187 |
+
SERVER_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.1")
|
| 188 |
+
CLIENT_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.2")
|
| 189 |
+
CODE_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.3")
|
| 190 |
+
EMAIL_PROTECTION = ObjectIdentifier("1.3.6.1.5.5.7.3.4")
|
| 191 |
+
TIME_STAMPING = ObjectIdentifier("1.3.6.1.5.5.7.3.8")
|
| 192 |
+
OCSP_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.9")
|
| 193 |
+
ANY_EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37.0")
|
| 194 |
+
SMARTCARD_LOGON = ObjectIdentifier("1.3.6.1.4.1.311.20.2.2")
|
| 195 |
+
KERBEROS_PKINIT_KDC = ObjectIdentifier("1.3.6.1.5.2.3.5")
|
| 196 |
+
IPSEC_IKE = ObjectIdentifier("1.3.6.1.5.5.7.3.17")
|
| 197 |
+
BUNDLE_SECURITY = ObjectIdentifier("1.3.6.1.5.5.7.3.35")
|
| 198 |
+
CERTIFICATE_TRANSPARENCY = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.4")
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
class OtherNameFormOID:
|
| 202 |
+
PERMANENT_IDENTIFIER = ObjectIdentifier("1.3.6.1.5.5.7.8.3")
|
| 203 |
+
HW_MODULE_NAME = ObjectIdentifier("1.3.6.1.5.5.7.8.4")
|
| 204 |
+
DNS_SRV = ObjectIdentifier("1.3.6.1.5.5.7.8.7")
|
| 205 |
+
NAI_REALM = ObjectIdentifier("1.3.6.1.5.5.7.8.8")
|
| 206 |
+
SMTP_UTF8_MAILBOX = ObjectIdentifier("1.3.6.1.5.5.7.8.9")
|
| 207 |
+
ACP_NODE_NAME = ObjectIdentifier("1.3.6.1.5.5.7.8.10")
|
| 208 |
+
BUNDLE_EID = ObjectIdentifier("1.3.6.1.5.5.7.8.11")
|
| 209 |
+
|
| 210 |
+
|
| 211 |
+
class AuthorityInformationAccessOID:
|
| 212 |
+
CA_ISSUERS = ObjectIdentifier("1.3.6.1.5.5.7.48.2")
|
| 213 |
+
OCSP = ObjectIdentifier("1.3.6.1.5.5.7.48.1")
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
class SubjectInformationAccessOID:
|
| 217 |
+
CA_REPOSITORY = ObjectIdentifier("1.3.6.1.5.5.7.48.5")
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
class CertificatePoliciesOID:
|
| 221 |
+
CPS_QUALIFIER = ObjectIdentifier("1.3.6.1.5.5.7.2.1")
|
| 222 |
+
CPS_USER_NOTICE = ObjectIdentifier("1.3.6.1.5.5.7.2.2")
|
| 223 |
+
ANY_POLICY = ObjectIdentifier("2.5.29.32.0")
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
class AttributeOID:
|
| 227 |
+
CHALLENGE_PASSWORD = ObjectIdentifier("1.2.840.113549.1.9.7")
|
| 228 |
+
UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2")
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
_OID_NAMES = {
|
| 232 |
+
NameOID.COMMON_NAME: "commonName",
|
| 233 |
+
NameOID.COUNTRY_NAME: "countryName",
|
| 234 |
+
NameOID.LOCALITY_NAME: "localityName",
|
| 235 |
+
NameOID.STATE_OR_PROVINCE_NAME: "stateOrProvinceName",
|
| 236 |
+
NameOID.STREET_ADDRESS: "streetAddress",
|
| 237 |
+
NameOID.ORGANIZATION_NAME: "organizationName",
|
| 238 |
+
NameOID.ORGANIZATIONAL_UNIT_NAME: "organizationalUnitName",
|
| 239 |
+
NameOID.SERIAL_NUMBER: "serialNumber",
|
| 240 |
+
NameOID.SURNAME: "surname",
|
| 241 |
+
NameOID.GIVEN_NAME: "givenName",
|
| 242 |
+
NameOID.TITLE: "title",
|
| 243 |
+
NameOID.GENERATION_QUALIFIER: "generationQualifier",
|
| 244 |
+
NameOID.X500_UNIQUE_IDENTIFIER: "x500UniqueIdentifier",
|
| 245 |
+
NameOID.DN_QUALIFIER: "dnQualifier",
|
| 246 |
+
NameOID.PSEUDONYM: "pseudonym",
|
| 247 |
+
NameOID.USER_ID: "userID",
|
| 248 |
+
NameOID.DOMAIN_COMPONENT: "domainComponent",
|
| 249 |
+
NameOID.EMAIL_ADDRESS: "emailAddress",
|
| 250 |
+
NameOID.JURISDICTION_COUNTRY_NAME: "jurisdictionCountryName",
|
| 251 |
+
NameOID.JURISDICTION_LOCALITY_NAME: "jurisdictionLocalityName",
|
| 252 |
+
NameOID.JURISDICTION_STATE_OR_PROVINCE_NAME: (
|
| 253 |
+
"jurisdictionStateOrProvinceName"
|
| 254 |
+
),
|
| 255 |
+
NameOID.BUSINESS_CATEGORY: "businessCategory",
|
| 256 |
+
NameOID.POSTAL_ADDRESS: "postalAddress",
|
| 257 |
+
NameOID.POSTAL_CODE: "postalCode",
|
| 258 |
+
NameOID.INN: "INN",
|
| 259 |
+
NameOID.OGRN: "OGRN",
|
| 260 |
+
NameOID.SNILS: "SNILS",
|
| 261 |
+
NameOID.UNSTRUCTURED_NAME: "unstructuredName",
|
| 262 |
+
SignatureAlgorithmOID.RSA_WITH_MD5: "md5WithRSAEncryption",
|
| 263 |
+
SignatureAlgorithmOID.RSA_WITH_SHA1: "sha1WithRSAEncryption",
|
| 264 |
+
SignatureAlgorithmOID.RSA_WITH_SHA224: "sha224WithRSAEncryption",
|
| 265 |
+
SignatureAlgorithmOID.RSA_WITH_SHA256: "sha256WithRSAEncryption",
|
| 266 |
+
SignatureAlgorithmOID.RSA_WITH_SHA384: "sha384WithRSAEncryption",
|
| 267 |
+
SignatureAlgorithmOID.RSA_WITH_SHA512: "sha512WithRSAEncryption",
|
| 268 |
+
SignatureAlgorithmOID.RSASSA_PSS: "rsassaPss",
|
| 269 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA1: "ecdsa-with-SHA1",
|
| 270 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA224: "ecdsa-with-SHA224",
|
| 271 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA256: "ecdsa-with-SHA256",
|
| 272 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA384: "ecdsa-with-SHA384",
|
| 273 |
+
SignatureAlgorithmOID.ECDSA_WITH_SHA512: "ecdsa-with-SHA512",
|
| 274 |
+
SignatureAlgorithmOID.DSA_WITH_SHA1: "dsa-with-sha1",
|
| 275 |
+
SignatureAlgorithmOID.DSA_WITH_SHA224: "dsa-with-sha224",
|
| 276 |
+
SignatureAlgorithmOID.DSA_WITH_SHA256: "dsa-with-sha256",
|
| 277 |
+
SignatureAlgorithmOID.ED25519: "ed25519",
|
| 278 |
+
SignatureAlgorithmOID.ED448: "ed448",
|
| 279 |
+
SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: (
|
| 280 |
+
"GOST R 34.11-94 with GOST R 34.10-2001"
|
| 281 |
+
),
|
| 282 |
+
SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: (
|
| 283 |
+
"GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)"
|
| 284 |
+
),
|
| 285 |
+
SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: (
|
| 286 |
+
"GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)"
|
| 287 |
+
),
|
| 288 |
+
HashAlgorithmOID.SHA1: "sha1",
|
| 289 |
+
HashAlgorithmOID.SHA224: "sha224",
|
| 290 |
+
HashAlgorithmOID.SHA256: "sha256",
|
| 291 |
+
HashAlgorithmOID.SHA384: "sha384",
|
| 292 |
+
HashAlgorithmOID.SHA512: "sha512",
|
| 293 |
+
HashAlgorithmOID.SHA3_224: "sha3_224",
|
| 294 |
+
HashAlgorithmOID.SHA3_256: "sha3_256",
|
| 295 |
+
HashAlgorithmOID.SHA3_384: "sha3_384",
|
| 296 |
+
HashAlgorithmOID.SHA3_512: "sha3_512",
|
| 297 |
+
HashAlgorithmOID.SHA3_224_NIST: "sha3_224",
|
| 298 |
+
HashAlgorithmOID.SHA3_256_NIST: "sha3_256",
|
| 299 |
+
HashAlgorithmOID.SHA3_384_NIST: "sha3_384",
|
| 300 |
+
HashAlgorithmOID.SHA3_512_NIST: "sha3_512",
|
| 301 |
+
PublicKeyAlgorithmOID.DSA: "dsaEncryption",
|
| 302 |
+
PublicKeyAlgorithmOID.EC_PUBLIC_KEY: "id-ecPublicKey",
|
| 303 |
+
PublicKeyAlgorithmOID.RSAES_PKCS1_v1_5: "rsaEncryption",
|
| 304 |
+
PublicKeyAlgorithmOID.X25519: "X25519",
|
| 305 |
+
PublicKeyAlgorithmOID.X448: "X448",
|
| 306 |
+
ExtendedKeyUsageOID.SERVER_AUTH: "serverAuth",
|
| 307 |
+
ExtendedKeyUsageOID.CLIENT_AUTH: "clientAuth",
|
| 308 |
+
ExtendedKeyUsageOID.CODE_SIGNING: "codeSigning",
|
| 309 |
+
ExtendedKeyUsageOID.EMAIL_PROTECTION: "emailProtection",
|
| 310 |
+
ExtendedKeyUsageOID.TIME_STAMPING: "timeStamping",
|
| 311 |
+
ExtendedKeyUsageOID.OCSP_SIGNING: "OCSPSigning",
|
| 312 |
+
ExtendedKeyUsageOID.SMARTCARD_LOGON: "msSmartcardLogin",
|
| 313 |
+
ExtendedKeyUsageOID.KERBEROS_PKINIT_KDC: "pkInitKDC",
|
| 314 |
+
ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES: "subjectDirectoryAttributes",
|
| 315 |
+
ExtensionOID.SUBJECT_KEY_IDENTIFIER: "subjectKeyIdentifier",
|
| 316 |
+
ExtensionOID.KEY_USAGE: "keyUsage",
|
| 317 |
+
ExtensionOID.PRIVATE_KEY_USAGE_PERIOD: "privateKeyUsagePeriod",
|
| 318 |
+
ExtensionOID.SUBJECT_ALTERNATIVE_NAME: "subjectAltName",
|
| 319 |
+
ExtensionOID.ISSUER_ALTERNATIVE_NAME: "issuerAltName",
|
| 320 |
+
ExtensionOID.BASIC_CONSTRAINTS: "basicConstraints",
|
| 321 |
+
ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS: (
|
| 322 |
+
"signedCertificateTimestampList"
|
| 323 |
+
),
|
| 324 |
+
ExtensionOID.SIGNED_CERTIFICATE_TIMESTAMPS: (
|
| 325 |
+
"signedCertificateTimestampList"
|
| 326 |
+
),
|
| 327 |
+
ExtensionOID.PRECERT_POISON: "ctPoison",
|
| 328 |
+
ExtensionOID.MS_CERTIFICATE_TEMPLATE: "msCertificateTemplate",
|
| 329 |
+
ExtensionOID.ADMISSIONS: "Admissions",
|
| 330 |
+
CRLEntryExtensionOID.CRL_REASON: "cRLReason",
|
| 331 |
+
CRLEntryExtensionOID.INVALIDITY_DATE: "invalidityDate",
|
| 332 |
+
CRLEntryExtensionOID.CERTIFICATE_ISSUER: "certificateIssuer",
|
| 333 |
+
ExtensionOID.NAME_CONSTRAINTS: "nameConstraints",
|
| 334 |
+
ExtensionOID.CRL_DISTRIBUTION_POINTS: "cRLDistributionPoints",
|
| 335 |
+
ExtensionOID.CERTIFICATE_POLICIES: "certificatePolicies",
|
| 336 |
+
ExtensionOID.POLICY_MAPPINGS: "policyMappings",
|
| 337 |
+
ExtensionOID.AUTHORITY_KEY_IDENTIFIER: "authorityKeyIdentifier",
|
| 338 |
+
ExtensionOID.POLICY_CONSTRAINTS: "policyConstraints",
|
| 339 |
+
ExtensionOID.EXTENDED_KEY_USAGE: "extendedKeyUsage",
|
| 340 |
+
ExtensionOID.FRESHEST_CRL: "freshestCRL",
|
| 341 |
+
ExtensionOID.INHIBIT_ANY_POLICY: "inhibitAnyPolicy",
|
| 342 |
+
ExtensionOID.ISSUING_DISTRIBUTION_POINT: "issuingDistributionPoint",
|
| 343 |
+
ExtensionOID.AUTHORITY_INFORMATION_ACCESS: "authorityInfoAccess",
|
| 344 |
+
ExtensionOID.SUBJECT_INFORMATION_ACCESS: "subjectInfoAccess",
|
| 345 |
+
ExtensionOID.OCSP_NO_CHECK: "OCSPNoCheck",
|
| 346 |
+
ExtensionOID.CRL_NUMBER: "cRLNumber",
|
| 347 |
+
ExtensionOID.DELTA_CRL_INDICATOR: "deltaCRLIndicator",
|
| 348 |
+
ExtensionOID.TLS_FEATURE: "TLSFeature",
|
| 349 |
+
AuthorityInformationAccessOID.OCSP: "OCSP",
|
| 350 |
+
AuthorityInformationAccessOID.CA_ISSUERS: "caIssuers",
|
| 351 |
+
SubjectInformationAccessOID.CA_REPOSITORY: "caRepository",
|
| 352 |
+
CertificatePoliciesOID.CPS_QUALIFIER: "id-qt-cps",
|
| 353 |
+
CertificatePoliciesOID.CPS_USER_NOTICE: "id-qt-unotice",
|
| 354 |
+
OCSPExtensionOID.NONCE: "OCSPNonce",
|
| 355 |
+
AttributeOID.CHALLENGE_PASSWORD: "challengePassword",
|
| 356 |
+
}
|
lib/python3.11/site-packages/cryptography/hazmat/asn1/__init__.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from cryptography.hazmat.asn1.asn1 import (
|
| 6 |
+
TLV,
|
| 7 |
+
BitString,
|
| 8 |
+
Default,
|
| 9 |
+
Explicit,
|
| 10 |
+
GeneralizedTime,
|
| 11 |
+
IA5String,
|
| 12 |
+
Implicit,
|
| 13 |
+
Null,
|
| 14 |
+
PrintableString,
|
| 15 |
+
SetOf,
|
| 16 |
+
Size,
|
| 17 |
+
UTCTime,
|
| 18 |
+
Variant,
|
| 19 |
+
decode_der,
|
| 20 |
+
encode_der,
|
| 21 |
+
sequence,
|
| 22 |
+
set,
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
__all__ = [
|
| 26 |
+
"TLV",
|
| 27 |
+
"BitString",
|
| 28 |
+
"Default",
|
| 29 |
+
"Explicit",
|
| 30 |
+
"GeneralizedTime",
|
| 31 |
+
"IA5String",
|
| 32 |
+
"Implicit",
|
| 33 |
+
"Null",
|
| 34 |
+
"PrintableString",
|
| 35 |
+
"SetOf",
|
| 36 |
+
"Size",
|
| 37 |
+
"UTCTime",
|
| 38 |
+
"Variant",
|
| 39 |
+
"decode_der",
|
| 40 |
+
"encode_der",
|
| 41 |
+
"sequence",
|
| 42 |
+
"set",
|
| 43 |
+
]
|
lib/python3.11/site-packages/cryptography/hazmat/asn1/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (789 Bytes). View file
|
|
|
lib/python3.11/site-packages/cryptography/hazmat/asn1/__pycache__/asn1.cpython-311.pyc
ADDED
|
Binary file (15.5 kB). View file
|
|
|
lib/python3.11/site-packages/cryptography/hazmat/asn1/asn1.py
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import builtins
|
| 8 |
+
import dataclasses
|
| 9 |
+
import sys
|
| 10 |
+
import types
|
| 11 |
+
import typing
|
| 12 |
+
|
| 13 |
+
if sys.version_info < (3, 11):
|
| 14 |
+
import typing_extensions
|
| 15 |
+
|
| 16 |
+
LiteralString = typing_extensions.LiteralString
|
| 17 |
+
else:
|
| 18 |
+
LiteralString = typing.LiteralString
|
| 19 |
+
|
| 20 |
+
from cryptography.hazmat.bindings._rust import declarative_asn1
|
| 21 |
+
|
| 22 |
+
if sys.version_info < (3, 10):
|
| 23 |
+
NoneType = type(None)
|
| 24 |
+
else:
|
| 25 |
+
NoneType = types.NoneType # type: ignore[nonetype-type]
|
| 26 |
+
|
| 27 |
+
T = typing.TypeVar("T", covariant=True)
|
| 28 |
+
U = typing.TypeVar("U")
|
| 29 |
+
Tag = typing.TypeVar("Tag", bound=LiteralString)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
@dataclasses.dataclass(frozen=True)
|
| 33 |
+
class Variant(typing.Generic[U, Tag]):
|
| 34 |
+
"""
|
| 35 |
+
A tagged variant for CHOICE fields with the same underlying type.
|
| 36 |
+
|
| 37 |
+
Use this when you have multiple CHOICE alternatives with the same type
|
| 38 |
+
and need to distinguish between them:
|
| 39 |
+
|
| 40 |
+
foo: (
|
| 41 |
+
Annotated[Variant[int, typing.Literal["IntA"]], Implicit(0)]
|
| 42 |
+
| Annotated[Variant[int, typing.Literal["IntB"]], Implicit(1)]
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
Usage:
|
| 46 |
+
example = Example(foo=Variant(5, "IntA"))
|
| 47 |
+
decoded.foo.value # The int value
|
| 48 |
+
decoded.foo.tag # "IntA" or "IntB"
|
| 49 |
+
"""
|
| 50 |
+
|
| 51 |
+
value: U
|
| 52 |
+
tag: str
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
decode_der = declarative_asn1.decode_der
|
| 56 |
+
encode_der = declarative_asn1.encode_der
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
def _is_union(field_type: type) -> bool:
|
| 60 |
+
# NOTE: types.UnionType for `T | U`, typing.Union for `Union[T, U]`.
|
| 61 |
+
# TODO: Drop the `hasattr()` once the minimum supported Python version
|
| 62 |
+
# is >= 3.10.
|
| 63 |
+
union_types = (
|
| 64 |
+
(types.UnionType, typing.Union)
|
| 65 |
+
if hasattr(types, "UnionType")
|
| 66 |
+
else (typing.Union,)
|
| 67 |
+
)
|
| 68 |
+
return typing.get_origin(field_type) in union_types
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def _extract_annotation(
|
| 72 |
+
metadata: tuple, field_name: str
|
| 73 |
+
) -> declarative_asn1.Annotation:
|
| 74 |
+
default = None
|
| 75 |
+
encoding = None
|
| 76 |
+
size = None
|
| 77 |
+
for raw_annotation in metadata:
|
| 78 |
+
if isinstance(raw_annotation, Default):
|
| 79 |
+
if default is not None:
|
| 80 |
+
raise TypeError(
|
| 81 |
+
f"multiple DEFAULT annotations found in field "
|
| 82 |
+
f"'{field_name}'"
|
| 83 |
+
)
|
| 84 |
+
default = raw_annotation.value
|
| 85 |
+
elif isinstance(raw_annotation, declarative_asn1.Encoding):
|
| 86 |
+
if encoding is not None:
|
| 87 |
+
raise TypeError(
|
| 88 |
+
f"multiple IMPLICIT/EXPLICIT annotations found in field "
|
| 89 |
+
f"'{field_name}'"
|
| 90 |
+
)
|
| 91 |
+
encoding = raw_annotation
|
| 92 |
+
elif isinstance(raw_annotation, declarative_asn1.Size):
|
| 93 |
+
if size is not None:
|
| 94 |
+
raise TypeError(
|
| 95 |
+
f"multiple SIZE annotations found in field '{field_name}'"
|
| 96 |
+
)
|
| 97 |
+
size = raw_annotation
|
| 98 |
+
else:
|
| 99 |
+
raise TypeError(f"unsupported annotation: {raw_annotation}")
|
| 100 |
+
|
| 101 |
+
return declarative_asn1.Annotation(
|
| 102 |
+
default=default, encoding=encoding, size=size
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def _normalize_field_type(
|
| 107 |
+
field_type: typing.Any, field_name: str
|
| 108 |
+
) -> declarative_asn1.AnnotatedType:
|
| 109 |
+
# Strip the `Annotated[...]` off, and populate the annotation
|
| 110 |
+
# from it if it exists.
|
| 111 |
+
if typing.get_origin(field_type) is typing.Annotated:
|
| 112 |
+
annotation = _extract_annotation(field_type.__metadata__, field_name)
|
| 113 |
+
field_type, *_ = typing.get_args(field_type)
|
| 114 |
+
else:
|
| 115 |
+
annotation = declarative_asn1.Annotation()
|
| 116 |
+
|
| 117 |
+
if annotation.size is not None and (
|
| 118 |
+
typing.get_origin(field_type) not in (builtins.list, SetOf)
|
| 119 |
+
and field_type
|
| 120 |
+
not in (
|
| 121 |
+
builtins.bytes,
|
| 122 |
+
builtins.str,
|
| 123 |
+
BitString,
|
| 124 |
+
IA5String,
|
| 125 |
+
PrintableString,
|
| 126 |
+
)
|
| 127 |
+
):
|
| 128 |
+
raise TypeError(
|
| 129 |
+
f"field '{field_name}' has a SIZE annotation, but SIZE "
|
| 130 |
+
"annotations are only supported for fields of types: "
|
| 131 |
+
"[SEQUENCE OF, SET OF, BIT STRING, OCTET STRING, UTF8String, "
|
| 132 |
+
"PrintableString, IA5String]"
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
if field_type is TLV:
|
| 136 |
+
if isinstance(annotation.encoding, Implicit):
|
| 137 |
+
raise TypeError(
|
| 138 |
+
f"field '{field_name}' has an IMPLICIT annotation, but "
|
| 139 |
+
"IMPLICIT annotations are not supported for TLV types."
|
| 140 |
+
)
|
| 141 |
+
elif annotation.default is not None:
|
| 142 |
+
raise TypeError(
|
| 143 |
+
f"field '{field_name}' has a DEFAULT annotation, but "
|
| 144 |
+
"DEFAULT annotations are not supported for TLV types."
|
| 145 |
+
)
|
| 146 |
+
|
| 147 |
+
if hasattr(field_type, "__asn1_root__"):
|
| 148 |
+
root_type = field_type.__asn1_root__
|
| 149 |
+
if not isinstance(
|
| 150 |
+
root_type,
|
| 151 |
+
(declarative_asn1.Type.Sequence, declarative_asn1.Type.Set),
|
| 152 |
+
):
|
| 153 |
+
raise TypeError(f"unsupported root type: {root_type}")
|
| 154 |
+
return declarative_asn1.AnnotatedType(
|
| 155 |
+
typing.cast(declarative_asn1.Type, root_type), annotation
|
| 156 |
+
)
|
| 157 |
+
elif _is_union(field_type):
|
| 158 |
+
union_args = typing.get_args(field_type)
|
| 159 |
+
if len(union_args) == 2 and NoneType in union_args:
|
| 160 |
+
# A Union between a type and None is an OPTIONAL
|
| 161 |
+
optional_type = (
|
| 162 |
+
union_args[0] if union_args[1] is type(None) else union_args[1]
|
| 163 |
+
)
|
| 164 |
+
if optional_type is TLV:
|
| 165 |
+
raise TypeError(
|
| 166 |
+
"optional TLV types (`TLV | None`) are not "
|
| 167 |
+
"currently supported"
|
| 168 |
+
)
|
| 169 |
+
annotated_type = _normalize_field_type(optional_type, field_name)
|
| 170 |
+
|
| 171 |
+
if not annotated_type.annotation.is_empty():
|
| 172 |
+
raise TypeError(
|
| 173 |
+
"optional (`X | None`) types cannot have `X` "
|
| 174 |
+
"annotated: annotations must apply to the union "
|
| 175 |
+
"(i.e: `Annotated[X | None, annotation]`)"
|
| 176 |
+
)
|
| 177 |
+
|
| 178 |
+
if annotation.default is not None:
|
| 179 |
+
raise TypeError(
|
| 180 |
+
"optional (`X | None`) types should not have a DEFAULT "
|
| 181 |
+
"annotation"
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
rust_field_type = declarative_asn1.Type.Option(annotated_type)
|
| 185 |
+
|
| 186 |
+
else:
|
| 187 |
+
# Otherwise, the Union is a CHOICE
|
| 188 |
+
if isinstance(annotation.encoding, Implicit):
|
| 189 |
+
# CHOICEs cannot be IMPLICIT. See X.680 section 31.2.9.
|
| 190 |
+
raise TypeError(
|
| 191 |
+
"CHOICE (`X | Y | ...`) types should not have an IMPLICIT "
|
| 192 |
+
"annotation"
|
| 193 |
+
)
|
| 194 |
+
variants = [
|
| 195 |
+
_type_to_variant(arg, field_name)
|
| 196 |
+
for arg in union_args
|
| 197 |
+
if arg is not type(None)
|
| 198 |
+
]
|
| 199 |
+
|
| 200 |
+
# Union types should either be all Variants
|
| 201 |
+
# (`Variant[..] | Variant[..] | etc`) or all non Variants
|
| 202 |
+
are_union_types_tagged = variants[0].tag_name is not None
|
| 203 |
+
if any(
|
| 204 |
+
(v.tag_name is not None) != are_union_types_tagged
|
| 205 |
+
for v in variants
|
| 206 |
+
):
|
| 207 |
+
raise TypeError(
|
| 208 |
+
"When using `asn1.Variant` in a union, all the other "
|
| 209 |
+
"types in the union must also be `asn1.Variant`"
|
| 210 |
+
)
|
| 211 |
+
|
| 212 |
+
if are_union_types_tagged:
|
| 213 |
+
tags = {v.tag_name for v in variants}
|
| 214 |
+
if len(variants) != len(tags):
|
| 215 |
+
raise TypeError(
|
| 216 |
+
"When using `asn1.Variant` in a union, the tags used "
|
| 217 |
+
"must be unique"
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
rust_choice_type = declarative_asn1.Type.Choice(variants)
|
| 221 |
+
# If None is part of the union types, this is an OPTIONAL CHOICE
|
| 222 |
+
rust_field_type = (
|
| 223 |
+
declarative_asn1.Type.Option(
|
| 224 |
+
declarative_asn1.AnnotatedType(
|
| 225 |
+
rust_choice_type, declarative_asn1.Annotation()
|
| 226 |
+
)
|
| 227 |
+
)
|
| 228 |
+
if NoneType in union_args
|
| 229 |
+
else rust_choice_type
|
| 230 |
+
)
|
| 231 |
+
|
| 232 |
+
elif typing.get_origin(field_type) is builtins.list:
|
| 233 |
+
inner_type = _normalize_field_type(
|
| 234 |
+
typing.get_args(field_type)[0], field_name
|
| 235 |
+
)
|
| 236 |
+
rust_field_type = declarative_asn1.Type.SequenceOf(inner_type)
|
| 237 |
+
elif typing.get_origin(field_type) is SetOf:
|
| 238 |
+
inner_type = _normalize_field_type(
|
| 239 |
+
typing.get_args(field_type)[0], field_name
|
| 240 |
+
)
|
| 241 |
+
rust_field_type = declarative_asn1.Type.SetOf(inner_type)
|
| 242 |
+
else:
|
| 243 |
+
rust_field_type = declarative_asn1.non_root_python_to_rust(field_type)
|
| 244 |
+
|
| 245 |
+
return declarative_asn1.AnnotatedType(rust_field_type, annotation)
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
# Convert a type to a Variant. Used with types inside Union
|
| 249 |
+
# annotations (T1, T2, etc in `Union[T1, T2, ...]`).
|
| 250 |
+
def _type_to_variant(
|
| 251 |
+
t: typing.Any, field_name: str
|
| 252 |
+
) -> declarative_asn1.Variant:
|
| 253 |
+
is_annotated = typing.get_origin(t) is typing.Annotated
|
| 254 |
+
inner_type = typing.get_args(t)[0] if is_annotated else t
|
| 255 |
+
|
| 256 |
+
# Check if this is a Variant[T, Tag] type
|
| 257 |
+
if typing.get_origin(inner_type) is Variant:
|
| 258 |
+
value_type, tag_literal = typing.get_args(inner_type)
|
| 259 |
+
if typing.get_origin(tag_literal) is not typing.Literal:
|
| 260 |
+
raise TypeError(
|
| 261 |
+
"When using `asn1.Variant` in a type annotation, the second "
|
| 262 |
+
"type parameter must be a `typing.Literal` type. E.g: "
|
| 263 |
+
'`Variant[int, typing.Literal["MyInt"]]`.'
|
| 264 |
+
)
|
| 265 |
+
tag_name = typing.get_args(tag_literal)[0]
|
| 266 |
+
|
| 267 |
+
if hasattr(value_type, "__asn1_root__"):
|
| 268 |
+
rust_type = value_type.__asn1_root__
|
| 269 |
+
else:
|
| 270 |
+
rust_type = declarative_asn1.non_root_python_to_rust(value_type)
|
| 271 |
+
|
| 272 |
+
if is_annotated:
|
| 273 |
+
ann_type = declarative_asn1.AnnotatedType(
|
| 274 |
+
rust_type,
|
| 275 |
+
_extract_annotation(t.__metadata__, field_name),
|
| 276 |
+
)
|
| 277 |
+
else:
|
| 278 |
+
ann_type = declarative_asn1.AnnotatedType(
|
| 279 |
+
rust_type,
|
| 280 |
+
declarative_asn1.Annotation(),
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
+
return declarative_asn1.Variant(Variant, ann_type, tag_name)
|
| 284 |
+
else:
|
| 285 |
+
# Plain type (not a tagged Variant)
|
| 286 |
+
return declarative_asn1.Variant(
|
| 287 |
+
inner_type,
|
| 288 |
+
_normalize_field_type(t, field_name),
|
| 289 |
+
None,
|
| 290 |
+
)
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
def _annotate_fields(
|
| 294 |
+
raw_fields: dict[str, type],
|
| 295 |
+
) -> dict[str, declarative_asn1.AnnotatedType]:
|
| 296 |
+
fields = {}
|
| 297 |
+
for field_name, field_type in raw_fields.items():
|
| 298 |
+
# Recursively normalize the field type into something that the
|
| 299 |
+
# Rust code can understand.
|
| 300 |
+
annotated_field_type = _normalize_field_type(field_type, field_name)
|
| 301 |
+
fields[field_name] = annotated_field_type
|
| 302 |
+
|
| 303 |
+
return fields
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
def _register_asn1_sequence(cls: type[U]) -> None:
|
| 307 |
+
raw_fields = typing.get_type_hints(cls, include_extras=True)
|
| 308 |
+
root = declarative_asn1.Type.Sequence(cls, _annotate_fields(raw_fields))
|
| 309 |
+
|
| 310 |
+
setattr(cls, "__asn1_root__", root)
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
def _register_asn1_set(cls: type[U]) -> None:
|
| 314 |
+
raw_fields = typing.get_type_hints(cls, include_extras=True)
|
| 315 |
+
root = declarative_asn1.Type.Set(cls, _annotate_fields(raw_fields))
|
| 316 |
+
|
| 317 |
+
setattr(cls, "__asn1_root__", root)
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
# Due to https://github.com/python/mypy/issues/19731, we can't define an alias
|
| 321 |
+
# for `dataclass_transform` that conditionally points to `typing` or
|
| 322 |
+
# `typing_extensions` depending on the Python version. We work around it by
|
| 323 |
+
# making the whole decorated class conditional on the Python version.
|
| 324 |
+
if sys.version_info < (3, 11):
|
| 325 |
+
|
| 326 |
+
@typing_extensions.dataclass_transform(kw_only_default=True)
|
| 327 |
+
def sequence(cls: type[U]) -> type[U]:
|
| 328 |
+
# We use `dataclasses.dataclass` to add an __init__ method
|
| 329 |
+
# to the class with keyword-only parameters.
|
| 330 |
+
if sys.version_info >= (3, 10):
|
| 331 |
+
dataclass_cls = dataclasses.dataclass(
|
| 332 |
+
repr=False,
|
| 333 |
+
eq=False,
|
| 334 |
+
# `match_args` was added in Python 3.10 and defaults
|
| 335 |
+
# to True
|
| 336 |
+
match_args=False,
|
| 337 |
+
# `kw_only` was added in Python 3.10 and defaults to
|
| 338 |
+
# False
|
| 339 |
+
kw_only=True,
|
| 340 |
+
)(cls)
|
| 341 |
+
else:
|
| 342 |
+
dataclass_cls = dataclasses.dataclass(
|
| 343 |
+
repr=False,
|
| 344 |
+
eq=False,
|
| 345 |
+
)(cls)
|
| 346 |
+
_register_asn1_sequence(dataclass_cls)
|
| 347 |
+
return dataclass_cls
|
| 348 |
+
|
| 349 |
+
@typing_extensions.dataclass_transform(kw_only_default=True)
|
| 350 |
+
def set(cls: type[U]) -> type[U]:
|
| 351 |
+
# We use `dataclasses.dataclass` to add an __init__ method
|
| 352 |
+
# to the class with keyword-only parameters.
|
| 353 |
+
if sys.version_info >= (3, 10):
|
| 354 |
+
dataclass_cls = dataclasses.dataclass(
|
| 355 |
+
repr=False,
|
| 356 |
+
eq=False,
|
| 357 |
+
# `match_args` was added in Python 3.10 and defaults
|
| 358 |
+
# to True
|
| 359 |
+
match_args=False,
|
| 360 |
+
# `kw_only` was added in Python 3.10 and defaults to
|
| 361 |
+
# False
|
| 362 |
+
kw_only=True,
|
| 363 |
+
)(cls)
|
| 364 |
+
else:
|
| 365 |
+
dataclass_cls = dataclasses.dataclass(
|
| 366 |
+
repr=False,
|
| 367 |
+
eq=False,
|
| 368 |
+
)(cls)
|
| 369 |
+
_register_asn1_set(dataclass_cls)
|
| 370 |
+
return dataclass_cls
|
| 371 |
+
|
| 372 |
+
else:
|
| 373 |
+
|
| 374 |
+
@typing.dataclass_transform(kw_only_default=True)
|
| 375 |
+
def sequence(cls: type[U]) -> type[U]:
|
| 376 |
+
# Only add an __init__ method, with keyword-only
|
| 377 |
+
# parameters.
|
| 378 |
+
dataclass_cls = dataclasses.dataclass(
|
| 379 |
+
repr=False,
|
| 380 |
+
eq=False,
|
| 381 |
+
match_args=False,
|
| 382 |
+
kw_only=True,
|
| 383 |
+
)(cls)
|
| 384 |
+
_register_asn1_sequence(dataclass_cls)
|
| 385 |
+
return dataclass_cls
|
| 386 |
+
|
| 387 |
+
@typing.dataclass_transform(kw_only_default=True)
|
| 388 |
+
def set(cls: type[U]) -> type[U]:
|
| 389 |
+
# Only add an __init__ method, with keyword-only
|
| 390 |
+
# parameters.
|
| 391 |
+
dataclass_cls = dataclasses.dataclass(
|
| 392 |
+
repr=False,
|
| 393 |
+
eq=False,
|
| 394 |
+
match_args=False,
|
| 395 |
+
kw_only=True,
|
| 396 |
+
)(cls)
|
| 397 |
+
_register_asn1_set(dataclass_cls)
|
| 398 |
+
return dataclass_cls
|
| 399 |
+
|
| 400 |
+
|
| 401 |
+
# TODO: replace with `Default[U]` once the min Python version is >= 3.12
|
| 402 |
+
@dataclasses.dataclass(frozen=True)
|
| 403 |
+
class Default(typing.Generic[U]):
|
| 404 |
+
value: U
|
| 405 |
+
|
| 406 |
+
|
| 407 |
+
SetOf = declarative_asn1.SetOf
|
| 408 |
+
|
| 409 |
+
Explicit = declarative_asn1.Encoding.Explicit
|
| 410 |
+
Implicit = declarative_asn1.Encoding.Implicit
|
| 411 |
+
Size = declarative_asn1.Size
|
| 412 |
+
|
| 413 |
+
PrintableString = declarative_asn1.PrintableString
|
| 414 |
+
IA5String = declarative_asn1.IA5String
|
| 415 |
+
UTCTime = declarative_asn1.UTCTime
|
| 416 |
+
GeneralizedTime = declarative_asn1.GeneralizedTime
|
| 417 |
+
BitString = declarative_asn1.BitString
|
| 418 |
+
TLV = declarative_asn1.Tlv
|
| 419 |
+
Null = declarative_asn1.Null
|
lib/python3.11/site-packages/cryptography/hazmat/backends/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from typing import Any
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def default_backend() -> Any:
|
| 11 |
+
from cryptography.hazmat.backends.openssl.backend import backend
|
| 12 |
+
|
| 13 |
+
return backend
|
lib/python3.11/site-packages/cryptography/hazmat/backends/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (580 Bytes). View file
|
|
|
lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__init__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.backends.openssl.backend import backend
|
| 8 |
+
|
| 9 |
+
__all__ = ["backend"]
|
lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (400 Bytes). View file
|
|
|
lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-311.pyc
ADDED
|
Binary file (14.4 kB). View file
|
|
|
lib/python3.11/site-packages/cryptography/hazmat/backends/openssl/backend.py
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.bindings._rust import openssl as rust_openssl
|
| 8 |
+
from cryptography.hazmat.bindings.openssl import binding
|
| 9 |
+
from cryptography.hazmat.primitives import hashes
|
| 10 |
+
from cryptography.hazmat.primitives._asymmetric import AsymmetricPadding
|
| 11 |
+
from cryptography.hazmat.primitives.asymmetric import ec
|
| 12 |
+
from cryptography.hazmat.primitives.asymmetric import utils as asym_utils
|
| 13 |
+
from cryptography.hazmat.primitives.asymmetric.padding import (
|
| 14 |
+
MGF1,
|
| 15 |
+
OAEP,
|
| 16 |
+
PSS,
|
| 17 |
+
PKCS1v15,
|
| 18 |
+
)
|
| 19 |
+
from cryptography.hazmat.primitives.ciphers import (
|
| 20 |
+
CipherAlgorithm,
|
| 21 |
+
)
|
| 22 |
+
from cryptography.hazmat.primitives.ciphers.algorithms import (
|
| 23 |
+
AES,
|
| 24 |
+
)
|
| 25 |
+
from cryptography.hazmat.primitives.ciphers.modes import (
|
| 26 |
+
CBC,
|
| 27 |
+
Mode,
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class Backend:
|
| 32 |
+
"""
|
| 33 |
+
OpenSSL API binding interfaces.
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
name = "openssl"
|
| 37 |
+
|
| 38 |
+
# TripleDES encryption is disallowed/deprecated throughout 2023 in
|
| 39 |
+
# FIPS 140-3. To keep it simple we denylist any use of TripleDES (TDEA).
|
| 40 |
+
_fips_ciphers = (AES,)
|
| 41 |
+
# Sometimes SHA1 is still permissible. That logic is contained
|
| 42 |
+
# within the various *_supported methods.
|
| 43 |
+
_fips_hashes = (
|
| 44 |
+
hashes.SHA224,
|
| 45 |
+
hashes.SHA256,
|
| 46 |
+
hashes.SHA384,
|
| 47 |
+
hashes.SHA512,
|
| 48 |
+
hashes.SHA512_224,
|
| 49 |
+
hashes.SHA512_256,
|
| 50 |
+
hashes.SHA3_224,
|
| 51 |
+
hashes.SHA3_256,
|
| 52 |
+
hashes.SHA3_384,
|
| 53 |
+
hashes.SHA3_512,
|
| 54 |
+
hashes.SHAKE128,
|
| 55 |
+
hashes.SHAKE256,
|
| 56 |
+
)
|
| 57 |
+
_fips_ecdh_curves = (
|
| 58 |
+
ec.SECP224R1,
|
| 59 |
+
ec.SECP256R1,
|
| 60 |
+
ec.SECP384R1,
|
| 61 |
+
ec.SECP521R1,
|
| 62 |
+
)
|
| 63 |
+
_fips_rsa_min_key_size = 2048
|
| 64 |
+
_fips_rsa_min_public_exponent = 65537
|
| 65 |
+
_fips_dsa_min_modulus = 1 << 2048
|
| 66 |
+
_fips_dh_min_key_size = 2048
|
| 67 |
+
_fips_dh_min_modulus = 1 << _fips_dh_min_key_size
|
| 68 |
+
|
| 69 |
+
def __init__(self) -> None:
|
| 70 |
+
self._binding = binding.Binding()
|
| 71 |
+
self._ffi = self._binding.ffi
|
| 72 |
+
self._lib = self._binding.lib
|
| 73 |
+
self._fips_enabled = rust_openssl.is_fips_enabled()
|
| 74 |
+
|
| 75 |
+
def __repr__(self) -> str:
|
| 76 |
+
return (
|
| 77 |
+
f"<OpenSSLBackend(version: {self.openssl_version_text()}, "
|
| 78 |
+
f"FIPS: {self._fips_enabled}, "
|
| 79 |
+
f"Legacy: {rust_openssl._legacy_provider_loaded})>"
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
def openssl_assert(self, ok: bool) -> None:
|
| 83 |
+
return binding._openssl_assert(ok)
|
| 84 |
+
|
| 85 |
+
def _enable_fips(self) -> None:
|
| 86 |
+
# This function enables FIPS mode for OpenSSL 3.0.0 on installs that
|
| 87 |
+
# have the FIPS provider installed properly.
|
| 88 |
+
rust_openssl.enable_fips(rust_openssl._providers)
|
| 89 |
+
assert rust_openssl.is_fips_enabled()
|
| 90 |
+
self._fips_enabled = rust_openssl.is_fips_enabled()
|
| 91 |
+
|
| 92 |
+
def openssl_version_text(self) -> str:
|
| 93 |
+
"""
|
| 94 |
+
Friendly string name of the loaded OpenSSL library. This is not
|
| 95 |
+
necessarily the same version as it was compiled against.
|
| 96 |
+
|
| 97 |
+
Example: OpenSSL 3.2.1 30 Jan 2024
|
| 98 |
+
"""
|
| 99 |
+
return rust_openssl.openssl_version_text()
|
| 100 |
+
|
| 101 |
+
def openssl_version_number(self) -> int:
|
| 102 |
+
return rust_openssl.openssl_version()
|
| 103 |
+
|
| 104 |
+
def hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
|
| 105 |
+
if self._fips_enabled and not isinstance(algorithm, self._fips_hashes):
|
| 106 |
+
return False
|
| 107 |
+
|
| 108 |
+
return rust_openssl.hashes.hash_supported(algorithm)
|
| 109 |
+
|
| 110 |
+
def signature_hash_supported(
|
| 111 |
+
self, algorithm: hashes.HashAlgorithm
|
| 112 |
+
) -> bool:
|
| 113 |
+
# Dedicated check for hashing algorithm use in message digest for
|
| 114 |
+
# signatures, e.g. RSA PKCS#1 v1.5 SHA1 (sha1WithRSAEncryption).
|
| 115 |
+
if self._fips_enabled and isinstance(algorithm, hashes.SHA1):
|
| 116 |
+
return False
|
| 117 |
+
return self.hash_supported(algorithm)
|
| 118 |
+
|
| 119 |
+
def scrypt_supported(self) -> bool:
|
| 120 |
+
if self._fips_enabled:
|
| 121 |
+
return False
|
| 122 |
+
else:
|
| 123 |
+
return hasattr(rust_openssl.kdf.Scrypt, "derive")
|
| 124 |
+
|
| 125 |
+
def argon2_supported(self) -> bool:
|
| 126 |
+
if self._fips_enabled:
|
| 127 |
+
return False
|
| 128 |
+
else:
|
| 129 |
+
return hasattr(rust_openssl.kdf.Argon2id, "derive")
|
| 130 |
+
|
| 131 |
+
def hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
|
| 132 |
+
# FIPS mode still allows SHA1 for HMAC
|
| 133 |
+
if self._fips_enabled and isinstance(algorithm, hashes.SHA1):
|
| 134 |
+
return True
|
| 135 |
+
if rust_openssl.CRYPTOGRAPHY_IS_AWSLC:
|
| 136 |
+
return isinstance(
|
| 137 |
+
algorithm,
|
| 138 |
+
(
|
| 139 |
+
hashes.MD5,
|
| 140 |
+
hashes.SHA1,
|
| 141 |
+
hashes.SHA224,
|
| 142 |
+
hashes.SHA256,
|
| 143 |
+
hashes.SHA384,
|
| 144 |
+
hashes.SHA512,
|
| 145 |
+
hashes.SHA512_224,
|
| 146 |
+
hashes.SHA512_256,
|
| 147 |
+
),
|
| 148 |
+
)
|
| 149 |
+
return self.hash_supported(algorithm)
|
| 150 |
+
|
| 151 |
+
def cipher_supported(self, cipher: CipherAlgorithm, mode: Mode) -> bool:
|
| 152 |
+
if self._fips_enabled:
|
| 153 |
+
# FIPS mode requires AES. TripleDES is disallowed/deprecated in
|
| 154 |
+
# FIPS 140-3.
|
| 155 |
+
if not isinstance(cipher, self._fips_ciphers):
|
| 156 |
+
return False
|
| 157 |
+
|
| 158 |
+
return rust_openssl.ciphers.cipher_supported(cipher, mode)
|
| 159 |
+
|
| 160 |
+
def pbkdf2_hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
|
| 161 |
+
return self.hmac_supported(algorithm)
|
| 162 |
+
|
| 163 |
+
def _consume_errors(self) -> list[rust_openssl.OpenSSLError]:
|
| 164 |
+
return rust_openssl.capture_error_stack()
|
| 165 |
+
|
| 166 |
+
def _oaep_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
|
| 167 |
+
if self._fips_enabled and isinstance(algorithm, hashes.SHA1):
|
| 168 |
+
return False
|
| 169 |
+
|
| 170 |
+
return isinstance(
|
| 171 |
+
algorithm,
|
| 172 |
+
(
|
| 173 |
+
hashes.SHA1,
|
| 174 |
+
hashes.SHA224,
|
| 175 |
+
hashes.SHA256,
|
| 176 |
+
hashes.SHA384,
|
| 177 |
+
hashes.SHA512,
|
| 178 |
+
),
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
def rsa_padding_supported(self, padding: AsymmetricPadding) -> bool:
|
| 182 |
+
if isinstance(padding, PKCS1v15):
|
| 183 |
+
return True
|
| 184 |
+
elif isinstance(padding, PSS) and isinstance(padding._mgf, MGF1):
|
| 185 |
+
# FIPS 186-4 only allows salt length == digest length for PSS
|
| 186 |
+
# It is technically acceptable to set an explicit salt length
|
| 187 |
+
# equal to the digest length and this will incorrectly fail, but
|
| 188 |
+
# since we don't do that in the tests and this method is
|
| 189 |
+
# private, we'll ignore that until we need to do otherwise.
|
| 190 |
+
if (
|
| 191 |
+
self._fips_enabled
|
| 192 |
+
and padding._salt_length != PSS.DIGEST_LENGTH
|
| 193 |
+
):
|
| 194 |
+
return False
|
| 195 |
+
return self.hash_supported(padding._mgf._algorithm)
|
| 196 |
+
elif isinstance(padding, OAEP) and isinstance(padding._mgf, MGF1):
|
| 197 |
+
return self._oaep_hash_supported(
|
| 198 |
+
padding._mgf._algorithm
|
| 199 |
+
) and self._oaep_hash_supported(padding._algorithm)
|
| 200 |
+
else:
|
| 201 |
+
return False
|
| 202 |
+
|
| 203 |
+
def rsa_encryption_supported(self, padding: AsymmetricPadding) -> bool:
|
| 204 |
+
if self._fips_enabled and isinstance(padding, PKCS1v15):
|
| 205 |
+
return False
|
| 206 |
+
else:
|
| 207 |
+
return self.rsa_padding_supported(padding)
|
| 208 |
+
|
| 209 |
+
def dsa_supported(self) -> bool:
|
| 210 |
+
return (
|
| 211 |
+
not rust_openssl.CRYPTOGRAPHY_IS_BORINGSSL
|
| 212 |
+
and not self._fips_enabled
|
| 213 |
+
)
|
| 214 |
+
|
| 215 |
+
def dsa_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
|
| 216 |
+
if not self.dsa_supported():
|
| 217 |
+
return False
|
| 218 |
+
return self.signature_hash_supported(algorithm)
|
| 219 |
+
|
| 220 |
+
def cmac_algorithm_supported(self, algorithm) -> bool:
|
| 221 |
+
return self.cipher_supported(
|
| 222 |
+
algorithm, CBC(b"\x00" * algorithm.block_size)
|
| 223 |
+
)
|
| 224 |
+
|
| 225 |
+
def elliptic_curve_supported(self, curve: ec.EllipticCurve) -> bool:
|
| 226 |
+
if self._fips_enabled and not isinstance(
|
| 227 |
+
curve, self._fips_ecdh_curves
|
| 228 |
+
):
|
| 229 |
+
return False
|
| 230 |
+
|
| 231 |
+
return rust_openssl.ec.curve_supported(curve)
|
| 232 |
+
|
| 233 |
+
def elliptic_curve_signature_algorithm_supported(
|
| 234 |
+
self,
|
| 235 |
+
signature_algorithm: ec.EllipticCurveSignatureAlgorithm,
|
| 236 |
+
curve: ec.EllipticCurve,
|
| 237 |
+
) -> bool:
|
| 238 |
+
# We only support ECDSA right now.
|
| 239 |
+
if not isinstance(signature_algorithm, ec.ECDSA):
|
| 240 |
+
return False
|
| 241 |
+
|
| 242 |
+
return self.elliptic_curve_supported(curve) and (
|
| 243 |
+
isinstance(signature_algorithm.algorithm, asym_utils.Prehashed)
|
| 244 |
+
or self.hash_supported(signature_algorithm.algorithm)
|
| 245 |
+
)
|
| 246 |
+
|
| 247 |
+
def elliptic_curve_exchange_algorithm_supported(
|
| 248 |
+
self, algorithm: ec.ECDH, curve: ec.EllipticCurve
|
| 249 |
+
) -> bool:
|
| 250 |
+
return self.elliptic_curve_supported(curve) and isinstance(
|
| 251 |
+
algorithm, ec.ECDH
|
| 252 |
+
)
|
| 253 |
+
|
| 254 |
+
def dh_supported(self) -> bool:
|
| 255 |
+
return (
|
| 256 |
+
not rust_openssl.CRYPTOGRAPHY_IS_BORINGSSL
|
| 257 |
+
and not rust_openssl.CRYPTOGRAPHY_IS_AWSLC
|
| 258 |
+
)
|
| 259 |
+
|
| 260 |
+
def dh_x942_serialization_supported(self) -> bool:
|
| 261 |
+
return self._lib.Cryptography_HAS_EVP_PKEY_DHX == 1
|
| 262 |
+
|
| 263 |
+
def x25519_supported(self) -> bool:
|
| 264 |
+
return not self._fips_enabled
|
| 265 |
+
|
| 266 |
+
def x448_supported(self) -> bool:
|
| 267 |
+
if self._fips_enabled:
|
| 268 |
+
return False
|
| 269 |
+
return (
|
| 270 |
+
not rust_openssl.CRYPTOGRAPHY_IS_LIBRESSL
|
| 271 |
+
and not rust_openssl.CRYPTOGRAPHY_IS_BORINGSSL
|
| 272 |
+
and not rust_openssl.CRYPTOGRAPHY_IS_AWSLC
|
| 273 |
+
)
|
| 274 |
+
|
| 275 |
+
def mlkem_supported(self) -> bool:
|
| 276 |
+
return (
|
| 277 |
+
rust_openssl.CRYPTOGRAPHY_IS_AWSLC
|
| 278 |
+
or rust_openssl.CRYPTOGRAPHY_IS_BORINGSSL
|
| 279 |
+
or rust_openssl.CRYPTOGRAPHY_OPENSSL_350_OR_GREATER
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
def mldsa_supported(self) -> bool:
|
| 283 |
+
return (
|
| 284 |
+
rust_openssl.CRYPTOGRAPHY_IS_AWSLC
|
| 285 |
+
or rust_openssl.CRYPTOGRAPHY_IS_BORINGSSL
|
| 286 |
+
or rust_openssl.CRYPTOGRAPHY_OPENSSL_350_OR_GREATER
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
def ed25519_supported(self) -> bool:
|
| 290 |
+
return True
|
| 291 |
+
|
| 292 |
+
def ed448_supported(self) -> bool:
|
| 293 |
+
return (
|
| 294 |
+
not rust_openssl.CRYPTOGRAPHY_IS_LIBRESSL
|
| 295 |
+
and not rust_openssl.CRYPTOGRAPHY_IS_BORINGSSL
|
| 296 |
+
and not rust_openssl.CRYPTOGRAPHY_IS_AWSLC
|
| 297 |
+
)
|
| 298 |
+
|
| 299 |
+
def ecdsa_deterministic_supported(self) -> bool:
|
| 300 |
+
return (
|
| 301 |
+
rust_openssl.CRYPTOGRAPHY_OPENSSL_320_OR_GREATER
|
| 302 |
+
and not self._fips_enabled
|
| 303 |
+
)
|
| 304 |
+
|
| 305 |
+
def poly1305_supported(self) -> bool:
|
| 306 |
+
return not self._fips_enabled
|
| 307 |
+
|
| 308 |
+
def pkcs7_supported(self) -> bool:
|
| 309 |
+
return True
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
backend = Backend()
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.primitives import padding
|
| 8 |
+
from cryptography.hazmat.primitives._serialization import (
|
| 9 |
+
KeySerializationEncryptionBuilder,
|
| 10 |
+
)
|
| 11 |
+
from cryptography.utils import Buffer
|
| 12 |
+
|
| 13 |
+
class PKCS7PaddingContext(padding.PaddingContext):
|
| 14 |
+
def __init__(self, block_size: int) -> None: ...
|
| 15 |
+
def update(self, data: Buffer) -> bytes: ...
|
| 16 |
+
def finalize(self) -> bytes: ...
|
| 17 |
+
|
| 18 |
+
class ANSIX923PaddingContext(padding.PaddingContext):
|
| 19 |
+
def __init__(self, block_size: int) -> None: ...
|
| 20 |
+
def update(self, data: Buffer) -> bytes: ...
|
| 21 |
+
def finalize(self) -> bytes: ...
|
| 22 |
+
|
| 23 |
+
class PKCS7UnpaddingContext(padding.PaddingContext):
|
| 24 |
+
def __init__(self, block_size: int) -> None: ...
|
| 25 |
+
def update(self, data: Buffer) -> bytes: ...
|
| 26 |
+
def finalize(self) -> bytes: ...
|
| 27 |
+
|
| 28 |
+
class ANSIX923UnpaddingContext(padding.PaddingContext):
|
| 29 |
+
def __init__(self, block_size: int) -> None: ...
|
| 30 |
+
def update(self, data: Buffer) -> bytes: ...
|
| 31 |
+
def finalize(self) -> bytes: ...
|
| 32 |
+
|
| 33 |
+
class Encoding:
|
| 34 |
+
PEM: typing.ClassVar[Encoding]
|
| 35 |
+
DER: typing.ClassVar[Encoding]
|
| 36 |
+
OpenSSH: typing.ClassVar[Encoding]
|
| 37 |
+
Raw: typing.ClassVar[Encoding]
|
| 38 |
+
X962: typing.ClassVar[Encoding]
|
| 39 |
+
SMIME: typing.ClassVar[Encoding]
|
| 40 |
+
|
| 41 |
+
class PrivateFormat:
|
| 42 |
+
PKCS8: typing.ClassVar[PrivateFormat]
|
| 43 |
+
TraditionalOpenSSL: typing.ClassVar[PrivateFormat]
|
| 44 |
+
Raw: typing.ClassVar[PrivateFormat]
|
| 45 |
+
OpenSSH: typing.ClassVar[PrivateFormat]
|
| 46 |
+
PKCS12: typing.ClassVar[PrivateFormat]
|
| 47 |
+
def encryption_builder(self) -> KeySerializationEncryptionBuilder: ...
|
| 48 |
+
|
| 49 |
+
class PublicFormat:
|
| 50 |
+
SubjectPublicKeyInfo: typing.ClassVar[PublicFormat]
|
| 51 |
+
PKCS1: typing.ClassVar[PublicFormat]
|
| 52 |
+
OpenSSH: typing.ClassVar[PublicFormat]
|
| 53 |
+
Raw: typing.ClassVar[PublicFormat]
|
| 54 |
+
CompressedPoint: typing.ClassVar[PublicFormat]
|
| 55 |
+
UncompressedPoint: typing.ClassVar[PublicFormat]
|
| 56 |
+
|
| 57 |
+
class ParameterFormat:
|
| 58 |
+
PKCS3: typing.ClassVar[ParameterFormat]
|
| 59 |
+
|
| 60 |
+
class ObjectIdentifier:
|
| 61 |
+
def __init__(self, value: str) -> None: ...
|
| 62 |
+
@property
|
| 63 |
+
def dotted_string(self) -> str: ...
|
| 64 |
+
@property
|
| 65 |
+
def _name(self) -> str: ...
|
| 66 |
+
|
| 67 |
+
T = typing.TypeVar("T")
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
lib: typing.Any
|
| 8 |
+
ffi: typing.Any
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
def decode_dss_signature(signature: bytes) -> tuple[int, int]: ...
|
| 6 |
+
def encode_dss_signature(r: int, s: int) -> bytes: ...
|
| 7 |
+
def parse_spki_for_data(data: bytes) -> bytes: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/declarative_asn1.pyi
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import datetime
|
| 6 |
+
import typing
|
| 7 |
+
|
| 8 |
+
def decode_der(cls: type, value: bytes) -> typing.Any: ...
|
| 9 |
+
def encode_der(value: typing.Any) -> bytes: ...
|
| 10 |
+
def non_root_python_to_rust(cls: type) -> Type: ...
|
| 11 |
+
|
| 12 |
+
# Type is a Rust enum with tuple variants. For now, we express the type
|
| 13 |
+
# annotations like this:
|
| 14 |
+
class Type:
|
| 15 |
+
Sequence: typing.ClassVar[type]
|
| 16 |
+
SequenceOf: typing.ClassVar[type]
|
| 17 |
+
Set: typing.ClassVar[type]
|
| 18 |
+
SetOf: typing.ClassVar[type]
|
| 19 |
+
Option: typing.ClassVar[type]
|
| 20 |
+
Choice: typing.ClassVar[type]
|
| 21 |
+
PyBool: typing.ClassVar[type]
|
| 22 |
+
PyInt: typing.ClassVar[type]
|
| 23 |
+
PyBytes: typing.ClassVar[type]
|
| 24 |
+
PyStr: typing.ClassVar[type]
|
| 25 |
+
|
| 26 |
+
class Annotation:
|
| 27 |
+
default: typing.Any | None
|
| 28 |
+
encoding: Encoding | None
|
| 29 |
+
size: Size | None
|
| 30 |
+
def __new__(
|
| 31 |
+
cls,
|
| 32 |
+
default: typing.Any | None = None,
|
| 33 |
+
encoding: Encoding | None = None,
|
| 34 |
+
size: Size | None = None,
|
| 35 |
+
) -> Annotation: ...
|
| 36 |
+
def is_empty(self) -> bool: ...
|
| 37 |
+
|
| 38 |
+
# Encoding is a Rust enum with tuple variants. For now, we express the type
|
| 39 |
+
# annotations like this:
|
| 40 |
+
class Encoding:
|
| 41 |
+
Implicit: typing.ClassVar[type]
|
| 42 |
+
Explicit: typing.ClassVar[type]
|
| 43 |
+
|
| 44 |
+
class Size:
|
| 45 |
+
min: int
|
| 46 |
+
max: int | None
|
| 47 |
+
|
| 48 |
+
def __new__(cls, min: int, max: int | None) -> Size: ...
|
| 49 |
+
@staticmethod
|
| 50 |
+
def exact(n: int) -> Size: ...
|
| 51 |
+
|
| 52 |
+
class AnnotatedType:
|
| 53 |
+
inner: Type
|
| 54 |
+
annotation: Annotation
|
| 55 |
+
|
| 56 |
+
def __new__(cls, inner: Type, annotation: Annotation) -> AnnotatedType: ...
|
| 57 |
+
|
| 58 |
+
class AnnotatedTypeObject:
|
| 59 |
+
annotated_type: AnnotatedType
|
| 60 |
+
value: typing.Any
|
| 61 |
+
|
| 62 |
+
def __new__(
|
| 63 |
+
cls, annotated_type: AnnotatedType, value: typing.Any
|
| 64 |
+
) -> AnnotatedTypeObject: ...
|
| 65 |
+
|
| 66 |
+
class Variant:
|
| 67 |
+
python_class: type
|
| 68 |
+
ann_type: AnnotatedType
|
| 69 |
+
tag_name: str | None
|
| 70 |
+
|
| 71 |
+
def __new__(
|
| 72 |
+
cls,
|
| 73 |
+
python_class: type,
|
| 74 |
+
ann_type: AnnotatedType,
|
| 75 |
+
tag_name: str | None,
|
| 76 |
+
) -> Variant: ...
|
| 77 |
+
|
| 78 |
+
class PrintableString:
|
| 79 |
+
def __new__(cls, inner: str) -> PrintableString: ...
|
| 80 |
+
def __repr__(self) -> str: ...
|
| 81 |
+
def __eq__(self, other: object) -> bool: ...
|
| 82 |
+
def as_str(self) -> str: ...
|
| 83 |
+
|
| 84 |
+
class IA5String:
|
| 85 |
+
def __new__(cls, inner: str) -> IA5String: ...
|
| 86 |
+
def __repr__(self) -> str: ...
|
| 87 |
+
def __eq__(self, other: object) -> bool: ...
|
| 88 |
+
def as_str(self) -> str: ...
|
| 89 |
+
|
| 90 |
+
class UTCTime:
|
| 91 |
+
def __new__(cls, inner: datetime.datetime) -> UTCTime: ...
|
| 92 |
+
def __repr__(self) -> str: ...
|
| 93 |
+
def __eq__(self, other: object) -> bool: ...
|
| 94 |
+
def as_datetime(self) -> datetime.datetime: ...
|
| 95 |
+
|
| 96 |
+
class GeneralizedTime:
|
| 97 |
+
def __new__(cls, inner: datetime.datetime) -> GeneralizedTime: ...
|
| 98 |
+
def __repr__(self) -> str: ...
|
| 99 |
+
def __eq__(self, other: object) -> bool: ...
|
| 100 |
+
def as_datetime(self) -> datetime.datetime: ...
|
| 101 |
+
|
| 102 |
+
class BitString:
|
| 103 |
+
def __new__(cls, data: bytes, padding_bits: int) -> BitString: ...
|
| 104 |
+
def __repr__(self) -> str: ...
|
| 105 |
+
def __eq__(self, other: object) -> bool: ...
|
| 106 |
+
def as_bytes(self) -> bytes: ...
|
| 107 |
+
def padding_bits(self) -> int: ...
|
| 108 |
+
|
| 109 |
+
class Tlv:
|
| 110 |
+
@property
|
| 111 |
+
def tag_bytes(self) -> bytes: ...
|
| 112 |
+
@property
|
| 113 |
+
def data(self) -> memoryview: ...
|
| 114 |
+
def parse(self, cls: type): ...
|
| 115 |
+
|
| 116 |
+
T = typing.TypeVar("T")
|
| 117 |
+
|
| 118 |
+
class SetOf(typing.Generic[T]):
|
| 119 |
+
def __new__(cls, inner: list[T]) -> SetOf[T]: ...
|
| 120 |
+
def as_list(self) -> list[T]: ...
|
| 121 |
+
def __eq__(self, other: object) -> bool: ...
|
| 122 |
+
def __repr__(self) -> str: ...
|
| 123 |
+
|
| 124 |
+
class Null:
|
| 125 |
+
def __new__(cls) -> Null: ...
|
| 126 |
+
def __repr__(self) -> str: ...
|
| 127 |
+
def __eq__(self, other: object) -> bool: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
class _Reasons:
|
| 6 |
+
BACKEND_MISSING_INTERFACE: _Reasons
|
| 7 |
+
UNSUPPORTED_HASH: _Reasons
|
| 8 |
+
UNSUPPORTED_CIPHER: _Reasons
|
| 9 |
+
UNSUPPORTED_PADDING: _Reasons
|
| 10 |
+
UNSUPPORTED_MGF: _Reasons
|
| 11 |
+
UNSUPPORTED_PUBLIC_KEY_ALGORITHM: _Reasons
|
| 12 |
+
UNSUPPORTED_ELLIPTIC_CURVE: _Reasons
|
| 13 |
+
UNSUPPORTED_SERIALIZATION: _Reasons
|
| 14 |
+
UNSUPPORTED_X509: _Reasons
|
| 15 |
+
UNSUPPORTED_EXCHANGE_ALGORITHM: _Reasons
|
| 16 |
+
UNSUPPORTED_DIFFIE_HELLMAN: _Reasons
|
| 17 |
+
UNSUPPORTED_MAC: _Reasons
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import datetime
|
| 6 |
+
from collections.abc import Iterator
|
| 7 |
+
|
| 8 |
+
from cryptography import x509
|
| 9 |
+
from cryptography.hazmat.primitives import hashes, serialization
|
| 10 |
+
from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
|
| 11 |
+
from cryptography.x509 import ocsp
|
| 12 |
+
|
| 13 |
+
class OCSPRequest:
|
| 14 |
+
@property
|
| 15 |
+
def issuer_key_hash(self) -> bytes: ...
|
| 16 |
+
@property
|
| 17 |
+
def issuer_name_hash(self) -> bytes: ...
|
| 18 |
+
@property
|
| 19 |
+
def hash_algorithm(self) -> hashes.HashAlgorithm: ...
|
| 20 |
+
@property
|
| 21 |
+
def serial_number(self) -> int: ...
|
| 22 |
+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
|
| 23 |
+
@property
|
| 24 |
+
def extensions(self) -> x509.Extensions: ...
|
| 25 |
+
|
| 26 |
+
class OCSPResponse:
|
| 27 |
+
@property
|
| 28 |
+
def responses(self) -> Iterator[OCSPSingleResponse]: ...
|
| 29 |
+
@property
|
| 30 |
+
def response_status(self) -> ocsp.OCSPResponseStatus: ...
|
| 31 |
+
@property
|
| 32 |
+
def signature_algorithm_oid(self) -> x509.ObjectIdentifier: ...
|
| 33 |
+
@property
|
| 34 |
+
def signature_hash_algorithm(
|
| 35 |
+
self,
|
| 36 |
+
) -> hashes.HashAlgorithm | None: ...
|
| 37 |
+
@property
|
| 38 |
+
def signature(self) -> bytes: ...
|
| 39 |
+
@property
|
| 40 |
+
def tbs_response_bytes(self) -> bytes: ...
|
| 41 |
+
@property
|
| 42 |
+
def certificates(self) -> list[x509.Certificate]: ...
|
| 43 |
+
@property
|
| 44 |
+
def responder_key_hash(self) -> bytes | None: ...
|
| 45 |
+
@property
|
| 46 |
+
def responder_name(self) -> x509.Name | None: ...
|
| 47 |
+
@property
|
| 48 |
+
def produced_at(self) -> datetime.datetime: ...
|
| 49 |
+
@property
|
| 50 |
+
def produced_at_utc(self) -> datetime.datetime: ...
|
| 51 |
+
@property
|
| 52 |
+
def certificate_status(self) -> ocsp.OCSPCertStatus: ...
|
| 53 |
+
@property
|
| 54 |
+
def revocation_time(self) -> datetime.datetime | None: ...
|
| 55 |
+
@property
|
| 56 |
+
def revocation_time_utc(self) -> datetime.datetime | None: ...
|
| 57 |
+
@property
|
| 58 |
+
def revocation_reason(self) -> x509.ReasonFlags | None: ...
|
| 59 |
+
@property
|
| 60 |
+
def this_update(self) -> datetime.datetime: ...
|
| 61 |
+
@property
|
| 62 |
+
def this_update_utc(self) -> datetime.datetime: ...
|
| 63 |
+
@property
|
| 64 |
+
def next_update(self) -> datetime.datetime | None: ...
|
| 65 |
+
@property
|
| 66 |
+
def next_update_utc(self) -> datetime.datetime | None: ...
|
| 67 |
+
@property
|
| 68 |
+
def issuer_key_hash(self) -> bytes: ...
|
| 69 |
+
@property
|
| 70 |
+
def issuer_name_hash(self) -> bytes: ...
|
| 71 |
+
@property
|
| 72 |
+
def hash_algorithm(self) -> hashes.HashAlgorithm: ...
|
| 73 |
+
@property
|
| 74 |
+
def serial_number(self) -> int: ...
|
| 75 |
+
@property
|
| 76 |
+
def extensions(self) -> x509.Extensions: ...
|
| 77 |
+
@property
|
| 78 |
+
def single_extensions(self) -> x509.Extensions: ...
|
| 79 |
+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
|
| 80 |
+
|
| 81 |
+
class OCSPSingleResponse:
|
| 82 |
+
@property
|
| 83 |
+
def certificate_status(self) -> ocsp.OCSPCertStatus: ...
|
| 84 |
+
@property
|
| 85 |
+
def revocation_time(self) -> datetime.datetime | None: ...
|
| 86 |
+
@property
|
| 87 |
+
def revocation_time_utc(self) -> datetime.datetime | None: ...
|
| 88 |
+
@property
|
| 89 |
+
def revocation_reason(self) -> x509.ReasonFlags | None: ...
|
| 90 |
+
@property
|
| 91 |
+
def this_update(self) -> datetime.datetime: ...
|
| 92 |
+
@property
|
| 93 |
+
def this_update_utc(self) -> datetime.datetime: ...
|
| 94 |
+
@property
|
| 95 |
+
def next_update(self) -> datetime.datetime | None: ...
|
| 96 |
+
@property
|
| 97 |
+
def next_update_utc(self) -> datetime.datetime | None: ...
|
| 98 |
+
@property
|
| 99 |
+
def issuer_key_hash(self) -> bytes: ...
|
| 100 |
+
@property
|
| 101 |
+
def issuer_name_hash(self) -> bytes: ...
|
| 102 |
+
@property
|
| 103 |
+
def hash_algorithm(self) -> hashes.HashAlgorithm: ...
|
| 104 |
+
@property
|
| 105 |
+
def serial_number(self) -> int: ...
|
| 106 |
+
|
| 107 |
+
def load_der_ocsp_request(data: bytes) -> ocsp.OCSPRequest: ...
|
| 108 |
+
def load_der_ocsp_response(data: bytes) -> ocsp.OCSPResponse: ...
|
| 109 |
+
def create_ocsp_request(
|
| 110 |
+
builder: ocsp.OCSPRequestBuilder,
|
| 111 |
+
) -> ocsp.OCSPRequest: ...
|
| 112 |
+
def create_ocsp_response(
|
| 113 |
+
status: ocsp.OCSPResponseStatus,
|
| 114 |
+
builder: ocsp.OCSPResponseBuilder | None,
|
| 115 |
+
private_key: PrivateKeyTypes | None,
|
| 116 |
+
hash_algorithm: hashes.HashAlgorithm | None,
|
| 117 |
+
) -> ocsp.OCSPResponse: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.bindings._rust.openssl import (
|
| 8 |
+
aead,
|
| 9 |
+
ciphers,
|
| 10 |
+
cmac,
|
| 11 |
+
dh,
|
| 12 |
+
dsa,
|
| 13 |
+
ec,
|
| 14 |
+
ed448,
|
| 15 |
+
ed25519,
|
| 16 |
+
hashes,
|
| 17 |
+
hmac,
|
| 18 |
+
hpke,
|
| 19 |
+
kdf,
|
| 20 |
+
keys,
|
| 21 |
+
mldsa,
|
| 22 |
+
mlkem,
|
| 23 |
+
poly1305,
|
| 24 |
+
rsa,
|
| 25 |
+
x448,
|
| 26 |
+
x25519,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
__all__ = [
|
| 30 |
+
"aead",
|
| 31 |
+
"ciphers",
|
| 32 |
+
"cmac",
|
| 33 |
+
"dh",
|
| 34 |
+
"dsa",
|
| 35 |
+
"ec",
|
| 36 |
+
"ed448",
|
| 37 |
+
"ed25519",
|
| 38 |
+
"hashes",
|
| 39 |
+
"hmac",
|
| 40 |
+
"hpke",
|
| 41 |
+
"kdf",
|
| 42 |
+
"keys",
|
| 43 |
+
"mldsa",
|
| 44 |
+
"mlkem",
|
| 45 |
+
"openssl_version",
|
| 46 |
+
"openssl_version_text",
|
| 47 |
+
"poly1305",
|
| 48 |
+
"raise_openssl_error",
|
| 49 |
+
"rsa",
|
| 50 |
+
"x448",
|
| 51 |
+
"x25519",
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
+
CRYPTOGRAPHY_IS_LIBRESSL: bool
|
| 55 |
+
CRYPTOGRAPHY_IS_BORINGSSL: bool
|
| 56 |
+
CRYPTOGRAPHY_IS_AWSLC: bool
|
| 57 |
+
CRYPTOGRAPHY_OPENSSL_309_OR_GREATER: bool
|
| 58 |
+
CRYPTOGRAPHY_OPENSSL_320_OR_GREATER: bool
|
| 59 |
+
CRYPTOGRAPHY_OPENSSL_330_OR_GREATER: bool
|
| 60 |
+
CRYPTOGRAPHY_OPENSSL_350_OR_GREATER: bool
|
| 61 |
+
|
| 62 |
+
class Providers: ...
|
| 63 |
+
|
| 64 |
+
_legacy_provider_loaded: bool
|
| 65 |
+
_providers: Providers
|
| 66 |
+
|
| 67 |
+
def openssl_version() -> int: ...
|
| 68 |
+
def openssl_version_text() -> str: ...
|
| 69 |
+
def raise_openssl_error() -> typing.NoReturn: ...
|
| 70 |
+
def capture_error_stack() -> list[OpenSSLError]: ...
|
| 71 |
+
def is_fips_enabled() -> bool: ...
|
| 72 |
+
def enable_fips(providers: Providers) -> None: ...
|
| 73 |
+
|
| 74 |
+
class OpenSSLError:
|
| 75 |
+
@property
|
| 76 |
+
def lib(self) -> int: ...
|
| 77 |
+
@property
|
| 78 |
+
def reason(self) -> int: ...
|
| 79 |
+
@property
|
| 80 |
+
def reason_text(self) -> bytes: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/aead.pyi
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from collections.abc import Sequence
|
| 6 |
+
|
| 7 |
+
from cryptography.utils import Buffer
|
| 8 |
+
|
| 9 |
+
class AESGCM:
|
| 10 |
+
def __init__(self, key: Buffer) -> None: ...
|
| 11 |
+
@staticmethod
|
| 12 |
+
def generate_key(bit_length: int) -> bytes: ...
|
| 13 |
+
def encrypt(
|
| 14 |
+
self,
|
| 15 |
+
nonce: Buffer,
|
| 16 |
+
data: Buffer,
|
| 17 |
+
associated_data: Buffer | None,
|
| 18 |
+
) -> bytes: ...
|
| 19 |
+
def decrypt(
|
| 20 |
+
self,
|
| 21 |
+
nonce: Buffer,
|
| 22 |
+
data: Buffer,
|
| 23 |
+
associated_data: Buffer | None,
|
| 24 |
+
) -> bytes: ...
|
| 25 |
+
def encrypt_into(
|
| 26 |
+
self,
|
| 27 |
+
nonce: Buffer,
|
| 28 |
+
data: Buffer,
|
| 29 |
+
associated_data: Buffer | None,
|
| 30 |
+
buf: Buffer,
|
| 31 |
+
) -> int: ...
|
| 32 |
+
def decrypt_into(
|
| 33 |
+
self,
|
| 34 |
+
nonce: Buffer,
|
| 35 |
+
data: Buffer,
|
| 36 |
+
associated_data: Buffer | None,
|
| 37 |
+
buf: Buffer,
|
| 38 |
+
) -> int: ...
|
| 39 |
+
|
| 40 |
+
class ChaCha20Poly1305:
|
| 41 |
+
def __init__(self, key: Buffer) -> None: ...
|
| 42 |
+
@staticmethod
|
| 43 |
+
def generate_key() -> bytes: ...
|
| 44 |
+
def encrypt(
|
| 45 |
+
self,
|
| 46 |
+
nonce: Buffer,
|
| 47 |
+
data: Buffer,
|
| 48 |
+
associated_data: Buffer | None,
|
| 49 |
+
) -> bytes: ...
|
| 50 |
+
def encrypt_into(
|
| 51 |
+
self,
|
| 52 |
+
nonce: Buffer,
|
| 53 |
+
data: Buffer,
|
| 54 |
+
associated_data: Buffer | None,
|
| 55 |
+
buf: Buffer,
|
| 56 |
+
) -> int: ...
|
| 57 |
+
def decrypt(
|
| 58 |
+
self,
|
| 59 |
+
nonce: Buffer,
|
| 60 |
+
data: Buffer,
|
| 61 |
+
associated_data: Buffer | None,
|
| 62 |
+
) -> bytes: ...
|
| 63 |
+
def decrypt_into(
|
| 64 |
+
self,
|
| 65 |
+
nonce: Buffer,
|
| 66 |
+
data: Buffer,
|
| 67 |
+
associated_data: Buffer | None,
|
| 68 |
+
buf: Buffer,
|
| 69 |
+
) -> int: ...
|
| 70 |
+
|
| 71 |
+
class AESCCM:
|
| 72 |
+
def __init__(self, key: Buffer, tag_length: int = 16) -> None: ...
|
| 73 |
+
@staticmethod
|
| 74 |
+
def generate_key(bit_length: int) -> bytes: ...
|
| 75 |
+
def encrypt(
|
| 76 |
+
self,
|
| 77 |
+
nonce: Buffer,
|
| 78 |
+
data: Buffer,
|
| 79 |
+
associated_data: Buffer | None,
|
| 80 |
+
) -> bytes: ...
|
| 81 |
+
def encrypt_into(
|
| 82 |
+
self,
|
| 83 |
+
nonce: Buffer,
|
| 84 |
+
data: Buffer,
|
| 85 |
+
associated_data: Buffer | None,
|
| 86 |
+
buf: Buffer,
|
| 87 |
+
) -> int: ...
|
| 88 |
+
def decrypt(
|
| 89 |
+
self,
|
| 90 |
+
nonce: Buffer,
|
| 91 |
+
data: Buffer,
|
| 92 |
+
associated_data: Buffer | None,
|
| 93 |
+
) -> bytes: ...
|
| 94 |
+
def decrypt_into(
|
| 95 |
+
self,
|
| 96 |
+
nonce: Buffer,
|
| 97 |
+
data: Buffer,
|
| 98 |
+
associated_data: Buffer | None,
|
| 99 |
+
buf: Buffer,
|
| 100 |
+
) -> int: ...
|
| 101 |
+
|
| 102 |
+
class AESSIV:
|
| 103 |
+
def __init__(self, key: Buffer) -> None: ...
|
| 104 |
+
@staticmethod
|
| 105 |
+
def generate_key(bit_length: int) -> bytes: ...
|
| 106 |
+
def encrypt(
|
| 107 |
+
self,
|
| 108 |
+
data: Buffer,
|
| 109 |
+
associated_data: Sequence[Buffer] | None,
|
| 110 |
+
) -> bytes: ...
|
| 111 |
+
def encrypt_into(
|
| 112 |
+
self,
|
| 113 |
+
data: Buffer,
|
| 114 |
+
associated_data: Sequence[Buffer] | None,
|
| 115 |
+
buf: Buffer,
|
| 116 |
+
) -> int: ...
|
| 117 |
+
def decrypt(
|
| 118 |
+
self,
|
| 119 |
+
data: Buffer,
|
| 120 |
+
associated_data: Sequence[Buffer] | None,
|
| 121 |
+
) -> bytes: ...
|
| 122 |
+
def decrypt_into(
|
| 123 |
+
self,
|
| 124 |
+
data: Buffer,
|
| 125 |
+
associated_data: Sequence[Buffer] | None,
|
| 126 |
+
buf: Buffer,
|
| 127 |
+
) -> int: ...
|
| 128 |
+
|
| 129 |
+
class AESOCB3:
|
| 130 |
+
def __init__(self, key: Buffer) -> None: ...
|
| 131 |
+
@staticmethod
|
| 132 |
+
def generate_key(bit_length: int) -> bytes: ...
|
| 133 |
+
def encrypt(
|
| 134 |
+
self,
|
| 135 |
+
nonce: Buffer,
|
| 136 |
+
data: Buffer,
|
| 137 |
+
associated_data: Buffer | None,
|
| 138 |
+
) -> bytes: ...
|
| 139 |
+
def encrypt_into(
|
| 140 |
+
self,
|
| 141 |
+
nonce: Buffer,
|
| 142 |
+
data: Buffer,
|
| 143 |
+
associated_data: Buffer | None,
|
| 144 |
+
buf: Buffer,
|
| 145 |
+
) -> int: ...
|
| 146 |
+
def decrypt(
|
| 147 |
+
self,
|
| 148 |
+
nonce: Buffer,
|
| 149 |
+
data: Buffer,
|
| 150 |
+
associated_data: Buffer | None,
|
| 151 |
+
) -> bytes: ...
|
| 152 |
+
def decrypt_into(
|
| 153 |
+
self,
|
| 154 |
+
nonce: Buffer,
|
| 155 |
+
data: Buffer,
|
| 156 |
+
associated_data: Buffer | None,
|
| 157 |
+
buf: Buffer,
|
| 158 |
+
) -> int: ...
|
| 159 |
+
|
| 160 |
+
class AESGCMSIV:
|
| 161 |
+
def __init__(self, key: Buffer) -> None: ...
|
| 162 |
+
@staticmethod
|
| 163 |
+
def generate_key(bit_length: int) -> bytes: ...
|
| 164 |
+
def encrypt(
|
| 165 |
+
self,
|
| 166 |
+
nonce: Buffer,
|
| 167 |
+
data: Buffer,
|
| 168 |
+
associated_data: Buffer | None,
|
| 169 |
+
) -> bytes: ...
|
| 170 |
+
def encrypt_into(
|
| 171 |
+
self,
|
| 172 |
+
nonce: Buffer,
|
| 173 |
+
data: Buffer,
|
| 174 |
+
associated_data: Buffer | None,
|
| 175 |
+
buf: Buffer,
|
| 176 |
+
) -> int: ...
|
| 177 |
+
def decrypt(
|
| 178 |
+
self,
|
| 179 |
+
nonce: Buffer,
|
| 180 |
+
data: Buffer,
|
| 181 |
+
associated_data: Buffer | None,
|
| 182 |
+
) -> bytes: ...
|
| 183 |
+
def decrypt_into(
|
| 184 |
+
self,
|
| 185 |
+
nonce: Buffer,
|
| 186 |
+
data: Buffer,
|
| 187 |
+
associated_data: Buffer | None,
|
| 188 |
+
buf: Buffer,
|
| 189 |
+
) -> int: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ciphers.pyi
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.primitives import ciphers
|
| 8 |
+
from cryptography.hazmat.primitives.ciphers import modes
|
| 9 |
+
|
| 10 |
+
@typing.overload
|
| 11 |
+
def create_encryption_ctx(
|
| 12 |
+
algorithm: ciphers.CipherAlgorithm, mode: modes.ModeWithAuthenticationTag
|
| 13 |
+
) -> ciphers.AEADEncryptionContext: ...
|
| 14 |
+
@typing.overload
|
| 15 |
+
def create_encryption_ctx(
|
| 16 |
+
algorithm: ciphers.CipherAlgorithm, mode: modes.Mode | None
|
| 17 |
+
) -> ciphers.CipherContext: ...
|
| 18 |
+
@typing.overload
|
| 19 |
+
def create_decryption_ctx(
|
| 20 |
+
algorithm: ciphers.CipherAlgorithm, mode: modes.ModeWithAuthenticationTag
|
| 21 |
+
) -> ciphers.AEADDecryptionContext: ...
|
| 22 |
+
@typing.overload
|
| 23 |
+
def create_decryption_ctx(
|
| 24 |
+
algorithm: ciphers.CipherAlgorithm, mode: modes.Mode | None
|
| 25 |
+
) -> ciphers.CipherContext: ...
|
| 26 |
+
def cipher_supported(
|
| 27 |
+
algorithm: ciphers.CipherAlgorithm, mode: modes.Mode
|
| 28 |
+
) -> bool: ...
|
| 29 |
+
def _advance(
|
| 30 |
+
ctx: ciphers.AEADEncryptionContext | ciphers.AEADDecryptionContext, n: int
|
| 31 |
+
) -> None: ...
|
| 32 |
+
def _advance_aad(
|
| 33 |
+
ctx: ciphers.AEADEncryptionContext | ciphers.AEADDecryptionContext, n: int
|
| 34 |
+
) -> None: ...
|
| 35 |
+
|
| 36 |
+
class CipherContext: ...
|
| 37 |
+
class AEADEncryptionContext: ...
|
| 38 |
+
class AEADDecryptionContext: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/cmac.pyi
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.primitives import ciphers
|
| 8 |
+
|
| 9 |
+
class CMAC:
|
| 10 |
+
def __init__(
|
| 11 |
+
self,
|
| 12 |
+
algorithm: ciphers.BlockCipherAlgorithm,
|
| 13 |
+
backend: typing.Any = None,
|
| 14 |
+
) -> None: ...
|
| 15 |
+
def update(self, data: bytes) -> None: ...
|
| 16 |
+
def finalize(self) -> bytes: ...
|
| 17 |
+
def verify(self, signature: bytes) -> None: ...
|
| 18 |
+
def copy(self) -> CMAC: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.primitives.asymmetric import dh
|
| 8 |
+
|
| 9 |
+
MIN_MODULUS_SIZE: int
|
| 10 |
+
|
| 11 |
+
class DHPrivateKey: ...
|
| 12 |
+
class DHPublicKey: ...
|
| 13 |
+
class DHParameters: ...
|
| 14 |
+
|
| 15 |
+
class DHPrivateNumbers:
|
| 16 |
+
def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None: ...
|
| 17 |
+
def private_key(self, backend: typing.Any = None) -> dh.DHPrivateKey: ...
|
| 18 |
+
@property
|
| 19 |
+
def x(self) -> int: ...
|
| 20 |
+
@property
|
| 21 |
+
def public_numbers(self) -> DHPublicNumbers: ...
|
| 22 |
+
|
| 23 |
+
class DHPublicNumbers:
|
| 24 |
+
def __init__(
|
| 25 |
+
self, y: int, parameter_numbers: DHParameterNumbers
|
| 26 |
+
) -> None: ...
|
| 27 |
+
def public_key(self, backend: typing.Any = None) -> dh.DHPublicKey: ...
|
| 28 |
+
@property
|
| 29 |
+
def y(self) -> int: ...
|
| 30 |
+
@property
|
| 31 |
+
def parameter_numbers(self) -> DHParameterNumbers: ...
|
| 32 |
+
|
| 33 |
+
class DHParameterNumbers:
|
| 34 |
+
def __init__(self, p: int, g: int, q: int | None = None) -> None: ...
|
| 35 |
+
def parameters(self, backend: typing.Any = None) -> dh.DHParameters: ...
|
| 36 |
+
@property
|
| 37 |
+
def p(self) -> int: ...
|
| 38 |
+
@property
|
| 39 |
+
def g(self) -> int: ...
|
| 40 |
+
@property
|
| 41 |
+
def q(self) -> int | None: ...
|
| 42 |
+
|
| 43 |
+
def generate_parameters(
|
| 44 |
+
generator: int, key_size: int, backend: typing.Any = None
|
| 45 |
+
) -> dh.DHParameters: ...
|
| 46 |
+
def from_pem_parameters(
|
| 47 |
+
data: bytes, backend: typing.Any = None
|
| 48 |
+
) -> dh.DHParameters: ...
|
| 49 |
+
def from_der_parameters(
|
| 50 |
+
data: bytes, backend: typing.Any = None
|
| 51 |
+
) -> dh.DHParameters: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.primitives.asymmetric import dsa
|
| 8 |
+
|
| 9 |
+
class DSAPrivateKey: ...
|
| 10 |
+
class DSAPublicKey: ...
|
| 11 |
+
class DSAParameters: ...
|
| 12 |
+
|
| 13 |
+
class DSAPrivateNumbers:
|
| 14 |
+
def __init__(self, x: int, public_numbers: DSAPublicNumbers) -> None: ...
|
| 15 |
+
@property
|
| 16 |
+
def x(self) -> int: ...
|
| 17 |
+
@property
|
| 18 |
+
def public_numbers(self) -> DSAPublicNumbers: ...
|
| 19 |
+
def private_key(self, backend: typing.Any = None) -> dsa.DSAPrivateKey: ...
|
| 20 |
+
|
| 21 |
+
class DSAPublicNumbers:
|
| 22 |
+
def __init__(
|
| 23 |
+
self, y: int, parameter_numbers: DSAParameterNumbers
|
| 24 |
+
) -> None: ...
|
| 25 |
+
@property
|
| 26 |
+
def y(self) -> int: ...
|
| 27 |
+
@property
|
| 28 |
+
def parameter_numbers(self) -> DSAParameterNumbers: ...
|
| 29 |
+
def public_key(self, backend: typing.Any = None) -> dsa.DSAPublicKey: ...
|
| 30 |
+
|
| 31 |
+
class DSAParameterNumbers:
|
| 32 |
+
def __init__(self, p: int, q: int, g: int) -> None: ...
|
| 33 |
+
@property
|
| 34 |
+
def p(self) -> int: ...
|
| 35 |
+
@property
|
| 36 |
+
def q(self) -> int: ...
|
| 37 |
+
@property
|
| 38 |
+
def g(self) -> int: ...
|
| 39 |
+
def parameters(self, backend: typing.Any = None) -> dsa.DSAParameters: ...
|
| 40 |
+
|
| 41 |
+
def generate_parameters(key_size: int) -> dsa.DSAParameters: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ec.pyi
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.primitives.asymmetric import ec
|
| 8 |
+
|
| 9 |
+
class ECPrivateKey: ...
|
| 10 |
+
class ECPublicKey: ...
|
| 11 |
+
|
| 12 |
+
class EllipticCurvePrivateNumbers:
|
| 13 |
+
def __init__(
|
| 14 |
+
self, private_value: int, public_numbers: EllipticCurvePublicNumbers
|
| 15 |
+
) -> None: ...
|
| 16 |
+
def private_key(
|
| 17 |
+
self, backend: typing.Any = None
|
| 18 |
+
) -> ec.EllipticCurvePrivateKey: ...
|
| 19 |
+
@property
|
| 20 |
+
def private_value(self) -> int: ...
|
| 21 |
+
@property
|
| 22 |
+
def public_numbers(self) -> EllipticCurvePublicNumbers: ...
|
| 23 |
+
|
| 24 |
+
class EllipticCurvePublicNumbers:
|
| 25 |
+
def __init__(self, x: int, y: int, curve: ec.EllipticCurve) -> None: ...
|
| 26 |
+
def public_key(
|
| 27 |
+
self, backend: typing.Any = None
|
| 28 |
+
) -> ec.EllipticCurvePublicKey: ...
|
| 29 |
+
@property
|
| 30 |
+
def x(self) -> int: ...
|
| 31 |
+
@property
|
| 32 |
+
def y(self) -> int: ...
|
| 33 |
+
@property
|
| 34 |
+
def curve(self) -> ec.EllipticCurve: ...
|
| 35 |
+
def __eq__(self, other: object) -> bool: ...
|
| 36 |
+
|
| 37 |
+
def curve_supported(curve: ec.EllipticCurve) -> bool: ...
|
| 38 |
+
def generate_private_key(
|
| 39 |
+
curve: ec.EllipticCurve, backend: typing.Any = None
|
| 40 |
+
) -> ec.EllipticCurvePrivateKey: ...
|
| 41 |
+
def from_private_numbers(
|
| 42 |
+
numbers: ec.EllipticCurvePrivateNumbers,
|
| 43 |
+
) -> ec.EllipticCurvePrivateKey: ...
|
| 44 |
+
def from_public_numbers(
|
| 45 |
+
numbers: ec.EllipticCurvePublicNumbers,
|
| 46 |
+
) -> ec.EllipticCurvePublicKey: ...
|
| 47 |
+
def from_public_bytes(
|
| 48 |
+
curve: ec.EllipticCurve, data: bytes
|
| 49 |
+
) -> ec.EllipticCurvePublicKey: ...
|
| 50 |
+
def derive_private_key(
|
| 51 |
+
private_value: int, curve: ec.EllipticCurve
|
| 52 |
+
) -> ec.EllipticCurvePrivateKey: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from cryptography.hazmat.primitives.asymmetric import ed25519
|
| 6 |
+
from cryptography.utils import Buffer
|
| 7 |
+
|
| 8 |
+
class Ed25519PrivateKey: ...
|
| 9 |
+
class Ed25519PublicKey: ...
|
| 10 |
+
|
| 11 |
+
def generate_key() -> ed25519.Ed25519PrivateKey: ...
|
| 12 |
+
def from_private_bytes(data: Buffer) -> ed25519.Ed25519PrivateKey: ...
|
| 13 |
+
def from_public_bytes(data: bytes) -> ed25519.Ed25519PublicKey: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from cryptography.hazmat.primitives.asymmetric import ed448
|
| 6 |
+
from cryptography.utils import Buffer
|
| 7 |
+
|
| 8 |
+
class Ed448PrivateKey: ...
|
| 9 |
+
class Ed448PublicKey: ...
|
| 10 |
+
|
| 11 |
+
def generate_key() -> ed448.Ed448PrivateKey: ...
|
| 12 |
+
def from_private_bytes(data: Buffer) -> ed448.Ed448PrivateKey: ...
|
| 13 |
+
def from_public_bytes(data: bytes) -> ed448.Ed448PublicKey: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
|
| 7 |
+
from cryptography.hazmat.primitives import hashes
|
| 8 |
+
from cryptography.utils import Buffer
|
| 9 |
+
|
| 10 |
+
class Hash(hashes.HashContext):
|
| 11 |
+
def __init__(
|
| 12 |
+
self, algorithm: hashes.HashAlgorithm, backend: typing.Any = None
|
| 13 |
+
) -> None: ...
|
| 14 |
+
@property
|
| 15 |
+
def algorithm(self) -> hashes.HashAlgorithm: ...
|
| 16 |
+
def update(self, data: Buffer) -> None: ...
|
| 17 |
+
def finalize(self) -> bytes: ...
|
| 18 |
+
def copy(self) -> Hash: ...
|
| 19 |
+
@staticmethod
|
| 20 |
+
def hash(algorithm: hashes.HashAlgorithm, data: Buffer) -> bytes: ...
|
| 21 |
+
|
| 22 |
+
def hash_supported(algorithm: hashes.HashAlgorithm) -> bool: ...
|
| 23 |
+
|
| 24 |
+
class XOFHash:
|
| 25 |
+
def __init__(self, algorithm: hashes.ExtendableOutputFunction) -> None: ...
|
| 26 |
+
@property
|
| 27 |
+
def algorithm(self) -> hashes.ExtendableOutputFunction: ...
|
| 28 |
+
def update(self, data: Buffer) -> None: ...
|
| 29 |
+
def squeeze(self, length: int) -> bytes: ...
|
| 30 |
+
def copy(self) -> XOFHash: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/pkcs12.pyi
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import typing
|
| 6 |
+
from collections.abc import Iterable
|
| 7 |
+
|
| 8 |
+
from cryptography import x509
|
| 9 |
+
from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
|
| 10 |
+
from cryptography.hazmat.primitives.serialization import (
|
| 11 |
+
KeySerializationEncryption,
|
| 12 |
+
)
|
| 13 |
+
from cryptography.hazmat.primitives.serialization.pkcs12 import (
|
| 14 |
+
PKCS12KeyAndCertificates,
|
| 15 |
+
PKCS12PrivateKeyTypes,
|
| 16 |
+
)
|
| 17 |
+
from cryptography.utils import Buffer
|
| 18 |
+
|
| 19 |
+
class PKCS12Certificate:
|
| 20 |
+
def __init__(
|
| 21 |
+
self, cert: x509.Certificate, friendly_name: bytes | None
|
| 22 |
+
) -> None: ...
|
| 23 |
+
@property
|
| 24 |
+
def friendly_name(self) -> bytes | None: ...
|
| 25 |
+
@property
|
| 26 |
+
def certificate(self) -> x509.Certificate: ...
|
| 27 |
+
|
| 28 |
+
def load_key_and_certificates(
|
| 29 |
+
data: Buffer,
|
| 30 |
+
password: Buffer | None,
|
| 31 |
+
backend: typing.Any = None,
|
| 32 |
+
) -> tuple[
|
| 33 |
+
PrivateKeyTypes | None,
|
| 34 |
+
x509.Certificate | None,
|
| 35 |
+
list[x509.Certificate],
|
| 36 |
+
]: ...
|
| 37 |
+
def load_pkcs12(
|
| 38 |
+
data: bytes,
|
| 39 |
+
password: bytes | None,
|
| 40 |
+
backend: typing.Any = None,
|
| 41 |
+
) -> PKCS12KeyAndCertificates: ...
|
| 42 |
+
def serialize_java_truststore(
|
| 43 |
+
certs: Iterable[PKCS12Certificate],
|
| 44 |
+
encryption_algorithm: KeySerializationEncryption,
|
| 45 |
+
) -> bytes: ...
|
| 46 |
+
def serialize_key_and_certificates(
|
| 47 |
+
name: bytes | None,
|
| 48 |
+
key: PKCS12PrivateKeyTypes | None,
|
| 49 |
+
cert: x509.Certificate | None,
|
| 50 |
+
cas: Iterable[x509.Certificate | PKCS12Certificate] | None,
|
| 51 |
+
encryption_algorithm: KeySerializationEncryption,
|
| 52 |
+
) -> bytes: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from collections.abc import Iterable
|
| 6 |
+
|
| 7 |
+
from cryptography import x509
|
| 8 |
+
from cryptography.hazmat.primitives import serialization
|
| 9 |
+
from cryptography.hazmat.primitives.asymmetric import rsa
|
| 10 |
+
from cryptography.hazmat.primitives.serialization import pkcs7
|
| 11 |
+
|
| 12 |
+
def serialize_certificates(
|
| 13 |
+
certs: list[x509.Certificate],
|
| 14 |
+
encoding: serialization.Encoding,
|
| 15 |
+
) -> bytes: ...
|
| 16 |
+
def encrypt_and_serialize(
|
| 17 |
+
builder: pkcs7.PKCS7EnvelopeBuilder,
|
| 18 |
+
content_encryption_algorithm: pkcs7.ContentEncryptionAlgorithm,
|
| 19 |
+
encoding: serialization.Encoding,
|
| 20 |
+
options: Iterable[pkcs7.PKCS7Options],
|
| 21 |
+
) -> bytes: ...
|
| 22 |
+
def sign_and_serialize(
|
| 23 |
+
builder: pkcs7.PKCS7SignatureBuilder,
|
| 24 |
+
encoding: serialization.Encoding,
|
| 25 |
+
options: Iterable[pkcs7.PKCS7Options],
|
| 26 |
+
) -> bytes: ...
|
| 27 |
+
def decrypt_der(
|
| 28 |
+
data: bytes,
|
| 29 |
+
certificate: x509.Certificate,
|
| 30 |
+
private_key: rsa.RSAPrivateKey,
|
| 31 |
+
options: Iterable[pkcs7.PKCS7Options],
|
| 32 |
+
) -> bytes: ...
|
| 33 |
+
def decrypt_pem(
|
| 34 |
+
data: bytes,
|
| 35 |
+
certificate: x509.Certificate,
|
| 36 |
+
private_key: rsa.RSAPrivateKey,
|
| 37 |
+
options: Iterable[pkcs7.PKCS7Options],
|
| 38 |
+
) -> bytes: ...
|
| 39 |
+
def decrypt_smime(
|
| 40 |
+
data: bytes,
|
| 41 |
+
certificate: x509.Certificate,
|
| 42 |
+
private_key: rsa.RSAPrivateKey,
|
| 43 |
+
options: Iterable[pkcs7.PKCS7Options],
|
| 44 |
+
) -> bytes: ...
|
| 45 |
+
def load_pem_pkcs7_certificates(
|
| 46 |
+
data: bytes,
|
| 47 |
+
) -> list[x509.Certificate]: ...
|
| 48 |
+
def load_der_pkcs7_certificates(
|
| 49 |
+
data: bytes,
|
| 50 |
+
) -> list[x509.Certificate]: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/test_support.pyi
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from cryptography import x509
|
| 6 |
+
from cryptography.hazmat.primitives import serialization
|
| 7 |
+
from cryptography.hazmat.primitives.serialization import pkcs7
|
| 8 |
+
from cryptography.utils import Buffer
|
| 9 |
+
|
| 10 |
+
class TestCertificate:
|
| 11 |
+
not_after_tag: int
|
| 12 |
+
not_before_tag: int
|
| 13 |
+
issuer_value_tags: list[int]
|
| 14 |
+
subject_value_tags: list[int]
|
| 15 |
+
|
| 16 |
+
def test_parse_certificate(data: bytes) -> TestCertificate: ...
|
| 17 |
+
def pkcs7_verify(
|
| 18 |
+
encoding: serialization.Encoding,
|
| 19 |
+
sig: bytes,
|
| 20 |
+
msg: Buffer | None,
|
| 21 |
+
certs: list[x509.Certificate],
|
| 22 |
+
options: list[pkcs7.PKCS7Options],
|
| 23 |
+
) -> None: ...
|
lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
import datetime
|
| 6 |
+
import typing
|
| 7 |
+
from collections.abc import Iterator
|
| 8 |
+
|
| 9 |
+
from cryptography import x509
|
| 10 |
+
from cryptography.hazmat.primitives import hashes, serialization
|
| 11 |
+
from cryptography.hazmat.primitives.asymmetric.ec import ECDSA
|
| 12 |
+
from cryptography.hazmat.primitives.asymmetric.padding import PSS, PKCS1v15
|
| 13 |
+
from cryptography.hazmat.primitives.asymmetric.types import (
|
| 14 |
+
CertificateIssuerPublicKeyTypes,
|
| 15 |
+
CertificatePublicKeyTypes,
|
| 16 |
+
PrivateKeyTypes,
|
| 17 |
+
)
|
| 18 |
+
from cryptography.x509 import certificate_transparency
|
| 19 |
+
|
| 20 |
+
def load_pem_x509_certificate(
|
| 21 |
+
data: bytes, backend: typing.Any = None
|
| 22 |
+
) -> x509.Certificate: ...
|
| 23 |
+
def load_der_x509_certificate(
|
| 24 |
+
data: bytes, backend: typing.Any = None
|
| 25 |
+
) -> x509.Certificate: ...
|
| 26 |
+
def load_pem_x509_certificates(
|
| 27 |
+
data: bytes,
|
| 28 |
+
) -> list[x509.Certificate]: ...
|
| 29 |
+
def load_pem_x509_crl(
|
| 30 |
+
data: bytes, backend: typing.Any = None
|
| 31 |
+
) -> x509.CertificateRevocationList: ...
|
| 32 |
+
def load_der_x509_crl(
|
| 33 |
+
data: bytes, backend: typing.Any = None
|
| 34 |
+
) -> x509.CertificateRevocationList: ...
|
| 35 |
+
def load_pem_x509_csr(
|
| 36 |
+
data: bytes, backend: typing.Any = None
|
| 37 |
+
) -> x509.CertificateSigningRequest: ...
|
| 38 |
+
def load_der_x509_csr(
|
| 39 |
+
data: bytes, backend: typing.Any = None
|
| 40 |
+
) -> x509.CertificateSigningRequest: ...
|
| 41 |
+
def encode_name_bytes(name: x509.Name) -> bytes: ...
|
| 42 |
+
def encode_extension_value(extension: x509.ExtensionType) -> bytes: ...
|
| 43 |
+
def create_x509_certificate(
|
| 44 |
+
builder: x509.CertificateBuilder,
|
| 45 |
+
private_key: PrivateKeyTypes,
|
| 46 |
+
hash_algorithm: hashes.HashAlgorithm | None,
|
| 47 |
+
rsa_padding: PKCS1v15 | PSS | None,
|
| 48 |
+
ecdsa_deterministic: bool | None,
|
| 49 |
+
) -> x509.Certificate: ...
|
| 50 |
+
def create_x509_csr(
|
| 51 |
+
builder: x509.CertificateSigningRequestBuilder,
|
| 52 |
+
private_key: PrivateKeyTypes,
|
| 53 |
+
hash_algorithm: hashes.HashAlgorithm | None,
|
| 54 |
+
rsa_padding: PKCS1v15 | PSS | None,
|
| 55 |
+
ecdsa_deterministic: bool | None,
|
| 56 |
+
) -> x509.CertificateSigningRequest: ...
|
| 57 |
+
def create_revoked_certificate(
|
| 58 |
+
builder: x509.RevokedCertificateBuilder,
|
| 59 |
+
) -> x509.RevokedCertificate: ...
|
| 60 |
+
def create_x509_crl(
|
| 61 |
+
builder: x509.CertificateRevocationListBuilder,
|
| 62 |
+
private_key: PrivateKeyTypes,
|
| 63 |
+
hash_algorithm: hashes.HashAlgorithm | None,
|
| 64 |
+
rsa_padding: PKCS1v15 | PSS | None,
|
| 65 |
+
ecdsa_deterministic: bool | None,
|
| 66 |
+
) -> x509.CertificateRevocationList: ...
|
| 67 |
+
|
| 68 |
+
class Sct:
|
| 69 |
+
@property
|
| 70 |
+
def version(self) -> certificate_transparency.Version: ...
|
| 71 |
+
@property
|
| 72 |
+
def log_id(self) -> bytes: ...
|
| 73 |
+
@property
|
| 74 |
+
def timestamp(self) -> datetime.datetime: ...
|
| 75 |
+
@property
|
| 76 |
+
def entry_type(self) -> certificate_transparency.LogEntryType: ...
|
| 77 |
+
@property
|
| 78 |
+
def signature_hash_algorithm(self) -> hashes.HashAlgorithm: ...
|
| 79 |
+
@property
|
| 80 |
+
def signature_algorithm(
|
| 81 |
+
self,
|
| 82 |
+
) -> certificate_transparency.SignatureAlgorithm: ...
|
| 83 |
+
@property
|
| 84 |
+
def signature(self) -> bytes: ...
|
| 85 |
+
@property
|
| 86 |
+
def extension_bytes(self) -> bytes: ...
|
| 87 |
+
|
| 88 |
+
class Certificate:
|
| 89 |
+
def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes: ...
|
| 90 |
+
@property
|
| 91 |
+
def serial_number(self) -> int: ...
|
| 92 |
+
@property
|
| 93 |
+
def version(self) -> x509.Version: ...
|
| 94 |
+
def public_key(self) -> CertificatePublicKeyTypes: ...
|
| 95 |
+
@property
|
| 96 |
+
def public_key_algorithm_oid(self) -> x509.ObjectIdentifier: ...
|
| 97 |
+
@property
|
| 98 |
+
def not_valid_before(self) -> datetime.datetime: ...
|
| 99 |
+
@property
|
| 100 |
+
def not_valid_before_utc(self) -> datetime.datetime: ...
|
| 101 |
+
@property
|
| 102 |
+
def not_valid_after(self) -> datetime.datetime: ...
|
| 103 |
+
@property
|
| 104 |
+
def not_valid_after_utc(self) -> datetime.datetime: ...
|
| 105 |
+
@property
|
| 106 |
+
def issuer(self) -> x509.Name: ...
|
| 107 |
+
@property
|
| 108 |
+
def subject(self) -> x509.Name: ...
|
| 109 |
+
@property
|
| 110 |
+
def signature_hash_algorithm(
|
| 111 |
+
self,
|
| 112 |
+
) -> hashes.HashAlgorithm | None: ...
|
| 113 |
+
@property
|
| 114 |
+
def signature_algorithm_oid(self) -> x509.ObjectIdentifier: ...
|
| 115 |
+
@property
|
| 116 |
+
def signature_algorithm_parameters(
|
| 117 |
+
self,
|
| 118 |
+
) -> PSS | PKCS1v15 | ECDSA | None: ...
|
| 119 |
+
@property
|
| 120 |
+
def extensions(self) -> x509.Extensions: ...
|
| 121 |
+
@property
|
| 122 |
+
def signature(self) -> bytes: ...
|
| 123 |
+
@property
|
| 124 |
+
def tbs_certificate_bytes(self) -> bytes: ...
|
| 125 |
+
@property
|
| 126 |
+
def tbs_precertificate_bytes(self) -> bytes: ...
|
| 127 |
+
def __eq__(self, other: object) -> bool: ...
|
| 128 |
+
def __hash__(self) -> int: ...
|
| 129 |
+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
|
| 130 |
+
def verify_directly_issued_by(self, issuer: Certificate) -> None: ...
|
| 131 |
+
|
| 132 |
+
class RevokedCertificate:
|
| 133 |
+
@property
|
| 134 |
+
def serial_number(self) -> int: ...
|
| 135 |
+
@property
|
| 136 |
+
def revocation_date(self) -> datetime.datetime: ...
|
| 137 |
+
@property
|
| 138 |
+
def revocation_date_utc(self) -> datetime.datetime: ...
|
| 139 |
+
@property
|
| 140 |
+
def extensions(self) -> x509.Extensions: ...
|
| 141 |
+
|
| 142 |
+
class CertificateRevocationList:
|
| 143 |
+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
|
| 144 |
+
def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes: ...
|
| 145 |
+
def get_revoked_certificate_by_serial_number(
|
| 146 |
+
self, serial_number: int
|
| 147 |
+
) -> x509.RevokedCertificate | None: ...
|
| 148 |
+
@property
|
| 149 |
+
def signature_hash_algorithm(
|
| 150 |
+
self,
|
| 151 |
+
) -> hashes.HashAlgorithm | None: ...
|
| 152 |
+
@property
|
| 153 |
+
def signature_algorithm_oid(self) -> x509.ObjectIdentifier: ...
|
| 154 |
+
@property
|
| 155 |
+
def signature_algorithm_parameters(
|
| 156 |
+
self,
|
| 157 |
+
) -> PSS | PKCS1v15 | ECDSA | None: ...
|
| 158 |
+
@property
|
| 159 |
+
def issuer(self) -> x509.Name: ...
|
| 160 |
+
@property
|
| 161 |
+
def next_update(self) -> datetime.datetime | None: ...
|
| 162 |
+
@property
|
| 163 |
+
def next_update_utc(self) -> datetime.datetime | None: ...
|
| 164 |
+
@property
|
| 165 |
+
def last_update(self) -> datetime.datetime: ...
|
| 166 |
+
@property
|
| 167 |
+
def last_update_utc(self) -> datetime.datetime: ...
|
| 168 |
+
@property
|
| 169 |
+
def extensions(self) -> x509.Extensions: ...
|
| 170 |
+
@property
|
| 171 |
+
def signature(self) -> bytes: ...
|
| 172 |
+
@property
|
| 173 |
+
def tbs_certlist_bytes(self) -> bytes: ...
|
| 174 |
+
def __eq__(self, other: object) -> bool: ...
|
| 175 |
+
def __len__(self) -> int: ...
|
| 176 |
+
@typing.overload
|
| 177 |
+
def __getitem__(self, idx: int) -> x509.RevokedCertificate: ...
|
| 178 |
+
@typing.overload
|
| 179 |
+
def __getitem__(self, idx: slice) -> list[x509.RevokedCertificate]: ...
|
| 180 |
+
def __iter__(self) -> Iterator[x509.RevokedCertificate]: ...
|
| 181 |
+
def is_signature_valid(
|
| 182 |
+
self, public_key: CertificateIssuerPublicKeyTypes
|
| 183 |
+
) -> bool: ...
|
| 184 |
+
|
| 185 |
+
class CertificateSigningRequest:
|
| 186 |
+
def __eq__(self, other: object) -> bool: ...
|
| 187 |
+
def __hash__(self) -> int: ...
|
| 188 |
+
def public_key(self) -> CertificatePublicKeyTypes: ...
|
| 189 |
+
@property
|
| 190 |
+
def subject(self) -> x509.Name: ...
|
| 191 |
+
@property
|
| 192 |
+
def signature_hash_algorithm(
|
| 193 |
+
self,
|
| 194 |
+
) -> hashes.HashAlgorithm | None: ...
|
| 195 |
+
@property
|
| 196 |
+
def signature_algorithm_oid(self) -> x509.ObjectIdentifier: ...
|
| 197 |
+
@property
|
| 198 |
+
def signature_algorithm_parameters(
|
| 199 |
+
self,
|
| 200 |
+
) -> PSS | PKCS1v15 | ECDSA | None: ...
|
| 201 |
+
@property
|
| 202 |
+
def extensions(self) -> x509.Extensions: ...
|
| 203 |
+
@property
|
| 204 |
+
def attributes(self) -> x509.Attributes: ...
|
| 205 |
+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
|
| 206 |
+
@property
|
| 207 |
+
def signature(self) -> bytes: ...
|
| 208 |
+
@property
|
| 209 |
+
def tbs_certrequest_bytes(self) -> bytes: ...
|
| 210 |
+
@property
|
| 211 |
+
def is_signature_valid(self) -> bool: ...
|
| 212 |
+
|
| 213 |
+
class PolicyBuilder:
|
| 214 |
+
def time(self, time: datetime.datetime) -> PolicyBuilder: ...
|
| 215 |
+
def store(self, store: Store) -> PolicyBuilder: ...
|
| 216 |
+
def max_chain_depth(self, max_chain_depth: int) -> PolicyBuilder: ...
|
| 217 |
+
def extension_policies(
|
| 218 |
+
self, *, ca_policy: ExtensionPolicy, ee_policy: ExtensionPolicy
|
| 219 |
+
) -> PolicyBuilder: ...
|
| 220 |
+
def build_client_verifier(self) -> ClientVerifier: ...
|
| 221 |
+
def build_server_verifier(
|
| 222 |
+
self, subject: x509.verification.Subject
|
| 223 |
+
) -> ServerVerifier: ...
|
| 224 |
+
|
| 225 |
+
class Policy:
|
| 226 |
+
@property
|
| 227 |
+
def max_chain_depth(self) -> int: ...
|
| 228 |
+
@property
|
| 229 |
+
def subject(self) -> x509.verification.Subject | None: ...
|
| 230 |
+
@property
|
| 231 |
+
def validation_time(self) -> datetime.datetime: ...
|
| 232 |
+
@property
|
| 233 |
+
def extended_key_usage(self) -> x509.ObjectIdentifier: ...
|
| 234 |
+
@property
|
| 235 |
+
def minimum_rsa_modulus(self) -> int: ...
|
| 236 |
+
|
| 237 |
+
class Criticality:
|
| 238 |
+
CRITICAL: Criticality
|
| 239 |
+
AGNOSTIC: Criticality
|
| 240 |
+
NON_CRITICAL: Criticality
|
| 241 |
+
|
| 242 |
+
T = typing.TypeVar("T", contravariant=True, bound=x509.ExtensionType)
|
| 243 |
+
|
| 244 |
+
MaybeExtensionValidatorCallback = typing.Callable[
|
| 245 |
+
[
|
| 246 |
+
Policy,
|
| 247 |
+
x509.Certificate,
|
| 248 |
+
T | None,
|
| 249 |
+
],
|
| 250 |
+
None,
|
| 251 |
+
]
|
| 252 |
+
|
| 253 |
+
PresentExtensionValidatorCallback = typing.Callable[
|
| 254 |
+
[Policy, x509.Certificate, T],
|
| 255 |
+
None,
|
| 256 |
+
]
|
| 257 |
+
|
| 258 |
+
class ExtensionPolicy:
|
| 259 |
+
@staticmethod
|
| 260 |
+
def permit_all() -> ExtensionPolicy: ...
|
| 261 |
+
@staticmethod
|
| 262 |
+
def webpki_defaults_ca() -> ExtensionPolicy: ...
|
| 263 |
+
@staticmethod
|
| 264 |
+
def webpki_defaults_ee() -> ExtensionPolicy: ...
|
| 265 |
+
def require_not_present(
|
| 266 |
+
self, extension_type: type[x509.ExtensionType]
|
| 267 |
+
) -> ExtensionPolicy: ...
|
| 268 |
+
def may_be_present(
|
| 269 |
+
self,
|
| 270 |
+
extension_type: type[T],
|
| 271 |
+
criticality: Criticality,
|
| 272 |
+
validator: MaybeExtensionValidatorCallback[T] | None,
|
| 273 |
+
) -> ExtensionPolicy: ...
|
| 274 |
+
def require_present(
|
| 275 |
+
self,
|
| 276 |
+
extension_type: type[T],
|
| 277 |
+
criticality: Criticality,
|
| 278 |
+
validator: PresentExtensionValidatorCallback[T] | None,
|
| 279 |
+
) -> ExtensionPolicy: ...
|
| 280 |
+
|
| 281 |
+
class VerifiedClient:
|
| 282 |
+
@property
|
| 283 |
+
def subjects(self) -> list[x509.GeneralName] | None: ...
|
| 284 |
+
@property
|
| 285 |
+
def chain(self) -> list[x509.Certificate]: ...
|
| 286 |
+
|
| 287 |
+
class ClientVerifier:
|
| 288 |
+
@property
|
| 289 |
+
def policy(self) -> Policy: ...
|
| 290 |
+
@property
|
| 291 |
+
def store(self) -> Store: ...
|
| 292 |
+
def verify(
|
| 293 |
+
self,
|
| 294 |
+
leaf: x509.Certificate,
|
| 295 |
+
intermediates: list[x509.Certificate],
|
| 296 |
+
) -> VerifiedClient: ...
|
| 297 |
+
|
| 298 |
+
class ServerVerifier:
|
| 299 |
+
@property
|
| 300 |
+
def policy(self) -> Policy: ...
|
| 301 |
+
@property
|
| 302 |
+
def store(self) -> Store: ...
|
| 303 |
+
def verify(
|
| 304 |
+
self,
|
| 305 |
+
leaf: x509.Certificate,
|
| 306 |
+
intermediates: list[x509.Certificate],
|
| 307 |
+
) -> list[x509.Certificate]: ...
|
| 308 |
+
|
| 309 |
+
class Store:
|
| 310 |
+
def __init__(self, certs: list[x509.Certificate]) -> None: ...
|
| 311 |
+
|
| 312 |
+
class VerificationError(Exception): ...
|
lib/python3.11/site-packages/cryptography/py.typed
ADDED
|
File without changes
|
lib/python3.11/site-packages/cryptography/utils.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# This file is dual licensed under the terms of the Apache License, Version
|
| 2 |
+
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
|
| 3 |
+
# for complete details.
|
| 4 |
+
|
| 5 |
+
from __future__ import annotations
|
| 6 |
+
|
| 7 |
+
import enum
|
| 8 |
+
import sys
|
| 9 |
+
import types
|
| 10 |
+
import typing
|
| 11 |
+
import warnings
|
| 12 |
+
from collections.abc import Callable, Sequence
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# We use a UserWarning subclass, instead of DeprecationWarning, because CPython
|
| 16 |
+
# decided deprecation warnings should be invisible by default.
|
| 17 |
+
class CryptographyDeprecationWarning(UserWarning):
|
| 18 |
+
pass
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Several APIs were deprecated with no specific end-of-life date because of the
|
| 22 |
+
# ubiquity of their use. They should not be removed until we agree on when that
|
| 23 |
+
# cycle ends.
|
| 24 |
+
DeprecatedIn36 = CryptographyDeprecationWarning
|
| 25 |
+
DeprecatedIn40 = CryptographyDeprecationWarning
|
| 26 |
+
DeprecatedIn41 = CryptographyDeprecationWarning
|
| 27 |
+
DeprecatedIn42 = CryptographyDeprecationWarning
|
| 28 |
+
DeprecatedIn43 = CryptographyDeprecationWarning
|
| 29 |
+
DeprecatedIn47 = CryptographyDeprecationWarning
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
# If you're wondering why we don't use `Buffer`, it's because `Buffer` would
|
| 33 |
+
# be more accurately named: Bufferable. It means something which has an
|
| 34 |
+
# `__buffer__`. Which means you can't actually treat the result as a buffer
|
| 35 |
+
# (and do things like take a `len()`).
|
| 36 |
+
Buffer = typing.Union[bytes, bytearray, memoryview]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def _check_bytes(name: str, value: bytes) -> None:
|
| 40 |
+
if not isinstance(value, bytes):
|
| 41 |
+
raise TypeError(f"{name} must be bytes")
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def _check_byteslike(name: str, value: Buffer) -> None:
|
| 45 |
+
try:
|
| 46 |
+
memoryview(value)
|
| 47 |
+
except TypeError:
|
| 48 |
+
raise TypeError(f"{name} must be bytes-like")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def int_to_bytes(integer: int, length: int | None = None) -> bytes:
|
| 52 |
+
if length == 0:
|
| 53 |
+
raise ValueError("length argument can't be 0")
|
| 54 |
+
return integer.to_bytes(
|
| 55 |
+
length or (integer.bit_length() + 7) // 8 or 1, "big"
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class InterfaceNotImplemented(Exception):
|
| 60 |
+
pass
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
class _DeprecatedValue:
|
| 64 |
+
def __init__(self, value: object, message: str, warning_class):
|
| 65 |
+
self.value = value
|
| 66 |
+
self.message = message
|
| 67 |
+
self.warning_class = warning_class
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class _ModuleWithDeprecations(types.ModuleType):
|
| 71 |
+
def __init__(self, module: types.ModuleType):
|
| 72 |
+
super().__init__(module.__name__)
|
| 73 |
+
self.__dict__["_module"] = module
|
| 74 |
+
|
| 75 |
+
def __getattr__(self, name: str) -> typing.Any:
|
| 76 |
+
obj = getattr(self._module, name)
|
| 77 |
+
if isinstance(obj, _DeprecatedValue):
|
| 78 |
+
warnings.warn(obj.message, obj.warning_class, stacklevel=2)
|
| 79 |
+
obj = obj.value
|
| 80 |
+
return obj
|
| 81 |
+
|
| 82 |
+
def __setattr__(self, attr: str, value: object) -> None:
|
| 83 |
+
setattr(self._module, attr, value)
|
| 84 |
+
|
| 85 |
+
def __delattr__(self, attr: str) -> None:
|
| 86 |
+
obj = getattr(self._module, attr)
|
| 87 |
+
if isinstance(obj, _DeprecatedValue):
|
| 88 |
+
warnings.warn(obj.message, obj.warning_class, stacklevel=2)
|
| 89 |
+
|
| 90 |
+
delattr(self._module, attr)
|
| 91 |
+
|
| 92 |
+
def __dir__(self) -> Sequence[str]:
|
| 93 |
+
return ["_module", *dir(self._module)]
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def deprecated(
|
| 97 |
+
value: object,
|
| 98 |
+
module_name: str,
|
| 99 |
+
message: str,
|
| 100 |
+
warning_class: type[Warning],
|
| 101 |
+
name: str | None = None,
|
| 102 |
+
) -> _DeprecatedValue:
|
| 103 |
+
module = sys.modules[module_name]
|
| 104 |
+
if not isinstance(module, _ModuleWithDeprecations):
|
| 105 |
+
sys.modules[module_name] = module = _ModuleWithDeprecations(module)
|
| 106 |
+
dv = _DeprecatedValue(value, message, warning_class)
|
| 107 |
+
# Maintain backwards compatibility with `name is None` for pyOpenSSL.
|
| 108 |
+
if name is not None:
|
| 109 |
+
setattr(module, name, dv)
|
| 110 |
+
return dv
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def cached_property(func: Callable) -> property:
|
| 114 |
+
cached_name = f"_cached_{func}"
|
| 115 |
+
sentinel = object()
|
| 116 |
+
|
| 117 |
+
def inner(instance: object):
|
| 118 |
+
cache = getattr(instance, cached_name, sentinel)
|
| 119 |
+
if cache is not sentinel:
|
| 120 |
+
return cache
|
| 121 |
+
result = func(instance)
|
| 122 |
+
setattr(instance, cached_name, result)
|
| 123 |
+
return result
|
| 124 |
+
|
| 125 |
+
return property(inner)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
# Python 3.10 changed representation of enums. We use well-defined object
|
| 129 |
+
# representation and string representation from Python 3.9.
|
| 130 |
+
class Enum(enum.Enum):
|
| 131 |
+
def __repr__(self) -> str:
|
| 132 |
+
return f"<{self.__class__.__name__}.{self._name_}: {self._value_!r}>"
|
| 133 |
+
|
| 134 |
+
def __str__(self) -> str:
|
| 135 |
+
return f"{self.__class__.__name__}.{self._name_}"
|
lib/python3.11/site-packages/httpx-0.28.1.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
lib/python3.11/site-packages/httpx-0.28.1.dist-info/METADATA
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.3
|
| 2 |
+
Name: httpx
|
| 3 |
+
Version: 0.28.1
|
| 4 |
+
Summary: The next generation HTTP client.
|
| 5 |
+
Project-URL: Changelog, https://github.com/encode/httpx/blob/master/CHANGELOG.md
|
| 6 |
+
Project-URL: Documentation, https://www.python-httpx.org
|
| 7 |
+
Project-URL: Homepage, https://github.com/encode/httpx
|
| 8 |
+
Project-URL: Source, https://github.com/encode/httpx
|
| 9 |
+
Author-email: Tom Christie <tom@tomchristie.com>
|
| 10 |
+
License: BSD-3-Clause
|
| 11 |
+
Classifier: Development Status :: 4 - Beta
|
| 12 |
+
Classifier: Environment :: Web Environment
|
| 13 |
+
Classifier: Framework :: AsyncIO
|
| 14 |
+
Classifier: Framework :: Trio
|
| 15 |
+
Classifier: Intended Audience :: Developers
|
| 16 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 17 |
+
Classifier: Operating System :: OS Independent
|
| 18 |
+
Classifier: Programming Language :: Python :: 3
|
| 19 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 21 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 25 |
+
Classifier: Topic :: Internet :: WWW/HTTP
|
| 26 |
+
Requires-Python: >=3.8
|
| 27 |
+
Requires-Dist: anyio
|
| 28 |
+
Requires-Dist: certifi
|
| 29 |
+
Requires-Dist: httpcore==1.*
|
| 30 |
+
Requires-Dist: idna
|
| 31 |
+
Provides-Extra: brotli
|
| 32 |
+
Requires-Dist: brotli; (platform_python_implementation == 'CPython') and extra == 'brotli'
|
| 33 |
+
Requires-Dist: brotlicffi; (platform_python_implementation != 'CPython') and extra == 'brotli'
|
| 34 |
+
Provides-Extra: cli
|
| 35 |
+
Requires-Dist: click==8.*; extra == 'cli'
|
| 36 |
+
Requires-Dist: pygments==2.*; extra == 'cli'
|
| 37 |
+
Requires-Dist: rich<14,>=10; extra == 'cli'
|
| 38 |
+
Provides-Extra: http2
|
| 39 |
+
Requires-Dist: h2<5,>=3; extra == 'http2'
|
| 40 |
+
Provides-Extra: socks
|
| 41 |
+
Requires-Dist: socksio==1.*; extra == 'socks'
|
| 42 |
+
Provides-Extra: zstd
|
| 43 |
+
Requires-Dist: zstandard>=0.18.0; extra == 'zstd'
|
| 44 |
+
Description-Content-Type: text/markdown
|
| 45 |
+
|
| 46 |
+
<p align="center">
|
| 47 |
+
<a href="https://www.python-httpx.org/"><img width="350" height="208" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/butterfly.png" alt='HTTPX'></a>
|
| 48 |
+
</p>
|
| 49 |
+
|
| 50 |
+
<p align="center"><strong>HTTPX</strong> <em>- A next-generation HTTP client for Python.</em></p>
|
| 51 |
+
|
| 52 |
+
<p align="center">
|
| 53 |
+
<a href="https://github.com/encode/httpx/actions">
|
| 54 |
+
<img src="https://github.com/encode/httpx/workflows/Test%20Suite/badge.svg" alt="Test Suite">
|
| 55 |
+
</a>
|
| 56 |
+
<a href="https://pypi.org/project/httpx/">
|
| 57 |
+
<img src="https://badge.fury.io/py/httpx.svg" alt="Package version">
|
| 58 |
+
</a>
|
| 59 |
+
</p>
|
| 60 |
+
|
| 61 |
+
HTTPX is a fully featured HTTP client library for Python 3. It includes **an integrated command line client**, has support for both **HTTP/1.1 and HTTP/2**, and provides both **sync and async APIs**.
|
| 62 |
+
|
| 63 |
+
---
|
| 64 |
+
|
| 65 |
+
Install HTTPX using pip:
|
| 66 |
+
|
| 67 |
+
```shell
|
| 68 |
+
$ pip install httpx
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
Now, let's get started:
|
| 72 |
+
|
| 73 |
+
```pycon
|
| 74 |
+
>>> import httpx
|
| 75 |
+
>>> r = httpx.get('https://www.example.org/')
|
| 76 |
+
>>> r
|
| 77 |
+
<Response [200 OK]>
|
| 78 |
+
>>> r.status_code
|
| 79 |
+
200
|
| 80 |
+
>>> r.headers['content-type']
|
| 81 |
+
'text/html; charset=UTF-8'
|
| 82 |
+
>>> r.text
|
| 83 |
+
'<!doctype html>\n<html>\n<head>\n<title>Example Domain</title>...'
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
Or, using the command-line client.
|
| 87 |
+
|
| 88 |
+
```shell
|
| 89 |
+
$ pip install 'httpx[cli]' # The command line client is an optional dependency.
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
Which now allows us to use HTTPX directly from the command-line...
|
| 93 |
+
|
| 94 |
+
<p align="center">
|
| 95 |
+
<img width="700" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/httpx-help.png" alt='httpx --help'>
|
| 96 |
+
</p>
|
| 97 |
+
|
| 98 |
+
Sending a request...
|
| 99 |
+
|
| 100 |
+
<p align="center">
|
| 101 |
+
<img width="700" src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/httpx-request.png" alt='httpx http://httpbin.org/json'>
|
| 102 |
+
</p>
|
| 103 |
+
|
| 104 |
+
## Features
|
| 105 |
+
|
| 106 |
+
HTTPX builds on the well-established usability of `requests`, and gives you:
|
| 107 |
+
|
| 108 |
+
* A broadly [requests-compatible API](https://www.python-httpx.org/compatibility/).
|
| 109 |
+
* An integrated command-line client.
|
| 110 |
+
* HTTP/1.1 [and HTTP/2 support](https://www.python-httpx.org/http2/).
|
| 111 |
+
* Standard synchronous interface, but with [async support if you need it](https://www.python-httpx.org/async/).
|
| 112 |
+
* Ability to make requests directly to [WSGI applications](https://www.python-httpx.org/advanced/transports/#wsgi-transport) or [ASGI applications](https://www.python-httpx.org/advanced/transports/#asgi-transport).
|
| 113 |
+
* Strict timeouts everywhere.
|
| 114 |
+
* Fully type annotated.
|
| 115 |
+
* 100% test coverage.
|
| 116 |
+
|
| 117 |
+
Plus all the standard features of `requests`...
|
| 118 |
+
|
| 119 |
+
* International Domains and URLs
|
| 120 |
+
* Keep-Alive & Connection Pooling
|
| 121 |
+
* Sessions with Cookie Persistence
|
| 122 |
+
* Browser-style SSL Verification
|
| 123 |
+
* Basic/Digest Authentication
|
| 124 |
+
* Elegant Key/Value Cookies
|
| 125 |
+
* Automatic Decompression
|
| 126 |
+
* Automatic Content Decoding
|
| 127 |
+
* Unicode Response Bodies
|
| 128 |
+
* Multipart File Uploads
|
| 129 |
+
* HTTP(S) Proxy Support
|
| 130 |
+
* Connection Timeouts
|
| 131 |
+
* Streaming Downloads
|
| 132 |
+
* .netrc Support
|
| 133 |
+
* Chunked Requests
|
| 134 |
+
|
| 135 |
+
## Installation
|
| 136 |
+
|
| 137 |
+
Install with pip:
|
| 138 |
+
|
| 139 |
+
```shell
|
| 140 |
+
$ pip install httpx
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
Or, to include the optional HTTP/2 support, use:
|
| 144 |
+
|
| 145 |
+
```shell
|
| 146 |
+
$ pip install httpx[http2]
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
HTTPX requires Python 3.8+.
|
| 150 |
+
|
| 151 |
+
## Documentation
|
| 152 |
+
|
| 153 |
+
Project documentation is available at [https://www.python-httpx.org/](https://www.python-httpx.org/).
|
| 154 |
+
|
| 155 |
+
For a run-through of all the basics, head over to the [QuickStart](https://www.python-httpx.org/quickstart/).
|
| 156 |
+
|
| 157 |
+
For more advanced topics, see the [Advanced Usage](https://www.python-httpx.org/advanced/) section, the [async support](https://www.python-httpx.org/async/) section, or the [HTTP/2](https://www.python-httpx.org/http2/) section.
|
| 158 |
+
|
| 159 |
+
The [Developer Interface](https://www.python-httpx.org/api/) provides a comprehensive API reference.
|
| 160 |
+
|
| 161 |
+
To find out about tools that integrate with HTTPX, see [Third Party Packages](https://www.python-httpx.org/third_party_packages/).
|
| 162 |
+
|
| 163 |
+
## Contribute
|
| 164 |
+
|
| 165 |
+
If you want to contribute with HTTPX check out the [Contributing Guide](https://www.python-httpx.org/contributing/) to learn how to start.
|
| 166 |
+
|
| 167 |
+
## Dependencies
|
| 168 |
+
|
| 169 |
+
The HTTPX project relies on these excellent libraries:
|
| 170 |
+
|
| 171 |
+
* `httpcore` - The underlying transport implementation for `httpx`.
|
| 172 |
+
* `h11` - HTTP/1.1 support.
|
| 173 |
+
* `certifi` - SSL certificates.
|
| 174 |
+
* `idna` - Internationalized domain name support.
|
| 175 |
+
* `sniffio` - Async library autodetection.
|
| 176 |
+
|
| 177 |
+
As well as these optional installs:
|
| 178 |
+
|
| 179 |
+
* `h2` - HTTP/2 support. *(Optional, with `httpx[http2]`)*
|
| 180 |
+
* `socksio` - SOCKS proxy support. *(Optional, with `httpx[socks]`)*
|
| 181 |
+
* `rich` - Rich terminal support. *(Optional, with `httpx[cli]`)*
|
| 182 |
+
* `click` - Command line client support. *(Optional, with `httpx[cli]`)*
|
| 183 |
+
* `brotli` or `brotlicffi` - Decoding for "brotli" compressed responses. *(Optional, with `httpx[brotli]`)*
|
| 184 |
+
* `zstandard` - Decoding for "zstd" compressed responses. *(Optional, with `httpx[zstd]`)*
|
| 185 |
+
|
| 186 |
+
A huge amount of credit is due to `requests` for the API layout that
|
| 187 |
+
much of this work follows, as well as to `urllib3` for plenty of design
|
| 188 |
+
inspiration around the lower-level networking details.
|
| 189 |
+
|
| 190 |
+
---
|
| 191 |
+
|
| 192 |
+
<p align="center"><i>HTTPX is <a href="https://github.com/encode/httpx/blob/master/LICENSE.md">BSD licensed</a> code.<br/>Designed & crafted with care.</i><br/>— 🦋 —</p>
|
| 193 |
+
|
| 194 |
+
## Release Information
|
| 195 |
+
|
| 196 |
+
### Fixed
|
| 197 |
+
|
| 198 |
+
* Reintroduced supposedly-private `URLTypes` shortcut. (#2673)
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
|
| 203 |
+
[Full changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md)
|
lib/python3.11/site-packages/httpx-0.28.1.dist-info/RECORD
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
../../../bin/httpx,sha256=TnVk8oixUBVqGxN4q73HkJFvq5BegCZTOx4YFN1Ez_w,185
|
| 2 |
+
httpx-0.28.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 3 |
+
httpx-0.28.1.dist-info/METADATA,sha256=_rubD48-gNV8gZnDBPNcQzboWB0dGNeYPJJ2a4J5OyU,7052
|
| 4 |
+
httpx-0.28.1.dist-info/RECORD,,
|
| 5 |
+
httpx-0.28.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
| 6 |
+
httpx-0.28.1.dist-info/entry_points.txt,sha256=2lVkdQmxLA1pNMgSN2eV89o90HCZezhmNwsy6ryKDSA,37
|
| 7 |
+
httpx-0.28.1.dist-info/licenses/LICENSE.md,sha256=TsWdVE8StfU5o6cW_TIaxYzNgDC0ZSIfLIgCAM3yjY0,1508
|
| 8 |
+
httpx/__init__.py,sha256=CsaZe6yZj0rHg6322AWKWHGTMVr9txgEfD5P3_Rrz60,2171
|
| 9 |
+
httpx/__pycache__/__init__.cpython-311.pyc,,
|
| 10 |
+
httpx/__pycache__/__version__.cpython-311.pyc,,
|
| 11 |
+
httpx/__pycache__/_api.cpython-311.pyc,,
|
| 12 |
+
httpx/__pycache__/_auth.cpython-311.pyc,,
|
| 13 |
+
httpx/__pycache__/_client.cpython-311.pyc,,
|
| 14 |
+
httpx/__pycache__/_config.cpython-311.pyc,,
|
| 15 |
+
httpx/__pycache__/_content.cpython-311.pyc,,
|
| 16 |
+
httpx/__pycache__/_decoders.cpython-311.pyc,,
|
| 17 |
+
httpx/__pycache__/_exceptions.cpython-311.pyc,,
|
| 18 |
+
httpx/__pycache__/_main.cpython-311.pyc,,
|
| 19 |
+
httpx/__pycache__/_models.cpython-311.pyc,,
|
| 20 |
+
httpx/__pycache__/_multipart.cpython-311.pyc,,
|
| 21 |
+
httpx/__pycache__/_status_codes.cpython-311.pyc,,
|
| 22 |
+
httpx/__pycache__/_types.cpython-311.pyc,,
|
| 23 |
+
httpx/__pycache__/_urlparse.cpython-311.pyc,,
|
| 24 |
+
httpx/__pycache__/_urls.cpython-311.pyc,,
|
| 25 |
+
httpx/__pycache__/_utils.cpython-311.pyc,,
|
| 26 |
+
httpx/__version__.py,sha256=LoUyYeOXTieGzuP_64UL0wxdtxjuu_QbOvE7NOg-IqU,108
|
| 27 |
+
httpx/_api.py,sha256=r_Zgs4jIpcPJLqK5dbbSayqo_iVMKFaxZCd-oOHxLEs,11743
|
| 28 |
+
httpx/_auth.py,sha256=Yr3QwaUSK17rGYx-7j-FdicFIzz4Y9FFV-1F4-7RXX4,11891
|
| 29 |
+
httpx/_client.py,sha256=xD-UG67-WMkeltAAOeGGj-cZ2RRTAm19sWRxlFY7_40,65714
|
| 30 |
+
httpx/_config.py,sha256=pPp2U-wicfcKsF-KYRE1LYdt3e6ERGeIoXZ8Gjo3LWc,8547
|
| 31 |
+
httpx/_content.py,sha256=LGGzrJTR3OvN4Mb1GVVNLXkXJH-6oKlwAttO9p5w_yg,8161
|
| 32 |
+
httpx/_decoders.py,sha256=p0dX8I0NEHexs3UGp4SsZutiMhsXrrWl6-GnqVb0iKM,12041
|
| 33 |
+
httpx/_exceptions.py,sha256=bxW7fxzgVMAdNTbwT0Vnq04gJDW1_gI_GFiQPuMyjL0,8527
|
| 34 |
+
httpx/_main.py,sha256=Cg9GMabiTT_swaDfUgIRitSwxLRMSwUDOm7LdSGqlA4,15626
|
| 35 |
+
httpx/_models.py,sha256=4__Guyv1gLxuZChwim8kfQNiIOcJ9acreFOSurvZfms,44700
|
| 36 |
+
httpx/_multipart.py,sha256=KOHEZZl6oohg9mPaKyyu345qq1rJLg35TUG3YAzXB3Y,9843
|
| 37 |
+
httpx/_status_codes.py,sha256=DYn-2ufBgMeXy5s8x3_TB7wjAuAAMewTakPrm5rXEsc,5639
|
| 38 |
+
httpx/_transports/__init__.py,sha256=GbUoBSAOp7z-l-9j5YhMhR3DMIcn6FVLhj072O3Nnno,275
|
| 39 |
+
httpx/_transports/__pycache__/__init__.cpython-311.pyc,,
|
| 40 |
+
httpx/_transports/__pycache__/asgi.cpython-311.pyc,,
|
| 41 |
+
httpx/_transports/__pycache__/base.cpython-311.pyc,,
|
| 42 |
+
httpx/_transports/__pycache__/default.cpython-311.pyc,,
|
| 43 |
+
httpx/_transports/__pycache__/mock.cpython-311.pyc,,
|
| 44 |
+
httpx/_transports/__pycache__/wsgi.cpython-311.pyc,,
|
| 45 |
+
httpx/_transports/asgi.py,sha256=HRfiDYMPt4wQH2gFgHZg4c-i3sblo6bL5GTqcET-xz8,5501
|
| 46 |
+
httpx/_transports/base.py,sha256=kZS_VMbViYfF570pogUCJ1bulz-ybfL51Pqs9yktebU,2523
|
| 47 |
+
httpx/_transports/default.py,sha256=AzeaRUyVwCccTyyNJexDf0n1dFfzzydpdIQgvw7PLnk,13983
|
| 48 |
+
httpx/_transports/mock.py,sha256=PTo0d567RITXxGrki6kN7_67wwAxfwiMDcuXJiZCjEo,1232
|
| 49 |
+
httpx/_transports/wsgi.py,sha256=NcPX3Xap_EwCFZWO_OaSyQNuInCYx1QMNbO8GAei6jY,4825
|
| 50 |
+
httpx/_types.py,sha256=Jyh41GQq7AOev8IOWKDAg7zCbvHAfufmW5g_PiTtErY,2965
|
| 51 |
+
httpx/_urlparse.py,sha256=ZAmH47ONfkxrrj-PPYhGeiHjb6AjKCS-ANWIN4OL_KY,18546
|
| 52 |
+
httpx/_urls.py,sha256=dX99VR1DSOHpgo9Aq7PzYO4FKdxqKjwyNp8grf8dHN0,21550
|
| 53 |
+
httpx/_utils.py,sha256=_TVeqAKvxJkKHdz7dFeb4s0LZqQXgeFkXSgfiHBK_1o,8285
|
| 54 |
+
httpx/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
lib/python3.11/site-packages/httpx-0.28.1.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: hatchling 1.26.3
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
lib/python3.11/site-packages/httpx-0.28.1.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
httpx = httpx:main
|
lib/python3.11/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright © 2019, [Encode OSS Ltd](https://www.encode.io/).
|
| 2 |
+
All rights reserved.
|
| 3 |
+
|
| 4 |
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
| 5 |
+
|
| 6 |
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
| 7 |
+
|
| 8 |
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
| 9 |
+
|
| 10 |
+
* Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
| 11 |
+
|
| 12 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
lib/python3.11/site-packages/httpx/__init__.py
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .__version__ import __description__, __title__, __version__
|
| 2 |
+
from ._api import *
|
| 3 |
+
from ._auth import *
|
| 4 |
+
from ._client import *
|
| 5 |
+
from ._config import *
|
| 6 |
+
from ._content import *
|
| 7 |
+
from ._exceptions import *
|
| 8 |
+
from ._models import *
|
| 9 |
+
from ._status_codes import *
|
| 10 |
+
from ._transports import *
|
| 11 |
+
from ._types import *
|
| 12 |
+
from ._urls import *
|
| 13 |
+
|
| 14 |
+
try:
|
| 15 |
+
from ._main import main
|
| 16 |
+
except ImportError: # pragma: no cover
|
| 17 |
+
|
| 18 |
+
def main() -> None: # type: ignore
|
| 19 |
+
import sys
|
| 20 |
+
|
| 21 |
+
print(
|
| 22 |
+
"The httpx command line client could not run because the required "
|
| 23 |
+
"dependencies were not installed.\nMake sure you've installed "
|
| 24 |
+
"everything with: pip install 'httpx[cli]'"
|
| 25 |
+
)
|
| 26 |
+
sys.exit(1)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
__all__ = [
|
| 30 |
+
"__description__",
|
| 31 |
+
"__title__",
|
| 32 |
+
"__version__",
|
| 33 |
+
"ASGITransport",
|
| 34 |
+
"AsyncBaseTransport",
|
| 35 |
+
"AsyncByteStream",
|
| 36 |
+
"AsyncClient",
|
| 37 |
+
"AsyncHTTPTransport",
|
| 38 |
+
"Auth",
|
| 39 |
+
"BaseTransport",
|
| 40 |
+
"BasicAuth",
|
| 41 |
+
"ByteStream",
|
| 42 |
+
"Client",
|
| 43 |
+
"CloseError",
|
| 44 |
+
"codes",
|
| 45 |
+
"ConnectError",
|
| 46 |
+
"ConnectTimeout",
|
| 47 |
+
"CookieConflict",
|
| 48 |
+
"Cookies",
|
| 49 |
+
"create_ssl_context",
|
| 50 |
+
"DecodingError",
|
| 51 |
+
"delete",
|
| 52 |
+
"DigestAuth",
|
| 53 |
+
"get",
|
| 54 |
+
"head",
|
| 55 |
+
"Headers",
|
| 56 |
+
"HTTPError",
|
| 57 |
+
"HTTPStatusError",
|
| 58 |
+
"HTTPTransport",
|
| 59 |
+
"InvalidURL",
|
| 60 |
+
"Limits",
|
| 61 |
+
"LocalProtocolError",
|
| 62 |
+
"main",
|
| 63 |
+
"MockTransport",
|
| 64 |
+
"NetRCAuth",
|
| 65 |
+
"NetworkError",
|
| 66 |
+
"options",
|
| 67 |
+
"patch",
|
| 68 |
+
"PoolTimeout",
|
| 69 |
+
"post",
|
| 70 |
+
"ProtocolError",
|
| 71 |
+
"Proxy",
|
| 72 |
+
"ProxyError",
|
| 73 |
+
"put",
|
| 74 |
+
"QueryParams",
|
| 75 |
+
"ReadError",
|
| 76 |
+
"ReadTimeout",
|
| 77 |
+
"RemoteProtocolError",
|
| 78 |
+
"request",
|
| 79 |
+
"Request",
|
| 80 |
+
"RequestError",
|
| 81 |
+
"RequestNotRead",
|
| 82 |
+
"Response",
|
| 83 |
+
"ResponseNotRead",
|
| 84 |
+
"stream",
|
| 85 |
+
"StreamClosed",
|
| 86 |
+
"StreamConsumed",
|
| 87 |
+
"StreamError",
|
| 88 |
+
"SyncByteStream",
|
| 89 |
+
"Timeout",
|
| 90 |
+
"TimeoutException",
|
| 91 |
+
"TooManyRedirects",
|
| 92 |
+
"TransportError",
|
| 93 |
+
"UnsupportedProtocol",
|
| 94 |
+
"URL",
|
| 95 |
+
"USE_CLIENT_DEFAULT",
|
| 96 |
+
"WriteError",
|
| 97 |
+
"WriteTimeout",
|
| 98 |
+
"WSGITransport",
|
| 99 |
+
]
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
__locals = locals()
|
| 103 |
+
for __name in __all__:
|
| 104 |
+
if not __name.startswith("__"):
|
| 105 |
+
setattr(__locals[__name], "__module__", "httpx") # noqa
|
lib/python3.11/site-packages/httpx/__pycache__/__init__.cpython-311.pyc
ADDED
|
Binary file (2.38 kB). View file
|
|
|
lib/python3.11/site-packages/httpx/__pycache__/__version__.cpython-311.pyc
ADDED
|
Binary file (313 Bytes). View file
|
|
|
lib/python3.11/site-packages/httpx/__pycache__/_api.cpython-311.pyc
ADDED
|
Binary file (9.71 kB). View file
|
|
|
lib/python3.11/site-packages/httpx/__pycache__/_auth.cpython-311.pyc
ADDED
|
Binary file (17.1 kB). View file
|
|
|