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

public final Class RC2

extends Object
Class Inheritance
Imports
java.security.SecureRandom, org.bouncycastle.crypto.Algorithm, .IllegalKeyException, .ParametersWithIV, .SymmetricKey, .SymmetricSecretKey, org.bouncycastle.crypto.internal.BlockCipher, .BufferedBlockCipher, .KeyGenerationParameters, .Mac, .ValidatedSymmetricKey, .Wrapper, org.bouncycastle.crypto.internal.modes.AEADBlockCipher, org.bouncycastle.crypto.internal.params.KeyParameter, .KeyParameterImpl, org.bouncycastle.util.Arrays, org.bouncycastle.util.encoders.Hex

Source class for implementations of RC2 based algorithms.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
RC2.AEADOperatorFactory

Factory for RC2 AEAD encryption/decryption operators.

public static class
RC2.AuthParameters

Parameters for RC2 AEAD and MAC modes.

private static class
public static class
RC2.KeyGenerator

RC2 key generator.

public static class
RC2.KeyWrapOperatorFactory

Factory for RC2 key wrap/unwrap operators.

public static class
RC2.MACOperatorFactory

Factory for producing RC2 MAC calculators.

public static class
RC2.OperatorFactory

Factory for basic RC2 encryption/decryption operators.

public static class
RC2.Parameters

Parameters for general RC2 block cipher modes.

Field Summary

Modifier and TypeField and Description
public static final GeneralAlgorithm
ALGORITHM

Raw RC2 algorithm, can be used for creating general purpose RC2 keys.

public static final RC2.Parameters
CBC

RC2 in cipher block chaining (CBC) mode.

public static final RC2.AuthParameters
CBC_MAC

RC2 cipher-based CBC MAC algorithm.

public static final RC2.Parameters
CBCwithCS1

RC2 in cipher block chaining mode cipher text stealing type 1.

public static final RC2.Parameters
CBCwithCS2

RC2 in cipher block chaining mode cipher text stealing type 2.

public static final RC2.Parameters
CBCwithCS3

RC2 in cipher block chaining mode cipher text stealing type 3.

public static final RC2.Parameters
CBCwithISO10126_2

RC2 in cipher block chaining mode with ISO10126-2 padding.

public static final RC2.Parameters
CBCwithISO7816_4

RC2 in cipher block chaining mode with ISO7816-4 padding.

public static final RC2.Parameters
CBCwithPKCS7

RC2 in cipher block chaining mode with PKCS#7/PKCS#5 padding.

public static final RC2.Parameters
CBCwithTBC

RC2 in cipher block chaining mode with trailing bit complement (TBC) padding.

public static final RC2.Parameters
CBCwithX923

RC2 in cipher block chaining mode with X9.23 padding.

public static final RC2.Parameters
CFB64

RC2 in cipher feedback (CFB) mode, 64 bit block size.

public static final RC2.Parameters
CFB8

RC2 in cipher feedback (CFB) mode, 8 bit block size.

public static final RC2.AuthParameters
CFB8_MAC

RC2 CFB8MAC.

public static final RC2.AuthParameters
CMAC

RC2 cipher-based MAC algorithm.

public static final RC2.Parameters
CTR

RC2 in counter (CTR) mode.

public static final RC2.AuthParameters
EAX

RC2 in EAX mode.

public static final RC2.Parameters
ECB

RC2 in electronic code book (ECB) mode.

public static final RC2.Parameters
ECBwithISO10126_2

RC2 in electronic code book mode with ISO10126-2 padding.

public static final RC2.Parameters
ECBwithISO7816_4

RC2 in electronic code book mode with ISO7816-4 padding.

public static final RC2.Parameters
ECBwithPKCS7

RC2 in electronic code book mode with PKCS#7/PKCS#5 padding.

public static final RC2.Parameters
ECBwithTBC

RC2 in electronic code book mode with trailing bit complement (TBC) padding.

public static final RC2.Parameters
ECBwithX923

RC2 in electronic code book mode with X9.23 padding.

private static final RC2.EngineProvider
public static final RC2.Parameters
OFB

RC2 in output feedback (OFB) mode, 64 bit block size.

public static final RC2.Parameters
RFC3217_WRAP

RC2 RFC 3217 key wrapper.

Constructor Summary

AccessConstructor and Description
private
RC2()

Method Summary

Modifier and TypeMethod and Description
private static KeyParameter
createRC2Parameters(SymmetricKey key, Algorithm algorithm, int effKeySizeInBits)

private static boolean
invalidKeySize(int keyLength)

private static ValidatedSymmetricKey
validateKey(SymmetricKey key, Algorithm paramAlgorithm)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALGORITHMback to summary
public static final GeneralAlgorithm ALGORITHM

