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

pack-priv Class DesEdeWrapEngine

extends Object
implements Wrapper
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.internal.Wrapper
Imports
java.security.SecureRandom, org.bouncycastle.crypto.fips.FipsSHS, .FipsTripleDES, org.bouncycastle.crypto.internal.BlockCipher, .CipherParameters, .Digest, .InvalidCipherTextException, .Wrapper, org.bouncycastle.crypto.internal.modes.CBCBlockCipher, org.bouncycastle.crypto.internal.params.DesParameters, .KeyParameter, .ParametersWithIV, .ParametersWithRandom, org.bouncycastle.util.Arrays

Wrap keys according to RFC 3217.

Note

Field Summary

Modifier and TypeField and Description
pack-priv byte[]
private CBCBlockCipher
engine

Field engine

private boolean
forWrapping

Field forWrapping

private byte[]
iv

Field iv

private static final byte[]
IV2

Field IV2

private KeyParameter
param

Field param

private ParametersWithIV
paramPlusIV

Field paramPlusIV

pack-priv Digest

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private byte[]

Returns:

the CMS checksum.
calculateCMSKeyChecksum
(byte[]
the key to check,
key
)

Some key wrap algorithms make use of the Key Checksum defined in CMS [CMS-Algorithms].

private boolean

Returns:

true if okay, false otherwise.
checkCMSKeyChecksum
(byte[]
key to be validated.
key
,
byte[]
the checksum.
checksum
)

For details see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum

public String

Returns:

the algorithm name "DESede".
getAlgorithmName
()

Implements org.bouncycastle.crypto.internal.Wrapper.getAlgorithmName.

Method getAlgorithmName
public void
init(boolean
true if for wrapping, false otherwise.
forWrapping
,
CipherParameters
necessary parameters, may include KeyParameter, ParametersWithRandom, and ParametersWithIV
param
)

Implements org.bouncycastle.crypto.internal.Wrapper.init.

Method init
private static byte[]
reverse(byte[] bs)

public byte[]

Returns:

the unwrapped bytes.
unwrap
(byte[]
byte array containing the wrapped key.
in
,
int
off set into in that the data starts at.
inOff
,
int
length of the data.
inLen
)

Implements org.bouncycastle.crypto.internal.Wrapper.unwrap.

Method unwrap
public byte[]

Returns:

the wrapped bytes.
wrap
(byte[]
byte array containing the encoded key.
in
,
int
off set into in that the data starts at.
inOff
,
int
length of the data.
inLen
)

Implements org.bouncycastle.crypto.internal.Wrapper.wrap.

Method wrap
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

digestback to summary
pack-priv byte[] digest
engineback to summary
private CBCBlockCipher engine

Field engine

forWrappingback to summary
private boolean forWrapping

Field forWrapping

ivback to summary
private byte[] iv

Field iv

IV2back to summary
private static final byte[] IV2

Field IV2

paramback to summary
private KeyParameter param

Field param

paramPlusIVback to summary
private ParametersWithIV paramPlusIV

Field paramPlusIV

sha1back to summary
pack-priv Digest sha1

Constructor Detail

DesEdeWrapEngineback to summary
pack-priv DesEdeWrapEngine()

Method Detail

calculateCMSKeyChecksumback to summary
private byte[] calculateCMSKeyChecksum(byte[] key)

Some key wrap algorithms make use of the Key Checksum defined in CMS [CMS-Algorithms]. This is used to provide an integrity check value for the key being wrapped. The algorithm is

- Compute the 20 octet SHA-1 hash on the key being wrapped. - Use the first 8 octets of this hash as the checksum value.

For details see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum.

Parameters
key:byte[]

the key to check,

Returns:byte[]

the CMS checksum.

checkCMSKeyChecksumback to summary
private boolean checkCMSKeyChecksum(byte[] key, byte[] checksum)

For details see http://www.w3.org/TR/xmlenc-core/#sec-CMSKeyChecksum

Parameters
key:byte[]

key to be validated.

checksum:byte[]

the checksum.

Returns:boolean

true if okay, false otherwise.

getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.internal.Wrapper.getAlgorithmName.

Method getAlgorithmName

Returns:String

the algorithm name "DESede".

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

Implements org.bouncycastle.crypto.internal.Wrapper.init.

Method init

Parameters
forWrapping:boolean

true if for wrapping, false otherwise.

param:CipherParameters

necessary parameters, may include KeyParameter, ParametersWithRandom, and ParametersWithIV

reverseback to summary
private static byte[] reverse(byte[] bs)
unwrapback to summary
public byte[] unwrap(byte[] in, int inOff, int inLen) throws InvalidCipherTextException

Implements org.bouncycastle.crypto.internal.Wrapper.unwrap.

Method unwrap

Parameters
in:byte[]

byte array containing the wrapped key.

inOff:int

off set into in that the data starts at.

inLen:int

length of the data.

Returns:byte[]

the unwrapped bytes.

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

Implements org.bouncycastle.crypto.internal.Wrapper.wrap.

Method wrap

Parameters
in:byte[]

byte array containing the encoded key.

inOff:int

off set into in that the data starts at.

inLen:int

length of the data.

Returns:byte[]

the wrapped bytes.