KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > crypto > spec > RC5ParameterSpec


1 /*
2  * @(#)RC5ParameterSpec.java 1.8 04/06/03
3  *
4  * Copyright (c) 2004 Sun Microsystems, Inc. All Rights Reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7   
8 /*
9  * NOTE:
10  * Because of various external restrictions (i.e. US export
11  * regulations, etc.), the actual source code can not be provided
12  * at this time. This file represents the skeleton of the source
13  * file, so that javadocs of the API can be created.
14  */

15
16 package javax.crypto.spec;
17
18 import java.security.spec.AlgorithmParameterSpec;
19
20 /**
21  * This class specifies the parameters used with the
22  * <a HREF="http://www.ietf.org/rfc/rfc2040.txt"><i>RC5</i></a>
23  * algorithm.
24  *
25  * <p> The parameters consist of a version number, a rounds count, a word
26  * size, and optionally an initialization vector (IV) (only in feedback mode).
27  *
28  * <p> This class can be used to initialize a <code>Cipher</code> object that
29  * implements the <i>RC5</i> algorithm as supplied by
30  * <a HREF="http://www.rsasecurity.com">RSA Security Inc.</a>,
31  * or any parties authorized by RSA Security.
32  *
33  * @author Jan Luehe
34  *
35  * @version 1.16, 06/03/04
36  * @since 1.4
37  */

38 public class RC5ParameterSpec implements AlgorithmParameterSpec
39 {
40
41     /**
42      * Constructs a parameter set for RC5 from the given version, number of
43      * rounds and word size (in bits).
44      *
45      * @param version the version.
46      * @param rounds the number of rounds.
47      * @param wordSize the word size in bits.
48      */

49     public RC5ParameterSpec(int version, int rounds, int wordSize) { }
50
51     /**
52      * Constructs a parameter set for RC5 from the given version, number of
53      * rounds, word size (in bits), and IV.
54      *
55      * <p> Note that the size of the IV (block size) must be twice the word
56      * size. The bytes that constitute the IV are those between
57      * <code>iv[0]</code> and <code>iv[2*(wordSize/8)-1]</code> inclusive.
58      *
59      * @param version the version.
60      * @param rounds the number of rounds.
61      * @param wordSize the word size in bits.
62      * @param iv the buffer with the IV. The first <code>2*(wordSize/8)
63      * </code> bytes of the buffer are copied to protect against subsequent
64      * modification.
65      * @exception IllegalArgumentException if <code>iv</code> is
66      * <code>null</code> or <code>(iv.length < 2 * (wordSize / 8))</code>
67      */

68     public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv)
69     { }
70
71     /**
72      * Constructs a parameter set for RC5 from the given version, number of
73      * rounds, word size (in bits), and IV.
74      *
75      * <p> The IV is taken from <code>iv</code>, starting at
76      * <code>offset</code> inclusive.
77      * Note that the size of the IV (block size), starting at
78      * <code>offset</code> inclusive, must be twice the word size.
79      * The bytes that constitute the IV are those between
80      * <code>iv[offset]</code> and <code>iv[offset+2*(wordSize/8)-1]</code>
81      * inclusive.
82      *
83      * @param version the version.
84      * @param rounds the number of rounds.
85      * @param wordSize the word size in bits.
86      * @param iv the buffer with the IV. The first <code>2*(wordSize/8)
87      * </code> bytes of the buffer beginning at <code>offset</code>
88      * inclusive are copied to protect against subsequent modification.
89      * @param offset the offset in <code>iv</code> where the IV starts.
90      * @exception IllegalArgumentException if <code>iv</code> is
91      * <code>null</code> or
92      * <code>(iv.length - offset < 2 * (wordSize / 8))</code>
93      */

94     public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv,
95         int offset)
96     { }
97
98     /**
99      * Returns the version.
100      *
101      * @return the version.
102      */

103     public int getVersion() {
104         return 0;
105     }
106
107     /**
108      * Returns the number of rounds.
109      *
110      * @return the number of rounds.
111      */

112     public int getRounds() {
113         return 0;
114     }
115
116     /**
117      * Returns the word size in bits.
118      *
119      * @return the word size in bits.
120      */

121     public int getWordSize() {
122         return 0;
123     }
124
125     /**
126      * Returns the IV or null if this parameter set does not contain an IV.
127      *
128      * @return the IV or null if this parameter set does not contain an IV.
129      * Returns a new array each time this method is called.
130      */

131     public byte[] getIV() {
132         return null;
133     }
134
135     /**
136      * Tests for equality between the specified object and this
137      * object. Two RC5ParameterSpec objects are considered equal if their
138      * version numbers, number of rounds, word sizes, and IVs are equal.
139      * (Two IV references are considered equal if both are <tt>null</tt>.)
140      *
141      * @param obj the object to test for equality with this object.
142      *
143      * @return true if the objects are considered equal, false if
144      * <code>obj</code> is null or otherwise.
145      */

146     public boolean equals(Object obj) {
147         return false;
148     }
149
150     /**
151      * Calculates a hash code value for the object.
152      * Objects that are equal will also have the same hashcode.
153      */

154     public int hashCode() {
155         return 0;
156     }
157 }
158
Popular Tags