Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The SSL/TLS protocol specification is modular and detached from the specifications used to authenticate the remote host. These other specifications are split into two categories: verifying that the certificate itself can be trusted (RFC 3280/5280) and verifying the identity in the certificate (RFC 6125, or RFC 2818 for HTTPS).</p> <p>The JSSE integrates the SSL protocol and the verification of the certificate in the <code>SSLSocket</code> (or <code>SSLEngine</code>) API, but doesn't handle the verification of the identifier (whch is equally important).</p> <p>This is mainly due to the fact that the <code>SSLSocket</code>/<code>SSLEngine</code> can apply to any application protocol (e.g. HTTP, IMAP, SMTP, LDAP, ...), but the rules for verifying the identifier were in different specifications (with small variations), until RFC 6125 (which is still quite recent).</p> <p><code>HttpsURLConnection</code> handles both, because it also uses a <code>HostnameVerifier</code>, which follows the HTTPS specification (RFC 2818, Section 3.1). This is done separately from the <code>SSLSocket</code>/<code>SSLEngine</code> API. For other protocols, you may need to implement what the protocol specification says.</p> <p>This being said, since Java 7, there is a mechanism to verify the identity of the certificate directly as part of the <code>SSLSocket</code>/<code>SSLEngine</code> API.</p> <pre><code>SSLParameters sslParams = new SSLParameters(); sslParams.setEndpointIdentificationAlgorithm("HTTPS"); sslSocket.setSSLParameters(sslParams); </code></pre> <p>Using this should make it throw an exception if the host name doesn't match.</p> <p>There aren't major differences between HTTPS and the more uniform specifications in RFC 6125 (besides the fact that the latter considers IP addresses out of scope). Even if you're not using HTTPS, it would still generally make sense to use its identification specifications for other protocols. (Perhaps an "RFC 6125" endpoint identification algorithm might come in later versions of Java.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload