KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)RC2ParameterSpec.java 1.7 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/rfc2268.txt"><i>RC2</i></a>
23  * algorithm.
24  *
25  * <p> The parameters consist of an effective key size and optionally
26  * an 8-byte 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>RC2</i> algorithm.
30  *
31  * @author Jan Luehe
32  *
33  * @version 1.13, 06/03/04
34  * @since 1.4
35  */

36 public class RC2ParameterSpec implements AlgorithmParameterSpec
37 {
38
39     /**
40      * Constructs a parameter set for RC2 from the given effective key size
41      * (in bits).
42      *
43      * @param effectiveKeyBits the effective key size in bits.
44      */

45     public RC2ParameterSpec(int effectiveKeyBits) { }
46
47     /**
48      * Constructs a parameter set for RC2 from the given effective key size
49      * (in bits) and an 8-byte IV.
50      *
51      * <p> The bytes that constitute the IV are those between
52      * <code>iv[0]</code> and <code>iv[7]</code> inclusive.
53      *
54      * @param effectiveKeyBits the effective key size in bits.
55      * @param iv the buffer with the 8-byte IV. The first 8 bytes of
56      * the buffer are copied to protect against subsequent modification.
57      * @exception IllegalArgumentException if <code>iv</code> is null.
58      */

59     public RC2ParameterSpec(int effectiveKeyBits, byte[] iv) { }
60
61     /**
62      * Constructs a parameter set for RC2 from the given effective key size
63      * (in bits) and IV.
64      *
65      * <p> The IV is taken from <code>iv</code>, starting at
66      * <code>offset</code> inclusive.
67      * The bytes that constitute the IV are those between
68      * <code>iv[offset]</code> and <code>iv[offset+7]</code> inclusive.
69      *
70      * @param effectiveKeyBits the effective key size in bits.
71      * @param iv the buffer with the IV. The first 8 bytes
72      * of the buffer beginning at <code>offset</code> inclusive
73      * are copied to protect against subsequent modification.
74      * @param offset the offset in <code>iv</code> where the 8-byte IV
75      * starts.
76      * @exception IllegalArgumentException if <code>iv</code> is null.
77      */

78     public RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset) { }
79
80     /**
81      * Returns the effective key size in bits.
82      *
83      * @return the effective key size in bits.
84      */

85     public int getEffectiveKeyBits() {
86         return 0;
87     }
88
89     /**
90      * Returns the IV or null if this parameter set does not contain an IV.
91      *
92      * @return the IV or null if this parameter set does not contain an IV.
93      * Returns a new array each time this method is called.
94      */

95     public byte[] getIV() {
96         return null;
97     }
98
99     /**
100      * Tests for equality between the specified object and this
101      * object. Two RC2ParameterSpec objects are considered equal if their
102      * effective key sizes and IVs are equal.
103      * (Two IV references are considered equal if both are <tt>null</tt>.)
104      *
105      * @param obj the object to test for equality with this object.
106      *
107      * @return true if the objects are considered equal, false if
108      * <code>obj</code> is null or otherwise.
109      */

110     public boolean equals(Object obj) {
111         return false;
112     }
113
114     /**
115      * Calculates a hash code value for the object.
116      * Objects that are equal will also have the same hashcode.
117      */

118     public int hashCode() {
119         return 0;
120     }
121 }
122
Popular Tags