RFC3394WrapEngine (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.crypto.engines

## Class RFC3394WrapEngine

- java.lang.Object
- - org.bouncycastle.crypto.engines.RFC3394WrapEngine

- All Implemented Interfaces:
    Wrapper
  Direct Known Subclasses:
    AESWrapEngine, ARIAWrapEngine, CamelliaWrapEngine, SEEDWrapEngine

      public class RFC3394WrapEngine
      extends java.lang.Object
      implements Wrapper

  an implementation of the AES Key Wrapper from the NIST Key Wrap Specification as described in RFC 3394.

  For further details see: https://www.ietf.org/rfc/rfc3394.txt and https://csrc.nist.gov/encryption/kms/key-wrap.pdf.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RFC3394WrapEngine(BlockCipher engine)` Create a RFC 3394 WrapEngine specifying the encrypt for wrapping, decrypt for unwrapping.
    `RFC3394WrapEngine(BlockCipher engine, boolean useReverseDirection)` Create a RFC 3394 WrapEngine specifying the direction for wrapping and unwrapping..

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAlgorithmName()` Return the name of the algorithm the wrapper implements.
    `void` | `init(boolean forWrapping, CipherParameters param)`
    `byte[]` | `unwrap(byte[] in, int inOff, int inLen)`
    `byte[]` | `wrap(byte[] in, int inOff, int inLen)`

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

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

- - ### Constructor Detail

    - #### RFC3394WrapEngine

          public RFC3394WrapEngine(BlockCipher engine)

      Create a RFC 3394 WrapEngine specifying the encrypt for wrapping, decrypt for unwrapping.
      Parameters:
        `engine` - the block cipher to be used for wrapping.

    - #### RFC3394WrapEngine

          public RFC3394WrapEngine(BlockCipher engine,
                                   boolean useReverseDirection)

      Create a RFC 3394 WrapEngine specifying the direction for wrapping and unwrapping..
      Parameters:
        `engine` - the block cipher to be used for wrapping.
        `useReverseDirection` - true if engine should be used in decryption mode for wrapping, false otherwise.

  - ### Method Detail

    - #### init

          public void init(boolean forWrapping,
                           CipherParameters param)

      Specified by:
        `init` in interface `Wrapper`

    - #### getAlgorithmName

          public java.lang.String getAlgorithmName()

      Description copied from interface: `Wrapper`
      Return the name of the algorithm the wrapper implements.
      Specified by:
        `getAlgorithmName` in interface `Wrapper`
      Returns:
        the name of the algorithm the wrapper implements.

    - #### wrap

          public byte[] wrap(byte[] in,
                             int inOff,
                             int inLen)

      Specified by:
        `wrap` in interface `Wrapper`

    - #### unwrap

          public byte[] unwrap(byte[] in,
                               int inOff,
                               int inLen)
                        throws InvalidCipherTextException

      Specified by:
        `unwrap` in interface `Wrapper`
      Throws:
        `InvalidCipherTextException`