KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > crypto > io > raes > Type0RaesParameters


1 /*
2  * Copyright 2005-2006 Schlichtherle IT Services
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package de.schlichtherle.crypto.io.raes;
18
19 /**
20  * The parameters of this interface are used with RAES <i>type 0</i> files.
21  * Type 0 RAES files use password based encryption according to the
22  * specifications in PKCS #5 V2.0 und PKCS #12 V1.0.
23  *
24  * @see <a HREF="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/index.html" target=_blank>PKCS #5</a>
25  * @see <a HREF="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-12/index.html" target=_blank>PKCS #12</a>
26  *
27  * @author Christian Schlichtherle
28  * @version @version@
29  * @since TrueZIP 6.0
30  */

31 public interface Type0RaesParameters extends RaesParameters {
32
33     /**
34      * Returns the password required to create or overwrite the RAES type 0 file.
35      *
36      * @return A clone of the char array holding the password to use for
37      * creating or overwriting the RAES file - never <tt>null</tt>.
38      *
39      * @throws RaesKeyException If password retrieval has been disabled or
40      * cancelled.
41      */

42     char[] getCreatePasswd() throws RaesKeyException;
43
44
45     /**
46      * Returns the password required to open the RAES type 0 file for reading.
47      * Please note that this method is called repeatedly until either the
48      * returned password is correct or an exception has been thrown.
49      *
50      * @return A clone of the char array holding the password to open the RAES
51      * file for reading - never <tt>null</tt>.
52      *
53      * @throws RaesKeyException If password retrieval has been disabled or
54      * cancelled.
55      */

56     char[] getOpenPasswd() throws RaesKeyException;
57
58     /**
59      * Callback to report that the password returned by {@link #getOpenPasswd()}
60      * is wrong.
61      */

62     void invalidOpenPasswd();
63
64     /** Identifier for a 128 bit ciphering key. */
65     int KEY_STRENGTH_128 = 0;
66
67     /** Identifier for a 192 bit ciphering key. */
68     int KEY_STRENGTH_192 = 1;
69
70     /** Identifier for a 256 bit ciphering key. */
71     int KEY_STRENGTH_256 = 2;
72     
73     /**
74      * Returns the key strength to use for creating or overwriting the RAES file.
75      *
76      * @see #KEY_STRENGTH_128
77      * @see #KEY_STRENGTH_192
78      * @see #KEY_STRENGTH_256
79      */

80     int getKeyStrength();
81
82     /**
83      * Sets the key strength which was used when creating or overwriting the
84      * RAES file.
85      */

86     void setKeyStrength(int keyStrength);
87 }
88
Popular Tags