Class PemKeyReader
- java.lang.Object
-
- com.floragunn.searchguard.support.PemKeyReader
-
public final class PemKeyReader extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.logging.log4j.Loggerlog
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcheckPath(String keystoreFilePath, String fileNameLogOnly)static X509CertificateloadCertificateFromFile(String file)static X509CertificateloadCertificateFromStream(InputStream in)static X509Certificate[]loadCertificatesFromFile(String file)static List<? extends Certificate>loadCertificatesFromFileAsList(String file)static X509Certificate[]loadCertificatesFromStream(InputStream in)static PrivateKeyloadKeyFromFile(String password, String keyFile)static PrivateKeyloadKeyFromStream(String password, InputStream in)static KeyStoreloadKeyStore(String storePath, String keyStorePassword, String type)static char[]randomChars(int len)static Stringresolve(String originalPath, String propName, org.elasticsearch.common.settings.Settings settings, Path configPath, boolean mustBeValid)static Stringresolve(String propName, org.elasticsearch.common.settings.Settings settings, Path configPath, boolean mustBeValid)static InputStreamresolveStream(String propName, org.elasticsearch.common.settings.Settings settings)static KeyStoretoKeystore(String authenticationCertificateAlias, char[] password, X509Certificate[] authenticationCertificate, PrivateKey authenticationKey)static PrivateKeytoPrivateKey(File keyFile, String keyPassword)static PrivateKeytoPrivateKey(InputStream in, String keyPassword)static KeyStoretoTruststore(String trustCertificatesAliasPrefix, X509Certificate[] trustCertificates)
-
-
-
Method Detail
-
toPrivateKey
public static PrivateKey toPrivateKey(File keyFile, String keyPassword) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, KeyException, IOException
-
toPrivateKey
public static PrivateKey toPrivateKey(InputStream in, String keyPassword) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, KeyException, IOException
-
loadCertificateFromFile
public static X509Certificate loadCertificateFromFile(String file) throws Exception
- Throws:
Exception
-
loadCertificatesFromFileAsList
public static List<? extends Certificate> loadCertificatesFromFileAsList(String file) throws Exception
- Throws:
Exception
-
loadCertificateFromStream
public static X509Certificate loadCertificateFromStream(InputStream in) throws Exception
- Throws:
Exception
-
loadKeyStore
public static KeyStore loadKeyStore(String storePath, String keyStorePassword, String type) throws Exception
- Throws:
Exception
-
loadKeyFromFile
public static PrivateKey loadKeyFromFile(String password, String keyFile) throws Exception
- Throws:
Exception
-
loadKeyFromStream
public static PrivateKey loadKeyFromStream(String password, InputStream in) throws Exception
- Throws:
Exception
-
loadCertificatesFromFile
public static X509Certificate[] loadCertificatesFromFile(String file) throws Exception
- Throws:
Exception
-
loadCertificatesFromStream
public static X509Certificate[] loadCertificatesFromStream(InputStream in) throws CertificateException
- Throws:
CertificateException
-
resolveStream
public static InputStream resolveStream(String propName, org.elasticsearch.common.settings.Settings settings)
-
resolve
public static String resolve(String propName, org.elasticsearch.common.settings.Settings settings, Path configPath, boolean mustBeValid)
-
resolve
public static String resolve(String originalPath, String propName, org.elasticsearch.common.settings.Settings settings, Path configPath, boolean mustBeValid)
-
toTruststore
public static KeyStore toTruststore(String trustCertificatesAliasPrefix, X509Certificate[] trustCertificates) throws Exception
- Throws:
Exception
-
toKeystore
public static KeyStore toKeystore(String authenticationCertificateAlias, char[] password, X509Certificate[] authenticationCertificate, PrivateKey authenticationKey) throws Exception
- Throws:
Exception
-
randomChars
public static char[] randomChars(int len)
-
-