Partager via


HttpsURLConnection.DefaultHostnameVerifier Property

Definition

Gets the default HostnameVerifier that is inherited by new instances of this class. -or- Sets the default HostnameVerifier inherited by a new instance of this class.

public static Javax.Net.Ssl.IHostnameVerifier? DefaultHostnameVerifier { [Android.Runtime.Register("getDefaultHostnameVerifier", "()Ljavax/net/ssl/HostnameVerifier;", "")] get; [Android.Runtime.Register("setDefaultHostnameVerifier", "(Ljavax/net/ssl/HostnameVerifier;)V", "")] set; }
[<get: Android.Runtime.Register("getDefaultHostnameVerifier", "()Ljavax/net/ssl/HostnameVerifier;", "")>]
[<set: Android.Runtime.Register("setDefaultHostnameVerifier", "(Ljavax/net/ssl/HostnameVerifier;)V", "")>]
static member DefaultHostnameVerifier : Javax.Net.Ssl.IHostnameVerifier with get, set

Property Value

the default host name verifier

Attributes

Exceptions

if the specified verifier is null.

Remarks

Property getter documentation:

Gets the default HostnameVerifier that is inherited by new instances of this class.

Java documentation for javax.net.ssl.HttpsURLConnection.getDefaultHostnameVerifier().

Property setter documentation:

Sets the default HostnameVerifier inherited by a new instance of this class.

Developers are <em>strongly</em> discouraged from changing the default HostnameVerifier as #getDefaultHostnameVerifier() is used by several classes for hostname verification on Android. <table> <tr> <th>User</th> <th>Effect</th> </tr> <tr> <td>Android's default TrustManager, as used with Android's default SSLContext, SSLSocketFactory and SSLSocket implementations. </td> <td>The HostnameVerifier is used to verify the peer's certificate hostname after connecting if SSLParameters.setEndpointIdentificationAlgorithm("HTTPS") has been called. Instances use the <em>current</em> default HostnameVerifier at verification time.</td> </tr> <tr> <td>android.net.SSLCertificateSocketFactory</td> <td>The current default HostnameVerifier is used from various createSocket methods. See android.net.SSLCertificateSocketFactory for details; for example android.net.SSLCertificateSocketFactory#createSocket(String, int). </td> </tr> <tr> <td>Android's default HttpsURLConnection implementation.</td> <td>The HostnameVerifier is used after a successful TLS handshake to verify the URI host against the TLS session server. Instances use the default HostnameVerifier set <em>when they were created</em> unless overridden with #setHostnameVerifier(HostnameVerifier). Android's HttpsURLConnection relies on the HostnameVerifier for the <em>entire</em> hostname verification step.</td> </tr> </table>

If this method is not called, the default HostnameVerifier will check the hostname according to RFC 2818.

Java documentation for javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(javax.net.ssl.HostnameVerifier).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to