]> Cypherpunks.ru repositories - pygost.git/blobdiff - pygost/test_cms.py
Forbid any later GNU GPL versions autousage
[pygost.git] / pygost / test_cms.py
index 98e9e068626ba8e49e8a79c387b094acd4cd6089..9359875800a7a3ab756234384e0361b2ffa94c9a 100644 (file)
@@ -4,8 +4,7 @@
 #
 # 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
@@ -20,8 +19,7 @@ from unittest import skipIf
 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
@@ -68,7 +66,7 @@ class TestSigned(TestCase):
         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)),
@@ -209,7 +207,7 @@ class TestEnvelopedKTRI(TestCase):
         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"])
@@ -370,7 +368,7 @@ class TestEnvelopedKARI(TestCase):
                             },
                         ),
                     ),
-                ) for spki_algorithm in (
+                ) for _ in (
                     id_tc26_gost3410_2012_256,
                     id_tc26_gost3410_2012_512,
                 )
@@ -385,7 +383,7 @@ class TestEnvelopedKARI(TestCase):
         _, 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