KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * @(#)DESedeKeySpec.java 1.9 03/12/19
3  *
4  * Copyright 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.InvalidKeyException;
19
20 /**
21  * This class specifies a DES-EDE ("triple-DES") key.
22  *
23  * @author Jan Luehe
24  *
25  * @version 1.19, 12/09/03
26  * @since 1.4
27  */

28 public class DESedeKeySpec implements java.security.spec.KeySpec
29 {
30     /**
31      * The constant which defines the length of a DESede key in bytes.
32      */

33     public static final int DES_EDE_KEY_LEN = 24;
34
35     /**
36      * Creates a DESedeKeySpec object using the first 24 bytes in
37      * <code>key</code> as the key material for the DES-EDE key.
38      *
39      * <p> The bytes that constitute the DES-EDE key are those between
40      * <code>key[0]</code> and <code>key[23]</code> inclusive
41      *
42      * @param key the buffer with the DES-EDE key material. The first
43      * 24 bytes of the buffer are copied to protect against subsequent
44      * modification.
45      *
46      * @exception NullPointerException if <code>key</code> is null.
47      * @exception InvalidKeyException if the given key material is shorter
48      * than 24 bytes.
49      */

50     public DESedeKeySpec(byte[] key) throws InvalidKeyException { }
51
52     /**
53      * Creates a DESedeKeySpec object using the first 24 bytes in
54      * <code>key</code>, beginning at <code>offset</code> inclusive,
55      * as the key material for the DES-EDE key.
56      *
57      * <p> The bytes that constitute the DES-EDE key are those between
58      * <code>key[offset]</code> and <code>key[offset+23]</code> inclusive.
59      *
60      * @param key the buffer with the DES-EDE key material. The first
61      * 24 bytes of the buffer beginning at <code>offset</code> inclusive
62      * are copied to protect against subsequent modification.
63      * @param offset the offset in <code>key</code>, where the DES-EDE key
64      * material starts.
65      *
66      * @exception NullPointerException if <code>key</code> is null.
67      * @exception InvalidKeyException if the given key material, starting at
68      * <code>offset</code> inclusive, is shorter than 24 bytes
69      */

70     public DESedeKeySpec(byte[] key, int offset) throws InvalidKeyException { }
71
72     /**
73      * Returns the DES-EDE key.
74      *
75      * @return the DES-EDE key. Returns a new array
76      * each time this method is called.
77      */

78     public byte[] getKey() { }
79
80     /**
81      * Checks if the given DES-EDE key, starting at <code>offset</code>
82      * inclusive, is parity-adjusted.
83      *
84      * @param key a byte array which holds the key value
85      * @param offset the offset into the byte array
86      * @return true if the given DES-EDE key is parity-adjusted, false
87      * otherwise
88      *
89      * @exception NullPointerException if <code>key</code> is null.
90      * @exception InvalidKeyException if the given key material, starting at
91      * <code>offset</code> inclusive, is shorter than 24 bytes
92      */

93     public static boolean isParityAdjusted(byte[] key, int offset)
94         throws InvalidKeyException
95     { }
96 }
97
Popular Tags