Package io.fusionauth.pem
Class PEMEncoder
java.lang.Object
io.fusionauth.pem.PEMEncoder
Encode a
PrivateKey or PublicKey into a PEM formatted string.- Author:
- Daniel DeGroff
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencode(Certificate certificate) Encode the X.509 certificate in a PEM format and return a string.Encode the provided key in a PEM format and return a string.encode(PrivateKey privateKey, PublicKey publicKey) Encode the provided keys in a PEM format and return a string.parseEncodedCertificate(String derEncoded) Attempt to covert a ASN.1 DER encoded X.509 certificate into a PEM encoded string.
-
Constructor Details
-
PEMEncoder
public PEMEncoder()
-
-
Method Details
-
parseEncodedCertificate
Attempt to covert a ASN.1 DER encoded X.509 certificate into a PEM encoded string.- Parameters:
derEncoded- base64 ASN.1 DER encoded bytes of an X.509 certificate- Returns:
- a PEM encoded certificate
-
encode
Encode the provided keys in a PEM format and return a string. If both private and public keys are provided a private key PEM will be returned with the public key embedded.If
nullis 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.
- Parameters:
privateKey- the private keypublicKey- the public key- Returns:
- a PEM Encoded key
-
encode
Encode the provided key in a PEM format and return a string.Both values may no be null.
- Parameters:
key- the key, this parameter may be of typePrivateKeyPublicKey- Returns:
- a PEM encoded key
-
encode
Encode the X.509 certificate in a PEM format and return a string.- Parameters:
certificate- The certificate- Returns:
- a PEM encoded certificate
-