NEWS | 28 +++++++++++++++++++++++++--- README | 2 +- VERSION | 2 +- news.texi | 27 +++++++++++++++++++++++++-- pygost/gost28147.py | 38 +++++++++++++++++++------------------- pygost/gost3410.py | 24 ++++++++++++------------ pygost/gost3410_vko.py | 2 +- pygost/gost341194.py | 4 ++-- pygost/gost3412.py | 2 +- pygost/test_cms.py | 16 ++++++++-------- pygost/test_gost28147.py | 10 +++++----- pygost/test_gost3410.py | 20 ++++++++++---------- pygost/test_gost3410_vko.py | 12 ++++++------ pygost/test_gost341194.py | 34 +++++++++++++++++----------------- pygost/test_pfx.py | 4 ++-- pygost/test_x509.py | 4 ++-- www.texi | 2 +- diff --git a/NEWS b/NEWS index 839a8fd3f6b3803969eac11fac969371bdcecf05d197178166e8aceb37af4d91..556e1e557f99700d465b2d2297e866eac5b8e4f91f302c519c3f41ad1168c036 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,28 @@ -3.16: - * 34.10-2012 TC26 twisted Edwards curve related parameters. - * More test vectors. +4.0: + * 34.10-2012 TC26 twisted Edwards curve related parameters + * More test vectors + * Backward incompatible Sbox and curves parameters renaming, to + comply with OIDs identifying them: + + Gost2814789_TestParamSet -> id-Gost28147-89-TestParamSet + Gost28147_CryptoProParamSetA -> id-Gost28147-89-CryptoPro-A-ParamSet + Gost28147_CryptoProParamSetB -> id-Gost28147-89-CryptoPro-B-ParamSet + Gost28147_CryptoProParamSetC -> id-Gost28147-89-CryptoPro-C-ParamSet + Gost28147_CryptoProParamSetD -> id-Gost28147-89-CryptoPro-D-ParamSet + Gost28147_tc26_ParamZ -> id-tc26-gost-28147-param-Z + GostR3411_94_TestParamSet -> id-GostR3411-94-TestParamSet + GostR3411_94_CryptoProParamSet -> id-GostR3411-94-CryptoProParamSet + + GostR3410_2001_TestParamSet -> id-GostR3410-2001-TestParamSet + GostR3410_2001_CryptoPro_A_ParamSet -> id-GostR3410-2001-CryptoPro-A-ParamSet + GostR3410_2001_CryptoPro_B_ParamSet -> id-GostR3410-2001-CryptoPro-B-ParamSet + GostR3410_2001_CryptoPro_C_ParamSet -> id-GostR3410-2001-CryptoPro-C-ParamSet + GostR3410_2001_CryptoPro_XchA_ParamSet -> id-GostR3410-2001-CryptoPro-XchA-ParamSet + GostR3410_2001_CryptoPro_XchB_ParamSet -> id-GostR3410-2001-CryptoPro-XchB-ParamSet + GostR3410_2012_TC26_256_ParamSetA -> id-tc26-gost-3410-2012-256-paramSetA + GostR3410_2012_TC26_ParamSetA -> id-tc26-gost-3410-12-512-paramSetA + GostR3410_2012_TC26_ParamSetB -> id-tc26-gost-3410-12-512-paramSetB + GostR3410_2012_TC26_ParamSetC -> id-tc26-gost-3410-2012-512-paramSetC 3.15: * Licence changed back to GNU GPLv3+. diff --git a/README b/README index d74bbab38ff02fcff74059f9267a01b8f77ccd3785e9b58ff5058768ec8822a2..aa020bc043f138ade440a0ffb629be57bd52fdd552b06fe2ac96ab48e0a48e37 100644 --- a/README +++ b/README @@ -29,7 +29,7 @@ Example 34.10-2012 keypair generation, signing and verifying: >>> from pygost.gost3410 import CURVE_PARAMS >>> from pygost.gost3410 import GOST3410Curve - >>> curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) + >>> curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) >>> from os import urandom >>> prv_raw = urandom(32) >>> from pygost.gost3410 import prv_unmarshal diff --git a/VERSION b/VERSION index d800460c12e365072e5a61569a8ec198f97a6d4d1901db04c614c92c3b7e1b1b..dddd2b6fe8e64351ebd48d13898cd77b3dd21803c72f8a028b265ed6c316055f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.16 +4.0 diff --git a/news.texi b/news.texi index fc525957cdda7f0d084af822a10e42110ab7e25d9023f7672ae1062edb66b1b3..7dc19f5fad15248abc2b5b5837abce382536d914e3a4bf0852fe0b2f91f4f549 100644 --- a/news.texi +++ b/news.texi @@ -3,11 +3,34 @@ @unnumbered News @table @strong -@anchor{Release 3.16} -@item 3.16 +@anchor{Release 4.0} +@item 4.0 @itemize @item 34.10-2012 TC26 twisted Edwards curve related parameters @item More test vectors + @item Backward incompatible Sbox and curves parameters renaming, + to comply with OIDs identifying them: +@verbatim +Gost2814789_TestParamSet -> id-Gost28147-89-TestParamSet +Gost28147_CryptoProParamSetA -> id-Gost28147-89-CryptoPro-A-ParamSet +Gost28147_CryptoProParamSetB -> id-Gost28147-89-CryptoPro-B-ParamSet +Gost28147_CryptoProParamSetC -> id-Gost28147-89-CryptoPro-C-ParamSet +Gost28147_CryptoProParamSetD -> id-Gost28147-89-CryptoPro-D-ParamSet +Gost28147_tc26_ParamZ -> id-tc26-gost-28147-param-Z +GostR3411_94_TestParamSet -> id-GostR3411-94-TestParamSet +GostR3411_94_CryptoProParamSet -> id-GostR3411-94-CryptoProParamSet + +GostR3410_2001_TestParamSet -> id-GostR3410-2001-TestParamSet +GostR3410_2001_CryptoPro_A_ParamSet -> id-GostR3410-2001-CryptoPro-A-ParamSet +GostR3410_2001_CryptoPro_B_ParamSet -> id-GostR3410-2001-CryptoPro-B-ParamSet +GostR3410_2001_CryptoPro_C_ParamSet -> id-GostR3410-2001-CryptoPro-C-ParamSet +GostR3410_2001_CryptoPro_XchA_ParamSet -> id-GostR3410-2001-CryptoPro-XchA-ParamSet +GostR3410_2001_CryptoPro_XchB_ParamSet -> id-GostR3410-2001-CryptoPro-XchB-ParamSet +GostR3410_2012_TC26_256_ParamSetA -> id-tc26-gost-3410-2012-256-paramSetA +GostR3410_2012_TC26_ParamSetA -> id-tc26-gost-3410-12-512-paramSetA +GostR3410_2012_TC26_ParamSetB -> id-tc26-gost-3410-12-512-paramSetB +GostR3410_2012_TC26_ParamSetC -> id-tc26-gost-3410-2012-512-paramSetC +@end verbatim @end itemize @anchor{Release 3.15} diff --git a/pygost/gost28147.py b/pygost/gost28147.py index 9fb4fbfc883b16a6f9827c48930547d680a2201fcad27b40d4694c27bbd4c7e8..55e29169fc1b8b5ae813bc592ae2982bcffe45d4ff500706ab88335fb4c260fd 100644 --- a/pygost/gost28147.py +++ b/pygost/gost28147.py @@ -52,9 +52,9 @@ 7, 6, 5, 4, 3, 2, 1, 0, ) # S-box parameters -DEFAULT_SBOX = "Gost28147_CryptoProParamSetA" +DEFAULT_SBOX = "id-Gost28147-89-CryptoPro-A-ParamSet" SBOXES = { - "Gost2814789_TestParamSet": ( + "id-Gost28147-89-TestParamSet": ( (4, 2, 15, 5, 9, 1, 0, 8, 14, 3, 11, 12, 13, 7, 10, 6), (12, 9, 15, 14, 8, 1, 3, 10, 2, 7, 4, 13, 6, 0, 11, 5), (13, 8, 14, 12, 7, 3, 9, 10, 1, 5, 2, 4, 6, 15, 0, 11), @@ -64,7 +64,7 @@ (8, 15, 6, 11, 1, 9, 12, 5, 13, 3, 7, 10, 0, 14, 2, 4), (9, 11, 12, 0, 3, 6, 7, 5, 4, 8, 14, 15, 1, 10, 2, 13), (12, 6, 5, 2, 11, 0, 9, 13, 3, 14, 7, 10, 15, 4, 1, 8), ), - "Gost28147_CryptoProParamSetA": ( + "id-Gost28147-89-CryptoPro-A-ParamSet": ( (9, 6, 3, 2, 8, 11, 1, 7, 10, 4, 14, 15, 12, 0, 13, 5), (3, 7, 14, 9, 8, 10, 15, 0, 5, 2, 6, 12, 11, 4, 13, 1), (14, 4, 6, 2, 11, 3, 13, 8, 12, 15, 5, 10, 0, 7, 1, 9), @@ -74,7 +74,7 @@ (3, 10, 13, 12, 1, 2, 0, 11, 7, 5, 9, 4, 8, 15, 14, 6), (1, 13, 2, 9, 7, 10, 6, 0, 8, 12, 4, 5, 15, 3, 11, 14), (11, 10, 15, 5, 0, 12, 14, 8, 6, 2, 3, 9, 1, 7, 13, 4), ), - "Gost28147_CryptoProParamSetB": ( + "id-Gost28147-89-CryptoPro-B-ParamSet": ( (8, 4, 11, 1, 3, 5, 0, 9, 2, 14, 10, 12, 13, 6, 7, 15), (0, 1, 2, 10, 4, 13, 5, 12, 9, 7, 3, 15, 11, 8, 6, 14), (14, 12, 0, 10, 9, 2, 13, 11, 7, 5, 8, 15, 3, 6, 1, 4), @@ -84,7 +84,7 @@ (8, 3, 2, 6, 4, 13, 14, 11, 12, 1, 7, 15, 10, 0, 9, 5), (5, 2, 10, 11, 9, 1, 12, 3, 7, 4, 13, 0, 6, 15, 8, 14), (0, 4, 11, 14, 8, 3, 7, 1, 10, 2, 9, 6, 15, 13, 5, 12), ), - "Gost28147_CryptoProParamSetC": ( + "id-Gost28147-89-CryptoPro-C-ParamSet": ( (1, 11, 12, 2, 9, 13, 0, 15, 4, 5, 8, 14, 10, 7, 6, 3), (0, 1, 7, 13, 11, 4, 5, 2, 8, 14, 15, 12, 9, 10, 6, 3), (8, 2, 5, 0, 4, 9, 15, 10, 3, 7, 12, 13, 6, 14, 1, 11), @@ -94,7 +94,7 @@ (12, 9, 11, 1, 8, 14, 2, 4, 7, 3, 6, 5, 10, 0, 15, 13), (10, 9, 6, 8, 13, 14, 2, 0, 15, 3, 5, 11, 4, 1, 12, 7), (7, 4, 0, 5, 10, 2, 15, 14, 12, 6, 1, 11, 13, 9, 3, 8), ), - "Gost28147_CryptoProParamSetD": ( + "id-Gost28147-89-CryptoPro-D-ParamSet": ( (15, 12, 2, 10, 6, 4, 5, 0, 7, 9, 14, 13, 1, 11, 8, 3), (11, 6, 3, 4, 12, 15, 14, 2, 7, 13, 8, 0, 5, 10, 9, 1), (1, 12, 11, 0, 15, 14, 6, 5, 10, 13, 4, 8, 9, 3, 7, 2), @@ -104,7 +104,17 @@ (8, 0, 15, 3, 2, 5, 14, 11, 1, 10, 4, 7, 12, 9, 13, 6), (3, 0, 6, 15, 1, 14, 9, 2, 13, 8, 12, 4, 11, 10, 5, 7), (1, 10, 6, 8, 15, 11, 0, 4, 12, 3, 5, 9, 7, 13, 2, 14), ), - "GostR3411_94_TestParamSet": ( + "id-tc26-gost-28147-param-Z": ( + (12, 4, 6, 2, 10, 5, 11, 9, 14, 8, 13, 7, 0, 3, 15, 1), + (6, 8, 2, 3, 9, 10, 5, 12, 1, 14, 4, 7, 11, 13, 0, 15), + (11, 3, 5, 8, 2, 15, 10, 13, 14, 1, 7, 4, 12, 9, 6, 0), + (12, 8, 2, 1, 13, 4, 15, 6, 7, 0, 10, 5, 3, 14, 9, 11), + (7, 15, 5, 10, 8, 1, 6, 13, 0, 9, 3, 14, 11, 4, 2, 12), + (5, 13, 15, 6, 9, 2, 12, 10, 11, 7, 8, 1, 4, 3, 14, 0), + (8, 14, 2, 5, 6, 9, 1, 12, 15, 4, 11, 0, 13, 10, 3, 7), + (1, 7, 14, 13, 0, 5, 8, 3, 4, 15, 10, 6, 9, 12, 11, 2), + ), + "id-GostR3411-94-TestParamSet": ( (4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3), (14, 11, 4, 12, 6, 13, 15, 10, 2, 3, 8, 1, 0, 7, 5, 9), (5, 8, 1, 13, 10, 3, 4, 2, 14, 15, 12, 7, 6, 0, 9, 11), @@ -114,7 +124,7 @@ (4, 11, 10, 0, 7, 2, 1, 13, 3, 6, 8, 5, 9, 12, 15, 14), (13, 11, 4, 1, 3, 15, 5, 9, 0, 10, 14, 7, 6, 8, 2, 12), (1, 15, 13, 0, 5, 7, 10, 4, 9, 2, 3, 14, 6, 11, 8, 12), ), - "GostR3411_94_CryptoProParamSet": ( + "id-GostR3411-94-CryptoProParamSet": ( (10, 4, 5, 6, 8, 1, 3, 7, 13, 12, 14, 0, 9, 2, 11, 15), (5, 15, 4, 0, 2, 13, 11, 9, 1, 7, 6, 3, 12, 14, 10, 8), (7, 15, 12, 14, 9, 4, 1, 0, 3, 11, 5, 2, 6, 10, 8, 13), @@ -124,16 +134,6 @@ (7, 6, 2, 4, 13, 9, 15, 0, 10, 1, 5, 11, 8, 14, 12, 3), (13, 14, 4, 1, 7, 0, 5, 10, 3, 12, 8, 15, 6, 2, 9, 11), (1, 3, 10, 9, 5, 11, 4, 15, 8, 6, 7, 14, 13, 0, 2, 12), ), - "Gost28147_tc26_ParamZ": ( - (12, 4, 6, 2, 10, 5, 11, 9, 14, 8, 13, 7, 0, 3, 15, 1), - (6, 8, 2, 3, 9, 10, 5, 12, 1, 14, 4, 7, 11, 13, 0, 15), - (11, 3, 5, 8, 2, 15, 10, 13, 14, 1, 7, 4, 12, 9, 6, 0), - (12, 8, 2, 1, 13, 4, 15, 6, 7, 0, 10, 5, 3, 14, 9, 11), - (7, 15, 5, 10, 8, 1, 6, 13, 0, 9, 3, 14, 11, 4, 2, 12), - (5, 13, 15, 6, 9, 2, 12, 10, 11, 7, 8, 1, 4, 3, 14, 0), - (8, 14, 2, 5, 6, 9, 1, 12, 15, 4, 11, 0, 13, 10, 3, 7), - (1, 7, 14, 13, 0, 5, 8, 3, 4, 15, 10, 6, 9, 12, 11, 2), - ), "EACParamSet": ( (11, 4, 8, 10, 9, 7, 0, 3, 1, 6, 2, 15, 14, 5, 12, 13), (1, 7, 14, 9, 11, 3, 15, 12, 0, 5, 4, 6, 13, 10, 8, 2), @@ -145,7 +145,7 @@ (4, 0, 14, 1, 5, 11, 8, 3, 12, 2, 9, 7, 6, 10, 13, 15), (7, 14, 12, 13, 9, 4, 8, 15, 10, 2, 6, 0, 3, 11, 5, 1), ), } -SBOXES["AppliedCryptography"] = SBOXES["GostR3411_94_TestParamSet"] +SBOXES["AppliedCryptography"] = SBOXES["id-GostR3411-94-TestParamSet"] def _K(s, _in): diff --git a/pygost/gost3410.py b/pygost/gost3410.py index cc2bcea105cfc1f35088fd0db234ea4f183ee5bdddc935d9c4992f37b61a21eb..d3ffb93aa3df7a6304162d47d42571c27042dfd30c33a80b896578599520ebef 100644 --- a/pygost/gost3410.py +++ b/pygost/gost3410.py @@ -35,7 +35,7 @@ 2012: 64, } -DEFAULT_CURVE = "GostR3410_2001_CryptoPro_A_ParamSet" +DEFAULT_CURVE = "id-GostR3410-2001-CryptoPro-A-ParamSet" # Curve parameters are the following: p, q, a, b, x, y CURVE_PARAMS = { "GostR3410_2001_ParamSet_cc": ( @@ -46,7 +46,7 @@ "2d06B4265ebc749ff7d0f1f1f88232e81632e9088fd44b7787d5e407e955080c", "0000000000000000000000000000000000000000000000000000000000000002", "a20e034bf8813ef5c18d01105e726a17eb248b264ae9706f440bedc8ccb6b22c", ), - "GostR3410_2001_TestParamSet": ( + "id-GostR3410-2001-TestParamSet": ( "8000000000000000000000000000000000000000000000000000000000000431", "8000000000000000000000000000000150FE8A1892976154C59CFC193ACCF5B3", "0000000000000000000000000000000000000000000000000000000000000007", @@ -54,7 +54,7 @@ "5FBFF498AA938CE739B8E022FBAFEF40563F6E6A3472FC2A514C0CE9DAE23B7E", "0000000000000000000000000000000000000000000000000000000000000002", "08E2A8A0E65147D4BD6316030E16D19C85C97F0A9CA267122B96ABBCEA7E8FC8", ), - "GostR3410_2001_CryptoPro_A_ParamSet": ( + "id-GostR3410-2001-CryptoPro-A-ParamSet": ( "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C611070995AD10045841B09B761B893", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94", @@ -62,7 +62,7 @@ "00000000000000000000000000000000000000000000000000000000000000a6", "0000000000000000000000000000000000000000000000000000000000000001", "8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14", ), - "GostR3410_2001_CryptoPro_B_ParamSet": ( + "id-GostR3410-2001-CryptoPro-B-ParamSet": ( "8000000000000000000000000000000000000000000000000000000000000C99", "800000000000000000000000000000015F700CFFF1A624E5E497161BCC8A198F", "8000000000000000000000000000000000000000000000000000000000000C96", @@ -70,7 +70,7 @@ "3E1AF419A269A5F866A7D3C25C3DF80AE979259373FF2B182F49D4CE7E1BBC8B", "0000000000000000000000000000000000000000000000000000000000000001", "3FA8124359F96680B83D1C3EB2C070E5C545C9858D03ECFB744BF8D717717EFC", ), - "GostR3410_2001_CryptoPro_C_ParamSet": ( + "id-GostR3410-2001-CryptoPro-C-ParamSet": ( "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D759B", "9B9F605F5A858107AB1EC85E6B41C8AA582CA3511EDDFB74F02F3A6598980BB9", "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D7598", @@ -78,7 +78,7 @@ "000000000000000000000000000000000000000000000000000000000000805a", "0000000000000000000000000000000000000000000000000000000000000000", "41ECE55743711A8C3CBF3783CD08C0EE4D4DC440D4641A8F366E550DFDB3BB67", ), - "GostR3410_2001_CryptoPro_XchA_ParamSet": ( + "id-GostR3410-2001-CryptoPro-XchA-ParamSet": ( "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C611070995AD10045841B09B761B893", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94", @@ -86,7 +86,7 @@ "00000000000000000000000000000000000000000000000000000000000000a6", "0000000000000000000000000000000000000000000000000000000000000001", "8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14", ), - "GostR3410_2001_CryptoPro_XchB_ParamSet": ( + "id-GostR3410-2001-CryptoPro-XchB-ParamSet": ( "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D759B", "9B9F605F5A858107AB1EC85E6B41C8AA582CA3511EDDFB74F02F3A6598980BB9", "9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D7598", @@ -94,7 +94,7 @@ "000000000000000000000000000000000000000000000000000000000000805a", "0000000000000000000000000000000000000000000000000000000000000000", "41ECE55743711A8C3CBF3783CD08C0EE4D4DC440D4641A8F366E550DFDB3BB67", ), - "GostR3410_2012_TC26_256_ParamSetA": ( + "id-tc26-gost-3410-2012-256-paramSetA": ( "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97", "400000000000000000000000000000000FD8CDDFC87B6635C115AF556C360C67", "C2173F1513981673AF4892C23035A27CE25E2013BF95AA33B22C656F277E7335", @@ -102,7 +102,7 @@ "295F9BAE7428ED9CCC20E7C359A9D41A22FCCD9108E17BF7BA9337A6F8AE9513", "91E38443A5E82C0D880923425712B2BB658B9196932E02C78B2582FE742DAA28", "32879423AB1A0375895786C4BB46E9565FDE0B5344766740AF268ADB32322E5C", ), - "GostR3410_2012_TC26_ParamSetA": ( + "id-tc26-gost-3410-12-512-paramSetA": ( "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27E69532F48D89116FF22B8D4E0560609B4B38ABFAD2B85DCACDB1411F10B275", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC4", @@ -110,7 +110,7 @@ "E8C2505DEDFC86DDC1BD0B2B6667F1DA34B82574761CB0E879BD081CFD0B6265EE3CB090F30D27614CB4574010DA90DD862EF9D4EBEE4761503190785A71C760", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003", "7503CFE87A836AE3A61B8816E25450E6CE5E1C93ACF1ABC1778064FDCBEFA921DF1626BE4FD036E93D75E6A50E3A41E98028FE5FC235F5B889A589CB5215F2A4", ), - "GostR3410_2012_TC26_ParamSetB": ( + "id-tc26-gost-3410-12-512-paramSetB": ( "8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006F", "800000000000000000000000000000000000000000000000000000000000000149A1EC142565A545ACFDB77BD9D40CFA8B996712101BEA0EC6346C54374F25BD", "8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006C", @@ -118,7 +118,7 @@ "687D1B459DC841457E3E06CF6F5E2517B97C7D614AF138BCBF85DC806C4B289F3E965D2DB1416D217F8B276FAD1AB69C50F78BEE1FA3106EFB8CCBC7C5140116", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002", "1A8F7EDA389B094C2C071E3647A8940F3C123B697578C213BE6DD9E6C8EC7335DCB228FD1EDF4A39152CBCAAF8C0398828041055F94CEEEC7E21340780FE41BD" ), - "GostR3410_2012_TC26_ParamSetC": ( + "id-tc26-gost-3410-2012-512-paramSetC": ( "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7", "3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC98CDBA46506AB004C33A9FF5147502CC8EDA9E7A769A12694623CEF47F023ED", "DC9203E514A721875485A529D2C722FB187BC8980EB866644DE41C68E143064546E861C0E2C9EDD92ADE71F46FCF50FF2AD97F951FDA9F2A2EB6546F39689BD3", @@ -134,7 +134,7 @@ class GOST3410Curve(object): """ GOST 34.10 validated curve - >>> p, q, a, b, x, y = CURVE_PARAMS["GostR3410_2001_TestParamSet"] + >>> p, q, a, b, x, y = CURVE_PARAMS["id-GostR3410-2001-TestParamSet"] >>> curve = GOST3410Curve(p, q, a, b, x, y) >>> prv = prv_unmarshal(urandom(32)) >>> signature = sign(curve, prv, GOST341194(data).digest()) diff --git a/pygost/gost3410_vko.py b/pygost/gost3410_vko.py index 82ffe34076bd52ed7fb38cc7400306f84cbb3e71a381d5731722fc74de963dab..0d2f5078fbe021b59d7a2662d245dcdbcd6ee242ff141613f378c00899a5c140 100644 --- a/pygost/gost3410_vko.py +++ b/pygost/gost3410_vko.py @@ -56,7 +56,7 @@ hash output. """ return GOST341194( kek(curve, prv, pub, ukm, mode=2001), - "GostR3411_94_CryptoProParamSet", + "id-GostR3411-94-CryptoProParamSet", ).digest() diff --git a/pygost/gost341194.py b/pygost/gost341194.py index 255864a039f5edc6d7490a27a7a1a434ad19b9a8a803209070f1f119f02c5462..896053934f4e94dba1afe13612b65d29e89c4a99f5de7fa83f9ab77c8778d38e 100644 --- a/pygost/gost341194.py +++ b/pygost/gost341194.py @@ -37,7 +37,7 @@ from pygost.utils import strxor from pygost.utils import xrange # pylint: disable=redefined-builtin -DEFAULT_SBOX = "GostR3411_94_TestParamSet" +DEFAULT_SBOX = "id-GostR3411-94-CryptoProParamSet" BLOCKSIZE = 32 C2 = 32 * b"\x00" C3 = hexdec(b"ff00ffff000000ffff0000ff00ffff0000ff00ff00ff00ffff00ff00ff00ff00") @@ -187,7 +187,7 @@ def new(data=b"", sbox=DEFAULT_SBOX): return GOST341194(data, sbox) -PBKDF2_HASHER = partial(GOST341194, sbox="GostR3411_94_CryptoProParamSet") +PBKDF2_HASHER = partial(GOST341194, sbox="id-GostR3411-94-CryptoProParamSet") def pbkdf2(password, salt, iterations, dklen): diff --git a/pygost/gost3412.py b/pygost/gost3412.py index ce8d1da07584ab8917970e9d69c43ddd7164672171153024e6f29489ac98193a..7a1a341232ea59072ccb4183e1454416bf7f2407113b7069bd4f1c855ad83ed2 100644 --- a/pygost/gost3412.py +++ b/pygost/gost3412.py @@ -164,7 +164,7 @@ :type key: bytes, 32 bytes """ # Backward compatibility key preparation for 28147-89 key schedule self.key = b"".join(key[i * 4:i * 4 + 4][::-1] for i in range(8)) - self.sbox = "Gost28147_tc26_ParamZ" + self.sbox = "id-tc26-gost-28147-param-Z" def encrypt(self, blk): return gost28147_ns2block(gost28147_encrypt( diff --git a/pygost/test_cms.py b/pygost/test_cms.py index 9d9f957cd5aa90c4a115cd4e13ba8f9819aab27f8822e63d55414bada07c5140..57de7e492b664bff557cf12dc3b8668dc2b5eb884f930e5532f1b3b516c7f5c1 100644 --- a/pygost/test_cms.py +++ b/pygost/test_cms.py @@ -90,7 +90,7 @@ prv_key_raw = hexdec("BFCF1D623E5CDD3032A7C6EABB4A923C46E43D640FFEAAF2C3ED39A8FA399924")[::-1] self.process_cms( content_info_raw, prv_key_raw, - "GostR3410_2001_CryptoPro_XchA_ParamSet", + "id-GostR3410-2001-CryptoPro-XchA-ParamSet", GOST34112012256, 2001, ) @@ -109,7 +109,7 @@ prv_key_raw = hexdec("3FC01CDCD4EC5F972EB482774C41E66DB7F380528DFE9E67992BA05AEE462435757530E641077CE587B976C8EEB48C48FD33FD175F0C7DE6A44E014E6BCB074B")[::-1] self.process_cms( content_info_raw, prv_key_raw, - "GostR3410_2012_TC26_ParamSetB", + "id-tc26-gost-3410-12-512-paramSetB", GOST34112012512, 2012, ) @@ -166,7 +166,7 @@ curve_name, keker, plaintext_expected, ): - sbox = "Gost28147_tc26_ParamZ" + sbox = "id-tc26-gost-28147-param-Z" content_info, tail = ContentInfo().decode(content_info_raw, ctx={ "defines_by_path": [ ( @@ -294,7 +294,7 @@ self.process_cms( content_info_raw, prv_key_our, - "GostR3410_2001_CryptoPro_XchA_ParamSet", + "id-GostR3410-2001-CryptoPro-XchA-ParamSet", keker, b"Test data to encrypt.\n" * 100, ) @@ -325,7 +325,7 @@ self.process_cms( content_info_raw, prv_key_our, - "GostR3410_2012_TC26_ParamSetB", + "id-tc26-gost-3410-12-512-paramSetB", keker, b"Test message", ) @@ -346,7 +346,7 @@ curve_name, keker, plaintext_expected, ): - sbox = "Gost28147_tc26_ParamZ" + sbox = "id-tc26-gost-28147-param-Z" content_info, tail = ContentInfo().decode(content_info_raw, ctx={ "defines_by_path": [ ( @@ -427,7 +427,7 @@ self.process_cms( content_info_raw, prv_key_our, - "GostR3410_2001_CryptoPro_XchA_ParamSet", + "id-GostR3410-2001-CryptoPro-XchA-ParamSet", keker, b"Test message", ) @@ -458,7 +458,7 @@ self.process_cms( content_info_raw, prv_key_our, - "GostR3410_2012_TC26_ParamSetB", + "id-tc26-gost-3410-12-512-paramSetB", keker, b"Test message", ) diff --git a/pygost/test_gost28147.py b/pygost/test_gost28147.py index d8a0bd86a2f33c081a9e012acae8b3f3859a0500bf23284cf73fce9e1b942d08..d672a0c0f5a09ebe4c5b5b2ef09eebb8455e996cba99788b2e7b629ffcac1220 100644 --- a/pygost/test_gost28147.py +++ b/pygost/test_gost28147.py @@ -38,7 +38,7 @@ class ECBTest(TestCase): def test_gcl(self): """ Test vectors from libgcl3 """ - sbox = "Gost2814789_TestParamSet" + sbox = "id-Gost28147-89-TestParamSet" key = hexdec(b"0475f6e05038fbfad2c7c390edb3ca3d1547124291ae1e8a2f79cd9ed2bcefbd") plaintext = bytes(bytearray(( 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, @@ -136,7 +136,7 @@ def test_cryptomanager(self): """ Test vector from http://cryptomanager.com/tv.html """ - sbox = "GostR3411_94_TestParamSet" + sbox = "id-GostR3411-94-TestParamSet" key = hexdec(b"75713134B60FEC45A607BB83AA3746AF4FF99DA6D1B53B5B1B402A1BAA030D1B") self.assertSequenceEqual( ecb_encrypt(key, hexdec(b"1122334455667788"), sbox=sbox), @@ -149,7 +149,7 @@ def test_cryptomanager(self): """ Test vector from http://cryptomanager.com/tv.html """ key = hexdec(b"75713134B60FEC45A607BB83AA3746AF4FF99DA6D1B53B5B1B402A1BAA030D1B") - sbox = "GostR3411_94_TestParamSet" + sbox = "id-GostR3411-94-TestParamSet" self.assertSequenceEqual( cfb_encrypt( key, @@ -209,7 +209,7 @@ class CTRTest(TestCase): def test_gcl(self): """ Test vectors from libgcl3 """ - sbox = "Gost2814789_TestParamSet" + sbox = "id-Gost28147-89-TestParamSet" key = hexdec(b"0475f6e05038fbfad2c7c390edb3ca3d1547124291ae1e8a2f79cd9ed2bcefbd") plaintext = bytes(bytearray(( 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, @@ -288,7 +288,7 @@ def test_gcl2(self): """ Test vectors 2 from libgcl3 """ - sbox = "Gost2814789_TestParamSet" + sbox = "id-Gost28147-89-TestParamSet" key = hexdec(b"fc7ad2886f455b50d29008fa622b57d5c65b3c637202025799cadf0768519e8a") plaintext = bytes(bytearray(( 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, diff --git a/pygost/test_gost3410.py b/pygost/test_gost3410.py index 46fddbfd90c2657f13c0d3a27667cf3654abb7b581130cf36f643478ac2bd35a..5a42aee76ba019454be361d8fde3f1432c1c3afe2162055e0bcaf93f34b1d5f9 100644 --- a/pygost/test_gost3410.py +++ b/pygost/test_gost3410.py @@ -69,7 +69,7 @@ ))) prv = bytes2long(prv) signature = signature[32:] + signature[:32] - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_TestParamSet"]) + c = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-TestParamSet"]) pubX, pubY = public_key(c, prv) self.assertSequenceEqual(long2bytes(pubX), pub_x) self.assertSequenceEqual(long2bytes(pubY), pub_y) @@ -78,7 +78,7 @@ self.assertTrue(verify(c, (pubX, pubY), digest, s)) self.assertTrue(verify(c, (pubX, pubY), digest, signature)) def test_sequence(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_TestParamSet"]) + c = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-TestParamSet"]) prv = bytes2long(urandom(32)) pubX, pubY = public_key(c, prv) for _ in range(20): @@ -221,7 +221,7 @@ self.assertTrue(verify(c, (pubX, pubY), digest, s, mode=2012)) self.assertTrue(verify(c, (pubX, pubY), digest, signature, mode=2012)) def test_sequence(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) + c = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) prv = bytes2long(urandom(64)) pubX, pubY = public_key(c, prv) for _ in range(20): @@ -235,7 +235,7 @@ class Test34102012SESPAKE(TestCase): """Test vectors for multiplication from :rfc:`8133` """ def test_curve1(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_CryptoPro_A_ParamSet"]) + c = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-CryptoPro-A-ParamSet"]) q_ind = ( 0xA69D51CAF1A309FA9E9B66187759B0174C274E080356F23CFCBFE84D396AD7BB, 0x5D26F29ECC2E9AC0404DCF7986FA55FE94986362170F54B9616426A659786DAC, @@ -265,7 +265,7 @@ ), ) def test_curve2(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_CryptoPro_B_ParamSet"]) + c = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-CryptoPro-B-ParamSet"]) q_ind = ( 0x3D715A874A4B17CB3B517893A9794A2B36C89D2FFC693F01EE4CC27E7F49E399, 0x1C5A641FCF7CE7E87CDF8CEA38F3DB3096EACE2FAD158384B53953365F4FE7FE, @@ -295,7 +295,7 @@ ), ) def test_curve3(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_CryptoPro_C_ParamSet"]) + c = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-CryptoPro-C-ParamSet"]) q_ind = ( 0x1E36383E43BB6CFA2917167D71B7B5DD3D6D462B43D7C64282AE67DFBEC2559D, 0x137478A9F721C73932EA06B45CF72E37EB78A63F29A542E563C614650C8B6399, @@ -325,7 +325,7 @@ ), ) def test_curve4(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) + c = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) q_ind = ( 0x2A17F8833A32795327478871B5C5E88AEFB91126C64B4B8327289BEA62559425D18198F133F400874328B220C74497CD240586CB249E158532CB8090776CD61C, 0x728F0C4A73B48DA41CE928358FAD26B47A6E094E9362BAE82559F83CDDC4EC3A4676BD3707EDEAF4CD85E99695C64C241EDC622BE87DC0CF87F51F4367F723C5, @@ -355,7 +355,7 @@ ), ) def test_curve5(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetB"]) + c = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetB"]) q_ind = ( 0x7E1FAE8285E035BEC244BEF2D0E5EBF436633CF50E55231DEA9C9CF21D4C8C33DF85D4305DE92971F0A4B4C07E00D87BDBC720EB66E49079285AAF12E0171149, 0x2CC89998B875D4463805BA0D858A196592DB20AB161558FF2F4EF7A85725D20953967AE621AFDEAE89BB77C83A2528EF6FCE02F68BDA4679D7F2704947DBC408, @@ -385,7 +385,7 @@ ), ) def test_curve6(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_256_ParamSetA"]) + c = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-2012-256-paramSetA"]) q_ind = ( 0xB51ADF93A40AB15792164FAD3352F95B66369EB2A4EF5EFAE32829320363350E, 0x74A358CC08593612F5955D249C96AFB7E8B0BB6D8BD2BBE491046650D822BE18, @@ -415,7 +415,7 @@ ), ) def test_curve7(self): - c = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetC"]) + c = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-2012-512-paramSetC"]) q_ind = ( 0x489C91784E02E98F19A803ABCA319917F37689E5A18965251CE2FF4E8D8B298F5BA7470F9E0E713487F96F4A8397B3D09A270C9D367EB5E0E6561ADEEB51581D, 0x684EA885ACA64EAF1B3FEE36C0852A3BE3BD8011B0EF18E203FF87028D6EB5DB2C144A0DCC71276542BFD72CA2A43FA4F4939DA66D9A60793C704A8C94E16F18, diff --git a/pygost/test_gost3410_vko.py b/pygost/test_gost3410_vko.py index 13ebebaa33233b947bd8d60ad955e3ebca521db282ce277b49b710a042e1be01..070f7c23515bcf5df4296acb7f53250292218ebd428fd7bfba9c4cda70156143 100644 --- a/pygost/test_gost3410_vko.py +++ b/pygost/test_gost3410_vko.py @@ -33,7 +33,7 @@ class TestVKO34102001(TestCase): def test_vector(self): - curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_TestParamSet"]) + curve = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-TestParamSet"]) ukm = ukm_unmarshal(hexdec("5172be25f852a233")) prv1 = prv_unmarshal(hexdec("1df129e43dab345b68f6a852f4162dc69f36b2f84717d08755cc5c44150bf928")) prv2 = prv_unmarshal(hexdec("5b9356c6474f913f1e83885ea0edd5df1a43fd9d799d219093241157ac9ed473")) @@ -44,7 +44,7 @@ self.assertSequenceEqual(kek_34102001(curve, prv1, pub2, ukm), kek) self.assertSequenceEqual(kek_34102001(curve, prv2, pub1, ukm), kek) def test_sequence(self): - curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2001_TestParamSet"]) + curve = GOST3410Curve(*CURVE_PARAMS["id-GostR3410-2001-TestParamSet"]) for _ in range(10): ukm = ukm_unmarshal(urandom(8)) prv1 = bytes2long(urandom(32)) @@ -63,7 +63,7 @@ class TestVKO34102012256(TestCase): """RFC 7836 """ def test_vector(self): - curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) + curve = GOST3410Curve(*CURVE_PARAMS["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 +74,7 @@ self.assertSequenceEqual(kek_34102012256(curve, prvA, pubB, ukm), vko) self.assertSequenceEqual(kek_34102012256(curve, prvB, pubA, ukm), vko) def test_sequence(self): - curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) + curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) for _ in range(10): ukm = ukm_unmarshal(urandom(8)) prv1 = bytes2long(urandom(32)) @@ -93,7 +93,7 @@ class TestVKO34102012512(TestCase): """RFC 7836 """ def test_vector(self): - curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) + curve = GOST3410Curve(*CURVE_PARAMS["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 +104,7 @@ self.assertSequenceEqual(kek_34102012512(curve, prvA, pubB, ukm), vko) self.assertSequenceEqual(kek_34102012512(curve, prvB, pubA, ukm), vko) def test_sequence(self): - curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) + curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) for _ in range(10): ukm = ukm_unmarshal(urandom(8)) prv1 = bytes2long(urandom(32)) diff --git a/pygost/test_gost341194.py b/pygost/test_gost341194.py index 3ea96e139118c049276b23144a32eb44912072de69a6057f58585bc5ac9b4c0a..ae0e3c0d45ce2da60d3b3c9428dc04f67daa468dfd0db3b1312e68a06ae313ed 100644 --- a/pygost/test_gost341194.py +++ b/pygost/test_gost341194.py @@ -45,55 +45,55 @@ class TestVectors(TestCase): def test_empty(self): self.assertSequenceEqual( - GOST341194(b"", "GostR3411_94_TestParamSet").hexdigest(), + GOST341194(b"", "id-GostR3411-94-TestParamSet").hexdigest(), "ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d", ) def test_a(self): self.assertSequenceEqual( - GOST341194(b"a", "GostR3411_94_TestParamSet").hexdigest(), + GOST341194(b"a", "id-GostR3411-94-TestParamSet").hexdigest(), "d42c539e367c66e9c88a801f6649349c21871b4344c6a573f849fdce62f314dd", ) def test_abc(self): self.assertSequenceEqual( - GOST341194(b"abc", "GostR3411_94_TestParamSet").hexdigest(), + GOST341194(b"abc", "id-GostR3411-94-TestParamSet").hexdigest(), "f3134348c44fb1b2a277729e2285ebb5cb5e0f29c975bc753b70497c06a4d51d", ) def test_message_digest(self): self.assertSequenceEqual( - GOST341194(b"message digest", "GostR3411_94_TestParamSet").hexdigest(), + GOST341194(b"message digest", "id-GostR3411-94-TestParamSet").hexdigest(), "ad4434ecb18f2c99b60cbe59ec3d2469582b65273f48de72db2fde16a4889a4d", ) def test_Us(self): self.assertSequenceEqual( - GOST341194(128 * b"U", "GostR3411_94_TestParamSet").hexdigest(), + GOST341194(128 * b"U", "id-GostR3411-94-TestParamSet").hexdigest(), "53a3a3ed25180cef0c1d85a074273e551c25660a87062a52d926a9e8fe5733a4", ) def test_dog(self): self.assertSequenceEqual( - GOST341194(b"The quick brown fox jumps over the lazy dog", "GostR3411_94_TestParamSet",).hexdigest(), + GOST341194(b"The quick brown fox jumps over the lazy dog", "id-GostR3411-94-TestParamSet",).hexdigest(), "77b7fa410c9ac58a25f49bca7d0468c9296529315eaca76bd1a10f376d1f4294", ) def test_cog(self): self.assertSequenceEqual( - GOST341194(b"The quick brown fox jumps over the lazy cog", "GostR3411_94_TestParamSet",).hexdigest(), + GOST341194(b"The quick brown fox jumps over the lazy cog", "id-GostR3411-94-TestParamSet",).hexdigest(), "a3ebc4daaab78b0be131dab5737a7f67e602670d543521319150d2e14eeec445", ) def test_rfc32(self): self.assertSequenceEqual( - GOST341194(b"This is message, length=32 bytes", "GostR3411_94_TestParamSet",).hexdigest(), + GOST341194(b"This is message, length=32 bytes", "id-GostR3411-94-TestParamSet",).hexdigest(), "b1c466d37519b82e8319819ff32595e047a28cb6f83eff1c6916a815a637fffa", ) def test_rfc50(self): self.assertSequenceEqual( - GOST341194(b"Suppose the original message has length = 50 bytes", "GostR3411_94_TestParamSet",).hexdigest(), + GOST341194(b"Suppose the original message has length = 50 bytes", "id-GostR3411-94-TestParamSet",).hexdigest(), "471aba57a60a770d3a76130635c1fbea4ef14de51f78b4ae57dd893b62f55208", ) @@ -103,49 +103,49 @@ """ CryptoPro S-box test vectors """ def test_empty(self): self.assertSequenceEqual( - GOST341194(b"", "GostR3411_94_CryptoProParamSet").hexdigest(), + GOST341194(b"", "id-GostR3411-94-CryptoProParamSet").hexdigest(), "981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0", ) def test_a(self): self.assertSequenceEqual( - GOST341194(b"a", "GostR3411_94_CryptoProParamSet").hexdigest(), + GOST341194(b"a", "id-GostR3411-94-CryptoProParamSet").hexdigest(), "e74c52dd282183bf37af0079c9f78055715a103f17e3133ceff1aacf2f403011", ) def test_abc(self): self.assertSequenceEqual( - GOST341194(b"abc", "GostR3411_94_CryptoProParamSet").hexdigest(), + GOST341194(b"abc", "id-GostR3411-94-CryptoProParamSet").hexdigest(), "b285056dbf18d7392d7677369524dd14747459ed8143997e163b2986f92fd42c", ) def test_message_digest(self): self.assertSequenceEqual( - GOST341194(b"message digest", "GostR3411_94_CryptoProParamSet",).hexdigest(), + GOST341194(b"message digest", "id-GostR3411-94-CryptoProParamSet",).hexdigest(), "bc6041dd2aa401ebfa6e9886734174febdb4729aa972d60f549ac39b29721ba0", ) def test_dog(self): self.assertSequenceEqual( - GOST341194(b"The quick brown fox jumps over the lazy dog", "GostR3411_94_CryptoProParamSet",).hexdigest(), + GOST341194(b"The quick brown fox jumps over the lazy dog", "id-GostR3411-94-CryptoProParamSet",).hexdigest(), "9004294a361a508c586fe53d1f1b02746765e71b765472786e4770d565830a76", ) def test_32(self): self.assertSequenceEqual( - GOST341194(b"This is message, length=32 bytes", "GostR3411_94_CryptoProParamSet",).hexdigest(), + GOST341194(b"This is message, length=32 bytes", "id-GostR3411-94-CryptoProParamSet",).hexdigest(), "2cefc2f7b7bdc514e18ea57fa74ff357e7fa17d652c75f69cb1be7893ede48eb", ) def test_50(self): self.assertSequenceEqual( - GOST341194(b"Suppose the original message has length = 50 bytes", "GostR3411_94_CryptoProParamSet",).hexdigest(), + GOST341194(b"Suppose the original message has length = 50 bytes", "id-GostR3411-94-CryptoProParamSet",).hexdigest(), "c3730c5cbccacf915ac292676f21e8bd4ef75331d9405e5f1a61dc3130a65011", ) def test_Us(self): self.assertSequenceEqual( - GOST341194(128 * b"U", "GostR3411_94_CryptoProParamSet").hexdigest(), + GOST341194(128 * b"U", "id-GostR3411-94-CryptoProParamSet").hexdigest(), "1c4ac7614691bbf427fa2316216be8f10d92edfd37cd1027514c1008f649c4e8", ) diff --git a/pygost/test_pfx.py b/pygost/test_pfx.py index c53fe27a07b76578f42d52f376c4e963f828655c805c8ec88deefc9babdca51e..d27f7206f2dda8bdbda55136df712da4af1a810d1de9571e1d5099a7c68b2640 100644 --- a/pygost/test_pfx.py +++ b/pygost/test_pfx.py @@ -110,7 +110,7 @@ cfb_decrypt( key, bytes(shrouded_key_bag["encryptedData"]), iv=bytes(enc_scheme_params["iv"]), - sbox="Gost28147_tc26_ParamZ", + sbox="id-tc26-gost-28147-param-Z", ), private_key_info_expected, ) @@ -153,7 +153,7 @@ cfb_decrypt( key, bytes(encrypted_data["encryptedContentInfo"]["encryptedContent"]), iv=bytes(enc_scheme_params["iv"]), - sbox="Gost28147_tc26_ParamZ", + sbox="id-tc26-gost-28147-param-Z", ), cert_bag_expected, ) diff --git a/pygost/test_x509.py b/pygost/test_x509.py index de3c5ae927123584f8a52eb382f2e260f7c954771ce0f1c1a58e24e1c2c878b6..319299da6779600878e08921e5b308490c8a8c3d5dbf64e0806d404bd433fea2 100644 --- a/pygost/test_x509.py +++ b/pygost/test_x509.py @@ -105,7 +105,7 @@ dqQfmHrz6TI6Xojdh/t8ckODv/587NS5/6KsM77vc6Wh90NAT2s= """) prv_key_raw = hexdec("BFCF1D623E5CDD3032A7C6EABB4A923C46E43D640FFEAAF2C3ED39A8FA399924")[::-1] self.process_cert( - "GostR3410_2001_CryptoPro_XchA_ParamSet", + "id-GostR3410-2001-CryptoPro-XchA-ParamSet", 2001, GOST34112012256, prv_key_raw, @@ -133,7 +133,7 @@ o3eUNFkNyHJwQCk2WoOlO16zwGk2tdKH4KmD5w== """) prv_key_raw = hexdec("3FC01CDCD4EC5F972EB482774C41E66DB7F380528DFE9E67992BA05AEE462435757530E641077CE587B976C8EEB48C48FD33FD175F0C7DE6A44E014E6BCB074B")[::-1] self.process_cert( - "GostR3410_2012_TC26_ParamSetB", + "id-tc26-gost-3410-12-512-paramSetB", 2012, GOST34112012512, prv_key_raw, diff --git a/www.texi b/www.texi index 8006173d828f02d58f1d594a0db88f2f704ca94aef12736041c881fa4e967e85..1caafd64b9472c41c0f259b2931e8fcd7533e8f4234affcaadbaeefbf7154523 100644 --- a/www.texi +++ b/www.texi @@ -61,7 +61,7 @@ @verbatim >>> from pygost.gost3410 import CURVE_PARAMS >>> from pygost.gost3410 import GOST3410Curve ->>> curve = GOST3410Curve(*CURVE_PARAMS["GostR3410_2012_TC26_ParamSetA"]) +>>> curve = GOST3410Curve(*CURVE_PARAMS["id-tc26-gost-3410-12-512-paramSetA"]) >>> from os import urandom >>> prv_raw = urandom(32) >>> from pygost.gost3410 import prv_unmarshal