org.apache.commons.ssl

## Class TrustChain

- java.lang.Object
- - org.apache.commons.ssl.TrustChain

Direct Known Subclasses:
  TrustMaterial

    public class TrustChain
    extends java.lang.Object

Since:
  27-Feb-2006
Author:
  Credit Union Central of British Columbia, www.cucbc.com, juliusdavies@cucbc.com

### Field Summary

Fields
`private java.util.Set` `trustMaterial`
`private java.security.KeyStore` `unifiedKeyStore`
`private java.util.SortedSet` `x509Certificates`

### Constructor Summary

Constructors
Constructor and Description
`TrustChain()`

### Method Summary

Methods
`void` `addTrustMaterial(TrustChain tc)`
`boolean` `contains(TrustChain tc)`
`boolean` `contains(java.security.cert.X509Certificate cert)`
`protected boolean` `containsTrustAll()`
`java.util.SortedSet` `getCertificates()`
`int` `getSize()`
`java.lang.Object` `getTrustManagerFactory()`
`java.lang.Object[]` `getTrustManagers()`
`java.security.KeyStore` `getUnifiedKeyStore()`
`boolean` `isEmpty()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### trustMaterial

    private final java.util.Set trustMaterial

#### x509Certificates

    private java.util.SortedSet x509Certificates

#### unifiedKeyStore

    private java.security.KeyStore unifiedKeyStore

### Constructor Detail

#### TrustChain

    public TrustChain()

### Method Detail

#### getUnifiedKeyStore

    public java.security.KeyStore getUnifiedKeyStore()
                                              throws java.security.KeyStoreException,
                                                     java.io.IOException,
                                                     java.security.NoSuchAlgorithmException,
                                                     java.security.cert.CertificateException

Throws:
  `java.security.KeyStoreException`
  `java.io.IOException`
  `java.security.NoSuchAlgorithmException`
  `java.security.cert.CertificateException`

#### addTrustMaterial

    public void addTrustMaterial(TrustChain tc)

#### contains

    public boolean contains(TrustChain tc)

#### contains

    public boolean contains(java.security.cert.X509Certificate cert)
                     throws java.security.KeyStoreException,
                            java.io.IOException,
                            java.security.NoSuchAlgorithmException,
                            java.security.cert.CertificateException

Throws:
  `java.security.KeyStoreException`
  `java.io.IOException`
  `java.security.NoSuchAlgorithmException`
  `java.security.cert.CertificateException`

#### getTrustManagerFactory

    public java.lang.Object getTrustManagerFactory()
                                            throws java.security.NoSuchAlgorithmException,
                                                   java.security.KeyStoreException,
                                                   java.io.IOException,
                                                   java.security.cert.CertificateException

Throws:
  `java.security.NoSuchAlgorithmException`
  `java.security.KeyStoreException`
  `java.io.IOException`
  `java.security.cert.CertificateException`

#### getTrustManagers

    public java.lang.Object[] getTrustManagers()
                                        throws java.security.NoSuchAlgorithmException,
                                               java.security.KeyStoreException,
                                               java.io.IOException,
                                               java.security.cert.CertificateException

Returns:
  Array of TrustManager[] - presumably these will be dropped into a call to SSLContext.init(). Note: returns null if this TrustChain doesn't contain anything to trust.
Throws:
  `java.security.NoSuchAlgorithmException` - serious problems
  `java.security.KeyStoreException` - serious problems
  `java.io.IOException` - serious problems
  `java.security.cert.CertificateException` - serious problems

#### getCertificates

    public java.util.SortedSet getCertificates()
                                        throws java.security.KeyStoreException,
                                               java.io.IOException,
                                               java.security.NoSuchAlgorithmException,
                                               java.security.cert.CertificateException

Returns:
  All X509Certificates contained in this TrustChain as a SortedSet. The X509Certificates are sorted based on expiry date.

  See org.apache.commons.ssl.Certificates.COMPARE_BY_EXPIRY.
Throws:
  `java.security.KeyStoreException` - serious problems
  `java.io.IOException` - serious problems
  `java.security.NoSuchAlgorithmException` - serious problems
  `java.security.cert.CertificateException` - serious problems

#### getSize

    public int getSize()
                throws java.security.KeyStoreException,
                       java.io.IOException,
                       java.security.NoSuchAlgorithmException,
                       java.security.cert.CertificateException

Returns:
  Count of all X509Certificates contained in this TrustChain.
Throws:
  `java.security.KeyStoreException`
  `java.io.IOException`
  `java.security.NoSuchAlgorithmException`
  `java.security.cert.CertificateException`

#### isEmpty

    public boolean isEmpty()
                    throws java.security.KeyStoreException,
                           java.io.IOException,
                           java.security.NoSuchAlgorithmException,
                           java.security.cert.CertificateException

Returns:
  Count of all X509Certificates contained in this TrustChain.
Throws:
  `java.security.KeyStoreException`
  `java.io.IOException`
  `java.security.NoSuchAlgorithmException`
  `java.security.cert.CertificateException`

#### containsTrustAll

    protected boolean containsTrustAll()