Package org.apache.zookeeper.util
Class PemReader
- java.lang.Object
-
- org.apache.zookeeper.util.PemReader
-
public final class PemReader extends java.lang.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.asCharSource
has been removed. - A dependency on
java.nio.file.Files
has been added.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.security.KeyStore
loadKeyStore(java.io.File certificateChainFile, java.io.File privateKeyFile, java.util.Optional<java.lang.String> keyPassword)
static java.security.PrivateKey
loadPrivateKey(java.io.File privateKeyFile, java.util.Optional<java.lang.String> keyPassword)
static java.security.PrivateKey
loadPrivateKey(java.lang.String privateKey, java.util.Optional<java.lang.String> keyPassword)
static java.security.PublicKey
loadPublicKey(java.io.File publicKeyFile)
static java.security.PublicKey
loadPublicKey(java.lang.String publicKey)
static java.security.KeyStore
loadTrustStore(java.io.File certificateChainFile)
static java.util.List<java.security.cert.X509Certificate>
readCertificateChain(java.io.File certificateChainFile)
static java.util.List<java.security.cert.X509Certificate>
readCertificateChain(java.lang.String certificateChain)
-
-
-
Method Detail
-
loadTrustStore
public static java.security.KeyStore loadTrustStore(java.io.File certificateChainFile) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadKeyStore
public static java.security.KeyStore loadKeyStore(java.io.File certificateChainFile, java.io.File privateKeyFile, java.util.Optional<java.lang.String> keyPassword) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
readCertificateChain
public static java.util.List<java.security.cert.X509Certificate> readCertificateChain(java.io.File certificateChainFile) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
readCertificateChain
public static java.util.List<java.security.cert.X509Certificate> readCertificateChain(java.lang.String certificateChain) throws java.security.cert.CertificateException
- Throws:
java.security.cert.CertificateException
-
loadPrivateKey
public static java.security.PrivateKey loadPrivateKey(java.io.File privateKeyFile, java.util.Optional<java.lang.String> keyPassword) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadPrivateKey
public static java.security.PrivateKey loadPrivateKey(java.lang.String privateKey, java.util.Optional<java.lang.String> keyPassword) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadPublicKey
public static java.security.PublicKey loadPublicKey(java.io.File publicKeyFile) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
loadPublicKey
public static java.security.PublicKey loadPublicKey(java.lang.String publicKey) throws java.security.GeneralSecurityException
- Throws:
java.security.GeneralSecurityException
-
-