Package com.peterphi.std.crypto
Class PEMHelper
java.lang.Object
com.peterphi.std.crypto.PEMHelper
PEM handling utilities
-
Method Summary
Modifier and TypeMethodDescriptionstatic KeyStore
loadCertificates
(File pemFile) Load one or more X.509 Certificates from a PEM filestatic Object
parse
(org.bouncycastle.util.io.pem.PemObject obj) Parse a PemObject.
-
Method Details
-
loadCertificates
Load one or more X.509 Certificates from a PEM file- Parameters:
pemFile
- A PKCS8 PEM file containing onlyCERTIFICATE
/X.509 CERTIFICATE
blocks- Returns:
- a JKS KeyStore with the certificate aliases "cert
index
" where index is the 0-based index of the certificate in the PEM - Throws:
RuntimeException
- if a problem occurs
-
parse
public static Object parse(org.bouncycastle.util.io.pem.PemObject obj) throws GeneralSecurityException Parse a PemObject. Currently only supportsCERTIFICATE
/X.509 CERTIFICATE
types- Parameters:
obj
- a PemObject with a type and with contents- Returns:
- a parsed object (or null if the input is null)
- Throws:
GeneralSecurityException
- if there is a parsing problemIllegalArgumentException
- if the PemObject cannot be recognised
-