# VKO GOST R 34.10-2001 (described in RFC4357), Key Agreement Algorithm. Looking for its implementation/detailed description/examples

VKO GOST R 34.10-2001 was described in RFC4357 Page 7 But the description is very poor. Here it is:

This algorithm creates a key encryption key (KEK) using 64 bit UKM, the sender's private key, and the recipient's public key (or the reverse of the latter pair).

1. Let $$K(x,y,UKM) = ((UKM*x)(mod q)) . (y.P)$$ (512 bit), where

$$x$$ - sender's private key (256 bit)
$$x.P$$ - sender's public key (512 bit)
$$y$$ - recipient's private key (256 bit)
$$y.P$$ - recipient's public key (512 bit)
$$UKM$$ - non-zero integer, produced as in step 2 p. 6.1 [GOSTR341001]
$$P$$ - base point on the elliptic curve (two 256-bit coordinates)
$$UKM*x$$ - $$x$$ multiplied by UKM as integers
$$x.P$$ - a multiple point

1. Calculate a 256-bit hash of $$K(x,y,UKM)$$:

$$KEK(x,y,UKM) = gostR3411 (K(x,y,UKM))$$

Keypairs $$(x,x.P)$$ and $$(y,y.P)$$ MUST comply with [GOSTR341001].

This algorithm MUST NOT be used when $$x.P = P, y.P = P$$

I want to implement it. Would be great to get more detailed description of that alogirthm with standard values for all parameters, with several examples (to be used in testing my own implementation) of all intermediate and final values on both sides. Here’s an example of a great description for Signature Algorithm GOST R 34.10-2012 (PDF, Russian language).

There is an implementation in OpenSSL of VKO GOST “engines/ccgost/gost2001_keyx.c”, but I'm not familiar with OpenSSL, so understanding of those functions internals is difficult for me. Maybe someone has at least some C++ (or any other language) implementation of VKO GOST key agreement algorithm (could be through OpenSSL) so that I can run it and get golden test values for testing my own implementation.

I just finished with implementing my own Big Integer C++ library with elliptic curves support. I've implemented Key Agreement from RFC4357 and surprisingly it works! You get the same$$K(x, y, UKM)$$ on both sides while only sharing public keys and UKM between both parties.

Just found a nice description of VKO GOST in the next document Using cryptographic algorithms related to GOST R 34.10/11-2012 (PDF, Russian language). It has reference examples of computing shared key $$K(x, y, UKM)$$ after hashing it with Hash GOST R 34.11-2012.

Still looking for real detailed standards with real values. Maybe some other Key Agreement standards that are well used in Russia or related to GOST R 34.10 standard.

• Did you find the answer? I has the data, but can't reproduce it with gost engine code from OpenSSL: PK = E123BBD0A6869A30B19807AFFA2EA081155B63D29BC75930EC5F3B4824A7B158A77A6626133574EC0FAF0907EC6642E981D21D082F8F62AB8E5B2B951D6A5D1E SK = 92C608372E301011CF36F7CC27CE57F57EAC37C42200E8D174702BC29577B0F4 UKM = E603D3ADF7110899 POINT = B89B2825BE8D76441FA7132BEC6E5CE0ABCC11AF86E11EC323D89B764FC15023B291567AC4DA064EBED423D06203C9A232D01FA308F21D0EBBADA4B95C47CAA0 KEK = 1AF59F994A7AB649D9E1165ECCD28BC7DC42D23C7B6909087928F24B4BF09258 May 27, 2015 at 10:59
• tools.ietf.org/html/rfc5832 May 28, 2015 at 10:24
• It should also be noted that GOST R 34.10-2001 was deprecated, and will no longer be in service as of 2018 May 28, 2015 at 10:30

After that I would suggest running a test SSL/TLS connection with those certificates and openssl s_client and openssl s_server utilities. If it works, you may then recompile OpenSSL and make it dump all needed intermediate data during SSL handshake to stdout. You can then have as many reference examples as needed.