DESedeWrapEngine (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.crypto.engines

## Class DESedeWrapEngine

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

- All Implemented Interfaces:
    Wrapper

      public class DESedeWrapEngine
      extends java.lang.Object
      implements Wrapper

  Wrap keys according to draft-ietf-smime-key-wrap-01.txt.

  Note:

  - this is based on a draft, and as such is subject to change - don't use this class for anything requiring long term storage.
  - if you are using this to wrap triple-des keys you need to set the parity bits on the key and, if it's a two-key triple-des key, pad it yourself.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DESedeWrapEngine()`

  - ### Method Summary

    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

    - #### DESedeWrapEngine

          public DESedeWrapEngine()

  - ### 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 otherwise.
        `param` - necessary parameters, may include KeyParameter, ParametersWithRandom, and ParametersWithIV

    - #### getAlgorithmName

          public java.lang.String getAlgorithmName()

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

    - #### wrap

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

      Method wrap
      Specified by:
        `wrap` in interface `Wrapper`
      Parameters:
        `in` - byte array containing the encoded key.
        `inOff` - off set into in that the data starts at.
        `inLen` - length of the 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` - off set into in that the data starts at.
        `inLen` - length of the data.
      Returns:
        the unwrapped bytes.
      Throws:
        `InvalidCipherTextException`