Raw RC2 algorithm, can be used for creating general purpose RC2 keys.

CBCback to summary
public static final RC2.Parameters CBC

RC2 in cipher block chaining (CBC) mode.

CBC_MACback to summary
public static final RC2.AuthParameters CBC_MAC

RC2 cipher-based CBC MAC algorithm.

CBCwithCS1back to summary
public static final RC2.Parameters CBCwithCS1

RC2 in cipher block chaining mode cipher text stealing type 1.

CBCwithCS2back to summary
public static final RC2.Parameters CBCwithCS2

RC2 in cipher block chaining mode cipher text stealing type 2.

CBCwithCS3back to summary
public static final RC2.Parameters CBCwithCS3

RC2 in cipher block chaining mode cipher text stealing type 3.

CBCwithISO10126_2back to summary
public static final RC2.Parameters CBCwithISO10126_2

RC2 in cipher block chaining mode with ISO10126-2 padding.

CBCwithISO7816_4back to summary
public static final RC2.Parameters CBCwithISO7816_4

RC2 in cipher block chaining mode with ISO7816-4 padding.

CBCwithPKCS7back to summary
public static final RC2.Parameters CBCwithPKCS7

RC2 in cipher block chaining mode with PKCS#7/PKCS#5 padding.

CBCwithTBCback to summary
public static final RC2.Parameters CBCwithTBC

RC2 in cipher block chaining mode with trailing bit complement (TBC) padding.

CBCwithX923back to summary
public static final RC2.Parameters CBCwithX923

RC2 in cipher block chaining mode with X9.23 padding.

CFB64back to summary
public static final RC2.Parameters CFB64

RC2 in cipher feedback (CFB) mode, 64 bit block size.

CFB8back to summary
public static final RC2.Parameters CFB8

RC2 in cipher feedback (CFB) mode, 8 bit block size.

CFB8_MACback to summary
public static final RC2.AuthParameters CFB8_MAC

RC2 CFB8MAC.

CMACback to summary
public static final RC2.AuthParameters CMAC

RC2 cipher-based MAC algorithm.

CTRback to summary
public static final RC2.Parameters CTR

RC2 in counter (CTR) mode.

EAXback to summary
public static final RC2.AuthParameters EAX

RC2 in EAX mode.

ECBback to summary
public static final RC2.Parameters ECB

RC2 in electronic code book (ECB) mode.

ECBwithISO10126_2back to summary
public static final RC2.Parameters ECBwithISO10126_2

RC2 in electronic code book mode with ISO10126-2 padding.

ECBwithISO7816_4back to summary
public static final RC2.Parameters ECBwithISO7816_4

RC2 in electronic code book mode with ISO7816-4 padding.

ECBwithPKCS7back to summary
public static final RC2.Parameters ECBwithPKCS7

RC2 in electronic code book mode with PKCS#7/PKCS#5 padding.

ECBwithTBCback to summary
public static final RC2.Parameters ECBwithTBC

RC2 in electronic code book mode with trailing bit complement (TBC) padding.

ECBwithX923back to summary
public static final RC2.Parameters ECBwithX923

RC2 in electronic code book mode with X9.23 padding.

ENGINE_PROVIDERback to summary
private static final RC2.EngineProvider ENGINE_PROVIDER
OFBback to summary
public static final RC2.Parameters OFB

RC2 in output feedback (OFB) mode, 64 bit block size.

RFC3217_WRAPback to summary
public static final RC2.Parameters RFC3217_WRAP

RC2 RFC 3217 key wrapper.

Constructor Detail

RC2back to summary
private RC2()

Method Detail

createRC2Parametersback to summary
private static KeyParameter createRC2Parameters(SymmetricKey key, Algorithm algorithm, int effKeySizeInBits)
invalidKeySizeback to summary
private static boolean invalidKeySize(int keyLength)
validateKeyback to summary
private static ValidatedSymmetricKey validateKey(SymmetricKey key, Algorithm paramAlgorithm)
org.bouncycastle.crypto.general back to summary

public final Class RC2.AEADOperatorFactory

extends GuardedAEADOperatorFactory<RC2.AuthParameters>
Class Inheritance

Factory for RC2 AEAD encryption/decryption operators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected AEADBlockCipher
Inherited from org.bouncycastle.crypto.general.GuardedAEADOperatorFactory:
createInputAEADDecryptorcreateOutputAEADDecryptorcreateOutputAEADEncryptor

Constructor Detail

AEADOperatorFactoryback to summary
public AEADOperatorFactory()

Method Detail

createAEADCipherback to summary
protected AEADBlockCipher createAEADCipher(boolean forEncryption, SymmetricKey key, RC2.AuthParameters parameters)

Implements abstract org.bouncycastle.crypto.general.GuardedAEADOperatorFactory.createAEADCipher.

