# coding: utf-8
# PyGOST -- Pure Python GOST cryptographic functions library
-# Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2015-2022 Sergey Matveev <stargrave@stargrave.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
:returns: wrapped key
:rtype: bytes, 44 bytes
"""
- return wrap_gost(ukm, diversify(kek, bytearray(ukm)), cek, sbox=sbox)
+ return wrap_gost(
+ ukm,
+ diversify(kek, bytearray(ukm), sbox=sbox),
+ cek,
+ sbox=sbox,
+ )
def unwrap_cryptopro(kek, data, sbox=DEFAULT_SBOX):
key_and_key_mac = ctr(encrypter_key, bs, kexp, iv)
key, key_mac = key_and_key_mac[:-bs], key_and_key_mac[-bs:]
if not compare_digest(mac(encrypter_mac, bs, iv + key), key_mac):
- raise ValueError("invalid authentication tag")
+ raise ValueError("Invalid authentication tag")
return key