# coding: utf-8
# PyGOST -- Pure Python GOST cryptographic functions library
-# Copyright (C) 2015-2019 Sergey Matveev <stargrave@stargrave.org>
+# Copyright (C) 2015-2020 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
-# 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 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
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"))
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))
"""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)
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))
"""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)
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))