Skip to content
Advertisement

Java SSL client not selecting a smartcard key

I’m trying to use an Estonian ID card for SSL client authentication in a java program. This works in Chrome/Firefox against both banking sites and test servers (nginx or openssl s_server).

However my Java client (okhttp) works fine for a local keystore and fails when trying to use the ID card. I’ve boiled it down to this test case which reproduces the problem I see in a debugger and with logging (-Djavax.net.debug=ssl:handshake).

I can communicate with the card, e.g. I can print out the certificates for the same key. I’m piggybacking on the DigiDoc3 Client on Mac OSX.

I can see the exception that seems to cause the key to be ignored

JavaScript

Test program output

JavaScript

Test code

JavaScript

In the mean time I’ve put in a support request as well.

Advertisement

Answer

Based solely on Martin’s answer, building https://github.com/OpenSC/OpenSC from source and installing OpenSC-0.15.0.dmg gave an alternative driver that worked first time. I didn’t use the pkcs11-spy because it just worked first time.

JavaScript

I was able to test against openssl

JavaScript

Which responded with

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement