py2docfx 0.1.20rc2196756__py3-none-any.whl → 0.1.21__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. py2docfx/convert_prepare/get_source.py +1 -1
  2. py2docfx/convert_prepare/package_info.py +37 -27
  3. py2docfx/convert_prepare/tests/test_get_source.py +3 -1
  4. py2docfx/convert_prepare/tests/test_package_info.py +159 -1
  5. py2docfx/docfx_yaml/build_finished.py +1 -1
  6. py2docfx/docfx_yaml/logger.py +42 -28
  7. py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/api.py +3 -2
  8. py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/legacy.py +17 -1
  9. py2docfx/venv/basevenv/Lib/site-packages/charset_normalizer/version.py +1 -1
  10. py2docfx/venv/basevenv/Lib/site-packages/requests/__version__.py +2 -2
  11. py2docfx/venv/basevenv/Lib/site-packages/requests/adapters.py +17 -40
  12. py2docfx/venv/basevenv/Lib/site-packages/requests/sessions.py +1 -1
  13. py2docfx/venv/venv1/Lib/site-packages/azure/core/_version.py +1 -1
  14. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication.py +21 -9
  15. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_authentication_async.py +21 -9
  16. py2docfx/venv/venv1/Lib/site-packages/azure/core/pipeline/policies/_retry.py +1 -1
  17. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_bearer_token_provider.py +1 -1
  18. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/authorization_code.py +1 -1
  19. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azd_cli.py +82 -17
  20. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_cli.py +28 -5
  21. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/azure_powershell.py +28 -4
  22. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/broker.py +79 -0
  23. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/chained.py +9 -3
  24. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/default.py +153 -53
  25. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/imds.py +25 -1
  26. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/shared_cache.py +12 -5
  27. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/vscode.py +163 -144
  28. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_credentials/workload_identity.py +23 -12
  29. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/__init__.py +4 -0
  30. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/interactive.py +14 -2
  31. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/pipeline.py +4 -2
  32. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/utils.py +96 -0
  33. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_version.py +1 -1
  34. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_bearer_token_provider.py +3 -3
  35. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/authorization_code.py +1 -1
  36. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azd_cli.py +32 -13
  37. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_cli.py +26 -5
  38. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/azure_powershell.py +13 -2
  39. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/chained.py +1 -1
  40. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/default.py +120 -55
  41. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/imds.py +27 -1
  42. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/on_behalf_of.py +1 -1
  43. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/shared_cache.py +12 -5
  44. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/vscode.py +15 -67
  45. py2docfx/venv/venv1/Lib/site-packages/azure/identity/aio/_credentials/workload_identity.py +17 -13
  46. py2docfx/venv/venv1/Lib/site-packages/cffi/__init__.py +2 -2
  47. py2docfx/venv/venv1/Lib/site-packages/cffi/cparser.py +1 -1
  48. py2docfx/venv/venv1/Lib/site-packages/cffi/recompiler.py +5 -5
  49. py2docfx/venv/venv1/Lib/site-packages/cffi/setuptools_ext.py +13 -0
  50. py2docfx/venv/venv1/Lib/site-packages/cffi/vengine_cpy.py +3 -0
  51. py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/api.py +3 -2
  52. py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/legacy.py +17 -1
  53. py2docfx/venv/venv1/Lib/site-packages/charset_normalizer/version.py +1 -1
  54. py2docfx/venv/venv1/Lib/site-packages/cryptography/__about__.py +1 -1
  55. py2docfx/venv/venv1/Lib/site-packages/cryptography/__init__.py +0 -13
  56. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/_oid.py +8 -0
  57. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/asn1/__init__.py +10 -0
  58. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/asn1/asn1.py +116 -0
  59. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/backends/openssl/backend.py +3 -9
  60. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/declarative_asn1.pyi +32 -0
  61. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi +23 -0
  62. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi +1 -13
  63. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/openssl/_conditional.py +16 -0
  64. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/bindings/openssl/binding.py +16 -1
  65. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py +0 -2
  66. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py +8 -0
  67. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py +0 -47
  68. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/kdf/hkdf.py +6 -91
  69. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/kdf/kbkdf.py +1 -3
  70. py2docfx/venv/venv1/Lib/site-packages/cryptography/hazmat/primitives/serialization/ssh.py +1 -1
  71. py2docfx/venv/venv1/Lib/site-packages/cryptography/utils.py +0 -2
  72. py2docfx/venv/venv1/Lib/site-packages/cryptography/x509/name.py +2 -3
  73. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/__init__.py +1 -1
  74. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/any_pb2.py +2 -2
  75. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/api_pb2.py +12 -8
  76. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/compiler/plugin_pb2.py +2 -2
  77. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor.py +398 -246
  78. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor_pb2.py +74 -72
  79. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/descriptor_pool.py +5 -4
  80. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/duration_pb2.py +2 -2
  81. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/empty_pb2.py +2 -2
  82. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/field_mask_pb2.py +2 -2
  83. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/api_implementation.py +0 -6
  84. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/extension_dict.py +3 -3
  85. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/field_mask.py +3 -3
  86. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/python_edition_defaults.py +1 -1
  87. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/python_message.py +10 -2
  88. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/internal/type_checkers.py +47 -5
  89. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/json_format.py +55 -32
  90. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/runtime_version.py +6 -26
  91. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/source_context_pb2.py +2 -2
  92. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/struct_pb2.py +2 -2
  93. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/text_format.py +30 -19
  94. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/timestamp_pb2.py +2 -2
  95. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/type_pb2.py +2 -2
  96. py2docfx/venv/venv1/Lib/site-packages/google/protobuf/wrappers_pb2.py +2 -2
  97. py2docfx/venv/venv1/Lib/site-packages/psutil/__init__.py +39 -19
  98. py2docfx/venv/venv1/Lib/site-packages/psutil/_common.py +3 -5
  99. py2docfx/venv/venv1/Lib/site-packages/psutil/_psaix.py +1 -2
  100. py2docfx/venv/venv1/Lib/site-packages/psutil/_psbsd.py +53 -78
  101. py2docfx/venv/venv1/Lib/site-packages/psutil/_pslinux.py +55 -38
  102. py2docfx/venv/venv1/Lib/site-packages/psutil/_psosx.py +40 -12
  103. py2docfx/venv/venv1/Lib/site-packages/psutil/_psposix.py +0 -1
  104. py2docfx/venv/venv1/Lib/site-packages/psutil/_pssunos.py +1 -2
  105. py2docfx/venv/venv1/Lib/site-packages/psutil/_pswindows.py +33 -13
  106. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/__init__.py +185 -122
  107. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/__main__.py +2 -3
  108. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_bsd.py +5 -10
  109. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_connections.py +3 -4
  110. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_contracts.py +41 -45
  111. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_linux.py +35 -38
  112. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_memleaks.py +4 -8
  113. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_misc.py +6 -12
  114. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_osx.py +17 -8
  115. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_posix.py +29 -17
  116. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process.py +74 -75
  117. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_process_all.py +11 -13
  118. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_scripts.py +2 -3
  119. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_sudo.py +117 -0
  120. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_system.py +21 -31
  121. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_testutils.py +23 -23
  122. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_unicode.py +15 -8
  123. py2docfx/venv/venv1/Lib/site-packages/psutil/tests/test_windows.py +65 -33
  124. py2docfx/venv/venv1/Lib/site-packages/pycparser/__init__.py +1 -1
  125. py2docfx/venv/venv1/Lib/site-packages/pycparser/c_generator.py +1 -1
  126. py2docfx/venv/venv1/Lib/site-packages/pycparser/c_lexer.py +14 -0
  127. py2docfx/venv/venv1/Lib/site-packages/pycparser/c_parser.py +30 -7
  128. py2docfx/venv/venv1/Lib/site-packages/pycparser/lextab.py +1 -1
  129. py2docfx/venv/venv1/Lib/site-packages/pycparser/yacctab.py +132 -127
  130. py2docfx/venv/venv1/Lib/site-packages/requests/__version__.py +2 -2
  131. py2docfx/venv/venv1/Lib/site-packages/requests/adapters.py +17 -40
  132. py2docfx/venv/venv1/Lib/site-packages/requests/sessions.py +1 -1
  133. py2docfx/venv/venv1/Lib/site-packages/typing_extensions.py +91 -18
  134. {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dist-info}/METADATA +1 -1
  135. {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dist-info}/RECORD +137 -135
  136. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/linux_vscode_adapter.py +0 -100
  137. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/macos_vscode_adapter.py +0 -34
  138. py2docfx/venv/venv1/Lib/site-packages/azure/identity/_internal/win_vscode_adapter.py +0 -77
  139. {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dist-info}/WHEEL +0 -0
  140. {py2docfx-0.1.20rc2196756.dist-info → py2docfx-0.1.21.dist-info}/top_level.txt +0 -0
