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

pack-priv Class RC2WrapEngine

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

Wrap keys according to RFC 3217 - RC2 mechanism

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 CipherParameters
param

Field param

private ParametersWithIV
paramPlusIV

Field paramPlusIV

pack-priv Digest
private SecureRandom

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private byte[]
calculateCMSKeyChecksum(byte[] key)

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

private boolean
checkCMSKeyChecksum(byte[] key, byte[] checksum)

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

public String

Returns:

the algorithm name "RC2".
getAlgorithmName
()

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

Method getAlgorithmName
public void
init(boolean forWrapping, CipherParameters param)

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

Method init
public byte[]

Returns:

the unwrapped bytes.
unwrap
(byte[] in, int inOff, int inLen)

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

Method unwrap
public byte[]

Returns:

the wrapped bytes.
wrap
(byte[] in, int inOff, int 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 CipherParameters param

Field param

paramPlusIVback to summary
private ParametersWithIV paramPlusIV

Field paramPlusIV

sha1back to summary
pack-priv Digest sha1
srback to summary
private SecureRandom sr

Constructor Detail

RC2WrapEngineback to summary
pack-priv RC2WrapEngine()

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

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

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

getAlgorithmNameback to summary
public String getAlgorithmName()

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

Method getAlgorithmName

Returns:String

the algorithm name "RC2".

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

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

Method init

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

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

Method unwrap

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

Returns:byte[]

the wrapped bytes.