Most visited

Recently visited

Added in API level 1

Certificate

public abstract class Certificate
extends Object implements Serializable

java.lang.Object
    java.security.cert.Certificate
Known Direct Subclasses


用于管理各种身份证书的抽象类。 身份证书是委托人与另一名委托人支持的公钥的约束。 (委托人代表个人用户,团体或公司等实体。)

该类是对具有不同格式但重要常见用途的证书的抽象。 例如,不同类型的证书(如X.509和PGP)共享一般证书功能(如编码和验证)以及某些类型的信息(如公钥)。

X.509,PGP和SDSI证书都可以通过继承证书类来实现,尽管它们包含不同的信息集,并且它们以不同的方式存储和检索信息。

也可以看看:

摘要(Summary)

Nested classes

class Certificate.CertificateRep

序列化的替代证书类。

Protected constructors

Certificate(String type)

创建指定类型的证书。

公共方法(Public methods)

boolean equals(Object other)

将此证书与指定对象进行比较来进行比较。

abstract byte[] getEncoded()

返回此证书的编码形式。

abstract PublicKey getPublicKey()

从此证书获取公钥。

final String getType()

返回此证书的类型。

int hashCode()

从其编码形式返回此证书的哈希码值。

abstract String toString()

返回此证书的字符串表示形式。

abstract void verify(PublicKey key, String sigProvider)

验证是否使用与指定的公钥对应的私钥对该证书进行了签名。

abstract void verify(PublicKey key)

验证是否使用与指定的公钥对应的私钥对该证书进行了签名。

Protected methods

Object writeReplace()

替换要序列化的证书。

继承方法(Inherited methods)

From class java.lang.Object

Protected constructors

Certificate

Added in API level 1
Certificate (String type)

创建指定类型的证书。

参数(Parameters)
type String: the standard name of the certificate type. See the CertificateFactory section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard certificate types.

公共方法(Public methods)

equals

Added in API level 1
boolean equals (Object other)

将此证书与指定对象进行比较来进行比较。 如果other对象是instanceof Certificate ,则检索其编码形式并与此证书的编码形式进行比较。

参数(Parameters)
other Object: the object to test for equality with this certificate.
返回(Returns)
boolean true iff the encoded forms of the two certificates match, false otherwise.

getEncoded

Added in API level 1
byte[] getEncoded ()

返回此证书的编码形式。 假定每种证书类型只有一种形式的编码; 例如,X.509证书将被编码为ASN.1 DER。

返回(Returns)
byte[] the encoded form of this certificate
抛出异常(Throws)
CertificateEncodingException if an encoding error occurs.

getPublicKey

Added in API level 1
PublicKey getPublicKey ()

从此证书获取公钥。

返回(Returns)
PublicKey the public key.

getType

Added in API level 1
String getType ()

返回此证书的类型。

返回(Returns)
String the type of this certificate.

hashCode

Added in API level 1
int hashCode ()

从其编码形式返回此证书的哈希码值。

返回(Returns)
int the hashcode value.

toString

Added in API level 1
String toString ()

返回此证书的字符串表示形式。

返回(Returns)
String a string representation of this certificate.

verify

Added in API level 1
void verify (PublicKey key, 
                String sigProvider)

验证是否使用与指定的公钥对应的私钥对该证书进行了签名。 此方法使用由指定提供商提供的签名验证引擎。

参数(Parameters)
key PublicKey: the PublicKey used to carry out the verification.
sigProvider String: the name of the signature provider.
抛出异常(Throws)
NoSuchAlgorithmException on unsupported signature algorithms.
InvalidKeyException on incorrect key.
NoSuchProviderException on incorrect provider.
SignatureException on signature errors.
CertificateException on encoding errors.

verify

Added in API level 1
void verify (PublicKey key)

验证是否使用与指定的公钥对应的私钥对该证书进行了签名。

参数(Parameters)
key PublicKey: the PublicKey used to carry out the verification.
抛出异常(Throws)
NoSuchAlgorithmException on unsupported signature algorithms.
InvalidKeyException on incorrect key.
NoSuchProviderException if there's no default provider.
SignatureException on signature errors.
CertificateException on encoding errors.

Protected methods

writeReplace

Added in API level 1
Object writeReplace ()

替换要序列化的证书。

返回(Returns)
Object the alternate Certificate object to be serialized
抛出异常(Throws)
ObjectStreamException if a new object representing this Certificate could not be created

Hooray!