Class SP80038FWrapEngine

java.lang.Object
org.bouncycastle.crypto.internal.wrappers.SP80038FWrapEngine
All Implemented Interfaces:
Wrapper

public final class SP80038FWrapEngine extends Object
an implementation of the AES Key Wrapper from the NIST Key Wrap Specification as described in RFC 3394/SP800-38F.

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

  • Field Details

    • ivKW

      protected static final byte[] ivKW
    • ivKWP

      protected static final byte[] ivKWP
    • wrapCipherMode

      protected final boolean wrapCipherMode
    • engine

      protected final BlockCipher engine
    • delta

      protected final int delta
    • iv

      protected final byte[] iv
    • param

      protected KeyParameter param
    • forWrapping

      protected boolean forWrapping
  • Constructor Details

    • SP80038FWrapEngine

      public SP80038FWrapEngine(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 Details

    • getAlgorithmName

      public String getAlgorithmName()
      Description copied from interface: Wrapper
      Return the name of the algorithm the wrapper implements.
      Returns:
      the name of the algorithm the wrapper implements.
    • wrap

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

      public byte[] unwrap(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
      Throws:
      InvalidCipherTextException
    • init

      public void init(boolean forWrapping, CipherParameters param)
      Specified by:
      init in interface Wrapper
    • W

      protected byte[] W(int n, byte[] block)
    • invW

      protected void invW(int n, byte[] block, byte[] a)