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.PrivateKey readPrivateKey​(java.nio.file.Path keyPath, java.util.function.Supplier<char[]> passwordSupplier)
    Creates a PrivateKey from 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.GeneralSecurityException
      Creates a PrivateKey from 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 file
      passwordSupplier - A password supplier for the potentially encrypted (password protected) key
      Returns:
      a private key from the contents of the file
      Throws:
      java.io.IOException
      java.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.CertificateException
      java.io.IOException