Class Pem.Decoder

java.lang.Object
oracle.nosql.driver.iam.pki.Pem.Decoder
Enclosing class:
Pem

public static class Pem.Decoder extends Object
Decodes PEM encoded text streams into the desired format
  • Method Details

    • with

      public Pem.Decoder with(Pem.Passphrase passphrase)
      Produce a decoder configured to use the specified passphrase for encrypted private keys
      Parameters:
      passphrase - The passphrase or null if no encrypted private keys will be decoded
      Returns:
      Decoder instance
    • decodeCertificate

      public Certificate decodeCertificate(String contents)
      Decode an X509 certificate
      Parameters:
      contents - The PEM encoded form of the X509 certificate
      Returns:
      Certificate instance
    • decodeCertificate

      public Certificate decodeCertificate(ReadableByteChannel contents)
      Decode an X509 certificate
      Parameters:
      contents - The PEM encoded form of the X509 certificate
      Returns:
      Certificate instance
    • decodeCertificateChain

      public Collection<? extends Certificate> decodeCertificateChain(String contents)
      Decode an X509 certificate chain
      Parameters:
      contents - The PEM encoded certificate chain
      Returns:
      Collection of Certificate instances
    • decodeCertificateChain

      public Collection<? extends Certificate> decodeCertificateChain(ReadableByteChannel contents)
      Decode an X509 certificate chain
      Parameters:
      contents - The PEM encoded certificate chain
      Returns:
      Collection of Certificate instances
    • decodePrivateKey

      public PrivateKey decodePrivateKey(ReadableByteChannel bytes) throws IOException
      Decode a private key. The private key is sensitive data, the caller is responsible for ensuring the input stream is closed (and any backing storage is erased)
      Parameters:
      bytes - The PEM encoded private key as UTF-8 encoded byte stream
      Returns:
      PrivateKey instance
      Throws:
      IOException
    • decodePrivateKey

      public PrivateKey decodePrivateKey(byte[] contents)
      Decode a private key. The private key is sensitive data and must be provided as a byte array. The caller is responsible for erasing the byte array after use.
      Parameters:
      contents - The PEM encoded private key as UTF-8 encoded bytes
      Returns:
      PrivateKey instance
    • decodePublicKey

      public PublicKey decodePublicKey(String contents)
      Decode a public key
      Parameters:
      contents - The PEM encoded public key
      Returns:
      PublicKey instance
    • decodePublicKey

      public PublicKey decodePublicKey(ReadableByteChannel contents)
      Decode a public key
      Parameters:
      contents - The PEM encoded public key
      Returns:
      PublicKey instance