public abstract class Certificate extends Object
用于管理各种身份证书的抽象类。身份证明是由一个主要的保证,一个公钥是另一个主体的。(一个主体代表一个实体,如个人用户、集团或公司。)
这个类是一个抽象的证书,有不同的格式,但重要的共同用途。例如,不同类型的证书,如X.509和PGP,共享通用证书功能(如编码和验证)和某些类型的信息(如公共密钥)。
X.509,PGP和SDSI证书都可以通过子类化证书类实现的,即使它们包含不同的信息,他们以不同的方式存储和检索信息。
注:包中的类javax.security.cert存在为了兼容早期版本的java安全套接字扩展(JSSE)。新的应用程序应使用标准java SE证书班位于java.security.cert。
X509Certificate
Constructor and Description |
---|
Certificate() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other)
将此证书与指定的对象进行比较。
|
abstract byte[] |
getEncoded()
返回此证书的编码形式。
|
abstract PublicKey |
getPublicKey()
从该证书中获取公钥。
|
int |
hashCode()
返回此证书的编码形式的hashCode值。
|
abstract String |
toString()
返回此证书的字符串表示形式。
|
abstract void |
verify(PublicKey key)
验证该证书是使用对应于指定公共密钥的私钥签名的。
|
abstract void |
verify(PublicKey key, String sigProvider)
验证该证书是使用对应于指定公共密钥的私钥签名的。
|
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 abstract String toString()
public abstract PublicKey getPublicKey()
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.