]> Cypherpunks.ru repositories - pygost.git/blob - www.texi
Use curve's cofactor during VKO calculations
[pygost.git] / www.texi
1 \input texinfo
2 @documentencoding UTF-8
3 @settitle PyGOST
4
5 @copying
6 Copyright @copyright{} 2015-2020 @email{stargrave@@stargrave.org, Sergey Matveev}
7 @end copying
8
9 @node Top
10 @top PyGOST
11
12 PyGOST is pure Python 2.7/3.x GOST cryptographic functions library.
13 GOST is GOvernment STandard of Russian Federation (and Soviet Union).
14 It is
15 @url{https://www.gnu.org/philosophy/pragmatic.html, copylefted}
16 @url{https://www.gnu.org/philosophy/free-sw.html, free software}:
17 licenced under @url{https://www.gnu.org/licenses/gpl-3.0.html, GPLv3}.
18 You can read about GOST algorithms @url{http://www.gost.cypherpunks.ru/, more}.
19
20 Currently supported algorithms are:
21
22 @itemize
23 @item GOST 28147-89 (@url{https://tools.ietf.org/html/rfc5830.html, RFC 5830})
24     block cipher with ECB, CNT (CTR), CFB, MAC,
25     CBC (@url{https://tools.ietf.org/html/rfc4357.html, RFC 4357})
26     modes of operation
27 @item various 28147-89-related S-boxes included
28 @item GOST R 34.11-94 hash function
29     (@url{https://tools.ietf.org/html/rfc5831.html, RFC 5831})
30 @item GOST R 34.11-94 based @url{https://en.wikipedia.org/wiki/PBKDF2, PBKDF2} function
31 @item GOST R 34.11-2012 Стрибог (Streebog) hash function
32     (@url{https://tools.ietf.org/html/rfc6986.html, RFC 6986})
33 @item GOST R 34.11-2012 based PBKDF2 function (Р 50.1.111-2016)
34 @item GOST R 34.10-2001
35     (@url{https://tools.ietf.org/html/rfc5832.html, RFC 5832})
36     public key signature function
37 @item GOST R 34.10-2012
38     (@url{https://tools.ietf.org/html/rfc7091.html, RFC 7091})
39     public key signature function
40 @item various 34.10 curve parameters included
41 @item Coordinates conversion from twisted Edwards to Weierstrass
42     form and vice versa
43 @item VKO GOST R 34.10-2001 key agreement function
44     (@url{https://tools.ietf.org/html/rfc4357.html, RFC 4357})
45 @item VKO GOST R 34.10-2012 key agreement function
46     (@url{https://tools.ietf.org/html/rfc7836.html, RFC 7836})
47 @item 28147-89 and CryptoPro key wrapping
48     (@url{https://tools.ietf.org/html/rfc4357.html, RFC 4357})
49 @item 28147-89 CryptoPro key meshing for CFB and CBC modes
50     (@url{https://tools.ietf.org/html/rfc4357.html, RFC 4357})
51 @item @url{https://tools.ietf.org/html/rfc4491.html, RFC 4491}
52     (using GOST algorithms with X.509) compatibility helpers
53 @item GOST R 34.12-2015 128-bit block cipher Кузнечик (Kuznechik)
54     (@url{https://tools.ietf.org/html/rfc7801.html, RFC 7801})
55 @item GOST R 34.12-2015 64-bit block cipher Магма (Magma)
56 @item GOST R 34.13-2015 padding methods and block cipher modes of operation
57       (ECB, CTR, OFB, CBC, CFB, MAC)
58 @item MGM AEAD mode for 64 and 128 bit ciphers (Р 1323565.1.026–2019)
59 @item CTR-ACPKM, OMAC-ACPKM-Master modes of operation (Р 1323565.1.017-2018)
60 @item KExp15/KImp15 key export/import functions (Р 1323565.1.017-2018)
61 @item KDF_GOSTR3411_2012_256, KDF_TREE_GOSTR3411_2012_256 (Р 50.1.113-2016)
62 @item KEG export key generation function (Р 1323565.1.020-2018)
63 @item PEP247-compatible hash/MAC functions
64 @end itemize
65
66 Example 34.10-2012 keypair generation, signing and verifying:
67
68 @example
69 >>> from pygost.gost3410 import CURVES
70 >>> curve = CURVES["id-tc26-gost-3410-12-512-paramSetA"]
71 >>> from os import urandom
72 >>> prv_raw = urandom(32)
73 >>> from pygost.gost3410 import prv_unmarshal
74 >>> prv = prv_unmarshal(prv_raw)
75 >>> from pygost.gost3410 import public_key
76 >>> pub = public_key(curve, prv)
77 >>> from pygost.gost3410 import pub_marshal
78 >>> from pygost.utils import hexenc
79 >>> print "Public key is:", hexenc(pub_marshal(pub))
80 >>> from pygost import gost34112012256
81 >>> data_for_signing = b"some data"
82 >>> dgst = gost34112012256.new(data_for_signing).digest()[::-1]
83 >>> from pygost.gost3410 import sign
84 >>> signature = sign(curve, prv, dgst, mode=2012)
85 >>> from pygost.gost3410 import verify
86 >>> verify(curve, pub, dgst, signature, mode=2012)
87 True
88 @end example
89
90 Please send questions, bug reports and patches to
91 @url{https://lists.cypherpunks.ru/mailman/listinfo/gost, gost}
92 mailing list. Announcements also go to this mailing list.
93
94 @insertcopying
95
96 @include faq.texi
97 @include news.texi
98 @include install.texi
99
100 @bye