Class SessionKey


  • public class SessionKey
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      SessionKey​(org.bouncycastle.openpgp.PGPSessionKey sessionKey)
      Constructor to create a session key from a BC PGPSessionKey object.
      SessionKey​(SymmetricKeyAlgorithm algorithm, byte[] key)
      Create a session key object from an algorithm and a key.
    • Constructor Detail

      • 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 Detail

      • 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object