<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Форум Рутокен &mdash; TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
		<link>https://forum.rutoken.ru/topic/4419/</link>
		<atom:link href="https://forum.rutoken.ru/feed/rss/topic/4419/" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «TLS с помощью RSA ключа на Рутокен ЭЦП».]]></description>
		<lastBuildDate>Tue, 17 Sep 2024 17:00:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26082/#p26082</link>
			<description><![CDATA[<div class="quotebox"><cite>Ахат пишет:</cite><blockquote><p>Да, помогло, благодарю за ответы. Дальше ошибка &quot;ee key too small&quot;, хотя ключи 2048 бит.</p></blockquote></div><p>Есть подозрения, что в современном openssl security level по умолчанию установлен в значение 2, поэтому эффективное значение безопасности ключа в битах должно быть не меньше 128, что соответствует длине ключа как минимум 3072 (см. <a href="https://github.com/openssl/openssl/blob/a57c6f84920bff522bca5fede73f1a3f132d7cff/crypto/rsa/rsa_lib.c#L336C5-L337C20">https://github.com/openssl/openssl/blob … C5-L337C20</a> <a href="https://github.com/openssl/openssl/blob/a57c6f84920bff522bca5fede73f1a3f132d7cff/crypto/x509/x509_vfy.c#L3597">https://github.com/openssl/openssl/blob … fy.c#L3597</a> <a href="https://github.com/openssl/openssl/blob/a57c6f84920bff522bca5fede73f1a3f132d7cff/include/openssl/tls1.h#L31">https://github.com/openssl/openssl/blob … tls1.h#L31</a> <a href="https://github.com/openssl/openssl/blob/a57c6f84920bff522bca5fede73f1a3f132d7cff/crypto/rsa/rsa_lib.c#L385">https://github.com/openssl/openssl/blob … lib.c#L385</a> <a href="https://github.com/openssl/openssl/blob/a57c6f84920bff522bca5fede73f1a3f132d7cff/crypto/x509/x509_vfy.c#L3624">https://github.com/openssl/openssl/blob … fy.c#L3624</a>)</p><p>В этом ответе есть рекомендации по установке security level ниже через конфиг openssl: <a href="https://askubuntu.com/a/1233456">https://askubuntu.com/a/1233456</a></p><p>Предлагаю сначала без правок конфига поменять вызов на<br /></p><div class="codebox"><pre><code>s_client -host localhost -port 8443 -cert c:\test\openssl_1.1\cert.pem -keyform engine -key &quot;pkcs11:id=12&quot; -engine rtengine -cipher &quot;DEFAULT:@SECLEVEL=1&quot;</code></pre></div><p> (см. <a href="https://github.com/openssl/openssl/issues/3619">https://github.com/openssl/openssl/issues/3619</a>)</p>]]></description>
			<author><![CDATA[null@example.com (Евгений Мироненко)]]></author>
			<pubDate>Tue, 17 Sep 2024 17:00:16 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26082/#p26082</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26079/#p26079</link>
			<description><![CDATA[<div class="quotebox"><cite>Евгений Мироненко пишет:</cite><blockquote><p>&gt;Скорее всего, ваш сертификат в der-кодировке, а s_client ожидает PEM. Примерно такая команда перекодирует в PEM:</p><p><strong><br />openssl x509 -in c:\test\openssl_1.1\cert.crt -inform DER -out c:\test\openssl_1.1\cert.pem<br /></strong></p></blockquote></div><p>Да, помогло, благодарю за ответы. Дальше ошибка &quot;ee key too small&quot;, хотя ключи 2048 бит.<br /></p><div class="codebox"><pre><code>c:\test\openssl_1.1&gt;.\openssl.exe x509 -in c:\test\openssl_1.1\cert.crt -inform DER -out c:\test\openssl_1.1\cert.pem

c:\test\openssl_1.1&gt;set OPENSSL_CONF=C:\test\openssl_1.1\openssl.cnf

c:\test\openssl_1.1&gt;.\openssl.exe
OpenSSL&gt; s_client -host localhost -port 8443 -cert c:\test\openssl_1.1\cert.pem -keyform engine -key &quot;pkcs11:id=12&quot; -engine rtengine
engine &quot;rtengine&quot; set.
Enter PKCS#11 token PIN:
error setting certificate
5564:error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small:ssl\ssl_rsa.c:301:
error in s_client
OpenSSL&gt; exit

c:\test\openssl_1.1&gt;type .\cert.pem
-----BEGIN CERTIFICATE-----
MIIDIzCCAgsCFF8ZfT5FmIddK7CJezbSeo0ZsvF/MA0GCSqGSIb3DQEBCwUAME4x
CzAJBgNVBAYTAlJVMQ8wDQYDVQQDDAZJdmFub3YxHTAbBgkqhkiG9w0BCQEWDml2
YW5vdkBtYWlsLnJ1MQ8wDQYDVQQIDAZNb3Njb3cwHhcNMjQwOTE2MTQzOTE1WhcN
MjQxMDE2MTQzOTE1WjBOMQswCQYDVQQGEwJSVTEPMA0GA1UEAwwGSXZhbm92MR0w
GwYJKoZIhvcNAQkBFg5pdmFub3ZAbWFpbC5ydTEPMA0GA1UECAwGTW9zY293MIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3L/Ey8xkZIhycSTXT2dTJgbr
AcCc92o/UhhJfD23X8NrZd1Gkpon4pT2vVrOy1ZFwPmkQIBg78GMXnQZXDMdDxA7
nnhv6FDa49/HovdSit7dK5PUMxO183LZ+Ct34A16QVFuwbOyKxNI4Za07CeRElXo
B2S8iS2JoudH/jjwpWeIjrqZYgmvDPr5dJf74/dm8Camv2RpgC7uyMAsY4tsNcyM
eOGWy37jufz2yF4PKWfux8HcguzhLFyRvHUg3R7euoPN9LfJi0KT03uN1rbScWuk
puosnTOUB75LzFgv8VgW2o47rlw4cWVp2bJcH3q5AL1IrduTih8Gkz9qLD5enwID
AQABMA0GCSqGSIb3DQEBCwUAA4IBAQCEUJA2vEULb4LjluA01Y7YXUOkqyW2gmxg
TtnMJCkrjomHBIQ0AKwHhRisp4LVY1SKmRpstrq6HyKzP3WjnZtP/3lkCRHgjNrN
jNN72cLA+E8IFHu+wWPF71YrgQluFOYOSkmUMOsVHL3XF/x4JE2N/beErMEPfrDq
aWYqmFn0sIQzQxcLr9TcDz0KsuZ8+IOcVjjWBJExpobKdLiuZ16WCPZlGV6K8t3x
sRDFYMBAN4eKkU4mSHse6Mm2sXtpyOVljMWsJO+EItOzTyTWLeDnUjRCtRkb2EKV
297yZnrL2mXX6D+xqbDIW/NtgodyAk9VuVEpI58gN6i236UDnZLY
-----END CERTIFICATE-----</code></pre></div><p>В сертификате нет использования ключа (KeyUsage и EKU), неужели из-за этого?</p>]]></description>
			<author><![CDATA[null@example.com (Ахат)]]></author>
			<pubDate>Tue, 17 Sep 2024 14:07:44 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26079/#p26079</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26060/#p26060</link>
			<description><![CDATA[<div class="quotebox"><cite>Ахат пишет:</cite><blockquote><p>Верно ли я понял, что rtengine-1.6 или новее можно использовать для RSA ключей вместо libp11+libpkcs11 и в линуксе?</p></blockquote></div><p>Да, верно. Функциональность rtengine одинакова вне зависимости от платформы. Только следует учитывать, что опции конфигурации OPENSSL и способ указания идентификаторов ключей у rtengine и у engine_pkcs11 могут отличаться. В отношении rtengine можно ориентироваться на <a href="https://dev.rutoken.ru/pages/viewpage.action?pageId=43450394">https://dev.rutoken.ru/pages/viewpage.a … d=43450394</a></p>]]></description>
			<author><![CDATA[null@example.com (Евгений Мироненко)]]></author>
			<pubDate>Tue, 17 Sep 2024 05:26:11 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26060/#p26060</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26059/#p26059</link>
			<description><![CDATA[<p>&gt; В винде s_client почему-то требует доверия к сертификату:</p><p>Скорее всего, ваш сертификат в der-кодировке, а s_client ожидает PEM. Примерно такая команда перекодирует в PEM:</p><p><strong><br />openssl x509 -in c:\test\openssl_1.1\cert.crt -inform DER -out c:\test\openssl_1.1\cert.pem<br /></strong></p>]]></description>
			<author><![CDATA[null@example.com (Евгений Мироненко)]]></author>
			<pubDate>Tue, 17 Sep 2024 05:21:24 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26059/#p26059</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26057/#p26057</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Не подскажете версию opensc?</p></blockquote></div><p> Да, древняя, за 2012 год. На свежей в линуксе:<br /></p><div class="codebox"><pre><code>$ pkcs11-tool --module librtpkcs11ecp.so -O
Using slot 0 with a present token (0x0)
Public Key Object; GOSTR3410-2012-256
  PARAMS OID: 06072a850302022400
  VALUE:      9e46b532be4c3124fd6b9aadf518fd343ea7738a2f49cd2d7d7bc6681f9c61d7
              a88a788152af3b51bcf6cbd62c28d6336f39f0da9ca2cb4a120a42933358357f
  label:      24071601
  ID:         24071601
  Usage:      verify
  Access:     local
Public Key Object; GOSTR3410-2012-256
  PARAMS OID: 06072a850302022400
  VALUE:      9e8d052fff3a9acf168c1718a694fbfb22df5939c461ce03794abfec58000452
              b633898b2276e12b3c165f41d2c1a22187e5b2a8b1070e14cd456e5829f78f2e
  label:      24071602
  ID:         24071602
  Usage:      verify
  Access:     local
Certificate Object; type = X.509 cert
  label:      24071601
  subject:    DN: SNILS=11223344595/......
  serial:     7C00159B7EEC95EF69F8C1798A000800159B7E
  ID:         24071601
Certificate Object; type = X.509 cert
  label:      
  subject:    DN: C=RU, CN=Ivanov/emailAddress=ivanov@mail.ru, ST=Moscow
  serial:     5F197D3E4598875D2BB0897B36D27A8D19B2F17F
  ID:         3132
Public Key Object; RSA 2048 bits
  label:      
  ID:         3132
  Usage:      encrypt, verify, wrap
  Access:     local</code></pre></div><div class="quotebox"><blockquote><p>Как появились RSA-ключи на токене?</p></blockquote></div><p>Ключи появились по <a href="https://dev.rutoken.ru/pages/viewpage.action?pageId=132777032">https://dev.rutoken.ru/pages/viewpage.a … =132777032</a> </p><div class="codebox"><pre><code>pkcs11-tool --module rtpkcs11ecp.dll --keypairgen --key-type rsa:2048 -l --id 3132</code></pre></div><p>В винде s_client почему-то требует доверия к сертификату:<br /></p><div class="codebox"><pre><code>OpenSSL&gt; s_client -host localhost -port 8443 -cert c:\test\openssl_1.1\cert.crt -keyform engine -key &quot;pkcs11:id=12&quot; -engine rtengine
engine &quot;rtengine&quot; set.
Enter PKCS#11 token PIN:
unable to load certificate
9976:error:0909006C:PEM routines:get_name:no start line:crypto\pem\pem_lib.c:745:Expecting: TRUSTED CERTIFICATE
error in s_client</code></pre></div><p> Данный сертификат добавил в Доверенные корневые виндового хранилища, результат не поменялся.<br />В линуксе такой ошибки не было, хотя там использовалась не rtengine, а libp11 и libpkcs11 из <a href="https://github.com/OpenSC/libp11/tree/master">https://github.com/OpenSC/libp11/tree/master</a> - это сказано в инструкции <a href="https://dev.rutoken.ru/pages/viewpage.action?pageId=132777032">https://dev.rutoken.ru/pages/viewpage.a … =132777032</a><br />Верно ли я понял, что rtengine-1.6 или новее можно использовать для RSA ключей вместо libp11+libpkcs11 и в линуксе?</p>]]></description>
			<author><![CDATA[null@example.com (Ахат)]]></author>
			<pubDate>Mon, 16 Sep 2024 18:41:25 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26057/#p26057</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26056/#p26056</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Но если задавать переменную OPENSSL_CONF и такой конфиг, то ломается pkcs11-tool:</p></blockquote></div><p>Это интересное поведение. Не подскажете версию opensc? Мой pkcs11-tool (opensc 0.25.1) как будто не зависит от переменной OPENSSL_CONF.</p><div class="quotebox"><blockquote><p>Если не задавать OPENSSL_CONF, то pkcs11-tool работает, но после добавления сертификата не видит публичный RSA ключ как отдельный объект:</p></blockquote></div><p>Еще одно интересное поведение. Как появились RSA-ключи на токене? Существовал ли изначально публичный ключ или был только приватный? Есть вывод <strong>pkcs11-tool -O -l</strong> до импорта сертификата?</p>]]></description>
			<author><![CDATA[null@example.com (Евгений Мироненко)]]></author>
			<pubDate>Mon, 16 Sep 2024 17:14:42 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26056/#p26056</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26055/#p26055</link>
			<description><![CDATA[<p>Добавил в конфиг:<br /></p><div class="codebox"><pre><code># Настройки создания запросов на сертификат
[req]
prompt = no
distinguished_name = req_distinguished_name
req_extensions = ext

# Сведения о владельце сертификата
[req_distinguished_name]
countryName = RU
commonName = Ivanov
emailAddress = ivanov@mail.ru
stateOrProvinceName = Moscow

# Расширения сертификата
[ext]
subjectSignTool = ASN1:FORMAT:UTF8,UTF8String:СКЗИ \&quot;Рутокен ЭЦП 2.0\&quot;
extendedKeyUsage=emailProtection
keyUsage=digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment</code></pre></div><p>Самоподписанный успешно создался:<br /></p><div class="codebox"><pre><code>c:\test\openssl_1.1&gt;.\openssl.exe
OpenSSL&gt; req -engine rtengine -new -key pkcs11:id=12 -keyform engine -x509 -out cert.crt -outform DER
engine &quot;rtengine&quot; set.
Enter PKCS#11 token PIN:
OpenSSL&gt; exit</code></pre></div><p>Но если задавать переменную OPENSSL_CONF и такой конфиг, то ломается pkcs11-tool:<br /></p><div class="codebox"><pre><code>C:\distr\OpenSC Project\OpenSC\tools&gt;.\pkcs11-tool.exe --module rtPKCS11ECP.dll -T
Auto configuration failed
4480:error:25078067:DSO support routines:WIN32_LOAD:could not load the shared library:.\crypto\dso\dso_win32.c:172:filename(c:\test\openssl_1.1\rtengine.dll)
4480:error:25070067:DSO support routines:DSO_load:could not load the shared library:.\crypto\dso\dso_lib.c:244:
4480:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:.\crypto\engine\eng_dyn.c:450:
4480:error:0E07606D:configuration file routines:MODULE_RUN:module initialization error:.\crypto\conf\conf_mod.c:235:module=engines, value=engine_section, retcode=-1</code></pre></div><p>Если не задавать OPENSSL_CONF, то pkcs11-tool работает, но после добавления сертификата не видит публичный RSA ключ как отдельный объект:<br /></p><div class="codebox"><pre><code>C:\distr\OpenSC Project\OpenSC\tools&gt;.\pkcs11-tool.exe --module rtPKCS11ECP.dll -l -y cert -w C:\test\openssl_1.1\cert.crt --id 3132
Using slot 0 with a present token (0x0)
Logging in to &quot;Rutoken ECP &lt;no label&gt;&quot;.
Please enter User PIN: Created certificate:
Certificate Object, type = X.509 cert
  label:
  ID:         3132

C:\distr\OpenSC Project\OpenSC\tools&gt;.\pkcs11-tool.exe --module rtPKCS11ECP.dll -O
Using slot 0 with a present token (0x0)
Public Key Object; GOSTR3410
  PARAMS OID: 06072a850302022400
  VALUE:      9e46b532be4c3124fd6b9aadf518fd343ea7738a2f49cd2d7d7bc6681f9c61d7
              a88a788152af3b51bcf6cbd62c28d6336f39f0da9ca2cb4a120a42933358357f
  label:      24071601
  ID:         24071601
  Usage:      verify
Public Key Object; GOSTR3410
  PARAMS OID: 06072a850302022400
  VALUE:      9e8d052fff3a9acf168c1718a694fbfb22df5939c461ce03794abfec58000452
              b633898b2276e12b3c165f41d2c1a22187e5b2a8b1070e14cd456e5829f78f2e
  label:      24071602
  ID:         24071602
  Usage:      verify
Certificate Object, type = X.509 cert
  label:      24071601
  ID:         24071601
Certificate Object, type = X.509 cert
  label:
  ID:         3132</code></pre></div><p> - по данному выводу не ясно есть ли соответствующие ключи или сертификат без ключей.<br />В ПУР данный сертификат отображается в разделе Сертификаты с ключами.<br />Но бывает, что в ПУР RSA сертификат (не данный, другой) тоже не отображается в разделе &quot;Сертификаты с ключами&quot;, а отображается в разделе &quot;Сертификаты&quot;, при этом ключевая пара есть. Это зависит только от версии ПУР?</p>]]></description>
			<author><![CDATA[null@example.com (Ахат)]]></author>
			<pubDate>Mon, 16 Sep 2024 16:21:39 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26055/#p26055</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26054/#p26054</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>OpenSSL&gt; req -engine rtengine -new -key 0:3132 -keyform engine -x509 -out cert.crt -outform DER<br />engine &quot;rtengine&quot; set.<br />Can&#039;t open C:\Program Files\Common Files\SSL/openssl.cnf for reading, No error<br />11904:error:02001003:system library:fopen:No such process:crypto\bio\bss_file.c:69:fopen(&#039;C:\Program Files\Common Files\SSL/openssl.cnf&#039;,&#039;r&#039;)<br />11904:error:2006D080:BIO routines:BIO_new_file:no such file:crypto\bio\bss_file.c:76:<br />error in req</p></blockquote></div><p>Эта ошибка как раз подтверждает, что утилита req не может существовать без openssl.cnf. Просто если вы загружаете rtengine через dynamic engine, в openssl.cnf не должно быть упоминаний/загрузки rtengine, но могут быть все прочие настройки.</p>]]></description>
			<author><![CDATA[null@example.com (Евгений Мироненко)]]></author>
			<pubDate>Mon, 16 Sep 2024 16:03:35 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26054/#p26054</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26053/#p26053</link>
			<description><![CDATA[<p>Вынужден вас отправить к документации на openssl: <a href="https://docs.openssl.org/master/man1/openssl-req/#examples">https://docs.openssl.org/master/man1/op … /#examples</a> и к этому ответу на stackexchange: <a href="https://superuser.com/questions/947061/openssl-unable-to-find-distinguished-name-in-config">https://superuser.com/questions/947061/ … -in-config</a></p><p>TL/DR: для того, чтобы работала утилита req из openssl-tool, в openssl.cnf нужны дополнительные настройки.</p>]]></description>
			<author><![CDATA[null@example.com (Евгений Мироненко)]]></author>
			<pubDate>Mon, 16 Sep 2024 16:00:37 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26053/#p26053</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26051/#p26051</link>
			<description><![CDATA[<p>Через конфиг заработало, но почему не принимает distinguished_name из команды:<br /></p><div class="codebox"><pre><code>OpenSSL&gt; req -engine rtengine -new -key pkcs11:id=12 -keyform engine -x509 -out cert.crt -outform DER
engine &quot;rtengine&quot; set.
Enter PKCS#11 token PIN:
unable to find &#039;distinguished_name&#039; in config
problems making Certificate Request
12996:error:0E06D06C:configuration file routines:NCONF_get_string:no value:crypto\conf\conf_lib.c:273:group=req name=distinguished_name
error in req

OpenSSL&gt; req -engine rtengine -new -key pkcs11:id=12 -keyform engine -x509 -out cert.crt -outform DER -subj &quot;/C=RU/ST=Moscow/L=Moscow/O=Aktiv/OU=dev/CN=testuser/emailAddress=testuser@mail.com&quot;
engine &quot;rtengine&quot; set.
Enter PKCS#11 token PIN:
unable to find &#039;distinguished_name&#039; in config
problems making Certificate Request
12996:error:0E06D06C:configuration file routines:NCONF_get_string:no value:crypto\conf\conf_lib.c:273:group=req name=distinguished_name
error in req</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Ахат)]]></author>
			<pubDate>Mon, 16 Sep 2024 14:31:21 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26051/#p26051</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26049/#p26049</link>
			<description><![CDATA[<p>Евгений, благодарю за ответ.</p><div class="quotebox"><cite>Евгений Мироненко пишет:</cite><blockquote><p>Загрузка осуществляется командой:<br /></p><div class="codebox"><pre><code>&gt; engine dynamic -pre SO_PATH:c:\test\openssl_1.1\rtengine.dll -pre ID:rtengine -pre LIST_ADD:1 -pre LOAD -pre pkcs11_path:rtpkcs11ecp.dll</code></pre></div></blockquote></div><div class="codebox"><pre><code>c:\test\openssl_1.1&gt;echo %OPENSSL_CONF%
%OPENSSL_CONF%

c:\test\openssl_1.1&gt;.\openssl.exe
OpenSSL&gt; engine dynamic -pre SO_PATH:c:\test\openssl_1.1\rtengine.dll -pre ID:rtengine -pre LIST_ADD:1 -pre LOAD -pre pkcs11_path:rtpkcs11ecp.dll
(dynamic) Dynamic engine loading support
[Success]: SO_PATH:c:\test\openssl_1.1\rtengine.dll
[Success]: ID:rtengine
[Success]: LIST_ADD:1
[Success]: LOAD
[Success]: pkcs11_path:rtpkcs11ecp.dll
Loaded: (rtengine) Rutoken engine

OpenSSL&gt; req -engine rtengine -new -key 0:3132 -keyform engine -x509 -out cert.crt -outform DER
engine &quot;rtengine&quot; set.
Can&#039;t open C:\Program Files\Common Files\SSL/openssl.cnf for reading, No error
11904:error:02001003:system library:fopen:No such process:crypto\bio\bss_file.c:69:fopen(&#039;C:\Program Files\Common Files\SSL/openssl.cnf&#039;,&#039;r&#039;)
11904:error:2006D080:BIO routines:BIO_new_file:no such file:crypto\bio\bss_file.c:76:
error in req</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Ахат)]]></author>
			<pubDate>Mon, 16 Sep 2024 14:13:23 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26049/#p26049</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26048/#p26048</link>
			<description><![CDATA[<p><strong>Ахат</strong>, добрый день!</p><p>Среди ваших попыток загрузки engine была, как минимум, одна удачная, но она осталась незамеченной. Давайте разберемся.</p><p>Существует два метода загрузки engine в openssl-tool:<br />1. С использованием конфигурационного файла openssl.cnf<br />2. При помощи dynamic engine (<a href="https://github.com/openssl/openssl/blob/master/README-ENGINES.md#dynamic-engines">https://github.com/openssl/openssl/blob … ic-engines</a>)</p><p><strong>Как произвести загрузку rtengine с использованием openssl.cnf</strong></p><p>1. Указать в openssl.cnf, как минимум, следующие значения:<br /></p><div class="codebox"><pre><code>openssl_conf = openssl_def

[openssl_def]
engines = engine_section

[engine_section]
rtengine = gost_section

[gost_section]
dynamic_path = c:\\test\\openssl_1.1\\rtengine.dll
pkcs11_path = c:\\windows\\system32\\rtpkcs11ecp.dll
# rand_token = pkcs11:manufacturer=Aktiv%20Co.;model=Rutoken%20ECP
default_algorithms = CIPHERS, DIGEST, PKEY
# enable_rand = yes</code></pre></div><p>* Я закомментировал опции rand_token и enable_rand, чтобы openssl-tool с rtengine мог работать и без токена. Если вам из соображений безопасности важно брать энтропию для случайных чисел с токена, так делать не стоит.</p><p>* На windows есть проблема с прямыми/обратными слешами. Рабочий вариант (проверил у себя перед рекомендацией) -- использовать по два обратных слеша.</p><p>2. Задать переменную окружения OPENSSL_CONF, указывающую на ваш файл openssl.cnf. В пределах одной консоли cmd.exe это делается командой <strong>set OPENSSL_CONF=C:\test\openssl_1.1\openssl.cnf</strong></p><p><strong>Как произвести загрузку rtengine с использованием dynamic engine</strong></p><p>Загрузка осуществляется командой:<br /></p><div class="codebox"><pre><code>&gt; engine dynamic -pre SO_PATH:c:\test\openssl_1.1\rtengine.dll -pre ID:rtengine -pre LIST_ADD:1 -pre LOAD -pre pkcs11_path:rtpkcs11ecp.dll</code></pre></div><p>Загрузка openssl при помощи dynamic engine, пожалуй, имеет смысл только если вы используете openssl-tool как криптокалькулятор (однократно запустили openssl без параметров, и через командный интерфейс зовете доступные команды).</p><p>Загрузка rtengine обоими способами сразу (что вы продемонстрировали) не имеет логичного объяснения и на предвещает ничего хорошего.</p>]]></description>
			<author><![CDATA[null@example.com (Евгений Мироненко)]]></author>
			<pubDate>Mon, 16 Sep 2024 13:40:08 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26048/#p26048</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26046/#p26046</link>
			<description><![CDATA[<p>Поменял в конфиге слеши на обратные:<br /></p><div class="codebox"><pre><code>c:\test\openssl_1.1&gt;.\openssl.exe engine dynamic -pre SO_PATH:c:\test\openssl_1.1\rtengine.dll -pre ID:rtengine -pre LIST_ADD:1 -pre LOAD -pre pkcs11_path:rtpkcs11ecp.dll
(dynamic) Dynamic engine loading support
[Success]: SO_PATH:c:\test\openssl_1.1\rtengine.dll
[Success]: ID:rtengine
[Success]: LIST_ADD:1
[Success]: LOAD
[Success]: pkcs11_path:rtpkcs11ecp.dll
Loaded: (rtengine) Rutoken engine
tengine.dll)5078067:DSO support routines:win32_load:could not load the shared library:crypto\dso\dso_win32.c:108:filename(c:    estopenssl_1.1
8844:error:25070067:DSO support routines:DSO_load:could not load the shared library:crypto\dso\dso_lib.c:162:
8844:error:260B6084:engine routines:dynamic_load:dso not found:crypto\engine\eng_dyn.c:434:
tengine.dll260BC066:engine routines:int_engine_configure:engine configuration error:crypto\engine\eng_cnf.c:141:section=gost_section, name=dynamic_path, value=c:       estopenssl_1.1
8844:error:0E07606D:configuration file routines:module_run:module initialization error:crypto\conf\conf_mod.c:177:module=engines, value=engine_section, retcode=-1

c:\test\openssl_1.1&gt;type %OPENSSL_CONF%
openssl_conf = openssl_def

[openssl_def]
engines = engine_section

[engine_section]
rtengine = gost_section

[gost_section]
dynamic_path = c:\test\openssl_1.1\rtengine.dll
pkcs11_path = c:\windows\system32\rtpkcs11ecp.dll
#rand_token = pkcs11:manufacturer=Aktiv%20Co.;model=Rutoken%20ECP
#default_algorithms = CIPHERS, DIGEST, PKEY
#enable_rand = yes

c:\test\openssl_1.1&gt;&quot;C:\distr\OpenSC Project\OpenSC\tools\pkcs11-tool.exe&quot; --module rtpkcs11ecp.dll --list-slots
Auto configuration failed
tengine.dll)25078067:DSO support routines:WIN32_LOAD:could not load the shared library:.\crypto\dso\dso_win32.c:172:filename(c: estopenssl_1.1
13156:error:25070067:DSO support routines:DSO_load:could not load the shared library:.\crypto\dso\dso_lib.c:244:
13156:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:.\crypto\engine\eng_dyn.c:450:
13156:error:0E07606D:configuration file routines:MODULE_RUN:module initialization error:.\crypto\conf\conf_mod.c:235:module=engines, value=engine_section, retcode=-1</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Ахат)]]></author>
			<pubDate>Mon, 16 Sep 2024 12:34:16 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26046/#p26046</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26045/#p26045</link>
			<description><![CDATA[<div class="quotebox"><cite>Филиппов Никита пишет:</cite><blockquote><p><strong>Ахат</strong>, Необходимо указывать имя rtengine и в ID:rtengine. <br /><a href="https://docs.openssl.org/1.1.1/man1/engine/#options">Документация </a>по этим опциям.</p></blockquote></div><div class="codebox"><pre><code>c:\test\openssl_1.1&gt;.\openssl.exe engine dynamic -pre SO_PATH:c:/test/openssl_1.1/rtengine.dll -pre ID:rtengine -pre LIST_ADD:1 -pre LOAD -pre pkcs11_path:rtpkcs11ecp.dll
(dynamic) Dynamic engine loading support
[Success]: SO_PATH:c:/test/openssl_1.1/rtengine.dll
[Success]: ID:rtengine
[Success]: LIST_ADD:1
[Failure]: LOAD
13088:error:260B606D:engine routines:dynamic_load:init failed:crypto\engine\eng_dyn.c:507:
[Failure]: pkcs11_path:rtpkcs11ecp.dll
13088:error:260AC089:engine routines:int_ctrl_helper:invalid cmd name:crypto\engine\eng_ctrl.c:87:
13088:error:260AB089:engine routines:ENGINE_ctrl_cmd_string:invalid cmd name:crypto\engine\eng_ctrl.c:255:

c:\test\openssl_1.1&gt;.\openssl.exe engine dynamic -pre SO_PATH:c:/test/openssl_1.1/rtengine.dll -pre ID:rtengine -pre LIST_ADD:1 -pre LOAD -pre pkcs11_path:c:/windows/system32/rtpkcs11ecp.dll
(dynamic) Dynamic engine loading support
[Success]: SO_PATH:c:/test/openssl_1.1/rtengine.dll
[Success]: ID:rtengine
[Success]: LIST_ADD:1
[Failure]: LOAD
9436:error:260B606D:engine routines:dynamic_load:init failed:crypto\engine\eng_dyn.c:507:
[Failure]: pkcs11_path:c:/windows/system32/rtpkcs11ecp.dll
9436:error:260AC089:engine routines:int_ctrl_helper:invalid cmd name:crypto\engine\eng_ctrl.c:87:
9436:error:260AB089:engine routines:ENGINE_ctrl_cmd_string:invalid cmd name:crypto\engine\eng_ctrl.c:255:

c:\test\openssl_1.1&gt;type %OPENSSL_CONF%
openssl_conf = openssl_def

[openssl_def]
engines = engine_section

[engine_section]
rtengine = gost_section

[gost_section]
dynamic_path = c:/test/openssl_1.1/rtengine.dll
pkcs11_path = c:/windows/system32/rtpkcs11ecp.dll
rand_token = pkcs11:manufacturer=Aktiv%20Co.;model=Rutoken%20ECP
default_algorithms = CIPHERS, DIGEST, PKEY
enable_rand = yes</code></pre></div><p>А также pkcs11-tool дает ошибку:<br /></p><div class="codebox"><pre><code>C:\distr\OpenSC Project\OpenSC\tools&gt;.\pkcs11-tool.exe --module c:\windows\system32\rtpkcs11ecp.dll --list-slots
Auto configuration failed
8668:error:25078067:DSO support routines:WIN32_LOAD:could not load the shared library:.\crypto\dso\dso_win32.c:172:filename(c:/test/openssl_1.1/rtengine.dll)
8668:error:25070067:DSO support routines:DSO_load:could not load the shared library:.\crypto\dso\dso_lib.c:244:
8668:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:.\crypto\engine\eng_dyn.c:450:
8668:error:0E07606D:configuration file routines:MODULE_RUN:module initialization error:.\crypto\conf\conf_mod.c:235:module=engines, value=engine_section, retcode=-1

C:\distr\OpenSC Project\OpenSC\tools&gt;dir c:\test\openssl_1.1
...
 Содержимое папки c:\test\openssl_1.1

16.09.2024  14:44    &lt;DIR&gt;          .
16.09.2024  14:44    &lt;DIR&gt;          ..
29.11.2023  10:05         2 266 248 libcrypto-1_1-x64.dll
29.11.2023  10:05           636 040 libssl-1_1-x64.dll
16.09.2024  14:57               366 openssl.cnf
16.09.2024  14:39             2 209 openssl.cnf.old
29.11.2023  10:05           731 272 openssl.exe
16.09.2024  14:43        17 561 090 rtengine-1.6.0.zip
16.09.2024  14:44           490 176 rtengine.dll
               7 файлов     21 687 401 байт

c:\test\openssl_1.1&gt;dir c:\windows\system32\rtpkcs11ecp.dll
...
28.08.2024  13:31         4 732 088 rtPKCS11ECP.dll</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Ахат)]]></author>
			<pubDate>Mon, 16 Sep 2024 12:27:25 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26045/#p26045</guid>
		</item>
		<item>
			<title><![CDATA[Re: TLS с помощью RSA ключа на Рутокен ЭЦП]]></title>
			<link>https://forum.rutoken.ru/post/26038/#p26038</link>
			<description><![CDATA[<p><strong>Ахат</strong>, Необходимо указывать имя rtengine и в ID:rtengine. <br /><a href="https://docs.openssl.org/1.1.1/man1/engine/#options">Документация </a>по этим опциям.</p>]]></description>
			<author><![CDATA[null@example.com (Филиппов Никита)]]></author>
			<pubDate>Mon, 16 Sep 2024 08:37:25 +0000</pubDate>
			<guid>https://forum.rutoken.ru/post/26038/#p26038</guid>
		</item>
	</channel>
</rss>
