I'm implementing a protocol that specifies TLS1.2
as transport layer and requires client-side server authentication to verify the server's hostname by comparing the hostname value of the connecting client socket to the value indicated by the server in its certificate, namely subjectAltName
extension of type dNSName
.
I've created a test, put this value in the server's certificate and it seemed to get ignored by the client completely, but I'd like to be sure. Do I have to code this check in an implementation of X509ExtendedTrustManager.checkServerTrusted(X509Certificate[], String, Socket)
or can I enable it through some obscure property? The reference guide appears silent on this matter.
The protocol specification (the one I'm implementing) also mentions that wildcards may be used as a prefix of the value in the certificate.
A "*" wildcard character MAY be used as the leftmost name component in the certificate. For example, *.example.com would match a.example.com, foo.example.com, etc., but would not match example.com.
However, when I tried to create such an extension value with keytool
, it refused to do so. What's going on?
"C:\Program Files\Java\jdk1.7.0_51\bin\keytool.exe" -genkeypair -alias server -keyalg RSA -validity 365 -ext san=dns:*.example.com -keystore mykeystore ...
keytool error: java.lang.RuntimeException: java.io.IOException: DNSName components must begin with a letter