]> Cypherpunks.ru repositories - pygost.git/blobdiff - pygost/test_gost3410.py
gost3410 private key % Q
[pygost.git] / pygost / test_gost3410.py
index f95c47b9b5cb859f466c460632a1dae6bf2100ac..677968d803c0fd7018eb5a88babbd9e81a5f1af1 100644 (file)
@@ -1,6 +1,6 @@
 # coding: utf-8
 # PyGOST -- Pure Python GOST cryptographic functions library
-# Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2015-2021 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
@@ -19,6 +19,8 @@ from unittest import TestCase
 
 from pygost.gost3410 import CURVES
 from pygost.gost3410 import GOST3410Curve
+from pygost.gost3410 import prv_marshal
+from pygost.gost3410 import prv_unmarshal
 from pygost.gost3410 import public_key
 from pygost.gost3410 import sign
 from pygost.gost3410 import uv2xy
@@ -81,8 +83,8 @@ class Test341001(TestCase):
 
     def test_sequence(self):
         c = CURVES["id-GostR3410-2001-TestParamSet"]
-        prv = bytes2long(urandom(32))
-        pubX, pubY = public_key(c, prv)
+        prv = prv_unmarshal(urandom(32))
+        pubX, pubY = public_key(c, prv_unmarshal(prv_marshal(c, prv)))
         for _ in range(20):
             digest = urandom(32)
             s = sign(c, prv, digest)
@@ -255,7 +257,7 @@ class Test34102012(TestCase):
     def test_sequence(self):
         c = CURVES["id-tc26-gost-3410-12-512-paramSetA"]
         prv = bytes2long(urandom(64))
-        pubX, pubY = public_key(c, prv)
+        pubX, pubY = public_key(c, prv_unmarshal(prv_marshal(c, prv)))
         for _ in range(20):
             digest = urandom(64)
             s = sign(c, prv, digest)