Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/net/http/SslCertificate#nestedclasses) \| [Ctors](https://developer.android.com/reference/android/net/http/SslCertificate#pubctors) \| [Methods](https://developer.android.com/reference/android/net/http/SslCertificate#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/http/SslCertificate#inhmethods)

# SslCertificate

*** ** * ** ***


`
public


class
SslCertificate
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.http.SslCertificate |

<br />

*** ** * ** ***

SSL certificate info (certificate details) class

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/net/http/SslCertificate.DName` A distinguished name helper class: a 3-tuple of: - the most specific common name (CN) - the most specific organization (O) - the most specific organizational unit (OU) |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/net/http/SslCertificate#SslCertificate(java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String issuedTo, https://developer.android.com/reference/java/lang/String issuedBy, https://developer.android.com/reference/java/lang/String validNotBefore, https://developer.android.com/reference/java/lang/String validNotAfter) ` *This constructor is deprecated. Use `https://developer.android.com/reference/android/net/http/SslCertificate#SslCertificate(java.security.cert.X509Certificate)`* |
| ` https://developer.android.com/reference/android/net/http/SslCertificate#SslCertificate(java.lang.String,%20java.lang.String,%20java.util.Date,%20java.util.Date)(https://developer.android.com/reference/java/lang/String issuedTo, https://developer.android.com/reference/java/lang/String issuedBy, https://developer.android.com/reference/java/util/Date validNotBefore, https://developer.android.com/reference/java/util/Date validNotAfter) ` *This constructor is deprecated. Use `https://developer.android.com/reference/android/net/http/SslCertificate#SslCertificate(java.security.cert.X509Certificate)`* |
| ` https://developer.android.com/reference/android/net/http/SslCertificate#SslCertificate(java.security.cert.X509Certificate)(https://developer.android.com/reference/java/security/cert/X509Certificate certificate) ` Creates a new SSL certificate object from an X509 certificate |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/net/http/SslCertificate.DName` | ` https://developer.android.com/reference/android/net/http/SslCertificate#getIssuedBy()() ` |
| ` https://developer.android.com/reference/android/net/http/SslCertificate.DName` | ` https://developer.android.com/reference/android/net/http/SslCertificate#getIssuedTo()() ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotAfter()() ` *This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotAfterDate()`* |
| ` https://developer.android.com/reference/java/util/Date` | ` https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotAfterDate()() ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotBefore()() ` *This method was deprecated in API level 15. Use `https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotBeforeDate()`* |
| ` https://developer.android.com/reference/java/util/Date` | ` https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotBeforeDate()() ` |
| ` https://developer.android.com/reference/java/security/cert/X509Certificate` | ` https://developer.android.com/reference/android/net/http/SslCertificate#getX509Certificate()() ` |
| ` static https://developer.android.com/reference/android/net/http/SslCertificate` | ` https://developer.android.com/reference/android/net/http/SslCertificate#restoreState(android.os.Bundle)(https://developer.android.com/reference/android/os/Bundle bundle) ` Restores the certificate stored in the bundle |
| ` static https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/net/http/SslCertificate#saveState(android.net.http.SslCertificate)(https://developer.android.com/reference/android/net/http/SslCertificate certificate) ` Saves the certificate state to a bundle |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/net/http/SslCertificate#toString()() ` Returns a string representation of the object. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||

## Public constructors

### SslCertificate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslCertificate (String issuedTo, 
                String issuedBy, 
                String validNotBefore, 
                String validNotAfter)
```


**This constructor is deprecated.**   

Use `https://developer.android.com/reference/android/net/http/SslCertificate#SslCertificate(java.security.cert.X509Certificate)`

Creates a new SSL certificate object

<br />

| Parameters ||
|---|---|
| `issuedTo` | `String`: The entity this certificate is issued to <br /> |
| `issuedBy` | `String`: The entity that issued this certificate <br /> |
| `validNotBefore` | `String`: The not-before date from the certificate validity period in ISO 8601 format <br /> |
| `validNotAfter` | `String`: The not-after date from the certificate validity period in ISO 8601 format <br /> |

### SslCertificate

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslCertificate (String issuedTo, 
                String issuedBy, 
                Date validNotBefore, 
                Date validNotAfter)
```


**This constructor is deprecated.**   

Use `https://developer.android.com/reference/android/net/http/SslCertificate#SslCertificate(java.security.cert.X509Certificate)`

Creates a new SSL certificate object

<br />

| Parameters ||
|---|---|
| `issuedTo` | `String`: The entity this certificate is issued to <br /> |
| `issuedBy` | `String`: The entity that issued this certificate <br /> |
| `validNotBefore` | `Date`: The not-before date from the certificate validity period <br /> |
| `validNotAfter` | `Date`: The not-after date from the certificate validity period <br /> |

### SslCertificate

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslCertificate (X509Certificate certificate)
```

Creates a new SSL certificate object from an X509 certificate

<br />

| Parameters ||
|---|---|
| `certificate` | `X509Certificate`: X509 certificate <br /> |

## Public methods

### getIssuedBy

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslCertificate.DName getIssuedBy ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/SslCertificate.DName` | Issued-by distinguished name or null if none has been set <br /> |

### getIssuedTo

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public SslCertificate.DName getIssuedTo ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/SslCertificate.DName` | Issued-to distinguished name or null if none has been set <br /> |

### getValidNotAfter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getValidNotAfter ()
```


**This method was deprecated
in API level 15.**   

Use `https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotAfterDate()`

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | Not-after date from the certificate validity period in ISO 8601 format or "" if none has been set <br /> |

### getValidNotAfterDate

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Date getValidNotAfterDate ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Date` | Not-after date from the certificate validity period or "" if none has been set <br /> |

### getValidNotBefore

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
15](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getValidNotBefore ()
```


**This method was deprecated
in API level 15.**   

Use `https://developer.android.com/reference/android/net/http/SslCertificate#getValidNotBeforeDate()`

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | Not-before date from the certificate validity period in ISO 8601 format or "" if none has been set <br /> |

### getValidNotBeforeDate

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Date getValidNotBeforeDate ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Date` | Not-before date from the certificate validity period or "" if none has been set <br /> |

### getX509Certificate

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public X509Certificate getX509Certificate ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/security/cert/X509Certificate` | The `X509Certificate` used to create this `SslCertificate` or `null` if no certificate was provided. <br /> |

### restoreState

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static SslCertificate restoreState (Bundle bundle)
```

Restores the certificate stored in the bundle

<br />

| Parameters ||
|---|---|
| `bundle` | `Bundle`: The bundle with the certificate state stored in it <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/net/http/SslCertificate` | The SSL certificate stored in the bundle or null if fails <br /> |

### saveState

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static Bundle saveState (SslCertificate certificate)
```

Saves the certificate state to a bundle

<br />

| Parameters ||
|---|---|
| `certificate` | `SslCertificate`: The SSL certificate to store <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | A bundle with the certificate stored in it or null if fails <br /> |

### toString

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | A string representation of this certificate for debugging <br /> |