Class PemUtils
java.lang.Object
org.jboss.resteasy.security.PemUtils
Utility classes to extract PublicKey, PrivateKey, and X509Certificate from openssl generated PEM files.
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic X509Certificatestatic X509CertificatedecodeCertificate(String cert) static PrivateKeystatic PrivateKeydecodePrivateKey(String pem) Extract a private key that is a PKCS8 pem string (base64 encoded PKCS8).static PublicKeydecodePublicKey(String pem) Extract a public key from a PEM string.static Stringstatic byte[]pemToDer(InputStream is) Decode a PEM file to DER format.static byte[]Decode a PEM string to DER format.static StringremoveBeginEnd(String pem)
-
Constructor Details
-
PemUtils
public PemUtils()
-
-
Method Details
-
decodeCertificate
- Throws:
Exception
-
decodeCertificate
- Throws:
Exception
-
decodePublicKey
-
decodePrivateKey
Extract a private key that is a PKCS8 pem string (base64 encoded PKCS8).- Parameters:
pem- PEM encoded string- Returns:
PrivateKey- Throws:
Exception- if error occurred
-
decodePrivateKey
- Throws:
Exception
-
pemToDer
Decode a PEM file to DER format.- Parameters:
is- input stream- Returns:
- decoded bytes
- Throws:
IOException- if I/O error occurred
-
pemToDer
Decode a PEM string to DER format.- Parameters:
pem- PEM encoded string- Returns:
- decoded bytes
- Throws:
IOException- if I/O error occurred
-
removeBeginEnd
-
pemFromStream
- Throws:
IOException
-