public class TrustUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static X509Certificate[] |
EMPTY_CERTIFICATE_ARRAY
Empty X509 certificate array, useful for indicating an empty root CA trust store.
|
| Constructor and Description |
|---|
TrustUtil() |
| Modifier and Type | Method and Description |
|---|---|
static List<X509Certificate> |
extractTrustedCertificateEntries(KeyStore trustStore)
Extracts the
KeyStore.TrustedCertificateEntrys from the specified KeyStore. |
static X509Certificate[] |
getBuiltinTrustedCAs()
Returns the built-in list of trusted CAs.
|
static X509TrustManager |
getDefaultJavaTrustManager()
Returns a new instance of the default TrustManager for this JVM.
|
static X509Certificate[] |
getJavaTrustedCAs()
Returns the list of root CAs trusted by default in this JVM, according to the TrustManager returned by
getDefaultJavaTrustManager(). |
static X509Certificate |
readSingleX509Certificate(String x509CertificateAsPem)
Parses a single PEM-encoded X509 certificate into an
X509Certificate. |
static X509Certificate[] |
readX509CertificatesFromPem(String pemEncodedCAs)
Parses a String containing zero or more PEM-encoded X509 certificates into an array of
X509Certificate. |
public static final X509Certificate[] EMPTY_CERTIFICATE_ARRAY
public static X509Certificate[] getBuiltinTrustedCAs()
public static X509Certificate[] getJavaTrustedCAs()
getDefaultJavaTrustManager().public static X509Certificate[] readX509CertificatesFromPem(String pemEncodedCAs)
X509Certificate.
Everything outside of BEGIN CERTIFICATE and END CERTIFICATE lines will be ignored.pemEncodedCAs - a String containing PEM-encoded certficiatespublic static X509Certificate readSingleX509Certificate(String x509CertificateAsPem)
X509Certificate.x509CertificateAsPem - PEM-encoded X509 certificatepublic static X509TrustManager getDefaultJavaTrustManager()
public static List<X509Certificate> extractTrustedCertificateEntries(KeyStore trustStore)
KeyStore.TrustedCertificateEntrys from the specified KeyStore. All other entry
types, including private keys, will be ignored.trustStore - keystore containing trusted certificate entriesCopyright © 2017. All rights reserved.