java.lang.Object
org.jenkinsci.main.modules.instance_identity.pem.PEMHelper

@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class PEMHelper extends Object
Helper class to decode and encode PEM formatted strings using PEMEncodable
See Also:
  • PEMEncodable
  • PEMEncodable.encode()
  • PEMEncodable.decode(String, char[])
  • Constructor Details

    • PEMHelper

      public PEMHelper()
  • Method Details

    • decodePEM

      @NonNull public static KeyPair decodePEM(@NonNull String pem) throws IOException
      Decodes a PEM formatted string to KeyPair. Wrapper for PEMEncodable.decode(String).
      Parameters:
      pem - String with the PEM format
      Returns:
      decoded PEM as KeyPair
      Throws:
      IOException - if a problem exists decoding the PEM
      See Also:
      • PEMEncodable.decode(String, char[])
    • encodePEM

      @NonNull public static String encodePEM(@NonNull KeyPair keys) throws IOException
      Encodes a KeyPair in a PCKS1 PEM formatted string. Wrapper for PEMEncodable.encode().
      Parameters:
      keys - KeyPair to encode
      Returns:
      KeyPair as an encoded PEM String
      Throws:
      IOException - if a problem exists decoding the PEM
      See Also:
      • PEMEncodable.encode()