JavaTM 2 Platform
Standard Ed. 6

java.security
类 KeyStore.PrivateKeyEntry

java.lang.Object
  继承者 java.security.KeyStore.PrivateKeyEntry
所有已实现的接口:
KeyStore.Entry
正在封闭类:
KeyStore

public static final class KeyStore.PrivateKeyEntry
extends Object
implements KeyStore.Entry

保存 PrivateKey 和相应证书链的 KeyStore 项。

从以下版本开始:
1.5

构造方法摘要
KeyStore.PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain)
          构造带 PrivateKey 和相应证书链的 PrivateKeyEntry
 
方法摘要
 Certificate getCertificate()
          从此项中的证书链获取终端实体 Certificate
 Certificate[] getCertificateChain()
          从此项获取 Certificate 链。
 PrivateKey getPrivateKey()
          从此项获取 PrivateKey
 String toString()
          返回此 PrivateKeyEntry 的字符串表示形式。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

KeyStore.PrivateKeyEntry

public KeyStore.PrivateKeyEntry(PrivateKey privateKey,
                                Certificate[] chain)
构造带 PrivateKey 和相应证书链的 PrivateKeyEntry

在将指定的 chain 存储进新的 PrivateKeyEntry 对象前将其复制。

参数:
privateKey - PrivateKey
chain - 表示证书链的 Certificate 数组。证书链必须是有序的并且在索引 0 处包含与私钥相对应的 Certificate
抛出:
NullPointerException - 如果 privateKeychainnull
IllegalArgumentException - 如果指定的证书链长度为 0、指定的证书链不包含相同类型的 Certificate、或者 PrivateKey 算法与在终端实体 Certificate(索引 0 处)中 PublicKey 的算法不匹配
方法详细信息

getPrivateKey

public PrivateKey getPrivateKey()
从此项获取 PrivateKey

返回:
此项中的 PrivateKey

getCertificateChain

public Certificate[] getCertificateChain()
从此项获取 Certificate 链。

存储的链在返回前被复制。

返回:
与公钥的证书链相对应的 Certificate 数组。如果证书的类型是 X.509,返回数组的运行时类型是 X509Certificate[]

getCertificate

public Certificate getCertificate()
从此项中的证书链获取终端实体 Certificate

返回:
此项中证书链的终端实体 Certificate(索引 0 处)。如果证书的类型是 X.509,返回证书的运行时类型是 X509Certificate

toString

public String toString()
返回此 PrivateKeyEntry 的字符串表示形式。

覆盖:
Object 中的 toString
返回:
此 PrivateKeyEntry 的字符串表示形式。

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策