Package io.airlift.security.pem
Class PemReader
- java.lang.Object
-
- io.airlift.security.pem.PemReader
-
public final class PemReader extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]base64Decode(String base64)static booleanisPem(File file)static booleanisPem(String data)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
-
isPem
public static boolean isPem(File file) throws IOException
- Throws:
IOException
-
isPem
public static boolean isPem(String data)
-
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
-
base64Decode
public static byte[] base64Decode(String base64)
-
-