updates
This commit is contained in:
@@ -15,7 +15,7 @@ from cryptography.hazmat.primitives.constant_time import bytes_eq
|
||||
def _wrap_core(
|
||||
wrapping_key: bytes,
|
||||
a: bytes,
|
||||
r: typing.List[bytes],
|
||||
r: list[bytes],
|
||||
) -> bytes:
|
||||
# RFC 3394 Key Wrap - 2.2.1 (index method)
|
||||
encryptor = Cipher(AES(wrapping_key), ECB()).encryptor()
|
||||
@@ -58,8 +58,8 @@ def aes_key_wrap(
|
||||
def _unwrap_core(
|
||||
wrapping_key: bytes,
|
||||
a: bytes,
|
||||
r: typing.List[bytes],
|
||||
) -> typing.Tuple[bytes, typing.List[bytes]]:
|
||||
r: list[bytes],
|
||||
) -> tuple[bytes, list[bytes]]:
|
||||
# Implement RFC 3394 Key Unwrap - 2.2.2 (index method)
|
||||
decryptor = Cipher(AES(wrapping_key), ECB()).decryptor()
|
||||
n = len(r)
|
||||
@@ -86,7 +86,7 @@ def aes_key_wrap_with_padding(
|
||||
if len(wrapping_key) not in [16, 24, 32]:
|
||||
raise ValueError("The wrapping key must be a valid AES key length")
|
||||
|
||||
aiv = b"\xA6\x59\x59\xA6" + len(key_to_wrap).to_bytes(
|
||||
aiv = b"\xa6\x59\x59\xa6" + len(key_to_wrap).to_bytes(
|
||||
length=4, byteorder="big"
|
||||
)
|
||||
# pad the key to wrap if necessary
|
||||
|
||||
Reference in New Issue
Block a user