X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=README;h=0f5fa1ce05158c20bff892d72b43521c67f89260;hb=f4078e53da769ade0d92e80ad9093040e7f71d58;hp=68317a60c86902f6d0df13fc1124c0789daed488;hpb=7711d3fca429d8d19fd8a6923894633b1d3d8f32;p=gogost.git diff --git a/README b/README index 68317a6..0f5fa1c 100644 --- a/README +++ b/README @@ -18,7 +18,7 @@ GOST is GOvernment STandard of Russian Federation (and Soviet Union). * GOST R 34.12-2015 128-bit block cipher Кузнечик (Kuznechik) (RFC 7801) * GOST R 34.12-2015 64-bit block cipher Магма (Magma) * GOST R 34.13-2015 padding methods -* MGM AEAD mode for 64 and 128 bit ciphers +* MGM AEAD mode for 64 and 128 bit ciphers (Р 1323565.1.026–2019) * TLSTREE keyscheduling function * ESPTREE/IKETREE (IKE* is the same as ESP*) keyscheduling function * PRF_IPSEC_PRFPLUS_GOSTR3411_2012_{256,512} and generic prf+ functions @@ -32,6 +32,31 @@ Known problems: * intermediate calculation values are not zeroed * 34.10 is not time constant and slow +Example 34.10-2012-256 keypair generation, signing and verifying: + + import ( + "crypto/rand" + "io" + "go.cypherpunks.ru/gogost/v5/gost3410" + "go.cypherpunks.ru/gogost/v5/gost34112012256" + ) + func main() { + data := []byte("data to be signed") + hasher := gost34112012256.New() + _, err := hasher.Write(data) + dgst := hasher.Sum(nil) + curve := gost3410.CurveIdtc26gost34102012256paramSetB() + prvRaw := make([]byte, int(32)) + _, err = io.ReadFull(rand.Reader, prvRaw) + prv, err := gost3410.NewPrivateKey(curve, prvRaw) + pub, err := prv.PublicKey() + pubRaw := pub.Raw() + sign, err := prv.Sign(rand.Reader, dgst, nil) + pub, err = gost3410.NewPublicKey(curve, pubRaw) + isValid, err := pub.VerifyDigest(dgst, sign) + if !isValid { panic("signature is invalid") } + } + GoGOST is free software: see the file COPYING for copying conditions. GoGOST'es home page is: http://www.gogost.cypherpunks.ru/