public class TrustSource extends Object
defaultTrustSource()- both the built-in and JVM-trusted CAsjavaTrustSource() - only default CAs trusted by the JVMbuiltinTrustSource() - only built-in trusted CAs (ultimately derived from Firefox's trust list)empty(), then calling the various add() methods to add
PEM-encoded files and Strings, KeyStores, and X509Certificates to the TrustSource. For example:
TrustSource customTrustSource = TrustSource.empty()
.add(myX509Certificate)
.add(pemFileContainingMyCA)
.add(javaKeyStore);
Note: This class is immutable, so calls to add() will return a new instance, rather than modifying the existing instance.| Modifier | Constructor and Description |
|---|---|
protected |
TrustSource()
Creates a TrustSource that contains no trusted certificates.
|
protected |
TrustSource(X509Certificate... trustedCAs)
Creates a TrustSource that considers only the specified certificates as "trusted".
|
| Modifier and Type | Method and Description |
|---|---|
TrustSource |
add(File trustedCAPemFile)
Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus zero or more CAs contained in
the PEM-encoded File.
|
TrustSource |
add(KeyStore trustStore)
Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus all trusted certificate
entries from the specified trustStore.
|
TrustSource |
add(String trustedPemEncodedCAs)
Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus zero or more CAs contained in
the PEM-encoded String.
|
TrustSource |
add(TrustSource trustSource)
Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus the trusted CAs in the specified
TrustSource.
|
TrustSource |
add(X509Certificate... trustedCertificates)
Returns a new TrustSource containing the same trusted CAs as this TrustSource, plus zero or more additional
trusted X509Certificates.
|
static TrustSource |
builtinTrustSource()
Returns a TrustSource containing only the builtin trusted CAs and does not include the JVM's trusted CAs.
|
static TrustSource |
defaultTrustSource()
Returns a TrustSource containing the default trusted CAs.
|
static TrustSource |
empty()
Returns a TrustSource that contains no trusted CAs.
|
X509Certificate[] |
getTrustedCAs()
Returns the X509 certificates considered "trusted" by this TrustSource.
|
static TrustSource |
javaTrustSource()
Returns a TrustSource containing the default CAs trusted by this JVM.
|
protected TrustSource()
empty().protected TrustSource(X509Certificate... trustedCAs)
empty() followed by add(X509Certificate...).trustedCAs - root CAs to trustpublic X509Certificate[] getTrustedCAs()
public static TrustSource empty()
public static TrustSource defaultTrustSource()
public static TrustSource builtinTrustSource()
TrustUtil.getBuiltinTrustedCAs().public static TrustSource javaTrustSource()
TrustUtil.getJavaTrustedCAs().public TrustSource add(String trustedPemEncodedCAs)
trustedPemEncodedCAs - String containing PEM-encoded certificates to trustpublic TrustSource add(X509Certificate... trustedCertificates)
trustedCertificates - X509Certificates of CAs to trustpublic TrustSource add(KeyStore trustStore)
KeyStore.TrustedCertificateEntry; private keys will be
ignored. The trustStore may be in JKS or PKCS12 format.trustStore - keystore containing trusted certificate entriespublic TrustSource add(File trustedCAPemFile)
trustedCAPemFile - File containing PEM-encoded certificatespublic TrustSource add(TrustSource trustSource)
trustSource - TrustSource to combine with this TrustSourceCopyright © 2016. All rights reserved.