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

org.bouncycastle.crypto.engines

## Class RC2WrapEngine

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

- All Implemented Interfaces:
    Wrapper

      public class RC2WrapEngine
      extends java.lang.Object
      implements Wrapper

  Wrap keys according to RFC 3217 - RC2 mechanism

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RC2WrapEngine()`

  - ### Method Summary

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

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

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

- - ### Constructor Detail

    - #### RC2WrapEngine

          public RC2WrapEngine()

  - ### Method Detail

    - #### init

          public void init(boolean forWrapping,
                           CipherParameters param)

      Method init
      Specified by:
        `init` in interface `Wrapper`
      Parameters:
        `forWrapping` - true if for wrapping, false for unwrap.
        `param` - parameters for wrap/unwrapping (iv required for unwrap).

    - #### getAlgorithmName

          public java.lang.String getAlgorithmName()

      Method getAlgorithmName
      Specified by:
        `getAlgorithmName` in interface `Wrapper`
      Returns:
        the algorithm name "RC2".

    - #### wrap

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

      Method wrap
      Specified by:
        `wrap` in interface `Wrapper`
      Parameters:
        `in` - byte array containing the key.
        `inOff` - offset into in array that the key data starts at.
        `inLen` - length of key data.
      Returns:
        the wrapped bytes.

    - #### unwrap

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

      Method unwrap
      Specified by:
        `unwrap` in interface `Wrapper`
      Parameters:
        `in` - byte array containing the wrapped key.
        `inOff` - offset into in array that the wrapped key starts at.
        `inLen` - length of wrapped key data.
      Returns:
        the unwrapped bytes.
      Throws:
        `InvalidCipherTextException`