org.bouncycastle.pqc.crypto.util

## Class SecretWithEncapsulationImpl

- java.lang.Object
- - org.bouncycastle.pqc.crypto.util.SecretWithEncapsulationImpl

- All Implemented Interfaces:
    Destroyable, SecretWithEncapsulation

      public class SecretWithEncapsulationImpl
      extends Object
      implements SecretWithEncapsulation

  Implementation of SecretWithEncapsulation for post-quantum cryptography. Provides secure storage and destruction of encapsulated secrets and session keys.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SecretWithEncapsulationImpl(byte[] sessionKey, byte[] cipher_text)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `checkDestroyed()`
    `void` | `destroy()`
    `byte[]` | `getEncapsulation()` Return the data that carries the secret in its encapsulated form.
    `byte[]` | `getSecret()` Return the secret associated with the encapsulation.
    `boolean` | `isDestroyed()`

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

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

- - ### Constructor Detail

    - #### SecretWithEncapsulationImpl

          public SecretWithEncapsulationImpl(byte[] sessionKey,
                                             byte[] cipher_text)

  - ### Method Detail

    - #### checkDestroyed

          void checkDestroyed()

    - #### destroy

          public void destroy()
                       throws DestroyFailedException

      Specified by:
        `destroy` in interface `Destroyable`
      Throws:
        `DestroyFailedException`

    - #### getEncapsulation

          public byte[] getEncapsulation()

      Description copied from interface: `SecretWithEncapsulation`
      Return the data that carries the secret in its encapsulated form.
      Specified by:
        `getEncapsulation` in interface `SecretWithEncapsulation`
      Returns:
        the encapsulation of the secret.

    - #### getSecret

          public byte[] getSecret()

      Description copied from interface: `SecretWithEncapsulation`
      Return the secret associated with the encapsulation.
      Specified by:
        `getSecret` in interface `SecretWithEncapsulation`
      Returns:
        the secret the encapsulation is for.

    - #### isDestroyed

          public boolean isDestroyed()

      Specified by:
        `isDestroyed` in interface `Destroyable`