Package org.elasticsearch.common.ssl
Class PemUtils
java.lang.Object
org.elasticsearch.common.ssl.PemUtils
public final class PemUtils
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description static java.util.List<java.security.cert.Certificate>readCertificates(java.util.Collection<java.nio.file.Path> certPaths)static java.security.PrivateKeyreadPrivateKey(java.nio.file.Path keyPath, java.util.function.Supplier<char[]> passwordSupplier)Creates aPrivateKeyfrom the contents of a file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
readPrivateKey
public static java.security.PrivateKey readPrivateKey(java.nio.file.Path keyPath, java.util.function.Supplier<char[]> passwordSupplier) throws java.io.IOException, java.security.GeneralSecurityExceptionCreates aPrivateKeyfrom the contents of a file. Supports PKCS#1, PKCS#8 encoded formats of encrypted and plaintext RSA, DSA and EC(secp256r1) keys- Parameters:
keyPath- the path for the key filepasswordSupplier- A password supplier for the potentially encrypted (password protected) key- Returns:
- a private key from the contents of the file
- Throws:
java.io.IOExceptionjava.security.GeneralSecurityException
-
readCertificates
public static java.util.List<java.security.cert.Certificate> readCertificates(java.util.Collection<java.nio.file.Path> certPaths) throws java.security.cert.CertificateException, java.io.IOException- Throws:
java.security.cert.CertificateExceptionjava.io.IOException
-