Class CertificateUtilities
- java.lang.Object
- 
- com.inductiveautomation.ignition.client.launch.util.CertificateUtilities
 
- 
 public class CertificateUtilities extends java.lang.Object
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classCertificateUtilities.TrustStoreTypeException
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringIGN_TRUSTSTORE_TYPE
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static java.security.KeyStoregetLoadedKeyStore(java.lang.String javaHome)Returns a KeyStore that is loaded from the supplied java home.static java.lang.StringgetSha256Fingerprint(java.security.cert.X509Certificate certificate)Returns the SHA-256 fingerprint of the certificate.static javax.net.ssl.TrustManager[]getTrustManagers()static voidinjectDefaultSslContext()Creates anSSLContextwhich is backed by aTrustManagerFactorywhose Keystore contains the contents of the default keystore on disk as well as the certificates in thegetCertificatesDirectory()and sets thatSSLContextas the default.static java.util.List<java.security.cert.X509Certificate>readPemBundleCertificates(java.io.File pemBundle)Reads all the valid certificates which exist in the provided PEM bundle file.
 
- 
- 
- 
Method Detail- 
readPemBundleCertificatespublic static java.util.List<java.security.cert.X509Certificate> readPemBundleCertificates(java.io.File pemBundle) 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.
 - 
getSha256Fingerprintpublic static java.lang.String getSha256Fingerprint(java.security.cert.X509Certificate certificate) throws java.lang.ExceptionReturns the SHA-256 fingerprint of the certificate.- Throws:
- java.lang.Exception
 
 - 
getTrustManagerspublic static javax.net.ssl.TrustManager[] getTrustManagers() throws java.security.NoSuchAlgorithmException, java.security.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:
- java.security.NoSuchAlgorithmException
- java.security.KeyStoreException
- CertificateUtilities.TrustStoreTypeException
- See Also:
- getLoadedKeyStore(String)
 
 - 
injectDefaultSslContextpublic static void injectDefaultSslContext() throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException, CertificateUtilities.TrustStoreTypeExceptionCreates anSSLContextwhich is backed by aTrustManagerFactorywhose Keystore contains the contents of the default keystore on disk as well as the certificates in thegetCertificatesDirectory()and sets thatSSLContextas the default.- Throws:
- java.security.KeyStoreException
- java.security.NoSuchAlgorithmException
- java.security.KeyManagementException
- CertificateUtilities.TrustStoreTypeException
 
 - 
getLoadedKeyStorepublic static java.security.KeyStore getLoadedKeyStore(java.lang.String javaHome) 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_STOREis 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.
 
 
- 
 
-