X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=pygost%2Ftest_gost3410_vko.py;h=99077594e357940e153b053a248d94b11063cbb6;hb=5e92533267cb41c42af1243592c530304d18bff5;hp=0c5c1e6c5b06150018bc9898182fc3046cc99200;hpb=0fcc8bc147ada51d2a9a912f18ac362d54b7d49a;p=pygost.git diff --git a/pygost/test_gost3410_vko.py b/pygost/test_gost3410_vko.py index 0c5c1e6..9907759 100644 --- a/pygost/test_gost3410_vko.py +++ b/pygost/test_gost3410_vko.py @@ -1,11 +1,10 @@ # coding: utf-8 # PyGOST -- Pure Python GOST cryptographic functions library -# Copyright (C) 2015-2019 Sergey Matveev +# Copyright (C) 2015-2020 Sergey Matveev # # 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 @@ -18,8 +17,7 @@ from os import urandom from unittest import TestCase -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 @@ -33,7 +31,7 @@ from pygost.utils import hexdec class TestVKO34102001(TestCase): def test_vector(self): - curve = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-TestParamSet"]) + curve = CURVES["id-GostR3410-2001-TestParamSet"] ukm = ukm_unmarshal(hexdec("5172be25f852a233")) prv1 = prv_unmarshal(hexdec("1df129e43dab345b68f6a852f4162dc69f36b2f84717d08755cc5c44150bf928")) prv2 = prv_unmarshal(hexdec("5b9356c6474f913f1e83885ea0edd5df1a43fd9d799d219093241157ac9ed473")) @@ -44,7 +42,7 @@ class TestVKO34102001(TestCase): self.assertSequenceEqual(kek_34102001(curve, prv2, pub1, ukm), kek) def test_sequence(self): - curve = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-TestParamSet"]) + curve = CURVES["id-GostR3410-2001-TestParamSet"] for _ in range(10): ukm = ukm_unmarshal(urandom(8)) prv1 = bytes2long(urandom(32)) @@ -63,7 +61,7 @@ class TestVKO34102012256(TestCase): """RFC 7836 """ def test_vector(self): - curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) + curve = CURVES["id-tc26-gost-3410-12-512-paramSetA"] ukm = ukm_unmarshal(hexdec("1d80603c8544c727")) prvA = prv_unmarshal(hexdec("c990ecd972fce84ec4db022778f50fcac726f46708384b8d458304962d7147f8c2db41cef22c90b102f2968404f9b9be6d47c79692d81826b32b8daca43cb667")) pubA = pub_unmarshal(hexdec("aab0eda4abff21208d18799fb9a8556654ba783070eba10cb9abb253ec56dcf5d3ccba6192e464e6e5bcb6dea137792f2431f6c897eb1b3c0cc14327b1adc0a7914613a3074e363aedb204d38d3563971bd8758e878c9db11403721b48002d38461f92472d40ea92f9958c0ffa4c93756401b97f89fdbe0b5e46e4a4631cdb5a"), mode=2012) @@ -74,7 +72,7 @@ class TestVKO34102012256(TestCase): self.assertSequenceEqual(kek_34102012256(curve, prvB, pubA, ukm), vko) def test_sequence(self): - curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) + curve = CURVES["id-tc26-gost-3410-12-512-paramSetA"] for _ in range(10): ukm = ukm_unmarshal(urandom(8)) prv1 = bytes2long(urandom(32)) @@ -93,7 +91,7 @@ class TestVKO34102012512(TestCase): """RFC 7836 """ def test_vector(self): - curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) + curve = CURVES["id-tc26-gost-3410-12-512-paramSetA"] ukm = ukm_unmarshal(hexdec("1d80603c8544c727")) prvA = prv_unmarshal(hexdec("c990ecd972fce84ec4db022778f50fcac726f46708384b8d458304962d7147f8c2db41cef22c90b102f2968404f9b9be6d47c79692d81826b32b8daca43cb667")) pubA = pub_unmarshal(hexdec("aab0eda4abff21208d18799fb9a8556654ba783070eba10cb9abb253ec56dcf5d3ccba6192e464e6e5bcb6dea137792f2431f6c897eb1b3c0cc14327b1adc0a7914613a3074e363aedb204d38d3563971bd8758e878c9db11403721b48002d38461f92472d40ea92f9958c0ffa4c93756401b97f89fdbe0b5e46e4a4631cdb5a"), mode=2012) @@ -104,7 +102,7 @@ class TestVKO34102012512(TestCase): self.assertSequenceEqual(kek_34102012512(curve, prvB, pubA, ukm), vko) def test_sequence(self): - curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) + curve = CURVES["id-tc26-gost-3410-12-512-paramSetA"] for _ in range(10): ukm = ukm_unmarshal(urandom(8)) prv1 = bytes2long(urandom(32))