Package org.apache.zookeeper.util
Class PemReader
- java.lang.Object
-
- org.apache.zookeeper.util.PemReader
-
public final class PemReader extends Object
Note: this class is copied from io.airlift.security.pem.PemReader (see https://github.com/airlift/airlift/blob/master/security/src/main/java/io/airlift/security/pem/PemReader.java) with permission of the authors, to avoid adding an extra library dependency to Zookeeper. The file was copied from commit hash 86348546af43217f4d04a0cdad624b0ae4751c2c. The following modifications have been made to the original source code:- imports have been rearranged to match Zookeeper import order style.
- The dependency on
com.google.common.io.Files.asCharSourcehas been removed. - A dependency on
java.nio.file.Fileshas been added.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static KeyStoreloadKeyStore(File certificateChainFile, File privateKeyFile, Optional<String> keyPassword)static PrivateKeyloadPrivateKey(File privateKeyFile, Optional<String> keyPassword)static PrivateKeyloadPrivateKey(String privateKey, Optional<String> keyPassword)static PublicKeyloadPublicKey(File publicKeyFile)static PublicKeyloadPublicKey(String publicKey)static KeyStoreloadTrustStore(File certificateChainFile)static List<X509Certificate>readCertificateChain(File certificateChainFile)static List<X509Certificate>readCertificateChain(String certificateChain)
-
-
-
Method Detail
-
loadTrustStore
public static KeyStore loadTrustStore(File certificateChainFile) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
loadKeyStore
public static KeyStore loadKeyStore(File certificateChainFile, File privateKeyFile, Optional<String> keyPassword) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
readCertificateChain
public static List<X509Certificate> readCertificateChain(File certificateChainFile) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
readCertificateChain
public static List<X509Certificate> readCertificateChain(String certificateChain) throws CertificateException
- Throws:
CertificateException
-
loadPrivateKey
public static PrivateKey loadPrivateKey(File privateKeyFile, Optional<String> keyPassword) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
loadPrivateKey
public static PrivateKey loadPrivateKey(String privateKey, Optional<String> keyPassword) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
loadPublicKey
public static PublicKey loadPublicKey(File publicKeyFile) throws IOException, GeneralSecurityException
- Throws:
IOExceptionGeneralSecurityException
-
loadPublicKey
public static PublicKey loadPublicKey(String publicKey) throws GeneralSecurityException
- Throws:
GeneralSecurityException
-
-