Class PrivateKeyReader

java.lang.Object
com.tccc.kos.commons.util.PrivateKeyReader

public class PrivateKeyReader extends Object
Reader to load a private key stored in PKCS8 format.
Version:
2022-06-24
  • Constructor Details

    • PrivateKeyReader

      public PrivateKeyReader()
  • Method Details

    • fromFile

      public PrivateKey fromFile(File keyFile) throws IOException
      Return a private key contained in the specified file.
      Parameters:
      keyFile - the file containing the key
      Returns:
      the private key
      Throws:
      IOException
    • fromResource

      public PrivateKey fromResource(String resource) throws IOException
      Return a private key contained in the specified resource.
      Parameters:
      resource - the resource containing the key
      Returns:
      the private key
      Throws:
      IOException
    • fromInputStream

      public PrivateKey fromInputStream(InputStream is) throws IOException
      Return a private key accessible via the input stream.
      Parameters:
      is - the stream containing the key
      Returns:
      the private key
      Throws:
      IOException