public class PEMEncoder extends Object
PrivateKey or PublicKey into a PEM formatted string.| Constructor and Description |
|---|
PEMEncoder() |
| Modifier and Type | Method and Description |
|---|---|
String |
encode(Certificate certificate)
Encode the X.509 certificate in a PEM format and return a string.
|
String |
encode(Key key)
Encode the provided key in a PEM format and return a string.
|
String |
encode(PrivateKey privateKey,
PublicKey publicKey)
Encode the provided keys in a PEM format and return a string.
|
String |
parseEncodedCertificate(String derEncoded)
Attempt to covert a ASN.1 DER encoded X.509 certificate into a PEM encoded string.
|
public String parseEncodedCertificate(String derEncoded)
derEncoded - base64 ASN.1 DER encoded bytes of an X.509 certificatepublic String encode(PrivateKey privateKey, PublicKey publicKey)
If null is passed for one of the two parameters, a PEM will be returned that only includes the non-null
value.
Both values may no be null.
privateKey - the private keypublicKey - the public keypublic String encode(Key key)
Both values may no be null.
key - the key, this parameter may be of type PrivateKey PublicKeypublic String encode(Certificate certificate)
certificate - The certificateCopyright © 2023. All rights reserved.