Class SessionKey

java.lang.Object
org.pgpainless.util.SessionKey

public class SessionKey extends Object
A SessionKey is the symmetric key that is used to encrypt/decrypt an OpenPGP message. The OpenPGP message header contains a copy of the session key, encrypted for the public key of each recipient.
  • Constructor Details

    • SessionKey

      public SessionKey(@Nonnull org.bouncycastle.openpgp.PGPSessionKey sessionKey)
      Constructor to create a session key from a BC PGPSessionKey object.
      Parameters:
      sessionKey - BC session key
    • SessionKey

      public SessionKey(@Nonnull SymmetricKeyAlgorithm algorithm, @Nonnull byte[] key)
      Create a session key object from an algorithm and a key.
      Parameters:
      algorithm - algorithm
      key - key
  • Method Details

    • getAlgorithm

      public SymmetricKeyAlgorithm getAlgorithm()
      Return the symmetric key algorithm.
      Returns:
      algorithm
    • getKey

      public byte[] getKey()
      Return the bytes of the key.
      Returns:
      key
    • toString

      public String toString()
      Overrides:
      toString in class Object