java.security.cert
Class TrustAnchor

java.lang.Object
  extended by java.security.cert.TrustAnchor

public class TrustAnchor
extends Object

An ultimately-trusted certificate to serve as the root of a certificate chain.


Constructor Summary
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.
TrustAnchor(X509Certificate trustedCert, byte[] nameConstraints)
          Create a new trust anchor from a certificate and (optional) name constraints.
 
Method Summary
 String getCAName()
          Return the certificate authority's distinguished name, or null if none was specified.
 PublicKey getCAPublicKey()
          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.
 X509Certificate getTrustedCert()
          Return the trusted certificate, or null if none was specified.
 String toString()
          Return a printable representation of this trust anchor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.

Method Detail

getTrustedCert

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

Returns:
The trusted certificate.

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.

toString

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

Overrides:
toString in class Object
Returns:
The printable representation.
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)