Class PemFileHelper


  • public class PemFileHelper
    extends java.lang.Object
    Helper methods for dealing with PEM files
    Since:
    0.1.0
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] readPemFile​(java.io.Reader keyReader)
      Reads a PEM file
      static void writePemFile​(java.io.Writer fileWriter, byte[] encodedKey, java.lang.String keyType)
      Writes a PEM file
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readPemFile

        public static byte[] readPemFile​(java.io.Reader keyReader)
                                  throws java.io.IOException
        Reads a PEM file
        Parameters:
        keyReader - the reader to load the key from
        Returns:
        a byte array with file content
        Throws:
        java.io.IOException - thrown if error reading file
      • writePemFile

        public static void writePemFile​(java.io.Writer fileWriter,
                                        byte[] encodedKey,
                                        java.lang.String keyType)
                                 throws java.io.IOException
        Writes a PEM file
        Parameters:
        fileWriter - the writer of the key
        encodedKey - the encoded key
        keyType - the key type
        Throws:
        java.io.IOException - thrown if error writing file