Skip to content

Inconsistent HostnameVerifier behavior between backends #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kevinoid opened this issue Oct 5, 2012 · 3 comments
Closed

Inconsistent HostnameVerifier behavior between backends #146

kevinoid opened this issue Oct 5, 2012 · 3 comments
Milestone

Comments

@kevinoid
Copy link

kevinoid commented Oct 5, 2012

The contract/behavior of HostnameVerifier differs between the JDK and Netty backends. For the JDK backend, the HostnameVerifier is only called in the case that the connection hostname does not match the certificate hostname (which is why HttpsURLConnection.getDefaultHostnameVerifier returns false in all cases). In contrast, the Netty backend always calls the HostnameVerifier, which places the burden of wildcard and subject alt name matching on the client code.

It would make SSL certificate verification much easier for client code if the behavior was consistent and, if the behavior is to call HostnameVerifier in all cases, to provide an implementation which client code could extend that takes care of this common case.

For reference, the implementation I am using (which emulates the JDK, but requires using Sun internal proprietary APIs) is here.

@harbulot
Copy link

For reference, how a hostname verifier should behave is standardised in RFC 2818, Section 3.1 (and in RFC 6125).

The default hostname verifier used by HttpsURLConnection in Java follows this specification strictly. Some other clients do not. In particular, some clients are more tolerant regarding IP addresses places in the Common Name (CN) of the Subject DN (whereas IP addresses should only be in a Subject Alternative Name of IPaddress type). This is discussed here: http://stackoverflow.com/questions/8443081/how-are-ssl-certificate-server-names-resolved-can-i-add-alternative-names-using

@wsargent
Copy link
Contributor

wsargent commented Apr 2, 2014

This can be closed out because #392 drops the JDK provider completely.

@slandelle slandelle added this to the 2.0.0.Alpha1 milestone Apr 2, 2014
@slandelle
Copy link
Contributor

Right, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants