<div>                <br>            </div>            <div class="yahoo_quoted" style="margin:10px 0px 0px 0.8ex;border-left:1px solid #ccc;padding-left:1ex;">                        <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">                <div>----- Forwarded Message -----</div>                <div><b>From:</b> Zlatko Vrastic <vrastic@yahoo.com></div><div><b>To:</b> "openssl-users@openssl.org" <openssl-users@openssl.org></div><div><b>Sent:</b> Friday, October 22, 2021, 03:25:10 PM GMT+2</div><div><b>Subject:</b> openssl s_client privatekey engine pkcs11  -  no SSL_connect:SSLv3/TLS write certificate verify</div><div><br></div>                <div><div dir="ltr">When using <br></div><div dir="ltr">openssl s_client ...... -keyform engine -engine pkcs11 -key 0:00<br></div><div dir="ltr">there is no SSL_connect:SSLv3/TLS write certificate verify step in handshake protocol<br></div><div dir="ltr">and server rejects connection.<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">Connection is https get to get token for further communication. During this https get tls1.2 is used as protocol.<br></div><div dir="ltr">Connecting to server with Windows and Visual Studio https request is good with pfx or with smart card, we get token.<br></div><div dir="ltr">On Linux openssl+opensc connection with client.pem and privatekey.pem extracted from pfx certificate is ok, we get token.<br></div><div dir="ltr">When we use smart card with openssl+opensc we get authorisation denied, the ssl client is not sending SSL_connect:SSLv3/TLS write certificate verify.<br></div><div dir="ltr">Comparing log from ssl, the initial handshake is the same, when we send get request string, after that handshake is different.<br></div><div dir="ltr"><br></div><div dir="ltr">good communication when used client.pem and privatekey.pem<br></div><div dir="ltr">SSL_connect:SSL negotiation finished successfully<br></div><div dir="ltr">SSL_connect:SSL negotiation finished successfully<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read hello request<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client hello<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client hello<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server hello<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server certificate<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server key exchange<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server certificate request<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server done<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client certificate<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client key exchange<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write certificate verify<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write change cipher spec<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write finished<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write finished<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read change cipher spec<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read finished<br></div><div dir="ltr">read R BLOCK<br></div><div dir="ltr">HTTP/1.1 200 OK<br></div><div dir="ltr"><br></div><div dir="ltr">missing write certificate verify when using gids smartcard:  -keyform engine -engine pkcs11 -key 0:00 (works the same used also: -keyform engine -engine pkcs11 -key "pkcs11:id=%00;type=private" )<br></div><div dir="ltr">SSL_connect:SSL negotiation finished successfully<br></div><div dir="ltr">SSL_connect:SSL negotiation finished successfully<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read hello request<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client hello<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client hello<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server hello<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server certificate<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server key exchange<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server certificate request<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read server done<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client certificate<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write client key exchange<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write change cipher spec<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write finished<br></div><div dir="ltr">SSL_connect:SSLv3/TLS write finished<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read change cipher spec<br></div><div dir="ltr">SSL_connect:SSLv3/TLS read finished<br></div><div dir="ltr">read R BLOCK<br></div><div dir="ltr">HTTP/1.1 401 Unauthorized<br></div><div dir="ltr"><br></div><div dir="ltr">Do You have any suggestions on what to try? We debugged and verified that the openssl engine pkcs11 through opensc is working good. <br></div><div dir="ltr">Do not know how to specify to s_client to send SSLv3/TLS write certificate verify. When this is not sent we get rejected from the server.<br></div><div dir="ltr"><br></div><div dir="ltr">Another issue we had was with cipher suites. Server usually works with ECDHE-RSA-AES256-GCM-SHA384.<br></div><div dir="ltr">With openssl installed on linux this cipher is used for communication.<br></div><div dir="ltr">With openssl installed on windows it returns<br></div><div dir="ltr">742F0000:error:0A080006:SSL routines:ssl_generate_param_group:EVP lib:ssl\s3_lib.c:4727:<br></div><div dir="ltr">742F0000:error:0A00013A:SSL routines:tls_process_ske_ecdhe:unable to find ecdh parameters:ssl\statem\statem_clnt.c:2140:<br></div><div dir="ltr">this cipher suite is supprted from openssl when checked with ciphers commands.<br></div><div dir="ltr">and later with<br></div><div dir="ltr">New, (NONE), Cipher is (NONE)<br></div><div dir="ltr">We skipped over this with -cipher AESGCM:!ECDHE-RSA-AES256-GCM-SHA384 by specifying to poenssl not to use this cipher, <br></div><div dir="ltr">communication is swithed to<br></div><div dir="ltr">New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256.<br></div><div dir="ltr">But this problem with SSLv3/TLS write certificate verify is the same on linux and windows.<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div></div>            </div>                </div>