JavaTM Platform
Standard Ed. 6

javax.crypto.spec
类 RC5ParameterSpec

java.lang.Object
  继承者 javax.crypto.spec.RC5ParameterSpec
所有已实现的接口:
AlgorithmParameterSpec

public class RC5ParameterSpec
extends Object
implements AlgorithmParameterSpec

此类指定随同 RC5 算法使用的参数。

参数由一个版本号、一个 round 计数、一个 word 大小以及一个任意初始化向量 (IV)(仅用于反馈模式)组成。

可以使用此类来初始化一个实现了 RSA Security Inc. 或 RSA Security 授权的任何参与方所提供的 RC5 算法的 Cipher 对象。

从以下版本开始:
1.4

构造方法摘要
RC5ParameterSpec(int version, int rounds, int wordSize)
          根据给定的版本、round 的数量以及 word 大小(以位为单位)为 RC5 构造一个参数集合。
RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv)
          根据给定的版本、round 的数量、word 大小(以位为单位)以及 IV 为 RC5 构造一个参数集合。
RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv, int offset)
          根据给定的版本、round 的数量、word 大小(以位为单位)以及 IV 为 RC5 构造一个参数集合。
 
方法摘要
 boolean equals(Object obj)
          测试给定对象与此对象的相等性。
 byte[] getIV()
          返回 IV,如果此参数集没有包含 IV 则返回 null。
 int getRounds()
          返回 rounds 的数量。
 int getVersion()
          返回版本。
 int getWordSize()
          返回以位为单位的 word 大小。
 int hashCode()
          计算此对象的哈希码值。
 
从类 java.lang.Object 继承的方法
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

RC5ParameterSpec

public RC5ParameterSpec(int version,
                        int rounds,
                        int wordSize)
根据给定的版本、round 的数量以及 word 大小(以位为单位)为 RC5 构造一个参数集合。

参数:
version - 版本。
rounds - rounds 的数量。
wordSize - 以位为单位的 word 大小。

RC5ParameterSpec

public RC5ParameterSpec(int version,
                        int rounds,
                        int wordSize,
                        byte[] iv)
根据给定的版本、round 的数量、word 大小(以位为单位)以及 IV 为 RC5 构造一个参数集合。

注意,IV 的大小(块大小)必须是 word 大小的两倍。组成 IV 的字节在 iv[0]iv[2*(wordSize/8)-1]] 范围内(包含两者)。

参数:
version - 版本。
rounds - rounds 的数量。
wordSize - 以位为单位的 word 大小。
iv - 具有 IV 的缓冲区。复制该缓冲区的前 2*(wordSize/8) 个字节来防止后续修改。
抛出:
IllegalArgumentException - 如果 ivnull 或者 (iv.length < 2 * (wordSize / 8))

RC5ParameterSpec

public RC5ParameterSpec(int version,
                        int rounds,
                        int wordSize,
                        byte[] iv,
                        int offset)
根据给定的版本、round 的数量、word 大小(以位为单位)以及 IV 为 RC5 构造一个参数集合。

此 IV 取自 iv,始于且包含 offset。注意,始于且包含 offset 的 IV 的大小(块大小)必须是 word 大小的两倍。组成 IV 的字节在 iv[offset]iv[offset+2*(wordSize/8)-1] 范围内(包含两者)。

参数:
version - 版本。
rounds - rounds 的数量。
wordSize - 以位为单位的 word 大小。
iv - 具有 IV 的缓冲区。复制该缓冲区的始于且包含 offset 的前 2*(wordSize/8) 个字节来防止后续修改。
offset - iv 中的偏移量,IV 从此处开始。
抛出:
IllegalArgumentException - 如果 ivnull 或者 (iv.length - offset < 2 * (wordSize / 8))
方法详细信息

getVersion

public int getVersion()
返回版本。

返回:
版本。

getRounds

public int getRounds()
返回 rounds 的数量。

返回:
rounds 的数量。

getWordSize

public int getWordSize()
返回以位为单位的 word 大小。

返回:
以位为单位的 word 大小。

getIV

public byte[] getIV()
返回 IV,如果此参数集没有包含 IV 则返回 null。

返回:
IV,如果此参数集没有包含 IV 则返回 null。每次调用此方法都返回一个新数组。

equals

public boolean equals(Object obj)
测试给定对象与此对象的相等性。如果两个 RC5ParameterSpec 对象的版本号、round 的数量、word 大小以及 IV 相等,则认为这两者相等。(都为 null 的两个 IV 引用视为相等。)

覆盖:
Object 中的 equals
参数:
obj - 要与此对象进行相等性测试的对象。
返回:
如果认为对象相等则返回 true;如果 obj 为 null 或其他情况则返回 false。
另请参见:
Object.hashCode(), Hashtable

hashCode

public int hashCode()
计算此对象的哈希码值。相等的对象也将具有相同的哈希码。

覆盖:
Object 中的 hashCode
返回:
此对象的一个哈希码值。
另请参见:
Object.equals(java.lang.Object), Hashtable

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策