SslCertificate
  public
  
  
  
  class
  SslCertificate
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.net.http.SslCertificate | 
SSL certificate info (certificate details) class
Summary
| Nested classes | |
|---|---|
| 
        
        
        
        
        class | SslCertificate.DNameA distinguished name helper class: a 3-tuple of: 
 | 
| Public constructors | |
|---|---|
| 
      SslCertificate(String issuedTo, String issuedBy, String validNotBefore, String validNotAfter)
      
      This constructor is deprecated.
    Use  | |
| 
      SslCertificate(String issuedTo, String issuedBy, Date validNotBefore, Date validNotAfter)
      
      This constructor is deprecated.
    Use  | |
| 
      SslCertificate(X509Certificate certificate)
      Creates a new SSL certificate object from an X509 certificate | |
| Public methods | |
|---|---|
| 
        
        
        
        
        
        SslCertificate.DName | 
      getIssuedBy()
       | 
| 
        
        
        
        
        
        SslCertificate.DName | 
      getIssuedTo()
       | 
| 
        
        
        
        
        
        String | 
      getValidNotAfter()
      
      This method was deprecated
      in API level 15.
    Use  | 
| 
        
        
        
        
        
        Date | 
      getValidNotAfterDate()
       | 
| 
        
        
        
        
        
        String | 
      getValidNotBefore()
      
      This method was deprecated
      in API level 15.
    Use  | 
| 
        
        
        
        
        
        Date | 
      getValidNotBeforeDate()
       | 
| 
        
        
        
        
        
        X509Certificate | 
      getX509Certificate()
       | 
| 
        
        
        static
        
        
        SslCertificate | 
      restoreState(Bundle bundle)
      Restores the certificate stored in the bundle | 
| 
        
        
        static
        
        
        Bundle | 
      saveState(SslCertificate certificate)
      Saves the certificate state to a bundle | 
| 
        
        
        
        
        
        String | 
      toString()
      Returns a string representation of the object. | 
| Inherited methods | |
|---|---|
Public constructors
SslCertificate
public SslCertificate (String issuedTo, String issuedBy, String validNotBefore, String validNotAfter)
      This constructor is deprecated.
    Use SslCertificate(java.security.cert.X509Certificate)
  
Creates a new SSL certificate object
| Parameters | |
|---|---|
| issuedTo | String: The entity this certificate is issued to | 
| issuedBy | String: The entity that issued this certificate | 
| validNotBefore | String: The not-before date from the certificate
     validity period in ISO 8601 format | 
| validNotAfter | String: The not-after date from the certificate
     validity period in ISO 8601 format | 
SslCertificate
public SslCertificate (String issuedTo, String issuedBy, Date validNotBefore, Date validNotAfter)
      This constructor is deprecated.
    Use SslCertificate(java.security.cert.X509Certificate)
  
Creates a new SSL certificate object
| Parameters | |
|---|---|
| issuedTo | String: The entity this certificate is issued to | 
| issuedBy | String: The entity that issued this certificate | 
| validNotBefore | Date: The not-before date from the certificate validity period | 
| validNotAfter | Date: The not-after date from the certificate validity period | 
SslCertificate
public SslCertificate (X509Certificate certificate)
Creates a new SSL certificate object from an X509 certificate
| Parameters | |
|---|---|
| certificate | X509Certificate: X509 certificate | 
Public methods
getIssuedBy
public SslCertificate.DName getIssuedBy ()
| Returns | |
|---|---|
| SslCertificate.DName | Issued-by distinguished name or null if none has been set | 
getIssuedTo
public SslCertificate.DName getIssuedTo ()
| Returns | |
|---|---|
| SslCertificate.DName | Issued-to distinguished name or null if none has been set | 
getValidNotAfter
public String getValidNotAfter ()
      This method was deprecated
      in API level 15.
    Use getValidNotAfterDate()
  
| Returns | |
|---|---|
| String | Not-after date from the certificate validity period in ISO 8601 format or "" if none has been set | 
getValidNotAfterDate
public Date getValidNotAfterDate ()
| Returns | |
|---|---|
| Date | Not-after date from the certificate validity period or "" if none has been set | 
getValidNotBefore
public String getValidNotBefore ()
      This method was deprecated
      in API level 15.
    Use getValidNotBeforeDate()
  
| Returns | |
|---|---|
| String | Not-before date from the certificate validity period in ISO 8601 format or "" if none has been set | 
getValidNotBeforeDate
public Date getValidNotBeforeDate ()
| Returns | |
|---|---|
| Date | Not-before date from the certificate validity period or "" if none has been set | 
getX509Certificate
public X509Certificate getX509Certificate ()
| Returns | |
|---|---|
| X509Certificate | The X509Certificateused to create thisSslCertificateornullif no certificate was provided. | 
restoreState
public static SslCertificate restoreState (Bundle bundle)
Restores the certificate stored in the bundle
| Parameters | |
|---|---|
| bundle | Bundle: The bundle with the certificate state stored in it | 
| Returns | |
|---|---|
| SslCertificate | The SSL certificate stored in the bundle or null if fails | 
saveState
public static Bundle saveState (SslCertificate certificate)
Saves the certificate state to a bundle
| Parameters | |
|---|---|
| certificate | SslCertificate: The SSL certificate to store | 
| Returns | |
|---|---|
| Bundle | A bundle with the certificate stored in it or null if fails | 
toString
public String toString ()
Returns a string representation of the object.
| Returns | |
|---|---|
| String | A string representation of this certificate for debugging | 
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
