Top Description Fields Constructors Methods
org.bouncycastle.crypto.engines

public Class RFC5649WrapEngine

extends Object
implements Wrapper
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.Wrapper
Known Direct Subclasses
org.bouncycastle.crypto.engines.AESWrapPadEngine, org.bouncycastle.crypto.engines.ARIAWrapPadEngine
Imports
org.bouncycastle.crypto.BlockCipher, .CipherParameters, .InvalidCipherTextException, .Wrapper, org.bouncycastle.crypto.params.KeyParameter, .ParametersWithIV, .ParametersWithRandom, org.bouncycastle.util.Arrays, .Pack

An implementation of the AES Key Wrap with Padding specification as described in RFC 5649.

For details on the specification see: https://tools.ietf.org/html/rfc5649

Field Summary

Modifier and TypeField and Description
private static final byte[]
private final BlockCipher
private boolean
private KeyParameter
private final byte[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
getAlgorithmName()

Implements org.bouncycastle.crypto.Wrapper.getAlgorithmName.

Return the name of the algorithm the wrapper implements.

public void
init(boolean forWrapping, CipherParameters param)

Implements org.bouncycastle.crypto.Wrapper.init.

private byte[]

Returns:

The padded key.
padPlaintext
(byte[]
The key being wrapped.
plaintext
)

Pads the plaintext (i.e., the key to be wrapped) as per section 4.1 of RFC 5649.

private byte[]

Returns:

Unwrapped data.
rfc3394UnwrapNoIvCheck
(byte[] in, int inOff, int inLen, byte[] extractedAIV)

Performs steps 1 and 2 of the unwrap process defined in RFC 3394.

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

Implements org.bouncycastle.crypto.Wrapper.unwrap.

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

Implements org.bouncycastle.crypto.Wrapper.wrap.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_IVback to summary
private static final byte[] DEFAULT_IV
engineback to summary
private final BlockCipher engine
forWrappingback to summary
private boolean forWrapping
paramback to summary
private KeyParameter param
preIVback to summary
private final byte[] preIV

Constructor Detail

RFC5649WrapEngineback to summary
public RFC5649WrapEngine(BlockCipher engine)

Method Detail

getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.Wrapper.getAlgorithmName.

Doc from org.bouncycastle.crypto.Wrapper.getAlgorithmName.

Return the name of the algorithm the wrapper implements.

Returns:String

the name of the algorithm the wrapper implements.

initback to summary
public void init(boolean forWrapping, CipherParameters param)

Implements org.bouncycastle.crypto.Wrapper.init.

padPlaintextback to summary
private byte[] padPlaintext(byte[] plaintext)

Pads the plaintext (i.e., the key to be wrapped) as per section 4.1 of RFC 5649.

Parameters
plaintext:byte[]

The key being wrapped.

Returns:byte[]

The padded key.

rfc3394UnwrapNoIvCheckback to summary
private byte[] rfc3394UnwrapNoIvCheck(byte[] in, int inOff, int inLen, byte[] extractedAIV)

Performs steps 1 and 2 of the unwrap process defined in RFC 3394. This code is duplicated from RFC3394WrapEngine because that class will throw an error during unwrap because the IV won't match up.

Returns:byte[]

Unwrapped data.

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

Implements org.bouncycastle.crypto.Wrapper.unwrap.

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

Implements org.bouncycastle.crypto.Wrapper.wrap.