Rutoken ЭЦП, генерирование ключевой пары.
$ openssl version
OpenSSL 1.0.2h 3 May 2016
openssl.cnf
----
[openssl_def]
engines = engine_section
[engine_section]
gost = gost_section
pkcs11 = pkcs11_section
[gost_section]
engine_id = gost
dynamic_path = /usr/lib64/engines/libgost.so
default_algorithms = ALL
init = 0
[pkcs11_section]
engine_id = pkcs11_gost
dynamic_path = /usr/lib64/engines/libpkcs11_gost.so
MODULE_PATH = /usr/lib64/librtpkcs11ecp.so
init = 0
Пытаюсь сгенерировать ключевую пару - получаю ошибку.
$ openssl genpkey -engine pkcs11_gost -algorithm GOST2001 -pkeyopt key_id:13 -pkeyopt paramset:XB -pkeyopt pin:1234
engine "pkcs11_gost" set.
Error writing key
139733111809680:error:0D0A30A7:asn1 encoding routines:i2d_PrivateKey:unsupported public key type:i2d_pr.c:76:
139733111809680:error:0906900D:PEM routines:PEM_ASN1_write_bio:ASN1 lib:pem_lib.c:358:
Что самое интересное запрос на сертификат проходит:
$ openssl req -engine pkcs11_gost -new -key 13 -keyform engine -out newreq.pem -text -subj "/C=RU/ST=Moscow/L=Moscow/O=None/OU=UNIX/CN=VoidNew"
engine "pkcs11_gost" set.
Enter Please enter PIN:
$ cat newreq.pem
Certificate Request:
Data:
Version: 0 (0x0)
Subject: C=RU, ST=Moscow, L=Moscow, O=None, OU=UNIX, CN=VoidNew
Subject Public Key Info:
Public Key Algorithm: GOST R 34.10-2001
Public key:
X:4DC54D5B9008FD76BB823C7A144591D1E2DA8771991C91C5C3B7A18CC9054B9C
Y:671F4D0607F19BF2D80CA47AF011E3BF7A31B2D91352298BDB6836B901239243
Parameter set: id-GostR3410-2001-CryptoPro-XchB-ParamSet
Attributes:
a0:00
----- CUT ----------------------------
-----END CERTIFICATE REQUEST-----
Через pkcs#11 Видим, что пара есть.
pkcs11-tool --module /usr/lib/librtpkcs11ecp.so -Ol
Using slot 0 with a present token (0x0)
Logging in to "Rutoken ECP <no label>".
Please enter User PIN:
Public Key Object; GOSTR3410
PARAMS OID: 06072a850302022401
VALUE: 50b49979d4afd224a0ee49f19c89121dfed2a1038984eaca0d7ce0c0a0e1f57f
c958b64f25fe9eb6a12e01f27581a4b59a2644518bc3c8418b0f66991dc62f41
label:
ID: 13
Usage: verify
Private Key Object; GOSTR3410
PARAMS OID: 06072a850302022401
label:
ID: 13
Usage: sign, derive
Это баг или фича?