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

public Class RC2WrapEngine

extends Object
implements Wrapper
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.Wrapper
Imports
java.security.SecureRandom, org.bouncycastle.crypto.CipherParameters, .CryptoServicesRegistrar, .Digest, .InvalidCipherTextException, .Wrapper, org.bouncycastle.crypto.modes.CBCBlockCipher, org.bouncycastle.crypto.params.ParametersWithIV, .ParametersWithRandom, org.bouncycastle.crypto.util.DigestFactory, 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
public

Method Summary

Modifier and TypeMethod and Description
private byte[]
private boolean
checkCMSKeyChecksum(byte[] key, byte[] checksum)

public String

Returns:

the algorithm name "RC2".
getAlgorithmName
()

Implements org.bouncycastle.crypto.Wrapper.getAlgorithmName.

Method getAlgorithmName

public void
init(boolean
true if for wrapping, false for unwrap.
forWrapping
,
CipherParameters
parameters for wrap/unwrapping (iv required for unwrap).
param
)

Implements org.bouncycastle.crypto.Wrapper.init.

Method init

public byte[]

Returns:

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

Implements org.bouncycastle.crypto.Wrapper.unwrap.

Method unwrap

public byte[]

Returns:

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

Implements org.bouncycastle.crypto.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
public RC2WrapEngine()

Method Detail

calculateCMSKeyChecksumback to summary
private byte[] calculateCMSKeyChecksum(byte[] key)
checkCMSKeyChecksumback to summary
private boolean checkCMSKeyChecksum(byte[] key, byte[] checksum)
getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.Wrapper.getAlgorithmName.

Method getAlgorithmName

Returns:String

the algorithm name "RC2".

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

Implements org.bouncycastle.crypto.Wrapper.init.

Method init

Parameters
forWrapping:boolean

true if for wrapping, false for unwrap.

param:CipherParameters

parameters for wrap/unwrapping (iv required for unwrap).

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

Implements org.bouncycastle.crypto.Wrapper.unwrap.

Method unwrap

Parameters
in:byte[]

byte array containing the wrapped key.

inOff:int

offset into in array that the wrapped key starts at.

inLen:int

length of wrapped key data.

Returns:byte[]

the unwrapped bytes.

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

Implements org.bouncycastle.crypto.Wrapper.wrap.

Method wrap

Parameters
in:byte[]

byte array containing the key.

inOff:int

offset into in array that the key data starts at.

inLen:int

length of key data.

Returns:byte[]

the wrapped bytes.