| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.security.cert.TrustAnchor
public class TrustAnchor
一个信任定位点或最受信任的证书颁发机构 (CA)。
此类表示“最受信任的 CA”,该 CA 用作验证 X.509 证书路径的信任定位点。最受信任的 CA 包括该 CA 的公钥、该 CA 的名称,以及可能使用此密钥所验证的路径集上的所有限制。可以受信任的 X509Certificate 形式或以单个参数的形式来指定这些参数。
 
并发访问
所有 TrustAnchor 对象必须是不可变的和线程安全的。也就是说,多个线程在单个 TrustAnchor 对象(或多个对象)上并发调用此类中所定义的各种方法不会产生什么恶果。要求 TrustAnchor 对象是不可变的并且是线程安全的就允许将其传递到各种代码片断中,而无需担心并列的访问。此规定适用于此类的所有公共字段和方法,以及由子类添加或重写的所有公共字段和方法。
PKIXParameters.PKIXParameters(Set), 
PKIXBuilderParameters.PKIXBuilderParameters(Set, CertSelector)| 构造方法摘要 | |
|---|---|
| TrustAnchor(String caName,
            PublicKey pubKey,
            byte[] nameConstraints)创建一个 TrustAnchor实例,其中以不同的名称和公钥的形式指定最受信任的 CA。 | |
| TrustAnchor(X500Principal caPrincipal,
            PublicKey pubKey,
            byte[] nameConstraints)创建一个 TrustAnchor实例,其中以 X500Principal 和公钥的形式指定最受信任的 CA。 | |
| TrustAnchor(X509Certificate trustedCert,
            byte[] nameConstraints)创建具有指定 X509Certificate和可选 nameConstraints 的TrustAnchor实例,在验证 X.509 证书路径时,该 nameConstraints 用作额外的限制条件。 | |
| 方法摘要 | |
|---|---|
|  X500Principal | getCA()以 X500Principal 的形式返回最受信任的 CA 的名称。 | 
|  String | getCAName()以 RFC 2253 String格式返回最受信任的 CA 的名称。 | 
|  PublicKey | getCAPublicKey()返回最受信任的 CA 的公钥。 | 
|  byte[] | getNameConstraints()返回 nameConstraints 参数。 | 
|  X509Certificate | getTrustedCert()返回最受信任的 CA 证书。 | 
|  String | toString()返回描述此 TrustAnchor的格式化字符串。 | 
| 从类 java.lang.Object 继承的方法 | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| 构造方法详细信息 | 
|---|
public TrustAnchor(X509Certificate trustedCert,
                   byte[] nameConstraints)
X509Certificate 和可选 nameConstraints 的 TrustAnchor 实例,在验证 X.509 证书路径时,该 nameConstraints 用作额外的限制条件。
 以 byte 数组的形式指定该 nameConstraints。此 byte 数组应该包含 DER 编码形式的 nameConstraints,因为它们将出现在 RFC 2459 和 X.509 内所定义的 NameConstraints 结构中。此结构的 ASN.1 定义如下。
  NameConstraints ::= SEQUENCE {
       permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
       excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
  GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
  GeneralSubtree ::= SEQUENCE {
       base                    GeneralName,
       minimum         [0]     BaseDistance DEFAULT 0,
       maximum         [1]     BaseDistance OPTIONAL }
  BaseDistance ::= INTEGER (0..MAX)
  GeneralName ::= CHOICE {
       otherName                       [0]     OtherName,
       rfc822Name                      [1]     IA5String,
       dNSName                         [2]     IA5String,
       x400Address                     [3]     ORAddress,
       directoryName                   [4]     Name,
       ediPartyName                    [5]     EDIPartyName,
       uniformResourceIdentifier       [6]     IA5String,
       iPAddress                       [7]     OCTET STRING,
       registeredID                    [8]     OBJECT IDENTIFIER}
 注意,为了防止后续修改,将复制所提供的 nameConstraints byte 数组。
trustedCert - 受信任的 X509CertificatenameConstraints - 一个 byte 数组,包含为检查 nameConstraints 所使用的 NameConstraints 扩展的 ASN.1 DER 编码。只包括该扩展的值,不包括 OID 或关键程度标志。指定 null 可省略该参数。
IllegalArgumentException - 如果无法解码该 nameConstraints
NullPointerException - 如果指定的 X509Certificate 为 null
public TrustAnchor(X500Principal caPrincipal,
                   PublicKey pubKey,
                   byte[] nameConstraints)
TrustAnchor 实例,其中以 X500Principal 和公钥的形式指定最受信任的 CA。nameConstraints 是可选的参数,在验证 X.509 证书路径时,将其用作额外的限制条件。
 
以 byte 数组的形式指定该 nameConstraints。此 byte 数组包含 DER 编码形式的 nameConstraints,因为它们将出现在 RFC 2459 和 X.509 内所定义的 NameConstraints 结构中。TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)  的文档中提供了此结构的 ASN.1 符号。
 
注意,为了防止后续修改,将复制此处所提供的 nameConstraints byte 数组。
caPrincipal - 最受信任的 CA 的名称,以 X500Principal 形式提供pubKey - 最受信任的 CA 的公钥nameConstraints - 一个 byte 数组,包含为检查 nameConstraints 所使用的 NameConstraints 扩展的 ASN.1 DER 编码。只包括该扩展的值,不包括 OID 或关键程度标志。指定 null 可省略该参数。
NullPointerException - 如果指定的 caPrincipal 或 pubKey 参数为 null
public TrustAnchor(String caName,
                   PublicKey pubKey,
                   byte[] nameConstraints)
TrustAnchor 实例,其中以不同的名称和公钥的形式指定最受信任的 CA。nameConstraints 是可选的参数,在验证 X.509 证书路径时,将其用作额外的限制条件。
 
以 byte 数组的形式指定该 nameConstraints。此 byte 数组包含 DER 编码形式的 nameConstraints,因为它们将出现在 RFC 2459 和 X.509 内所定义的 NameConstraints 结构中。TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)  的文档中提供了此结构的 ASN.1 符号。
 
注意,为了防止后续修改,将复制此处所提供的 nameConstraints byte 数组。
caName - 最受信任的 CA 的 X.500 区分名,以 RFC 2253 String 格式提供pubKey - 最受信任的 CA 的公钥nameConstraints - 一个 byte 数组,包含为检查 nameConstraints 所使用的 NameConstraints 扩展的 ASN.1 DER 编码。只包括该扩展的值,不包括 OID 或关键程度标志。指定 null 可省略该参数。
IllegalArgumentException - 如果指定的 caName 参数是空 (caName.length() == 0),或者格式不正确,或者无法解码该 nameConstraints
NullPointerException - 如果指定的 caName 或 pubKey 参数为 null| 方法详细信息 | 
|---|
public final X509Certificate getTrustedCert()
X509Certificate,如果信任定位点未被指定为受信任的证书,则返回 nullpublic final X500Principal getCA()
nullpublic final String getCAName()
String 格式返回最受信任的 CA 的名称。
nullpublic final PublicKey getCAPublicKey()
nullpublic final byte[] getNameConstraints()
以 byte 数组的形式返回该 nameConstraints。此 byte 数组包含 DER 编码形式的 nameConstraints,因为它们将出现在 RFC 2459 和 X.509 内所定义的 NameConstraints 结构中。TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)  的文档中提供了此结构的 ASN.1 符号。
 
注意,为了保护后续的修改,将复制返回的 byte 数组。
null。public String toString()
TrustAnchor 的格式化字符串。
Object 中的 toStringTrustAnchor 的格式化字符串| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。