mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Bump to ruff 0.9 (#12259)
This commit is contained in:
parent
92f3693ae3
commit
4c8aa4e3b5
12 changed files with 33 additions and 66 deletions
|
|
@ -204,7 +204,7 @@ requests==2.32.3 ; python_full_version >= '3.8'
|
|||
# via
|
||||
# sphinx
|
||||
# sphinxcontrib-spelling
|
||||
ruff==0.8.6
|
||||
ruff==0.9.0
|
||||
# via cryptography (pyproject.toml)
|
||||
six==1.17.0 ; python_full_version < '3.8'
|
||||
# via bleach
|
||||
|
|
|
|||
|
|
@ -126,8 +126,7 @@ class KeySerializationEncryptionBuilder:
|
|||
) -> KeySerializationEncryptionBuilder:
|
||||
if self._format is not PrivateFormat.PKCS12:
|
||||
raise TypeError(
|
||||
"key_cert_algorithm only supported with "
|
||||
"PrivateFormat.PKCS12"
|
||||
"key_cert_algorithm only supported with PrivateFormat.PKCS12"
|
||||
)
|
||||
if self._key_cert_algorithm is not None:
|
||||
raise ValueError("key_cert_algorithm already set")
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class HOTP:
|
|||
try:
|
||||
ctx.update(counter.to_bytes(length=8, byteorder="big"))
|
||||
except OverflowError:
|
||||
raise ValueError(f"Counter must be between 0 and {2 ** 64 - 1}.")
|
||||
raise ValueError(f"Counter must be between 0 and {2**64 - 1}.")
|
||||
|
||||
hmac_value = ctx.finalize()
|
||||
|
||||
|
|
|
|||
|
|
@ -511,8 +511,7 @@ class CertificateBuilder:
|
|||
time = _convert_to_naive_utc_time(time)
|
||||
if time < _EARLIEST_UTC_TIME:
|
||||
raise ValueError(
|
||||
"The not valid after date must be on or after"
|
||||
" 1950 January 1."
|
||||
"The not valid after date must be on or after 1950 January 1."
|
||||
)
|
||||
if (
|
||||
self._not_valid_before is not None
|
||||
|
|
|
|||
|
|
@ -451,8 +451,7 @@ class BasicConstraints(ExtensionType):
|
|||
|
||||
def __repr__(self) -> str:
|
||||
return (
|
||||
f"<BasicConstraints(ca={self.ca}, "
|
||||
f"path_length={self.path_length})>"
|
||||
f"<BasicConstraints(ca={self.ca}, path_length={self.path_length})>"
|
||||
)
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
|
|
@ -823,8 +822,7 @@ class CertificatePolicies(ExtensionType):
|
|||
policies = list(policies)
|
||||
if not all(isinstance(x, PolicyInformation) for x in policies):
|
||||
raise TypeError(
|
||||
"Every item in the policies list must be a "
|
||||
"PolicyInformation"
|
||||
"Every item in the policies list must be a PolicyInformation"
|
||||
)
|
||||
|
||||
self._policies = policies
|
||||
|
|
@ -2450,10 +2448,7 @@ class UnrecognizedExtension(ExtensionType):
|
|||
return self._value
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return (
|
||||
f"<UnrecognizedExtension(oid={self.oid}, "
|
||||
f"value={self.value!r})>"
|
||||
)
|
||||
return f"<UnrecognizedExtension(oid={self.oid}, value={self.value!r})>"
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if not isinstance(other, UnrecognizedExtension):
|
||||
|
|
|
|||
|
|
@ -109,8 +109,7 @@ class _SingleResponse:
|
|||
revocation_time = _convert_to_naive_utc_time(revocation_time)
|
||||
if revocation_time < _EARLIEST_UTC_TIME:
|
||||
raise ValueError(
|
||||
"The revocation_time must be on or after"
|
||||
" 1950 January 1."
|
||||
"The revocation_time must be on or after 1950 January 1."
|
||||
)
|
||||
|
||||
if revocation_reason is not None and not isinstance(
|
||||
|
|
|
|||
|
|
@ -250,8 +250,7 @@ EC_KEY_SECP256K1 = ec.EllipticCurvePrivateNumbers(
|
|||
|
||||
EC_KEY_SECP224R1 = ec.EllipticCurvePrivateNumbers(
|
||||
private_value=int(
|
||||
"234854340492774342642505519082413233282383066880756900834047566251"
|
||||
"50"
|
||||
"23485434049277434264250551908241323328238306688075690083404756625150"
|
||||
),
|
||||
public_numbers=ec.EllipticCurvePublicNumbers(
|
||||
curve=ec.SECP224R1(),
|
||||
|
|
|
|||
|
|
@ -147,8 +147,7 @@ class TestConcatKDFHMAC:
|
|||
)
|
||||
|
||||
okm = binascii.unhexlify(
|
||||
b"64ce901db10d558661f10b6836a122a7"
|
||||
b"605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
)
|
||||
|
||||
oinfo = binascii.unhexlify(
|
||||
|
|
@ -168,8 +167,7 @@ class TestConcatKDFHMAC:
|
|||
)
|
||||
|
||||
okm = binascii.unhexlify(
|
||||
b"64ce901db10d558661f10b6836a122a7"
|
||||
b"605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
)
|
||||
|
||||
oinfo = binascii.unhexlify(
|
||||
|
|
@ -189,8 +187,7 @@ class TestConcatKDFHMAC:
|
|||
)
|
||||
|
||||
okm = binascii.unhexlify(
|
||||
b"64ce901db10d558661f10b6836a122a7"
|
||||
b"605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
)
|
||||
|
||||
oinfo = binascii.unhexlify(
|
||||
|
|
@ -212,8 +209,7 @@ class TestConcatKDFHMAC:
|
|||
)
|
||||
|
||||
okm = binascii.unhexlify(
|
||||
b"64ce901db10d558661f10b6836a122a7"
|
||||
b"605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
b"64ce901db10d558661f10b6836a122a7605323ce2f39bf27eaaac8b34cf89f2f"
|
||||
)
|
||||
|
||||
oinfo = binascii.unhexlify(
|
||||
|
|
|
|||
|
|
@ -133,8 +133,7 @@ class TestPoly1305:
|
|||
|
||||
def test_buffer_protocol(self, backend):
|
||||
key = binascii.unhexlify(
|
||||
b"1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cb"
|
||||
b"c207075c0"
|
||||
b"1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0"
|
||||
)
|
||||
msg = binascii.unhexlify(
|
||||
b"2754776173206272696c6c69672c20616e642074686520736c69746"
|
||||
|
|
|
|||
|
|
@ -62,12 +62,10 @@ class TestX25519Exchange:
|
|||
|
||||
def test_rfc7748_1000_iteration(self, backend):
|
||||
old_private = private = public = binascii.unhexlify(
|
||||
b"090000000000000000000000000000000000000000000000000000000000"
|
||||
b"0000"
|
||||
b"0900000000000000000000000000000000000000000000000000000000000000"
|
||||
)
|
||||
shared_key = binascii.unhexlify(
|
||||
b"684cf59ba83309552800ef566f2f4d3c1c3887c49360e3875f2eb94d9953"
|
||||
b"2c51"
|
||||
b"684cf59ba83309552800ef566f2f4d3c1c3887c49360e3875f2eb94d99532c51"
|
||||
)
|
||||
private_key = X25519PrivateKey.from_private_bytes(private)
|
||||
public_key = X25519PublicKey.from_public_bytes(public)
|
||||
|
|
|
|||
|
|
@ -2732,13 +2732,11 @@ a4090a3a2f602a77ff3bac1417f7e25a683f667b3b91f105016a47afad46a0367b18e2bdf0c
|
|||
16,
|
||||
),
|
||||
"x": int(
|
||||
"1c7475da9a161e4b3f7d6b086494063543a979e34b8d7ac4"
|
||||
"4204d47bf9f",
|
||||
"1c7475da9a161e4b3f7d6b086494063543a979e34b8d7ac44204d47bf9f",
|
||||
16,
|
||||
),
|
||||
"y": int(
|
||||
"131cbd433f112871cc175943991b6a1350bf0cdd57ed8c83"
|
||||
"1a2a7710c92",
|
||||
"131cbd433f112871cc175943991b6a1350bf0cdd57ed8c831a2a7710c92",
|
||||
16,
|
||||
),
|
||||
},
|
||||
|
|
@ -2749,13 +2747,11 @@ a4090a3a2f602a77ff3bac1417f7e25a683f667b3b91f105016a47afad46a0367b18e2bdf0c
|
|||
16,
|
||||
),
|
||||
"x": int(
|
||||
"d37500a0391d98d3070d493e2b392a2c79dc736c097ed24b"
|
||||
"7dd5ddec44",
|
||||
"d37500a0391d98d3070d493e2b392a2c79dc736c097ed24b7dd5ddec44",
|
||||
16,
|
||||
),
|
||||
"y": int(
|
||||
"1d996cc79f37d8dba143d4a8ad9a8a60ed7ea760aae1ddba"
|
||||
"34d883f65d9",
|
||||
"1d996cc79f37d8dba143d4a8ad9a8a60ed7ea760aae1ddba34d883f65d9",
|
||||
16,
|
||||
),
|
||||
},
|
||||
|
|
@ -3750,35 +3746,29 @@ f47021022a6c9b45ed791d09d9540eb81ea065fc1959eca365001ee39928c343d75
|
|||
"COUNT": 0,
|
||||
"CAVS": {
|
||||
"d": int(
|
||||
"e53a88af7cf8ce6bf13c8b9ad191494e37a6acc1368c71f4"
|
||||
"306e39e5",
|
||||
"e53a88af7cf8ce6bf13c8b9ad191494e37a6acc1368c71f4306e39e5",
|
||||
16,
|
||||
),
|
||||
"x": int(
|
||||
"3a24217c4b957fea922eec9d9ac52d5cb4b3fcd95efde1e4"
|
||||
"fa0dd6e2",
|
||||
"3a24217c4b957fea922eec9d9ac52d5cb4b3fcd95efde1e4fa0dd6e2",
|
||||
16,
|
||||
),
|
||||
"y": int(
|
||||
"775b94025a808eb6f4af14ea4b57dca576c35373c6dc198b"
|
||||
"15b981df",
|
||||
"775b94025a808eb6f4af14ea4b57dca576c35373c6dc198b15b981df",
|
||||
16,
|
||||
),
|
||||
},
|
||||
"IUT": {
|
||||
"d": int(
|
||||
"09f51e302c6a0fe6ff48f34c208c6af91e70f65f88102e6f"
|
||||
"cab9af4a",
|
||||
"09f51e302c6a0fe6ff48f34c208c6af91e70f65f88102e6fcab9af4a",
|
||||
16,
|
||||
),
|
||||
"x": int(
|
||||
"c5d5706ccd7424c74fd616e699865af96e56f39adea6aa05"
|
||||
"9e5092b5",
|
||||
"c5d5706ccd7424c74fd616e699865af96e56f39adea6aa059e5092b5",
|
||||
16,
|
||||
),
|
||||
"y": int(
|
||||
"f0729077bb602404d56d2f7e2ba5bb2f383df4a542556788"
|
||||
"1ff0165d",
|
||||
"f0729077bb602404d56d2f7e2ba5bb2f383df4a5425567881ff0165d",
|
||||
16,
|
||||
),
|
||||
},
|
||||
|
|
@ -3984,35 +3974,29 @@ ffdfa60dd7
|
|||
"COUNT": 50,
|
||||
"CAVS": {
|
||||
"d": int(
|
||||
"540904b67b3716823dd621ed72ad3dbc615887b4f56f910b"
|
||||
"78a57199",
|
||||
"540904b67b3716823dd621ed72ad3dbc615887b4f56f910b78a57199",
|
||||
16,
|
||||
),
|
||||
"x": int(
|
||||
"28e5f3a72d8f6b8499dd1bcdfceafcecec68a0d715789bcf"
|
||||
"4b55fe15",
|
||||
"28e5f3a72d8f6b8499dd1bcdfceafcecec68a0d715789bcf4b55fe15",
|
||||
16,
|
||||
),
|
||||
"y": int(
|
||||
"8c8006a7da7c1a19f5328d7e865522b0c0dfb9a29b2c46dc"
|
||||
"96590d2a",
|
||||
"8c8006a7da7c1a19f5328d7e865522b0c0dfb9a29b2c46dc96590d2a",
|
||||
16,
|
||||
),
|
||||
},
|
||||
"IUT": {
|
||||
"d": int(
|
||||
"5e717ae889fc8d67be11c2ebe1a7d3550051448d68a040b2"
|
||||
"dee8e327",
|
||||
"5e717ae889fc8d67be11c2ebe1a7d3550051448d68a040b2dee8e327",
|
||||
16,
|
||||
),
|
||||
"x": int(
|
||||
"ae7f3db340b647d61713f5374c019f1be2b28573cb6219bb"
|
||||
"7b747223",
|
||||
"ae7f3db340b647d61713f5374c019f1be2b28573cb6219bb7b747223",
|
||||
16,
|
||||
),
|
||||
"y": int(
|
||||
"800e6bffcf97c15864ec6e5673fb83359b45f89b8a26a27f"
|
||||
"6f3dfbff",
|
||||
"800e6bffcf97c15864ec6e5673fb83359b45f89b8a26a27f6f3dfbff",
|
||||
16,
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -486,8 +486,7 @@ class TestNoticeReference:
|
|||
nr = x509.NoticeReference("org", [1, 3, 4])
|
||||
|
||||
assert repr(nr) == (
|
||||
"<NoticeReference(organization='org', notice_numbers=[1, 3, 4"
|
||||
"])>"
|
||||
"<NoticeReference(organization='org', notice_numbers=[1, 3, 4])>"
|
||||
)
|
||||
|
||||
def test_eq(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue