Most visited

Recently visited

Added in API level 1

SslCertificate

public class SslCertificate
extends Object

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


SSL证书信息(证书详细信息)类

Summary

Nested classes

class SslCertificate.DName

一个可分辨的名称助手类:一个三元组:

  • 最具体的通用名称(CN)
  • 最具体的组织(O)
  • 最具体的组织单位(OU)

Public constructors

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

此构造函数在API级别8中已弃用。请使用SslCertificate(X509Certificate)

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

此构造函数在API级别12中已弃用。请使用SslCertificate(X509Certificate)

SslCertificate(X509Certificate certificate)

从X509证书创建一个新的SSL证书对象

Public methods

SslCertificate.DName getIssuedBy()
SslCertificate.DName getIssuedTo()
String getValidNotAfter()

此方法在API级别8中已弃用。请使用getValidNotAfterDate()

Date getValidNotAfterDate()
String getValidNotBefore()

此方法在API级别8中已弃用。请使用getValidNotBeforeDate()

Date getValidNotBeforeDate()
static SslCertificate restoreState(Bundle bundle)

恢复存储在捆绑包中的证书

static Bundle saveState(SslCertificate certificate)

将证书状态保存为一个包

String toString()

返回对象的字符串表示形式。

Inherited methods

From class java.lang.Object

Public constructors

SslCertificate

Added in API level 1
SslCertificate (String issuedTo, 
                String issuedBy, 
                String validNotBefore, 
                String validNotAfter)

此构造函数在API级别8中已被弃用。
使用SslCertificate(X509Certificate)

创建一个新的SSL证书对象

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

Added in API level 8
SslCertificate (String issuedTo, 
                String issuedBy, 
                Date validNotBefore, 
                Date validNotAfter)

此构造函数在API级别12中已被弃用。
使用SslCertificate(X509Certificate)

创建一个新的SSL证书对象

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

Added in API level 1
SslCertificate (X509Certificate certificate)

从X509证书创建一个新的SSL证书对象

Parameters
certificate X509Certificate: X509 certificate

Public methods

getIssuedBy

Added in API level 1
SslCertificate.DName getIssuedBy ()

Returns
SslCertificate.DName Issued-by distinguished name or null if none has been set

getIssuedTo

Added in API level 1
SslCertificate.DName getIssuedTo ()

Returns
SslCertificate.DName Issued-to distinguished name or null if none has been set

getValidNotAfter

Added in API level 1
String getValidNotAfter ()

此方法在API级别8中已被弃用。
使用getValidNotAfterDate()

Returns
String Not-after date from the certificate validity period in ISO 8601 format or "" if none has been set

getValidNotAfterDate

Added in API level 8
Date getValidNotAfterDate ()

Returns
Date Not-after date from the certificate validity period or "" if none has been set

getValidNotBefore

Added in API level 1
String getValidNotBefore ()

此方法在API级别8中已被弃用。
使用getValidNotBeforeDate()

Returns
String Not-before date from the certificate validity period in ISO 8601 format or "" if none has been set

getValidNotBeforeDate

Added in API level 8
Date getValidNotBeforeDate ()

Returns
Date Not-before date from the certificate validity period or "" if none has been set

restoreState

Added in API level 1
SslCertificate restoreState (Bundle 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

Added in API level 1
Bundle saveState (SslCertificate certificate)

将证书状态保存为一个包

Parameters
certificate SslCertificate: The SSL certificate to store
Returns
Bundle A bundle with the certificate stored in it or null if fails

toString

Added in API level 1
String toString ()

返回对象的字符串表示形式。 通常, toString方法返回一个“文本表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。

ObjecttoString方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String A string representation of this certificate for debugging

Hooray!