#
# 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
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
from unittest import TestCase
from pygost.gost28147 import cfb_decrypt
-from pygost.gost3410 import CURVE_PARAMS
-from pygost.gost3410 import GOST3410Curve
+from pygost.gost3410 import CURVES
from pygost.gost3410 import prv_unmarshal
from pygost.gost3410 import pub_unmarshal
from pygost.gost3410 import public_key
self.assertIsNotNone(content_info["content"].defined)
_, signed_data = content_info["content"].defined
self.assertEqual(len(signed_data["signerInfos"]), 1)
- curve = GOST3410Curve(*CURVE_PARAMS[curve_name])
+ curve = CURVES[curve_name]
self.assertTrue(verify(
curve,
public_key(curve, prv_unmarshal(prv_key_raw)),
spk = encrypted_key["transportParameters"]["ephemeralPublicKey"]["subjectPublicKey"]
self.assertIsNotNone(spk.defined)
_, pub_key_their = spk.defined
- curve = GOST3410Curve(*CURVE_PARAMS[curve_name])
+ curve = CURVES[curve_name]
kek = keker(curve, prv_key_our, bytes(pub_key_their), ukm)
key_wrapped = bytes(encrypted_key["sessionEncryptedKey"]["encryptedKey"])
mac = bytes(encrypted_key["sessionEncryptedKey"]["macKey"])
},
),
),
- ) for spki_algorithm in (
+ ) for _ in (
id_tc26_gost3410_2012_256,
id_tc26_gost3410_2012_512,
)
_, pub_key_their = kari["originator"]["originatorKey"]["publicKey"].defined
ukm = bytes(kari["ukm"])
rek = kari["recipientEncryptedKeys"][0]
- curve = GOST3410Curve(*CURVE_PARAMS[curve_name])
+ curve = CURVES[curve_name]
kek = keker(curve, prv_key_our, bytes(pub_key_their), ukm)
self.assertIsNotNone(rek["encryptedKey"].defined)
_, encrypted_key = rek["encryptedKey"].defined