This class represents a "most-trusted CA", which is used as a trust anchor
for validating X.509 certification paths. A most-trusted CA includes the
public key of the CA, the CA's name, and any constraints upon the set of
paths which may be validated using this key. These parameters can be
specified in the form of a trusted X509Certificate
or as
individual parameters.
Concurrent Access
All TrustAnchor
objects must be immutable and
thread-safe. That is, multiple threads may concurrently invoke the
methods defined in this class on a single TrustAnchor
object (or more than one) with no ill effects. Requiring
TrustAnchor
objects to be immutable and thread-safe
allows them to be passed around to various pieces of code without
worrying about coordinating access. This stipulation applies to all
public fields and methods of this class and any added or overridden
by subclasses.
PKIXParameters#PKIXParameters(Set)
, PKIXBuilderParameters#PKIXBuilderParameters(Set, CertSelector)
Modifier and Type | Field and Description |
---|---|
private final String | |
private final X500Principal | |
private boolean | |
private boolean | |
private NameConstraintsExtension | |
private byte[] | |
private final PublicKey | |
private final X509Certificate |
Access | Constructor and Description |
---|---|
public | TrustAnchor(X509Certificate
a trusted trustedCert, byte[] X509Certificate a byte array containing the ASN.1 DER encoding of
a NameConstraints extension to be used for checking name constraints.
Only the value of the extension is included, not the OID or criticality
flag. Specify nameConstraints)null to omit the parameter.Creates an instance of |
public | TrustAnchor(X500Principal
the name of the most-trusted CA as X500Principal caPrincipal, PublicKey the public key of the most-trusted CA pubKey, byte[] a byte array containing the ASN.1 DER encoding of
a NameConstraints extension to be used for checking name constraints.
Only the value of the extension is included, not the OID or criticality
flag. Specify nameConstraints)null to omit the parameter.Creates an instance of |
public | TrustAnchor(String
the X.500 distinguished name of the most-trusted CA in
RFC 2253
caName, PublicKey String formatthe public key of the most-trusted CA pubKey, byte[] a byte array containing the ASN.1 DER encoding of
a NameConstraints extension to be used for checking name constraints.
Only the value of the extension is included, not the OID or criticality
flag. Specify nameConstraints)null to omit the parameter.Creates an instance of |
Modifier and Type | Method and Description |
---|---|
public final X500Principal | Returns: the X.500 distinguished name of the most-trusted CA, ornull if the trust anchor was not specified as a trusted
public key and name or X500Principal pairReturns the name of the most-trusted CA as an X500Principal. |
public final String | Returns: the X.500 distinguished name of the most-trusted CA, ornull if the trust anchor was not specified as a trusted
public key and name or X500Principal pairReturns the name of the most-trusted CA in RFC 2253 |
public final PublicKey | Returns: the public key of the most-trusted CA, ornull
if the trust anchor was not specified as a trusted public key and name
or X500Principal pairReturns the public key of the most-trusted CA. |
public final byte[] | Returns: a byte array containing the ASN.1 DER encoding of a NameConstraints extension used for checking name constraints, ornull if not set.Returns the name constraints parameter. |
public final X509Certificate | Returns: a trustedX509Certificate or null
if the trust anchor was not specified as a trusted certificateReturns the most-trusted CA certificate. |
pack-priv synchronized boolean | isJdkCA()
Returns true if anchor is a JDK CA (a root CA that is included by default in the cacerts keystore). |
private void | |
public String | Returns: a formatted string describing theTrustAnchor Overrides java. TrustAnchor .
|
caName | back to summary |
---|---|
private final String caName |
caPrincipal | back to summary |
---|---|
private final X500Principal caPrincipal |
hasJdkCABeenChecked | back to summary |
---|---|
private boolean hasJdkCABeenChecked |
jdkCA | back to summary |
---|---|
private boolean jdkCA |
nc | back to summary |
---|---|
private NameConstraintsExtension nc |
ncBytes | back to summary |
---|---|
private byte[] ncBytes |
pubKey | back to summary |
---|---|
private final PublicKey pubKey |
trustedCert | back to summary |
---|---|
private final X509Certificate trustedCert |
TrustAnchor | back to summary |
---|---|
public TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints) Creates an instance of The name constraints are specified as a byte array. This byte array should contain the DER encoded form of the name constraints, as they would appear in the NameConstraints structure defined in RFC 5280 and X.509. The ASN.1 definition of this structure appears below.
Note that the name constraints byte array supplied is cloned to protect against subsequent modifications.
|
TrustAnchor | back to summary |
---|---|
public TrustAnchor(X500Principal caPrincipal, PublicKey pubKey, byte[] nameConstraints) Creates an instance of
The name constraints are specified as a byte array. This byte array
contains the DER encoded form of the name constraints, as they
would appear in the NameConstraints structure defined in RFC 5280
and X.509. The ASN.1 notation for this structure is supplied in the
documentation for
Note that the name constraints byte array supplied here is cloned to protect against subsequent modifications.
|
TrustAnchor | back to summary |
---|---|
public TrustAnchor(String caName, PublicKey pubKey, byte[] nameConstraints) Creates an instance of
The name constraints are specified as a byte array. This byte array
contains the DER encoded form of the name constraints, as they
would appear in the NameConstraints structure defined in RFC 5280
and X.509. The ASN.1 notation for this structure is supplied in the
documentation for
Note that the name constraints byte array supplied here is cloned to protect against subsequent modifications.
|
getCA | back to summary |
---|---|
public final X500Principal getCA() Returns the name of the most-trusted CA as an X500Principal.
|
getCAName | back to summary |
---|---|
public final String getCAName() Returns the name of the most-trusted CA in RFC 2253
|
getCAPublicKey | back to summary |
---|---|
public final PublicKey getCAPublicKey() Returns the public key of the most-trusted CA.
|
getNameConstraints | back to summary |
---|---|
public final byte[] getNameConstraints() Returns the name constraints parameter. The specified name constraints are associated with this trust anchor and are intended to be used as additional constraints when validating an X.509 certification path.
The name constraints are returned as a byte array. This byte array
contains the DER encoded form of the name constraints, as they
would appear in the NameConstraints structure defined in RFC 5280
and X.509. The ASN.1 notation for this structure is supplied in the
documentation for
Note that the byte array returned is cloned to protect against subsequent modifications.
|
getTrustedCert | back to summary |
---|---|
public final X509Certificate getTrustedCert() Returns the most-trusted CA certificate.
|
isJdkCA | back to summary |
---|---|
pack-priv synchronized boolean isJdkCA() Returns true if anchor is a JDK CA (a root CA that is included by default in the cacerts keystore). |
setNameConstraints | back to summary |
---|---|
private void setNameConstraints(byte[] bytes) Decode the name constraints and clone them if not null. |
toString | back to summary |
---|---|
public String toString() Overrides java. Returns a formatted string describing the
|