SslError


public class SslError
extends Object

java.lang.Object
   ↳ android.net.http.SslError


This class represents a set of one or more SSL errors and the associated SSL certificate.

Summary

Constants

int SSL_DATE_INVALID

The date of the certificate is invalid

int SSL_EXPIRED

The certificate has expired

int SSL_IDMISMATCH

Hostname mismatch

int SSL_INVALID

A generic error occurred

int SSL_MAX_ERROR

This constant was deprecated in API level 15. This constant is not necessary for using the SslError API and can change from release to release.

int SSL_NOTYETVALID

The certificate is not yet valid

int SSL_UNTRUSTED

The certificate authority is not trusted

Public constructors

SslError(int error, SslCertificate certificate)

This constructor is deprecated. Use SslError(int, android.net.http.SslCertificate, java.lang.String)

SslError(int error, SslCertificate certificate, String url)

Creates a new SslError object using the supplied error, certificate and URL.

SslError(int error, X509Certificate certificate)

This constructor is deprecated. Use SslError(int, java.security.cert.X509Certificate, java.lang.String)

SslError(int error, X509Certificate certificate, String url)

Creates a new SslError object using the supplied error, certificate and URL.

Public methods

boolean addError(int error)

Adds the supplied SSL error to the set.

SslCertificate getCertificate()

Gets the SSL certificate associated with this object.

int getPrimaryError()

Gets the most severe SSL error in this object's set of errors.

String getUrl()

Gets the URL associated with this object.

boolean hasError(int error)

Determines whether this object includes the supplied error.

String toString()

Returns a string representation of this object.

Inherited methods

Constants

SSL_DATE_INVALID

Added in API level 14
public static final int SSL_DATE_INVALID

The date of the certificate is invalid

Constant Value: 4 (0x00000004)

SSL_EXPIRED

Added in API level 8
public static final int SSL_EXPIRED

The certificate has expired

Constant Value: 1 (0x00000001)

SSL_IDMISMATCH

Added in API level 8
public static final int SSL_IDMISMATCH

Hostname mismatch

Constant Value: 2 (0x00000002)

SSL_INVALID

Added in API level 14
public static final int SSL_INVALID

A generic error occurred

Constant Value: 5 (0x00000005)

SSL_MAX_ERROR

Added in API level 8
Deprecated in API level 15
public static final int SSL_MAX_ERROR

This constant was deprecated in API level 15.
This constant is not necessary for using the SslError API and can change from release to release.

The number of different SSL errors.

Constant Value: 6 (0x00000006)

SSL_NOTYETVALID

Added in API level 8
public static final int SSL_NOTYETVALID

The certificate is not yet valid

Constant Value: 0 (0x00000000)

SSL_UNTRUSTED

Added in API level 8
public static final int SSL_UNTRUSTED

The certificate authority is not trusted

Constant Value: 3 (0x00000003)

Public constructors

SslError

Added in API level 8
public SslError (int error, 
                SslCertificate certificate)

This constructor is deprecated.
Use SslError(int, android.net.http.SslCertificate, java.lang.String)

Creates a new SslError object using the supplied error and certificate. The URL will be set to the empty string.

Parameters
error int: The SSL error

certificate SslCertificate: The associated SSL certificate

SslError

Added in API level 14
public SslError (int error, 
                SslCertificate certificate, 
                String url)

Creates a new SslError object using the supplied error, certificate and URL.

Parameters
error int: The SSL error

certificate SslCertificate: The associated SSL certificate

url String: The associated URL

SslError

Added in API level 8
public SslError (int error, 
                X509Certificate certificate)

This constructor is deprecated.
Use SslError(int, java.security.cert.X509Certificate, java.lang.String)

Creates a new SslError object using the supplied error and certificate. The URL will be set to the empty string.

Parameters
error int: The SSL error

certificate X509Certificate: The associated SSL certificate

SslError

Added in API level 14
public SslError (int error, 
                X509Certificate certificate, 
                String url)

Creates a new SslError object using the supplied error, certificate and URL.

Parameters
error int: The SSL error

certificate X509Certificate: The associated SSL certificate

url String: The associated URL

Public methods

addError

Added in API level 8
public boolean addError (int error)

Adds the supplied SSL error to the set.

Parameters
error int: The SSL error to add

Returns
boolean True if the error being added is a known SSL error, otherwise false.

getCertificate

Added in API level 8
public SslCertificate getCertificate ()

Gets the SSL certificate associated with this object.

Returns
SslCertificate The SSL certificate, non-null.

getPrimaryError

Added in API level 8
public int getPrimaryError ()

Gets the most severe SSL error in this object's set of errors. Returns -1 if the set is empty.

Returns
int The most severe SSL error, or -1 if the set is empty.

getUrl

Added in API level 14
public String getUrl ()

Gets the URL associated with this object.

Returns
String The URL, non-null.

hasError

Added in API level 8
public boolean hasError (int error)

Determines whether this object includes the supplied error.

Parameters
error int: The SSL error to check for

Returns
boolean True if this object includes the error, otherwise false.

toString

Added in API level 8
public String toString ()

Returns a string representation of this object.

Returns
String A String representation of this object.