public abstract class Certificate extends Object implements Serializable
用于管理各种身份证书的抽象类。身份证是一个结合的一个主要的是凭证的另一个主要的公共密钥。(一个主体代表一个实体,如个人用户、集团或公司。)
这个类是一个抽象的证书,有不同的格式,但重要的共同用途。例如,不同类型的证书,如X.509和PGP,共享通用证书功能(如编码和验证)和某些类型的信息(如公共密钥)。
X.509,PGP和SDSI证书都可以通过子类化证书类实现的,即使它们包含不同的信息,他们以不同的方式存储和检索信息。
Modifier and Type | Class and Description |
---|---|
protected static class |
Certificate.CertificateRep
序列化的替代证书类。
|
Modifier | Constructor and Description |
---|---|
protected |
Certificate(String type)
创建指定类型的证书。
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
将此证书与指定的对象进行比较。
|
abstract byte[] |
getEncoded()
返回此证书的编码形式。
|
abstract PublicKey |
getPublicKey()
从该证书中获取公钥。
|
String |
getType()
返回此证书的类型。
|
int |
hashCode()
返回此证书的编码形式的hashCode值。
|
abstract String |
toString()
返回此证书的字符串表示形式。
|
abstract void |
verify(PublicKey key)
验证该证书是使用对应于指定公共密钥的私钥签名的。
|
void |
verify(PublicKey key, Provider sigProvider)
验证该证书是使用对应于指定公共密钥的私钥签名的。
|
abstract void |
verify(PublicKey key, String sigProvider)
验证该证书是使用对应于指定公共密钥的私钥签名的。
|
protected Object |
writeReplace()
更换证书被序列化。
|
protected Certificate(String type)
type
-的证型标准名称。看到有关标准证书类型信息在
Java Cryptography Architecture Standard Algorithm Name Documentation的certificatefactory节。
public final String getType()
public boolean equals(Object other)
other
对象是一个
instanceof
Certificate
,那么它的编码形式检索与该证书的编码形式比较。
equals
方法重写,继承类
Object
other
-与此证书相等测试对象。
Object.hashCode()
,
HashMap
public int hashCode()
hashCode
方法重写,继承类
Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public abstract byte[] getEncoded() throws CertificateEncodingException
CertificateEncodingException
-如果一个编码错误发生。
public abstract void verify(PublicKey key) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
key
-用来进行验证的公钥。
NoSuchAlgorithmException
-不支持的签名算法。
InvalidKeyException
-。
NoSuchProviderException
-如果没有默认提供程序。
SignatureException
-签名错误。
CertificateException
-编码错误。
public abstract void verify(PublicKey key, String sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, SignatureException
key
-用来进行验证的公钥。
sigProvider
-签名的提供程序的名称。
NoSuchAlgorithmException
-不支持的签名算法。
InvalidKeyException
-错误的关键。
NoSuchProviderException
-不正确的供应商。
SignatureException
-签名错误。
CertificateException
-。
public void verify(PublicKey key, Provider sigProvider) throws CertificateException, NoSuchAlgorithmException, InvalidKeyException, SignatureException
这种方法被添加到版本1.8的java平台标准版。为了保持与现有服务提供商的向后兼容性,这种方法不能abstract
默认情况下抛出一个UnsupportedOperationException
。
key
-用来进行验证的公钥。
sigProvider
-签名提供商。
NoSuchAlgorithmException
-不支持的签名算法。
InvalidKeyException
-错误的关键。
SignatureException
-签名错误。
CertificateException
-编码错误。
UnsupportedOperationException
如果方法不受支持
public abstract String toString()
public abstract PublicKey getPublicKey()
protected Object writeReplace() throws ObjectStreamException
ObjectStreamException
如果代表这个证书不能创建新对象
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.