GOST Engine
GOST Engine
OpenSSL GOST Engine also includes 'gostsum' and 'gost12sum' command line tools
for generating and checking GOST R34.11-94 and GOST R34.11-2012 hashsums.
They have the same purposes and behavior as the well-known sha1sum and md5sum
utilities. These utilities can be used independently from OpenSSL.
ALGORITHMS SUPPORTED
GOST R 34.11-2012 Message digest algorithm. 256- and 512-bit hash values.
GOST 28147-89 - Symmetric cipher with 256-bit key. Various modes are
defined in the standard, but only CBC, CFB and CNT modes are implemented
in the engine. To make statistical analysis more difficult, key
meshing is supported (see RFC 4357).
GOST 28147-89 MAC mode. Message authentication code. While a lot of MAC
algorithms out there are based on hash functions using HMAC algorithm,
this algoritm is based on symmetric cipher.
It has 256-bit symmetric key and 8-64 (default 32) bits of MAC value
(while HMAC has same key size and value size).
It is implemented as combination of EVP_PKEY type and EVP_MD type.
See RFC 4490 for S/MIME with GOST algorithms and RFC 4491 for PKI. TLS support
is implemented according IETF draft-chudov-cryptopro-cptls-03.txt and is
compatible with CryptoPro CSP 3.0+.
To use the engine you have to load it via openssl configuration
file. Applications should read openssl configuration file or provide
their own means to load engines. Also, applications which operate with
private keys, should use generic EVP_PKEY API instead of using RSA or
other algorithm-specific API.
Paramsets starting with X are intended to use for key exchange keys.
Paramsets without X are for digital signature keys.
Paramset for both algorithms 0 is the test paramset which should be used
only for test purposes.
3. S/MIME operations
If you want to send encrypted mail using GOST algorithms, don't forget
to specify -gost89 as encryption algorithm for OpenSSL smime command.
While OpenSSL is clever enough to find out that GOST R 34.11-94 digest
must be used for digital signing with GOST private key, it have no way
to derive symmetric encryption algorithm from key exchange keys.
4. TLS operations
RSA, DSA and EC keys can be used simultaneously with GOST keys, if
server implementation supports loading more than two private
key/certificate pairs. In this case ciphersuites which use any of loaded
keys would be supported and clients can negotiate ones they wish.
This allows creation of TLS servers which use GOST ciphersuites for
Russian clients and RSA/DSA ciphersuites for foreign clients.
To produce PKCS12 files compatible with MagPro CSP, you need to use
GOST algorithm for encryption of PKCS12 file and also GOST R 34.11-94
hash to derive key from password.
To test performance of GOST symmetric ciphers you should use -evp switch
of the openssl speed command. Engine-provided ciphers couldn't be
accessed by cipher-specific functions, only via generic evp interface
Applications never should access engine directly. They only use provided
EVP_PKEY API. But there are some details, which should be taken into
account.
EVP_PKEY_encrypt encrypts provided session key with VKO shared key and
packs it into GOST key transport structure, described in the RFC 4490.
It typically uses ephemeral key pair to compute shared key and packs its
public part along with encrypted key. So, for most cases use of
EVP_PKEY_encrypt/EVP_PKEY_decrypt with GOST keys is almost same as with
RSA.