Package javax.crypto.spec
Class RC2ParameterSpec
java.lang.Object
javax.crypto.spec.RC2ParameterSpec
- All Implemented Interfaces:
AlgorithmParameterSpec
public class RC2ParameterSpec extends Object implements AlgorithmParameterSpec
The algorithm parameter specification for the RC2 algorithm.
-
Constructor Summary
Constructors Constructor Description RC2ParameterSpec(int effectiveKeyBits)Creates a newRC2ParameterSpecinstance with the specified effective key length (in bits),RC2ParameterSpec(int effectiveKeyBits, byte[] iv)Creates a newRC2ParameterSpecinstance with the specified effective key length (in bits) and initialization vector.RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset)Creates a newRC2ParameterSpecinstance with the specified effective key length (in bits) and initialization vector. -
Method Summary
Modifier and Type Method Description booleanequals(Object obj)Compares the specified object to thisRC2ParameterSpecinstance.intgetEffectiveKeyBits()Returns the effective key length (in bits).byte[]getIV()Returns a copy of the initialization vector.inthashCode()Returns the hash code of thisRC2ParameterSpecinstance.
-
Constructor Details
-
RC2ParameterSpec
public RC2ParameterSpec(int effectiveKeyBits)Creates a newRC2ParameterSpecinstance with the specified effective key length (in bits),- Parameters:
effectiveKeyBits- the effective key length (in bits).
-
RC2ParameterSpec
public RC2ParameterSpec(int effectiveKeyBits, byte[] iv)Creates a newRC2ParameterSpecinstance with the specified effective key length (in bits) and initialization vector.The size of the initialization vector must be at least 8 bytes which are copied to protect them against modification.
- Parameters:
effectiveKeyBits- the effective key length (in bits).iv- the initialization vector.- Throws:
IllegalArgumentException- if the initialization vector is null or shorter than 8 bytes.
-
RC2ParameterSpec
public RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset)Creates a newRC2ParameterSpecinstance with the specified effective key length (in bits) and initialization vector.The size of the initialization vector starting at
offsetmust be at least 8 bytes which are copied to protect them against modification.- Parameters:
effectiveKeyBits- the effective key length (in bits).iv- the initialization vector.offset- the offset in the initialization vector to start at.- Throws:
IllegalArgumentException- if the initialization vector is null or starting atoffsetis shorter than 8 bytes.
-
-
Method Details
-
getEffectiveKeyBits
public int getEffectiveKeyBits()Returns the effective key length (in bits).- Returns:
- the effective key length (in bits).
-
getIV
public byte[] getIV()Returns a copy of the initialization vector.- Returns:
- a copy of the initialization vector, or null if none specified.
-
equals
Compares the specified object to thisRC2ParameterSpecinstance.- Overrides:
equalsin classObject- Parameters:
obj- the object to compare.- Returns:
- true if the effective key length and the initialization vector of both objects are equal, otherwise false.
- See Also:
Object.hashCode()
-
hashCode
public int hashCode()Returns the hash code of thisRC2ParameterSpecinstance.- Overrides:
hashCodein classObject- Returns:
- the hash code.
- See Also:
Object.equals(java.lang.Object)
-