Annotations
@Override
org.bouncycastle.crypto.general back to summary

public final Class RC2.AuthParameters

extends GeneralAuthParameters<RC2.AuthParameters>
Class Inheritance

Parameters for RC2 AEAD and MAC modes.

Field Summary

Modifier and TypeField and Description
private final int
Inherited from org.bouncycastle.crypto.general.GeneralAuthParameters:
macLenInBits

Constructor Summary

AccessConstructor and Description
private
AuthParameters(GeneralAlgorithm algorithm, int effectiveKeySizeInBits, byte[] iv, int tagLenInBits)

pack-priv
AuthParameters(GeneralAlgorithm
algorithm mode.
algorithm
)

Base constructor - the algorithm, null IV.

Method Summary

Modifier and TypeMethod and Description
protected RC2.AuthParameters
create(GeneralAlgorithm algorithm, byte[] iv, int macSizeInBits)

Implements abstract org.bouncycastle.crypto.general.GeneralAuthParameters.create.

public int
public RC2.AuthParameters
withEffectiveKeySizeInBits(int effectiveKeySizeInBits)

Inherited from org.bouncycastle.crypto.general.GeneralAuthParameters:
creategetMACSizeInBitswithIVwithMACSize

Field Detail

effectiveKeySizeInBitsback to summary
private final int effectiveKeySizeInBits

Constructor Detail

AuthParametersback to summary
private AuthParameters(GeneralAlgorithm algorithm, int effectiveKeySizeInBits, byte[] iv, int tagLenInBits)
AuthParametersback to summary
pack-priv AuthParameters(GeneralAlgorithm algorithm)

Base constructor - the algorithm, null IV. In this case the tag length defaults to the 64 for CMAC, 32 bits otherwise.

Parameters
algorithm:GeneralAlgorithm

algorithm mode.

Method Detail

createback to summary
protected RC2.AuthParameters create(GeneralAlgorithm algorithm, byte[] iv, int macSizeInBits)

Implements abstract org.bouncycastle.crypto.general.GeneralAuthParameters.create.

getEffectiveKeySizeInBitsback to summary
public int getEffectiveKeySizeInBits()
withEffectiveKeySizeInBitsback to summary
public RC2.AuthParameters withEffectiveKeySizeInBits(int effectiveKeySizeInBits)
org.bouncycastle.crypto.general back to summary

private final Class RC2.EngineProvider

extends Object
implements EngineProvider<BlockCipher>
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.internal.EngineProvider

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public BlockCipher
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EngineProviderback to summary
private EngineProvider()

Method Detail

createEngineback to summary
public BlockCipher createEngine()

Implements org.bouncycastle.crypto.internal.EngineProvider.createEngine.

org.bouncycastle.crypto.general back to summary

public final Class RC2.KeyGenerator

extends GuardedSymmetricKeyGenerator
Class Inheritance

RC2 key generator.

Field Summary

Modifier and TypeField and Description
private final GeneralAlgorithm
private final int
private final SecureRandom

Constructor Summary

AccessConstructor and Description
public
KeyGenerator(int keySizeInBits, SecureRandom random)

public
KeyGenerator(GeneralParameters<T extends Algorithm> parameterSet, int keySizeInBits, SecureRandom random)

private
KeyGenerator(GeneralAlgorithm algorithm, int keySizeInBits, SecureRandom random)

Method Summary

Modifier and TypeMethod and Description
public SymmetricKey
Inherited from org.bouncycastle.crypto.general.GuardedSymmetricKeyGenerator:
generateKey

Field Detail

algorithmback to summary
private final GeneralAlgorithm algorithm
keySizeInBitsback to summary
private final int keySizeInBits
randomback to summary
private final SecureRandom random

Constructor Detail

KeyGeneratorback to summary
public KeyGenerator(int keySizeInBits, SecureRandom random)
KeyGeneratorback to summary
public KeyGenerator(GeneralParameters<T extends Algorithm> parameterSet, int keySizeInBits, SecureRandom random)
KeyGeneratorback to summary
private KeyGenerator(GeneralAlgorithm algorithm, int keySizeInBits, SecureRandom random)

Method Detail

doGenerateKeyback to summary
public SymmetricKey doGenerateKey()

Implements abstract org.bouncycastle.crypto.general.GuardedSymmetricKeyGenerator.doGenerateKey.

org.bouncycastle.crypto.general back to summary

public final Class RC2.KeyWrapOperatorFactory

extends GuardedKeyWrapOperatorFactory<RC2.Parameters, SymmetricKey>
Class Inheritance

Factory for RC2 key wrap/unwrap operators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Wrapper
Inherited from org.bouncycastle.crypto.general.GuardedKeyWrapOperatorFactory:
createKeyUnwrappercreateKeyWrapper

