Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

SslError

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

Class Overview

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 14. 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 was deprecated in API level 14. Use SslError(int, SslCertificate, String)
SslError (int error, X509Certificate certificate)
This constructor was deprecated in API level 14. Use SslError(int, X509Certificate, 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, 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.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int SSL_DATE_INVALID

The date of the certificate is invalid

Constant Value: 4 (0x00000004)

public static final int SSL_EXPIRED

Added in API level 8

The certificate has expired

Constant Value: 1 (0x00000001)

public static final int SSL_IDMISMATCH

Added in API level 8

Hostname mismatch

Constant Value: 2 (0x00000002)

public static final int SSL_INVALID

A generic error occurred

Constant Value: 5 (0x00000005)

public static final int SSL_MAX_ERROR

Added in API level 8

This constant was deprecated in API level 14.
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)

public static final int SSL_NOTYETVALID

Added in API level 8

The certificate is not yet valid

Constant Value: 0 (0x00000000)

public static final int SSL_UNTRUSTED

Added in API level 8

The certificate authority is not trusted

Constant Value: 3 (0x00000003)

Public Constructors

public SslError (int error, SslCertificate certificate)

Added in API level 8

This constructor was deprecated in API level 14.
Use SslError(int, SslCertificate, String)

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

Parameters
error The SSL error
certificate The associated SSL certificate

public SslError (int error, X509Certificate certificate)

Added in API level 8

This constructor was deprecated in API level 14.
Use SslError(int, X509Certificate, String)

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

Parameters
error The SSL error
certificate The associated SSL certificate

public SslError (int error, SslCertificate certificate, String url)

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

Parameters
error The SSL error
certificate The associated SSL certificate
url The associated URL

public SslError (int error, X509Certificate certificate, String url)

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

Parameters
error The SSL error
certificate The associated SSL certificate
url The associated URL

Public Methods

public boolean addError (int error)

Added in API level 8

Adds the supplied SSL error to the set.

Parameters
error The SSL error to add
Returns
  • True if the error being added is a known SSL error, otherwise false.

public SslCertificate getCertificate ()

Added in API level 8

Gets the SSL certificate associated with this object.

Returns
  • The SSL certificate, non-null.

public int getPrimaryError ()

Added in API level 8

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

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

public String getUrl ()

Gets the URL associated with this object.

Returns
  • The URL, non-null.

public boolean hasError (int error)

Added in API level 8

Determines whether this object includes the supplied error.

Parameters
error The SSL error to check for
Returns
  • True if this object includes the error, otherwise false.

public String toString ()

Added in API level 8

Returns a string representation of this object.

Returns
  • A String representation of this object.