public class Pem extends Object
| Constructor and Description |
|---|
Pem() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decode(String input)
Decodes a PEM-encoded block.
|
static String |
encode(String type,
byte[] data)
PEM encodes data as the give type.
|
static String |
encodeCertificate(X509Certificate certificate)
PEM encodes the Certificate.
|
static String |
encodePrivateKey(PrivateKey privateKey)
PEM encodes the private key.
|
static String |
encodePublicKey(PublicKey publicKey)
PEM encodes the public key.
|
public static byte[] decode(String input) throws IOException
input - the input string, according to RFC 1421, can only contain characters in the base-64 alphabet and
whitespaces.IOException - thrown if input is invalidpublic static String encode(String type, byte[] data) throws IOException
type - the type of data being encodeddata - the data to encodeIOException - thrown if data is invalidpublic static String encodePrivateKey(PrivateKey privateKey) throws IOException
privateKey - the private key to encodeIOException - thrown if there is an issue encoding the keypublic static String encodePublicKey(PublicKey publicKey) throws IOException
publicKey - the public key to encodeIOException - thrown if there is an issue encoding the keypublic static String encodeCertificate(X509Certificate certificate) throws IOException, CertificateEncodingException
certificate - the certificate to encodeIOException - thrown if there is an issue encoding the certificateCertificateEncodingException - thrown if there is an issue encoding the certificateCopyright © 2021. All rights reserved.