Class CertificateUtilities
java.lang.Object
com.inductiveautomation.ignition.client.launch.util.CertificateUtilities
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyStore
getLoadedKeyStore
(String javaHome) Returns a KeyStore that is loaded from the supplied java home.static String
getSha256Fingerprint
(X509Certificate certificate) Returns the SHA-256 fingerprint of the certificate.static TrustManager[]
static void
Creates anSSLContext
which is backed by aTrustManagerFactory
whose Keystore contains the contents of the default keystore on disk as well as the certificates in thegetCertificatesDirectory()
and sets thatSSLContext
as the default.static List<X509Certificate>
readPemBundleCertificates
(File pemBundle) Reads all the valid certificates which exist in the provided PEM bundle file.
-
Field Details
-
IGN_TRUSTSTORE_TYPE
-
-
Method Details
-
readPemBundleCertificates
Reads all the valid certificates which exist in the provided PEM bundle file. If the file is null or doesn't exist an empty list is returned. -
getSha256Fingerprint
Returns the SHA-256 fingerprint of the certificate.- Throws:
Exception
-
getTrustManagers
public static TrustManager[] getTrustManagers() throws NoSuchAlgorithmException, KeyStoreException, CertificateUtilities.TrustStoreTypeException- Returns:
- the trust managers created from a trust manager factory initialized with the trust store loaded from java.home system property
- Throws:
NoSuchAlgorithmException
KeyStoreException
CertificateUtilities.TrustStoreTypeException
- See Also:
-
injectDefaultSslContext
public static void injectDefaultSslContext() throws KeyStoreException, NoSuchAlgorithmException, KeyManagementException, CertificateUtilities.TrustStoreTypeExceptionCreates anSSLContext
which is backed by aTrustManagerFactory
whose Keystore contains the contents of the default keystore on disk as well as the certificates in thegetCertificatesDirectory()
and sets thatSSLContext
as the default. -
getLoadedKeyStore
Returns a KeyStore that is loaded from the supplied java home. May be null if there was an issue loading the cacerts or default trust file file. If it has been previously loaded the existingKEY_STORE
is returned.The default trust store is retrieved via
getDefaultTrustStore(String)
- Parameters:
javaHome
- The path to java home. This is usually just the System Property 'java.home'. Must not be null.
-