@@ -81,6 +81,12 @@ def cryptography_has_tlsv13_hs_functions() -> list[str]:
81
81
  ]
82
82
 
83
83
 
84
+ def cryptography_has_ssl_verify_client_post_handshake() -> list[str]:
85
+ return [
86
+ "SSL_verify_client_post_handshake",
87
+ ]
88
+
89
+
84
90
  def cryptography_has_engine() -> list[str]:
85
91
  return [
86
92
  "ENGINE_by_id",
@@ -155,6 +161,10 @@ def cryptography_has_get_extms_support() -> list[str]:
155
161
  return ["SSL_get_extms_support"]
156
162
 
157
163
 
164
+ def cryptography_has_ssl_get0_group_name() -> list[str]:
165
+ return ["SSL_get0_group_name"]
166
+
167
+
158
168
  # This is a mapping of
159
169
  # {condition: function-returning-names-dependent-on-that-condition} so we can
160
170
  # loop over them and delete unsupported names at runtime. It will be removed
@@ -172,6 +182,9 @@ CONDITIONAL_NAMES = {
172
182
  "Cryptography_HAS_TLSv1_3_HS_FUNCTIONS": (
173
183
  cryptography_has_tlsv13_hs_functions
174
184
  ),
185
+ "Cryptography_HAS_SSL_VERIFY_CLIENT_POST_HANDSHAKE": (
186
+ cryptography_has_ssl_verify_client_post_handshake
187
+ ),
175
188
  "Cryptography_HAS_ENGINE": cryptography_has_engine,
176
189
  "Cryptography_HAS_VERIFIED_CHAIN": cryptography_has_verified_chain,
177
190
  "Cryptography_HAS_SRTP": cryptography_has_srtp,
@@ -188,4 +201,7 @@ CONDITIONAL_NAMES = {
188
201
  cryptography_has_ssl_op_ignore_unexpected_eof
189
202
  ),
190
203
  "Cryptography_HAS_GET_EXTMS_SUPPORT": cryptography_has_get_extms_support,
204
+ "Cryptography_HAS_SSL_GET0_GROUP_NAME": (
205
+ cryptography_has_ssl_get0_group_name
206
+ ),
191
207
  }
@@ -16,6 +16,7 @@ import cryptography
16
16
  from cryptography.exceptions import InternalError
17
17
  from cryptography.hazmat.bindings._rust import _openssl, openssl
18
18
  from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES
19
+ from cryptography.utils import CryptographyDeprecationWarning
19
20
 
20
21
 
21
22
  def _openssl_assert(ok: bool) -> None:
@@ -57,7 +58,7 @@ class Binding:
57
58
  OpenSSL API wrapper.
58
59
  """
59
60
 
60
- lib: typing.ClassVar = None
61
+ lib: typing.ClassVar[typing.Any] = None
61
62
  ffi = _openssl.ffi
62
63
  _lib_loaded = False
63
64
  _init_lock = threading.Lock()
@@ -120,3 +121,17 @@ if (
120
121
  UserWarning,
121
122
  stacklevel=2,
122
123
  )
124
+
125
+ if (
126
+ not openssl.CRYPTOGRAPHY_IS_LIBRESSL
127
+ and not openssl.CRYPTOGRAPHY_IS_BORINGSSL
128
+ and not openssl.CRYPTOGRAPHY_IS_AWSLC
129
+ and not openssl.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER
130
+ ):
131
+ warnings.warn(
132
+ "You are using OpenSSL < 3.0. Support for OpenSSL < 3.0 is deprecated "
133
+ "and will be removed in the next release. Please upgrade to OpenSSL "
134
+ "3.0 or later.",
135
+ CryptographyDeprecationWarning,
136
+ stacklevel=2,
137
+ )
@@ -91,8 +91,6 @@ class MGF(metaclass=abc.ABCMeta):
91
91
 
92
92
 
93
93
  class MGF1(MGF):
94
- MAX_LENGTH = _MaxLength()
95
-
96
94
  def __init__(self, algorithm: hashes.HashAlgorithm):
97
95
  if not isinstance(algorithm, hashes.HashAlgorithm):
98
96
  raise TypeError("Expected instance of hashes.HashAlgorithm.")
@@ -184,6 +184,8 @@ def rsa_crt_iqmp(p: int, q: int) -> int:
184
184
  """
185
185
  Compute the CRT (q ** -1) % p value from RSA primes p and q.
186
186
  """
187
+ if p <= 1 or q <= 1:
188
+ raise ValueError("Values can't be <= 1")
187
189
  return _modinv(q, p)
188
190
 
189
191
 
@@ -192,6 +194,8 @@ def rsa_crt_dmp1(private_exponent: int, p: int) -> int:
192
194
  Compute the CRT private_exponent % (p - 1) value from the RSA
193
195
  private_exponent (d) and p.
194
196
  """
197
+ if private_exponent <= 1 or p <= 1:
198
+ raise ValueError("Values can't be <= 1")
195
199
  return private_exponent % (p - 1)
196
200
 
197
201
 
@@ -200,6 +204,8 @@ def rsa_crt_dmq1(private_exponent: int, q: int) -> int:
200
204
  Compute the CRT private_exponent % (q - 1) value from the RSA
201
205
  private_exponent (d) and q.
202
206
  """
207
+ if private_exponent <= 1 or q <= 1:
208
+ raise ValueError("Values can't be <= 1")
203
209
  return private_exponent % (q - 1)
204
210
 
205
211
 
@@ -220,6 +226,8 @@ def rsa_recover_private_exponent(e: int, p: int, q: int) -> int:
220
226
  #
221
227
  # TODO: Replace with lcm(p - 1, q - 1) once the minimum
222
228
  # supported Python version is >= 3.9.
229
+ if e <= 1 or p <= 1 or q <= 1:
230
+ raise ValueError("Values can't be <= 1")
223
231
  lambda_n = (p - 1) * (q - 1) // gcd(p - 1, q - 1)
224
232
  return _modinv(e, lambda_n)
225
233
 
@@ -100,53 +100,6 @@ utils.deprecated(
100
100
  name="TripleDES",
101
101
  )
102
102
 
103
- utils.deprecated(
104
- Blowfish,
105
- __name__,
106
- "Blowfish has been moved to "
107
- "cryptography.hazmat.decrepit.ciphers.algorithms.Blowfish and "
108
- "will be removed from "
109
- "cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
110
- utils.DeprecatedIn37,
111
- name="Blowfish",
112
- )
113
-
114
-
115
- utils.deprecated(
116
- CAST5,
117
- __name__,
118
- "CAST5 has been moved to "
119
- "cryptography.hazmat.decrepit.ciphers.algorithms.CAST5 and "
120
- "will be removed from "
121
- "cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
122
- utils.DeprecatedIn37,
123
- name="CAST5",
124
- )
125
-
126
-
127
- utils.deprecated(
128
- IDEA,
129
- __name__,
130
- "IDEA has been moved to "
131
- "cryptography.hazmat.decrepit.ciphers.algorithms.IDEA and "
132
- "will be removed from "
133
- "cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
134
- utils.DeprecatedIn37,
135
- name="IDEA",
136
- )
137
-
138
-
139
- utils.deprecated(
140
- SEED,
141
- __name__,
142
- "SEED has been moved to "
143
- "cryptography.hazmat.decrepit.ciphers.algorithms.SEED and "
144
- "will be removed from "
145
- "cryptography.hazmat.primitives.ciphers.algorithms in 45.0.0.",
146
- utils.DeprecatedIn37,
147
- name="SEED",
148
- )
149
-
150
103
 
151
104
  class ChaCha20(CipherAlgorithm):
152
105
  name = "ChaCha20"
@@ -4,98 +4,13 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
- import typing
8
-
9
- from cryptography import utils
10
- from cryptography.exceptions import AlreadyFinalized, InvalidKey
11
- from cryptography.hazmat.primitives import constant_time, hashes, hmac
7
+ from cryptography.hazmat.bindings._rust import openssl as rust_openssl
12
8
  from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
13
9
 
10
+ HKDF = rust_openssl.kdf.HKDF
11
+ HKDFExpand = rust_openssl.kdf.HKDFExpand
14
12
 
15
- class HKDF(KeyDerivationFunction):
16
- def __init__(
17
- self,
18
- algorithm: hashes.HashAlgorithm,
19
- length: int,
20
- salt: bytes | None,
21
- info: bytes | None,
22
- backend: typing.Any = None,
23
- ):
24
- self._algorithm = algorithm
25
-
26
- if salt is None:
27
- salt = b"\x00" * self._algorithm.digest_size
28
- else:
29
- utils._check_bytes("salt", salt)
30
-
31
- self._salt = salt
32
-
33
- self._hkdf_expand = HKDFExpand(self._algorithm, length, info)
34
-
35
- def _extract(self, key_material: utils.Buffer) -> bytes:
36
- h = hmac.HMAC(self._salt, self._algorithm)
37
- h.update(key_material)
38
- return h.finalize()
39
-
40
- def derive(self, key_material: utils.Buffer) -> bytes:
41
- utils._check_byteslike("key_material", key_material)
42
- return self._hkdf_expand.derive(self._extract(key_material))
43
-
44
- def verify(self, key_material: bytes, expected_key: bytes) -> None:
45
- if not constant_time.bytes_eq(self.derive(key_material), expected_key):
46
- raise InvalidKey
47
-
48
-
49
- class HKDFExpand(KeyDerivationFunction):
50
- def __init__(
51
- self,
52
- algorithm: hashes.HashAlgorithm,
53
- length: int,
54
- info: bytes | None,
55
- backend: typing.Any = None,
56
- ):
57
- self._algorithm = algorithm
58
-
59
- max_length = 255 * algorithm.digest_size
60
-
61
- if length > max_length:
62
- raise ValueError(
63
- f"Cannot derive keys larger than {max_length} octets."
64
- )
65
-
66
- self._length = length
67
-
68
- if info is None:
69
- info = b""
70
- else:
71
- utils._check_bytes("info", info)
72
-
73
- self._info = info
74
-
75
- self._used = False
76
-
77
- def _expand(self, key_material: utils.Buffer) -> bytes:
78
- output = [b""]
79
- counter = 1
80
-
81
- while self._algorithm.digest_size * (len(output) - 1) < self._length:
82
- h = hmac.HMAC(key_material, self._algorithm)
83
- h.update(output[-1])
84
- h.update(self._info)
85
- h.update(bytes([counter]))
86
- output.append(h.finalize())
87
- counter += 1
88
-
89
- return b"".join(output)[: self._length]
90
-
91
- def derive(self, key_material: utils.Buffer) -> bytes:
92
- utils._check_byteslike("key_material", key_material)
93
- if self._used:
94
- raise AlreadyFinalized
95
-
96
- self._used = True
97
- return self._expand(key_material)
13
+ KeyDerivationFunction.register(HKDF)
14
+ KeyDerivationFunction.register(HKDFExpand)
98
15
 
99
- def verify(self, key_material: bytes, expected_key: bytes) -> None:
100
- if not constant_time.bytes_eq(self.derive(key_material), expected_key):
101
- raise InvalidKey
16
+ __all__ = ["HKDF", "HKDFExpand"]
@@ -117,9 +117,7 @@ class _KBKDFDeriver:
117
117
  raise TypeError("value must be of type int")
118
118
 
119
119
  value_bin = utils.int_to_bytes(1, value)
120
- if not 1 <= len(value_bin) <= 4:
121
- return False
122
- return True
120
+ return 1 <= len(value_bin) <= 4
123
121
 
124
122
  def derive(
125
123
  self, key_material: utils.Buffer, prf_output_size: int
@@ -1124,7 +1124,7 @@ def _load_ssh_public_identity(
1124
1124
 
1125
1125
 
1126
1126
  def load_ssh_public_identity(
1127
- data: bytes,
1127
+ data: utils.Buffer,
1128
1128
  ) -> SSHCertificate | SSHPublicKeyTypes:
1129
1129
  return _load_ssh_public_identity(data)
1130
1130
 
@@ -22,12 +22,10 @@ class CryptographyDeprecationWarning(UserWarning):
22
22
  # ubiquity of their use. They should not be removed until we agree on when that
23
23
  # cycle ends.
24
24
  DeprecatedIn36 = CryptographyDeprecationWarning
25
- DeprecatedIn37 = CryptographyDeprecationWarning
26
25
  DeprecatedIn40 = CryptographyDeprecationWarning
27
26
  DeprecatedIn41 = CryptographyDeprecationWarning
28
27
  DeprecatedIn42 = CryptographyDeprecationWarning
29
28
  DeprecatedIn43 = CryptographyDeprecationWarning
30
- DeprecatedIn45 = CryptographyDeprecationWarning
31
29
 
32
30
 
33
31
  # If you're wondering why we don't use `Buffer`, it's because `Buffer` would
@@ -144,9 +144,8 @@ class NameAttribute(typing.Generic[NameAttributeValueType]):
144
144
  )
145
145
  if not isinstance(value, bytes):
146
146
  raise TypeError("value must be bytes for BitString")
147
- else:
148
- if not isinstance(value, str):
149
- raise TypeError("value argument must be a str")
147
+ elif not isinstance(value, str):
148
+ raise TypeError("value argument must be a str")
150
149
 
151
150
  length_limits = _NAMEOID_LENGTH_LIMIT.get(oid)
152
151
  if length_limits is not None:
@@ -7,4 +7,4 @@
7
7
 
8
8
  # Copyright 2007 Google Inc. All Rights Reserved.
9
9
 
10
- __version__ = '6.31.1'
10
+ __version__ = '6.32.1'
@@ -2,7 +2,7 @@
2
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
3
3
  # NO CHECKED-IN PROTOBUF GENCODE
4
4
  # source: google/protobuf/any.proto
5
- # Protobuf Python Version: 6.31.1
5
+ # Protobuf Python Version: 6.32.1
6
6
  """Generated protocol buffer code."""
7
7
  from google.protobuf import descriptor as _descriptor
8
8
  from google.protobuf import descriptor_pool as _descriptor_pool
@@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder
12
12
  _runtime_version.ValidateProtobufRuntimeVersion(
13
13
  _runtime_version.Domain.PUBLIC,
14
14
  6,
15
- 31,
15
+ 32,
16
16
  1,
17
17
  '',
18
18
  'google/protobuf/any.proto'
@@ -2,7 +2,7 @@
2
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
3
3
  # NO CHECKED-IN PROTOBUF GENCODE
4
4
  # source: google/protobuf/api.proto
5
- # Protobuf Python Version: 6.31.1
5
+ # Protobuf Python Version: 6.32.1
6
6
  """Generated protocol buffer code."""
7
7
  from google.protobuf import descriptor as _descriptor
8
8
  from google.protobuf import descriptor_pool as _descriptor_pool
@@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder
12
12
  _runtime_version.ValidateProtobufRuntimeVersion(
13
13
  _runtime_version.Domain.PUBLIC,
14
14
  6,
15
- 31,
15
+ 32,
16
16
  1,
17
17
  '',
18
18
  'google/protobuf/api.proto'
@@ -26,7 +26,7 @@ from google.protobuf import source_context_pb2 as google_dot_protobuf_dot_source
26
26
  from google.protobuf import type_pb2 as google_dot_protobuf_dot_type__pb2
27
27
 
28
28
 
29
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobuf/api.proto\x12\x0fgoogle.protobuf\x1a$google/protobuf/source_context.proto\x1a\x1agoogle/protobuf/type.proto\"\xc1\x02\n\x03\x41pi\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x31\n\x07methods\x18\x02 \x03(\x0b\x32\x17.google.protobuf.MethodR\x07methods\x12\x31\n\x07options\x18\x03 \x03(\x0b\x32\x17.google.protobuf.OptionR\x07options\x12\x18\n\x07version\x18\x04 \x01(\tR\x07version\x12\x45\n\x0esource_context\x18\x05 \x01(\x0b\x32\x1e.google.protobuf.SourceContextR\rsourceContext\x12.\n\x06mixins\x18\x06 \x03(\x0b\x32\x16.google.protobuf.MixinR\x06mixins\x12/\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.SyntaxR\x06syntax\"\xb2\x02\n\x06Method\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x10request_type_url\x18\x02 \x01(\tR\x0erequestTypeUrl\x12+\n\x11request_streaming\x18\x03 \x01(\x08R\x10requestStreaming\x12*\n\x11response_type_url\x18\x04 \x01(\tR\x0fresponseTypeUrl\x12-\n\x12response_streaming\x18\x05 \x01(\x08R\x11responseStreaming\x12\x31\n\x07options\x18\x06 \x03(\x0b\x32\x17.google.protobuf.OptionR\x07options\x12/\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.SyntaxR\x06syntax\"/\n\x05Mixin\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n\x04root\x18\x02 \x01(\tR\x04rootBv\n\x13\x63om.google.protobufB\x08\x41piProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3')
29
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobuf/api.proto\x12\x0fgoogle.protobuf\x1a$google/protobuf/source_context.proto\x1a\x1agoogle/protobuf/type.proto\"\xdb\x02\n\x03\x41pi\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x31\n\x07methods\x18\x02 \x03(\x0b\x32\x17.google.protobuf.MethodR\x07methods\x12\x31\n\x07options\x18\x03 \x03(\x0b\x32\x17.google.protobuf.OptionR\x07options\x12\x18\n\x07version\x18\x04 \x01(\tR\x07version\x12\x45\n\x0esource_context\x18\x05 \x01(\x0b\x32\x1e.google.protobuf.SourceContextR\rsourceContext\x12.\n\x06mixins\x18\x06 \x03(\x0b\x32\x16.google.protobuf.MixinR\x06mixins\x12/\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.SyntaxR\x06syntax\x12\x18\n\x07\x65\x64ition\x18\x08 \x01(\tR\x07\x65\x64ition\"\xd4\x02\n\x06Method\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x10request_type_url\x18\x02 \x01(\tR\x0erequestTypeUrl\x12+\n\x11request_streaming\x18\x03 \x01(\x08R\x10requestStreaming\x12*\n\x11response_type_url\x18\x04 \x01(\tR\x0fresponseTypeUrl\x12-\n\x12response_streaming\x18\x05 \x01(\x08R\x11responseStreaming\x12\x31\n\x07options\x18\x06 \x03(\x0b\x32\x17.google.protobuf.OptionR\x07options\x12\x33\n\x06syntax\x18\x07 \x01(\x0e\x32\x17.google.protobuf.SyntaxB\x02\x18\x01R\x06syntax\x12\x1c\n\x07\x65\x64ition\x18\x08 \x01(\tB\x02\x18\x01R\x07\x65\x64ition\"/\n\x05Mixin\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x12\n\x04root\x18\x02 \x01(\tR\x04rootBv\n\x13\x63om.google.protobufB\x08\x41piProtoP\x01Z,google.golang.org/protobuf/types/known/apipb\xa2\x02\x03GPB\xaa\x02\x1eGoogle.Protobuf.WellKnownTypesb\x06proto3')
30
30
 
31
31
  _globals = globals()
32
32
  _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
@@ -34,10 +34,14 @@ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.api_pb2', _
34
34
  if not _descriptor._USE_C_DESCRIPTORS:
35
35
  _globals['DESCRIPTOR']._loaded_options = None
36
36
  _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\010ApiProtoP\001Z,google.golang.org/protobuf/types/known/apipb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
37
+ _globals['_METHOD'].fields_by_name['syntax']._loaded_options = None
38
+ _globals['_METHOD'].fields_by_name['syntax']._serialized_options = b'\030\001'
39
+ _globals['_METHOD'].fields_by_name['edition']._loaded_options = None
40
+ _globals['_METHOD'].fields_by_name['edition']._serialized_options = b'\030\001'
37
41
  _globals['_API']._serialized_start=113
38
- _globals['_API']._serialized_end=434
39
- _globals['_METHOD']._serialized_start=437
40
- _globals['_METHOD']._serialized_end=743
41
- _globals['_MIXIN']._serialized_start=745
42
- _globals['_MIXIN']._serialized_end=792
42
+ _globals['_API']._serialized_end=460
43
+ _globals['_METHOD']._serialized_start=463
44
+ _globals['_METHOD']._serialized_end=803
45
+ _globals['_MIXIN']._serialized_start=805
46
+ _globals['_MIXIN']._serialized_end=852
43
47
  # @@protoc_insertion_point(module_scope)
@@ -2,7 +2,7 @@
2
2
  # Generated by the protocol buffer compiler. DO NOT EDIT!
3
3
  # NO CHECKED-IN PROTOBUF GENCODE
4
4
  # source: google/protobuf/compiler/plugin.proto
5
- # Protobuf Python Version: 6.31.1
5
+ # Protobuf Python Version: 6.32.1
6
6
  """Generated protocol buffer code."""
7
7
  from google.protobuf import descriptor as _descriptor
8
8
  from google.protobuf import descriptor_pool as _descriptor_pool
@@ -12,7 +12,7 @@ from google.protobuf.internal import builder as _builder
12
12
  _runtime_version.ValidateProtobufRuntimeVersion(
13
13
  _runtime_version.Domain.PUBLIC,
14
14
  6,
15
- 31,
15
+ 32,
16
16
  1,
17
17
  '',
18
18
  'google/protobuf/compiler/plugin.proto'