org.apache.commons.ssl

## Class TrustMaterial

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

Direct Known Subclasses:
  KeyMaterial

    public class TrustMaterial
    extends TrustChain

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

### Field Summary

Fields
`static TrustMaterial` `CACERTS` Might be null if "$JAVA_HOME/jre/lib/security/cacerts" doesn't exist.
`static TrustMaterial` `DEFAULT` Should never be null (unless both CACERTS and JSSE_CACERTS are not present???).
`private java.security.KeyStore` `jks`
`static TrustMaterial` `JSSE_CACERTS` Might be null if "$JAVA_HOME/jre/lib/security/jssecacerts" doesn't exist.
`(package private) static int` `SIMPLE_TRUST_TYPE_TRUST_ALL`
`(package private) static int` `SIMPLE_TRUST_TYPE_TRUST_THIS_JVM`
`int` `simpleTrustType`
`static TrustMaterial` `TRUST_ALL`
`static TrustMaterial` `TRUST_THIS_JVM`

### Constructor Summary

Constructors
`` `TrustMaterial(byte[] pemBase64)`
`` `TrustMaterial(byte[] jks, char[] password)`
`` `TrustMaterial(java.util.Collection x509Certs)`
`` `TrustMaterial(java.io.File pemFile)`
`` `TrustMaterial(java.io.File jksFile, char[] password)`
`` `TrustMaterial(java.io.InputStream pemBase64)`
`` `TrustMaterial(java.io.InputStream jks, char[] password)`
`private` `TrustMaterial(int simpleTrustType)`
`(package private)` `TrustMaterial(java.security.KeyStore jks, int simpleTrustType)`
`` `TrustMaterial(java.lang.String pathToPemFile)`
`` `TrustMaterial(java.lang.String pathToJksFile, char[] password)`
`` `TrustMaterial(java.net.URL urlToPemFile)`
`` `TrustMaterial(java.net.URL urlToJKS, char[] password)`
`` `TrustMaterial(java.security.cert.X509Certificate x509Cert)`
`` `TrustMaterial(java.security.cert.X509Certificate[] x509Certs)`

### Method Summary

Methods
`protected boolean` `containsTrustAll()`
`java.security.KeyStore` `getKeyStore()`
`private static void` `loadCerts(java.security.KeyStore ks, java.util.Collection certs)`

### Methods inherited from class org.apache.commons.ssl.TrustChain

`addTrustMaterial, contains, contains, getCertificates, getSize, getTrustManagerFactory, getTrustManagers, getUnifiedKeyStore, isEmpty`

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

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

### Field Detail

#### SIMPLE_TRUST_TYPE_TRUST_ALL

    static final int SIMPLE_TRUST_TYPE_TRUST_ALL

See Also:
  Constant Field Values

#### SIMPLE_TRUST_TYPE_TRUST_THIS_JVM

    static final int SIMPLE_TRUST_TYPE_TRUST_THIS_JVM

See Also:
  Constant Field Values

#### CACERTS

    public static final TrustMaterial CACERTS

Might be null if "$JAVA_HOME/jre/lib/security/cacerts" doesn't exist.

#### JSSE_CACERTS

    public static final TrustMaterial JSSE_CACERTS

Might be null if "$JAVA_HOME/jre/lib/security/jssecacerts" doesn't exist.

#### DEFAULT

    public static final TrustMaterial DEFAULT

Should never be null (unless both CACERTS and JSSE_CACERTS are not present???). Is either CACERTS or JSSE_CACERTS. Priority given to JSSE_CACERTS, but 99.9% of the time it's CACERTS, since JSSE_CACERTS is almost never present.

#### TRUST_ALL

    public static final TrustMaterial TRUST_ALL

#### TRUST_THIS_JVM

    public static final TrustMaterial TRUST_THIS_JVM

#### simpleTrustType

    public final int simpleTrustType

#### jks

    private final java.security.KeyStore jks

### Constructor Detail

#### TrustMaterial

    private TrustMaterial(int simpleTrustType)

#### TrustMaterial

    TrustMaterial(java.security.KeyStore jks,
                 int simpleTrustType)

#### TrustMaterial

    public TrustMaterial(java.util.Collection x509Certs)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.security.cert.X509Certificate x509Cert)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.security.cert.X509Certificate[] x509Certs)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(byte[] pemBase64)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.io.InputStream pemBase64)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.lang.String pathToPemFile)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.io.File pemFile)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.net.URL urlToPemFile)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.lang.String pathToJksFile,
                 char[] password)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.io.File jksFile,
                 char[] password)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.net.URL urlToJKS,
                 char[] password)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(java.io.InputStream jks,
                 char[] password)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

#### TrustMaterial

    public TrustMaterial(byte[] jks,
                 char[] password)
                  throws java.security.GeneralSecurityException,
                         java.io.IOException

Throws:
  `java.security.GeneralSecurityException`
  `java.io.IOException`

### Method Detail

#### getKeyStore

    public java.security.KeyStore getKeyStore()

#### loadCerts

    private static void loadCerts(java.security.KeyStore ks,
                 java.util.Collection certs)
                           throws java.security.KeyStoreException

Throws:
  `java.security.KeyStoreException`

#### containsTrustAll

    protected boolean containsTrustAll()

Overrides:
  `containsTrustAll` in class `TrustChain`