public class PEMUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
PKCS_1_PRIVATE_KEY_PREFIX |
static String |
PKCS_1_PRIVATE_KEY_SUFFIX |
static String |
PKCS_1_PUBLIC_KEY_PREFIX |
static String |
PKCS_1_PUBLIC_KEY_SUFFIX |
static String |
PKCS_8_PRIVATE_KEY_PREFIX |
static String |
PKCS_8_PRIVATE_KEY_SUFFIX |
static String |
X509_CERTIFICATE_PREFIX |
static String |
X509_CERTIFICATE_SUFFIX |
static String |
X509_PUBLIC_KEY_PREFIX |
static String |
X509_PUBLIC_KEY_SUFFIX |
| Constructor and Description |
|---|
PEMUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
decodeCertificate(String pemEncodedString)
Decode a PEM encoded certificate, returning only the Base64 encoded string.
|
static String |
encodeCertificate(String encodedCertificate)
PEM encode a Base64 encoded string version of a certificate.
|
static String |
encodePrivateKey(PrivateKey privateKey)
Return a PEM encoded string representation of the provided
PrivateKey. |
static String |
encodePublicKey(PublicKey publicKey)
Return a PEM encoded string representation of the provided
PublicKey. |
public static final String PKCS_1_PRIVATE_KEY_PREFIX
public static final String PKCS_1_PRIVATE_KEY_SUFFIX
public static final String PKCS_1_PUBLIC_KEY_PREFIX
public static final String PKCS_1_PUBLIC_KEY_SUFFIX
public static final String PKCS_8_PRIVATE_KEY_PREFIX
public static final String PKCS_8_PRIVATE_KEY_SUFFIX
public static final String X509_CERTIFICATE_PREFIX
public static final String X509_CERTIFICATE_SUFFIX
public static final String X509_PUBLIC_KEY_PREFIX
public static final String X509_PUBLIC_KEY_SUFFIX
public static String decodeCertificate(String pemEncodedString)
pemEncodedString - the PEM encoded string version of the certificate.public static String encodeCertificate(String encodedCertificate)
encodedCertificate - the Base64 encoded certificatepublic static String encodePrivateKey(PrivateKey privateKey)
PrivateKey.privateKey - the private key to PEM encode.Copyright © 2017. All rights reserved.