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 new RC2ParameterSpec instance with the specified effective key length (in bits),
    RC2ParameterSpec​(int effectiveKeyBits, byte[] iv)
    Creates a new RC2ParameterSpec instance with the specified effective key length (in bits) and initialization vector.
    RC2ParameterSpec​(int effectiveKeyBits, byte[] iv, int offset)
    Creates a new RC2ParameterSpec instance with the specified effective key length (in bits) and initialization vector.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(Object obj)
    Compares the specified object to this RC2ParameterSpec instance.
    int getEffectiveKeyBits()
    Returns the effective key length (in bits).
    byte[] getIV()
    Returns a copy of the initialization vector.
    int hashCode()
    Returns the hash code of this RC2ParameterSpec instance.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RC2ParameterSpec

      public RC2ParameterSpec​(int effectiveKeyBits)
      Creates a new RC2ParameterSpec instance 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 new RC2ParameterSpec instance 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 new RC2ParameterSpec instance with the specified effective key length (in bits) and initialization vector.

      The size of the initialization vector starting at offset 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.
      offset - the offset in the initialization vector to start at.
      Throws:
      IllegalArgumentException - if the initialization vector is null or starting at offset is 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

      public boolean equals​(Object obj)
      Compares the specified object to this RC2ParameterSpec instance.
      Overrides:
      equals in class Object
      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 this RC2ParameterSpec instance.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code.
      See Also:
      Object.equals(java.lang.Object)