java.security.cert

Class TrustAnchor

public class TrustAnchor extends Object

An ultimately-trusted certificate to serve as the root of a certificate chain.
Constructor Summary
TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)
Create a new trust anchor from a certificate and (optional) name constraints.
TrustAnchor(String caName, PublicKey caKey, byte[] nameConstraints)
Create a new trust anchor from a certificate authority's distinguished name, public key, and (optional) name constraints.
Method Summary
StringgetCAName()
Return the certificate authority's distinguished name, or null if none was specified.
PublicKeygetCAPublicKey()
Return the certificate authority's public key, or null if none was specified.
byte[]getNameConstraints()
Return the encoded name constraints, or null if none was specified.
X509CertificategetTrustedCert()
Return the trusted certificate, or null if none was specified.
StringtoString()
Return a printable representation of this trust anchor.

Constructor Detail

TrustAnchor

public TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)
Create a new trust anchor from a certificate and (optional) name constraints.

If the nameConstraints argument in non-null, it will be copied to prevent modification.

Parameters: trustedCert The trusted certificate. nameConstraints The encoded nameConstraints.

TrustAnchor

public TrustAnchor(String caName, PublicKey caKey, byte[] nameConstraints)
Create a new trust anchor from a certificate authority's distinguished name, public key, and (optional) name constraints.

If the nameConstraints argument in non-null, it will be copied to prevent modification.

UNKNOWN: caName The CA's distinguished name. caKey The CA's public key. nameConstraints The encoded nameConstraints.

Method Detail

getCAName

public final String getCAName()
Return the certificate authority's distinguished name, or null if none was specified.

Returns: The CA's distinguished name.

getCAPublicKey

public final PublicKey getCAPublicKey()
Return the certificate authority's public key, or null if none was specified.

Returns: The CA's public key.

getNameConstraints

public final byte[] getNameConstraints()
Return the encoded name constraints, or null if none was specified.

The name constraints byte array is copied when this method is called to prevent modification.

Returns: The encoded name constraints.

getTrustedCert

public final X509Certificate getTrustedCert()
Return the trusted certificate, or null if none was specified.

Returns: The trusted certificate.

toString

public String toString()
Return a printable representation of this trust anchor.

Returns: The printable representation.