Class PEM

java.lang.Object
io.fusionauth.pem.domain.PEM
All Implemented Interfaces:
Buildable<PEM>

public class PEM extends Object implements Buildable<PEM>
Author:
Daniel DeGroff
  • Field Details

  • Constructor Details

  • Method Details

    • decode

      public static PEM decode(Path path)
      Decode a PEM in string format.
      Parameters:
      path - a path to an encoded PEM
      Returns:
      a PEM object
    • decode

      public static PEM decode(String encodedPEM)
      Decode a PEM in string format.
      Parameters:
      encodedPEM - an encoded PEM
      Returns:
      a PEM object
    • decode

      public static PEM decode(byte[] bytes)
      Decode a PEM in string format.
      Parameters:
      bytes - a byte array of the PEM
      Returns:
      a PEM object
    • encode

      public static String encode(Key key)
      Encode a key in PEM format.
      Parameters:
      key - a key
      Returns:
      an encoded PEM
    • encode

      public static String encode(PrivateKey privateKey, PublicKey publicKey)
      Encode a private key in PEM format given both the private and public key.

      The use of this method is only necessary if you are providing a private key that does not contain the encoded public key.

      Parameters:
      privateKey - a private key
      publicKey - a public key
      Returns:
      an encoded PEM
    • encode

      public static String encode(Certificate certificate)
      Encode a certificate in PEM format.
      Parameters:
      certificate - The certificate.
      Returns:
      An encoded PEM.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getCertificate

      public Certificate getCertificate()
    • getPrivateKey

      public <T extends PrivateKey> T getPrivateKey()
    • getPublicKey

      public <T extends PublicKey> T getPublicKey()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object