Package org.pgpainless.util

# 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 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.

## Method Summary

Modifier and Type
Method
Description
`SymmetricKeyAlgorithm`
`getAlgorithm()`
Return the symmetric key algorithm.
`byte[]`
`getKey()`
Return the bytes of the key.
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## 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`