Constructor Detail

KeyWrapOperatorFactoryback to summary
public KeyWrapOperatorFactory()

Method Detail

createWrapperback to summary
protected Wrapper createWrapper(boolean forWrapping, SymmetricKey key, RC2.Parameters parameters, SecureRandom random)

Implements abstract org.bouncycastle.crypto.general.GuardedKeyWrapOperatorFactory.createWrapper.

org.bouncycastle.crypto.general back to summary

public final Class RC2.MACOperatorFactory

extends GuardedMACOperatorFactory<RC2.AuthParameters>
Class Inheritance

Factory for producing RC2 MAC calculators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
protected Mac
Inherited from org.bouncycastle.crypto.general.GuardedMACOperatorFactory:
createOutputMACCalculator

Constructor Detail

MACOperatorFactoryback to summary
public MACOperatorFactory()

Method Detail

calculateMACSizeback to summary
protected int calculateMACSize(RC2.AuthParameters parameters)

Implements abstract org.bouncycastle.crypto.general.GuardedMACOperatorFactory.calculateMACSize.

Annotations
@Override
createMACback to summary
protected Mac createMAC(SymmetricKey key, final RC2.AuthParameters parameters)

Implements abstract org.bouncycastle.crypto.general.GuardedMACOperatorFactory.createMAC.

Annotations
@Override
org.bouncycastle.crypto.general back to summary

public final Class RC2.OperatorFactory

extends GuardedSymmetricOperatorFactory<RC2.Parameters>
Class Inheritance

Factory for basic RC2 encryption/decryption operators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected BufferedBlockCipher
Inherited from org.bouncycastle.crypto.general.GuardedSymmetricOperatorFactory:
createInputDecryptorcreateOutputDecryptorcreateOutputEncryptor

Constructor Detail

OperatorFactoryback to summary
public OperatorFactory()

Method Detail

createCipherback to summary
protected BufferedBlockCipher createCipher(boolean forEncryption, SymmetricKey key, RC2.Parameters parameters, SecureRandom random)

Implements abstract org.bouncycastle.crypto.general.GuardedSymmetricOperatorFactory.createCipher.

Annotations
@Override
org.bouncycastle.crypto.general back to summary

public final Class RC2.Parameters

extends GeneralParameters<GeneralAlgorithm>
implements ParametersWithIV
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.ParametersWithIV, org.bouncycastle.crypto.Parameters

Parameters for general RC2 block cipher modes.

Field Summary

Modifier and TypeField and Description
private final int
private final byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
private
Parameters(GeneralAlgorithm algorithm, int effectiveKeySizeInBits, byte[] iv)

Method Summary

Modifier and TypeMethod and Description
public int
public byte[]
getIV()

Implements org.bouncycastle.crypto.ParametersWithIV.getIV.

Return the initialization vector associated with this parameter set.
public RC2.Parameters
withEffectiveKeySizeInBits(int effectiveKeySizeInBits)

public RC2.Parameters
withIV(byte[]
the IV to use.
iv
)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV.
public RC2.Parameters
withIV(SecureRandom
the SecureRandom to use as the source of IV data.
random
)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV based on the output of the passed in random.
Inherited from org.bouncycastle.crypto.general.GeneralParameters:
getAlgorithm

Field Detail

effectiveKeySizeInBitsback to summary
private final int effectiveKeySizeInBits
ivback to summary
private final byte[] iv

Constructor Detail

Parametersback to summary
pack-priv Parameters(GeneralAlgorithm algorithm)
Parametersback to summary
private Parameters(GeneralAlgorithm algorithm, int effectiveKeySizeInBits, byte[] iv)

Method Detail

getEffectiveKeySizeInBitsback to summary
public int getEffectiveKeySizeInBits()
getIVback to summary
public byte[] getIV()

Implements org.bouncycastle.crypto.ParametersWithIV.getIV.

Doc from org.bouncycastle.crypto.ParametersWithIV.getIV.

Return the initialization vector associated with this parameter set.

Returns:byte[]

the IV for these parameters.

withEffectiveKeySizeInBitsback to summary
public RC2.Parameters withEffectiveKeySizeInBits(int effectiveKeySizeInBits)
withIVback to summary
public RC2.Parameters withIV(byte[] iv)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Doc from org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV.

Parameters
iv:byte[]

the IV to use.

Returns:RC2.Parameters

a copy of the current parameter set with the new IV.

withIVback to summary
public RC2.Parameters withIV(SecureRandom random)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Doc from org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV based on the output of the passed in random.

Parameters
random:SecureRandom

the SecureRandom to use as the source of IV data.

Returns:RC2.Parameters

a copy of the current parameter set with the new IV.