PyGOST is pure Python 2.7/3.x GOST cryptographic functions library. GOST is GOvernment STandard of Russian Federation (and Soviet Union). It is copylefted free software: licenced under GPLv3. You can read about GOST algorithms more.

Currently supported algorithms are:

Example 34.10-2012 keypair generation, signing and verifying:

>>> from pygost.gost3410 import CURVES
>>> curve = CURVES["id-tc26-gost-3410-12-512-paramSetA"]
>>> from os import urandom
>>> prv_raw = urandom(64)
>>> from pygost.gost3410 import prv_unmarshal
>>> prv = prv_unmarshal(prv_raw)
>>> from pygost.gost3410 import public_key
>>> pub = public_key(curve, prv)
>>> from pygost.gost3410 import pub_marshal
>>> from pygost.utils import hexenc
>>> print "Public key is:", hexenc(pub_marshal(pub))
>>> from pygost import gost34112012512
>>> data_for_signing = b"some data"
>>> dgst =[::-1]
>>> from pygost.gost3410 import sign
>>> signature = sign(curve, prv, dgst)
>>> from pygost.gost3410 import verify
>>> verify(curve, pub, dgst, signature)

Please send questions, bug reports and patches to gost mailing list. Announcements also go to this mailing list.

Copyright © 2015-2022