OSDN Git Service

Imported GNU Classpath 0.90
[pf3gnuchains/gcc-fork.git] / libjava / classpath / gnu / javax / crypto / jce / GnuCrypto.java
1 /* GnuCrypto.java -- 
2    Copyright (C) 2004, 2006 Free Software Foundation, Inc.
3
4 This file is a part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at
9 your option) any later version.
10
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
19 USA
20
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version.  */
37
38
39 package gnu.javax.crypto.jce;
40
41 import gnu.java.security.Registry;
42 import gnu.javax.crypto.cipher.CipherFactory;
43 import gnu.javax.crypto.mac.MacFactory;
44
45 import java.security.AccessController;
46 import java.security.PrivilegedAction;
47 import java.security.Provider;
48 import java.util.HashSet;
49 import java.util.Set;
50
51 /**
52  * <p>The GNU Crypto implementation of the Java Cryptographic Extension (JCE)
53  * Provider.</p>
54  *
55  * @see java.security.Provider
56  */
57 public final class GnuCrypto extends Provider
58 {
59
60   // Constants and variables
61   // -------------------------------------------------------------------------
62
63   // Constructor(s)
64   // -------------------------------------------------------------------------
65
66   /**
67    * <p>The <a href="http://www.gnu.org/software/gnu-crypto/">GNU Crypto</a>
68    * Provider.</p>
69    */
70   public GnuCrypto()
71   {
72     super(Registry.GNU_CRYPTO, 2.1, "GNU Crypto JCE Provider");
73
74     AccessController.doPrivileged(new PrivilegedAction()
75     {
76       public Object run()
77       {
78         // Cipher
79         put("Cipher.ANUBIS",
80             gnu.javax.crypto.jce.cipher.AnubisSpi.class.getName());
81         put("Cipher.ANUBIS ImplementedIn", "Software");
82         put("Cipher.ARCFOUR",
83             gnu.javax.crypto.jce.cipher.ARCFourSpi.class.getName());
84         put("Cipher.ARCFOUR ImplementedIn", "Software");
85         put("Cipher.BLOWFISH",
86             gnu.javax.crypto.jce.cipher.BlowfishSpi.class.getName());
87         put("Cipher.BLOWFISH ImplementedIn", "Software");
88         put("Cipher.DES", gnu.javax.crypto.jce.cipher.DESSpi.class.getName());
89         put("Cipher.DES ImplementedIn", "Software");
90         put("Cipher.KHAZAD",
91             gnu.javax.crypto.jce.cipher.KhazadSpi.class.getName());
92         put("Cipher.KHAZAD ImplementedIn", "Software");
93         put("Cipher.NULL",
94             gnu.javax.crypto.jce.cipher.NullCipherSpi.class.getName());
95         put("Cipher.NULL ImplementedIn", "Software");
96         put("Cipher.AES",
97             gnu.javax.crypto.jce.cipher.RijndaelSpi.class.getName());
98         put("Cipher.AES ImplementedIn", "Software");
99         put("Cipher.RIJNDAEL",
100             gnu.javax.crypto.jce.cipher.RijndaelSpi.class.getName());
101         put("Cipher.RIJNDAEL ImplementedIn", "Software");
102         put("Cipher.SERPENT",
103             gnu.javax.crypto.jce.cipher.SerpentSpi.class.getName());
104         put("Cipher.SERPENT ImplementedIn", "Software");
105         put("Cipher.SQUARE",
106             gnu.javax.crypto.jce.cipher.SquareSpi.class.getName());
107         put("Cipher.SQUARE ImplementedIn", "Software");
108         put("Cipher.TRIPLEDES",
109             gnu.javax.crypto.jce.cipher.TripleDESSpi.class.getName());
110         put("Cipher.TRIPLEDES ImplementedIn", "Software");
111         put("Cipher.TWOFISH",
112             gnu.javax.crypto.jce.cipher.TwofishSpi.class.getName());
113         put("Cipher.TWOFISH ImplementedIn", "Software");
114         put("Cipher.CAST5",
115             gnu.javax.crypto.jce.cipher.Cast5Spi.class.getName());
116         put("Cipher.CAST5 ImplementedIn", "Software");
117
118         // PBES2 ciphers.
119         put("Cipher.PBEWithHMacHavalAndAES",
120             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.AES.class.getName());
121         put("Cipher.PBEWithHMacHavalAndAnubis",
122             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Anubis.class.getName());
123         put(
124             "Cipher.PBEWithHMacHavalAndBlowfish",
125             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Blowfish.class.getName());
126         put("Cipher.PBEWithHMacHavalAndCast5",
127             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Cast5.class.getName());
128         put("Cipher.PBEWithHMacHavalAndDES",
129             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.DES.class.getName());
130         put("Cipher.PBEWithHMacHavalAndKhazad",
131             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Khazad.class.getName());
132         put("Cipher.PBEWithHMacHavalAndSerpent",
133             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Serpent.class.getName());
134         put("Cipher.PBEWithHMacHavalAndSquare",
135             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Square.class.getName());
136         put(
137             "Cipher.PBEWithHMacHavalAndTripleDES",
138             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.TripleDES.class.getName());
139         put("Cipher.PBEWithHMacHavalAndTwofish",
140             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Twofish.class.getName());
141
142         put("Cipher.PBEWithHMacMD2AndAES",
143             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.AES.class.getName());
144         put("Cipher.PBEWithHMacMD2AndAnubis",
145             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Anubis.class.getName());
146         put("Cipher.PBEWithHMacMD2AndBlowfish",
147             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Blowfish.class.getName());
148         put("Cipher.PBEWithHMacMD2AndCast5",
149             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Cast5.class.getName());
150         put("Cipher.PBEWithHMacMD2AndDES",
151             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.DES.class.getName());
152         put("Cipher.PBEWithHMacMD2AndKhazad",
153             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Khazad.class.getName());
154         put("Cipher.PBEWithHMacMD2AndSerpent",
155             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Serpent.class.getName());
156         put("Cipher.PBEWithHMacMD2AndSquare",
157             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Square.class.getName());
158         put("Cipher.PBEWithHMacMD2AndTripleDES",
159             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.TripleDES.class.getName());
160         put("Cipher.PBEWithHMacMD2AndTwofish",
161             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Twofish.class.getName());
162
163         put("Cipher.PBEWithHMacMD4AndAES",
164             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.AES.class.getName());
165         put("Cipher.PBEWithHMacMD4AndAnubis",
166             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Anubis.class.getName());
167         put("Cipher.PBEWithHMacMD4AndBlowfish",
168             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Blowfish.class.getName());
169         put("Cipher.PBEWithHMacMD4AndCast5",
170             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Cast5.class.getName());
171         put("Cipher.PBEWithHMacMD4AndDES",
172             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.DES.class.getName());
173         put("Cipher.PBEWithHMacMD4AndKhazad",
174             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Khazad.class.getName());
175         put("Cipher.PBEWithHMacMD4AndSerpent",
176             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Serpent.class.getName());
177         put("Cipher.PBEWithHMacMD4AndSquare",
178             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Square.class.getName());
179         put("Cipher.PBEWithHMacMD4AndTripleDES",
180             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.TripleDES.class.getName());
181         put("Cipher.PBEWithHMacMD4AndTwofish",
182             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Twofish.class.getName());
183
184         put("Cipher.PBEWithHMacMD5AndAES",
185             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.AES.class.getName());
186         put("Cipher.PBEWithHMacMD5AndAnubis",
187             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Anubis.class.getName());
188         put("Cipher.PBEWithHMacMD5AndBlowfish",
189             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Blowfish.class.getName());
190         put("Cipher.PBEWithHMacMD5AndCast5",
191             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Cast5.class.getName());
192         put("Cipher.PBEWithHMacMD5AndDES",
193             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.DES.class.getName());
194         put("Cipher.PBEWithHMacMD5AndKhazad",
195             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Khazad.class.getName());
196         put("Cipher.PBEWithHMacMD5AndSerpent",
197             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Serpent.class.getName());
198         put("Cipher.PBEWithHMacMD5AndSquare",
199             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Square.class.getName());
200         put("Cipher.PBEWithHMacMD5AndTripleDES",
201             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.TripleDES.class.getName());
202         put("Cipher.PBEWithHMacMD5AndTwofish",
203             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Twofish.class.getName());
204
205         put("Cipher.PBEWithHMacSHA1AndAES",
206             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.AES.class.getName());
207         put("Cipher.PBEWithHMacSHA1AndAnubis",
208             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Anubis.class.getName());
209         put("Cipher.PBEWithHMacSHA1AndBlowfish",
210             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Blowfish.class.getName());
211         put("Cipher.PBEWithHMacSHA1AndCast5",
212             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Cast5.class.getName());
213         put("Cipher.PBEWithHMacSHA1AndDES",
214             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.DES.class.getName());
215         put("Cipher.PBEWithHMacSHA1AndKhazad",
216             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Khazad.class.getName());
217         put("Cipher.PBEWithHMacSHA1AndSerpent",
218             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Serpent.class.getName());
219         put("Cipher.PBEWithHMacSHA1AndSquare",
220             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Square.class.getName());
221         put(
222             "Cipher.PBEWithHMacSHA1AndTripleDES",
223             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.TripleDES.class.getName());
224         put("Cipher.PBEWithHMacSHA1AndTwofish",
225             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Twofish.class.getName());
226
227         put("Cipher.PBEWithHMacSHA256AndAES",
228             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.AES.class.getName());
229         put("Cipher.PBEWithHMacSHA256AndAnubis",
230             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Anubis.class.getName());
231         put(
232             "Cipher.PBEWithHMacSHA256AndBlowfish",
233             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Blowfish.class.getName());
234         put("Cipher.PBEWithHMacSHA256AndCast5",
235             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Cast5.class.getName());
236         put("Cipher.PBEWithHMacSHA256AndDES",
237             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.DES.class.getName());
238         put("Cipher.PBEWithHMacSHA256AndKhazad",
239             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Khazad.class.getName());
240         put(
241             "Cipher.PBEWithHMacSHA256AndSerpent",
242             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Serpent.class.getName());
243         put("Cipher.PBEWithHMacSHA256AndSquare",
244             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Square.class.getName());
245         put(
246             "Cipher.PBEWithHMacSHA256AndTripleDES",
247             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.TripleDES.class.getName());
248         put(
249             "Cipher.PBEWithHMacSHA256AndTwofish",
250             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Twofish.class.getName());
251
252         put("Cipher.PBEWithHMacSHA384AndAES",
253             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.AES.class.getName());
254         put("Cipher.PBEWithHMacSHA384AndAnubis",
255             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Anubis.class.getName());
256         put(
257             "Cipher.PBEWithHMacSHA384AndBlowfish",
258             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Blowfish.class.getName());
259         put("Cipher.PBEWithHMacSHA384AndCast5",
260             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Cast5.class.getName());
261         put("Cipher.PBEWithHMacSHA384AndDES",
262             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.DES.class.getName());
263         put("Cipher.PBEWithHMacSHA384AndKhazad",
264             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Khazad.class.getName());
265         put(
266             "Cipher.PBEWithHMacSHA384AndSerpent",
267             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Serpent.class.getName());
268         put("Cipher.PBEWithHMacSHA384AndSquare",
269             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Square.class.getName());
270         put(
271             "Cipher.PBEWithHMacSHA384AndTripleDES",
272             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.TripleDES.class.getName());
273         put(
274             "Cipher.PBEWithHMacSHA384AndTwofish",
275             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Twofish.class.getName());
276
277         put("Cipher.PBEWithHMacSHA512AndAES",
278             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.AES.class.getName());
279         put("Cipher.PBEWithHMacSHA512AndAnubis",
280             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Anubis.class.getName());
281         put(
282             "Cipher.PBEWithHMacSHA512AndBlowfish",
283             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Blowfish.class.getName());
284         put("Cipher.PBEWithHMacSHA512AndCast5",
285             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Cast5.class.getName());
286         put("Cipher.PBEWithHMacSHA512AndDES",
287             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.DES.class.getName());
288         put("Cipher.PBEWithHMacSHA512AndKhazad",
289             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Khazad.class.getName());
290         put(
291             "Cipher.PBEWithHMacSHA512AndSerpent",
292             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Serpent.class.getName());
293         put("Cipher.PBEWithHMacSHA512AndSquare",
294             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Square.class.getName());
295         put(
296             "Cipher.PBEWithHMacSHA512AndTripleDES",
297             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.TripleDES.class.getName());
298         put(
299             "Cipher.PBEWithHMacSHA512AndTwofish",
300             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Twofish.class.getName());
301
302         put("Cipher.PBEWithHMacTigerAndAES",
303             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.AES.class.getName());
304         put("Cipher.PBEWithHMacTigerAndAnubis",
305             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Anubis.class.getName());
306         put(
307             "Cipher.PBEWithHMacTigerAndBlowfish",
308             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Blowfish.class.getName());
309         put("Cipher.PBEWithHMacTigerAndCast5",
310             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Cast5.class.getName());
311         put("Cipher.PBEWithHMacTigerAndDES",
312             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.DES.class.getName());
313         put("Cipher.PBEWithHMacTigerAndKhazad",
314             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Khazad.class.getName());
315         put("Cipher.PBEWithHMacTigerAndSerpent",
316             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Serpent.class.getName());
317         put("Cipher.PBEWithHMacTigerAndSquare",
318             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Square.class.getName());
319         put(
320             "Cipher.PBEWithHMacTigerAndTripleDES",
321             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.TripleDES.class.getName());
322         put("Cipher.PBEWithHMacTigerAndTwofish",
323             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Twofish.class.getName());
324
325         put("Cipher.PBEWithHMacWhirlpoolAndAES",
326             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.AES.class.getName());
327         put(
328             "Cipher.PBEWithHMacWhirlpoolAndAnubis",
329             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Anubis.class.getName());
330         put(
331             "Cipher.PBEWithHMacWhirlpoolAndBlowfish",
332             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Blowfish.class.getName());
333         put(
334             "Cipher.PBEWithHMacWhirlpoolAndCast5",
335             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Cast5.class.getName());
336         put("Cipher.PBEWithHMacWhirlpoolAndDES",
337             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.DES.class.getName());
338         put(
339             "Cipher.PBEWithHMacWhirlpoolAndKhazad",
340             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Khazad.class.getName());
341         put(
342             "Cipher.PBEWithHMacWhirlpoolAndSerpent",
343             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Serpent.class.getName());
344         put(
345             "Cipher.PBEWithHMacWhirlpoolAndSquare",
346             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Square.class.getName());
347         put(
348             "Cipher.PBEWithHMacWhirlpoolAndTripleDES",
349             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.TripleDES.class.getName());
350         put(
351             "Cipher.PBEWithHMacWhirlpoolAndTwofish",
352             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Twofish.class.getName());
353
354         // SecretKeyFactory interface to PBKDF2.
355         put(
356             "SecretKeyFactory.PBKDF2WithHMacHaval",
357             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacHaval.class.getName());
358         put("SecretKeyFactory.PBKDF2WithHMacMD2",
359             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD2.class.getName());
360         put("SecretKeyFactory.PBKDF2WithHMacMD4",
361             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD4.class.getName());
362         put("SecretKeyFactory.PBKDF2WithHMacMD5",
363             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD5.class.getName());
364         put(
365             "SecretKeyFactory.PBKDF2WithHMacSHA1",
366             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA1.class.getName());
367         put(
368             "SecretKeyFactory.PBKDF2WithHMacSHA256",
369             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA256.class.getName());
370         put(
371             "SecretKeyFactory.PBKDF2WithHMacSHA384",
372             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA384.class.getName());
373         put(
374             "SecretKeyFactory.PBKDF2WithHMacSHA512",
375             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA512.class.getName());
376         put(
377             "SecretKeyFactory.PBKDF2WithHMacTiger",
378             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacTiger.class.getName());
379         put(
380             "SecretKeyFactory.PBKDF2WithHMacWhirlpool",
381             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacWhirlpool.class.getName());
382
383         // Simple SecretKeyFactory implementations.
384         put("SecretKeyFactory.Anubis",
385             gnu.javax.crypto.jce.key.AnubisSecretKeyFactoryImpl.class.getName());
386         put(
387             "SecretKeyFactory.Blowfish",
388             gnu.javax.crypto.jce.key.BlowfishSecretKeyFactoryImpl.class.getName());
389         put("SecretKeyFactory.Cast5",
390             gnu.javax.crypto.jce.key.Cast5SecretKeyFactoryImpl.class.getName());
391         put("SecretKeyFactory.DES",
392             gnu.javax.crypto.jce.key.DESSecretKeyFactoryImpl.class.getName());
393         put("SecretKeyFactory.Khazad",
394             gnu.javax.crypto.jce.key.KhazadSecretKeyFactoryImpl.class.getName());
395         put(
396             "SecretKeyFactory.Rijndael",
397             gnu.javax.crypto.jce.key.RijndaelSecretKeyFactoryImpl.class.getName());
398         put(
399             "SecretKeyFactory.Serpent",
400             gnu.javax.crypto.jce.key.SerpentSecretKeyFactoryImpl.class.getName());
401         put("SecretKeyFactory.Square",
402             gnu.javax.crypto.jce.key.SquareSecretKeyFactoryImpl.class.getName());
403         put("SecretKeyFactory.TripleDES",
404             gnu.javax.crypto.jce.key.DESedeSecretKeyFactoryImpl.class.getName());
405         put("Alg.Alias.SecretKeyFactory.AES", "Rijndael");
406         put("Alg.Alias.SecretKeyFactory.DESede", "TripleDES");
407         put("Alg.Alias.SecretKeyFactory.3-DES", "TripleDES");
408         put("Alg.Alias.SecretKeyFactory.3DES", "TripleDES");
409
410         put("AlgorithmParameters.BlockCipherParameters",
411             gnu.javax.crypto.jce.params.BlockCipherParameters.class.getName());
412
413
414         // KeyGenerator Adapter implementations
415         put("KeyGenerator.Anubis",
416             gnu.javax.crypto.jce.key.AnubisKeyGeneratorImpl.class.getName());
417         put("KeyGenerator.Blowfish",
418             gnu.javax.crypto.jce.key.BlowfishKeyGeneratorImpl.class.getName());
419         put("KeyGenerator.Cast5",
420             gnu.javax.crypto.jce.key.Cast5KeyGeneratorImpl.class.getName());
421         put("KeyGenerator.DES",
422             gnu.javax.crypto.jce.key.DESKeyGeneratorImpl.class.getName());
423         put("KeyGenerator.Khazad",
424             gnu.javax.crypto.jce.key.KhazadKeyGeneratorImpl.class.getName());
425         put("KeyGenerator.Rijndael",
426             gnu.javax.crypto.jce.key.RijndaelKeyGeneratorImpl.class.getName());
427         put("KeyGenerator.Serpent",
428             gnu.javax.crypto.jce.key.SerpentKeyGeneratorImpl.class.getName());
429         put("KeyGenerator.Square",
430             gnu.javax.crypto.jce.key.SquareKeyGeneratorImpl.class.getName());
431         put("KeyGenerator.TripleDES",
432             gnu.javax.crypto.jce.key.TripleDESKeyGeneratorImpl.class.getName());
433         put("Alg.Alias.KeyGenerator.AES", "Rijndael");
434         put("Alg.Alias.KeyGenerator.DESede", "TripleDES");
435         put("Alg.Alias.KeyGenerator.3-DES", "TripleDES");
436         put("Alg.Alias.KeyGenerator.3DES", "TripleDES");
437
438         // MAC
439         put("Mac.HMAC-MD2", gnu.javax.crypto.jce.mac.HMacMD2Spi.class.getName());
440         put("Mac.HMAC-MD4", gnu.javax.crypto.jce.mac.HMacMD4Spi.class.getName());
441         put("Mac.HMAC-MD5", gnu.javax.crypto.jce.mac.HMacMD5Spi.class.getName());
442         put("Mac.HMAC-RIPEMD128",
443             gnu.javax.crypto.jce.mac.HMacRipeMD128Spi.class.getName());
444         put("Mac.HMAC-RIPEMD160",
445             gnu.javax.crypto.jce.mac.HMacRipeMD160Spi.class.getName());
446         put("Mac.HMAC-SHA160",
447             gnu.javax.crypto.jce.mac.HMacSHA160Spi.class.getName());
448         put("Mac.HMAC-SHA256",
449             gnu.javax.crypto.jce.mac.HMacSHA256Spi.class.getName());
450         put("Mac.HMAC-SHA384",
451             gnu.javax.crypto.jce.mac.HMacSHA384Spi.class.getName());
452         put("Mac.HMAC-SHA512",
453             gnu.javax.crypto.jce.mac.HMacSHA512Spi.class.getName());
454         put("Mac.HMAC-TIGER",
455             gnu.javax.crypto.jce.mac.HMacTigerSpi.class.getName());
456         put("Mac.HMAC-HAVAL",
457             gnu.javax.crypto.jce.mac.HMacHavalSpi.class.getName());
458         put("Mac.HMAC-WHIRLPOOL",
459             gnu.javax.crypto.jce.mac.HMacWhirlpoolSpi.class.getName());
460         put("Mac.TMMH16", gnu.javax.crypto.jce.mac.TMMH16Spi.class.getName());
461         put("Mac.UHASH32", gnu.javax.crypto.jce.mac.UHash32Spi.class.getName());
462         put("Mac.UMAC32", gnu.javax.crypto.jce.mac.UMac32Spi.class.getName());
463
464         put("Mac.OMAC-ANUBIS",
465             gnu.javax.crypto.jce.mac.OMacAnubisImpl.class.getName());
466         put("Mac.OMAC-BLOWFISH",
467             gnu.javax.crypto.jce.mac.OMacBlowfishImpl.class.getName());
468         put("Mac.OMAC-CAST5",
469             gnu.javax.crypto.jce.mac.OMacCast5Impl.class.getName());
470         put("Mac.OMAC-DES",
471             gnu.javax.crypto.jce.mac.OMacDESImpl.class.getName());
472         put("Mac.OMAC-KHAZAD",
473             gnu.javax.crypto.jce.mac.OMacKhazadImpl.class.getName());
474         put("Mac.OMAC-RIJNDAEL",
475             gnu.javax.crypto.jce.mac.OMacRijndaelImpl.class.getName());
476         put("Mac.OMAC-SERPENT",
477             gnu.javax.crypto.jce.mac.OMacSerpentImpl.class.getName());
478         put("Mac.OMAC-SQUARE",
479             gnu.javax.crypto.jce.mac.OMacSquareImpl.class.getName());
480         put("Mac.OMAC-TRIPLEDES",
481             gnu.javax.crypto.jce.mac.OMacTripleDESImpl.class.getName());
482         put("Mac.OMAC-TWOFISH",
483             gnu.javax.crypto.jce.mac.OMacTwofishImpl.class.getName());
484
485         // Aliases
486         put("Alg.Alias.AlgorithmParameters.AES", "BlockCipherParameters");
487         put("Alg.Alias.AlgorithmParameters.BLOWFISH", "BlockCipherParameters");
488         put("Alg.Alias.AlgorithmParameters.ANUBIS", "BlockCipherParameters");
489         put("Alg.Alias.AlgorithmParameters.KHAZAD", "BlockCipherParameters");
490         put("Alg.Alias.AlgorithmParameters.NULL", "BlockCipherParameters");
491         put("Alg.Alias.AlgorithmParameters.RIJNDAEL", "BlockCipherParameters");
492         put("Alg.Alias.AlgorithmParameters.SERPENT", "BlockCipherParameters");
493         put("Alg.Alias.AlgorithmParameters.SQUARE", "BlockCipherParameters");
494         put("Alg.Alias.AlgorithmParameters.TWOFISH", "BlockCipherParameters");
495         put("Alg.Alias.Cipher.RC4", "ARCFOUR");
496         put("Alg.Alias.Cipher.3-DES", "TRIPLEDES");
497         put("Alg.Alias.Cipher.3DES", "TRIPLEDES");
498         put("Alg.Alias.Cipher.DES-EDE", "TRIPLEDES");
499         put("Alg.Alias.Cipher.DESede", "TRIPLEDES");
500         put("Alg.Alias.Cipher.CAST128", "CAST5");
501         put("Alg.Alias.Cipher.CAST-128", "CAST5");
502         put("Alg.Alias.Mac.HMAC-SHS", "HMAC-SHA160");
503         put("Alg.Alias.Mac.HMAC-SHA", "HMAC-SHA160");
504         put("Alg.Alias.Mac.HMAC-SHA1", "HMAC-SHA160");
505         put("Alg.Alias.Mac.HMAC-SHA-160", "HMAC-SHA160");
506         put("Alg.Alias.Mac.HMAC-SHA-256", "HMAC-SHA256");
507         put("Alg.Alias.Mac.HMAC-SHA-384", "HMAC-SHA384");
508         put("Alg.Alias.Mac.HMAC-SHA-512", "HMAC-SHA512");
509         put("Alg.Alias.Mac.HMAC-RIPEMD-160", "HMAC-RIPEMD160");
510         put("Alg.Alias.Mac.HMAC-RIPEMD-128", "HMAC-RIPEMD128");
511         put("Alg.Alias.Mac.OMAC-AES", "OMAC-RIJNDAEL");
512         put("Alg.Alias.Mac.OMAC-3DES", "OMAC-3DES");
513         put("Alg.Alias.Mac.HmacMD4", "HMAC-MD4");
514         put("Alg.Alias.Mac.HmacMD5", "HMAC-MD5");
515         put("Alg.Alias.Mac.HmacSHA-1", "HMAC-SHA-1");
516         put("Alg.Alias.Mac.HmacSHA1", "HMAC-SHA1");
517         put("Alg.Alias.Mac.HmacSHA-160", "HMAC-SHA-160");
518         put("Alg.Alias.Mac.HmacSHA160", "HMAC-SHA-160");
519         put("Alg.Alias.Mac.HmacSHA-256", "HMAC-SHA-256");
520         put("Alg.Alias.Mac.HmacSHA256", "HMAC-SHA-256");
521         put("Alg.Alias.Mac.HmacSHA-384", "HMAC-SHA-384");
522         put("Alg.Alias.Mac.HmacSHA384", "HMAC-SHA-384");
523         put("Alg.Alias.Mac.HmacSHA-512", "HMAC-SHA-512");
524         put("Alg.Alias.Mac.HmacSHA512", "HMAC-SHA-512");
525         put("Alg.Alias.Mac.HmacRIPEMD128", "HMAC-RIPEMD128");
526         put("Alg.Alias.Mac.HmacRIPEMD-128", "HMAC-RIPEMD128");
527         put("Alg.Alias.Mac.HmacRIPEMD160", "HMAC-RIPEMD160");
528         put("Alg.Alias.Mac.HmacRIPEMD-160", "HMAC-RIPEMD160");
529         put("Alg.Alias.Mac.HmacTiger", "HMAC-TIGER");
530         put("Alg.Alias.Mac.HmacHaval", "HMAC-HAVAL");
531         put("Alg.Alias.Mac.HmacWhirlpool", "HMAC-WHIRLPOOL");
532
533         // KeyAgreement
534         put("KeyAgreement.DH",
535             gnu.javax.crypto.jce.DiffieHellmanImpl.class.getName());
536         put("Alg.Alias.KeyAgreement.DiffieHellman", "DH");
537
538         // Cipher
539         put("Cipher.RSAES-PKCS1-v1_5",
540             gnu.javax.crypto.RSACipherImpl.class.getName());
541         put("Alg.Alias.Cipher.RSA", "RSAES-PKCS1-v1_5");
542
543         // SecureRandom
544         put("SecureRandom.ARCFOUR", gnu.javax.crypto.jce.prng.ARCFourRandomSpi.class.getName());
545         put("SecureRandom.ARCFOUR ImplementedIn", "Software");
546         put("SecureRandom.CSPRNG", gnu.javax.crypto.jce.prng.CSPRNGSpi.class.getName());
547         put("SecureRandom.CSPRNG ImplementedIn", "Software");
548         put("SecureRandom.ICM", gnu.javax.crypto.jce.prng.ICMRandomSpi.class.getName());
549         put("SecureRandom.ICM ImplementedIn", "Software");
550         put("SecureRandom.UMAC-KDF", gnu.javax.crypto.jce.prng.UMacRandomSpi.class.getName());
551         put("SecureRandom.UMAC-KDF ImplementedIn", "Software");
552         put("SecureRandom.Fortuna", gnu.javax.crypto.jce.prng.FortunaImpl.class.getName ());
553         put("SecureRandom.Fortuna ImplementedIn", "Software");
554
555         // KeyStore
556         put("KeyStore.GKR", gnu.javax.crypto.jce.keyring.GnuKeyring.class.getName());
557         put("Alg.Alias.KeyStore.GnuKeyring", "GKR");
558
559         // KeyPairGenerator ---------------------------------------------------
560         put("KeyPairGenerator.DH",
561             gnu.javax.crypto.jce.sig.DHKeyPairGeneratorSpi.class.getName());
562         put("KeyPairGenerator.DH KeySize", "512");
563         put("KeyPairGenerator.DH ImplementedIn", "Software");
564
565         put("Alg.Alias.KeyPairGenerator.DiffieHellman", "DH");
566
567         // KeyFactory ---------------------------------------------------------
568         put("KeyFactory.DH",
569             gnu.javax.crypto.jce.sig.DHKeyFactory.class.getName());
570
571         put("Alg.Alias,KeyFactory.DiffieHellman", "DH");
572
573         // Algorithm Parameters -----------------------------------------------
574         put("AlgorithmParameters.DH",
575             gnu.javax.crypto.jce.sig.DHParameters.class.getName());
576
577         put("Alg.Alias.AlgorithmParameters.DiffieHellman", "DH");
578
579         // Algorithm Parameters Generator -------------------------------------
580         put("AlgorithmParameterGenerator.DH",
581             gnu.javax.crypto.jce.sig.DHParametersGenerator.class.getName());
582
583         put("Alg.Alias.AlgorithmParameterGenerator.DiffieHellman", "DH");
584
585         return null;
586       }
587     });
588   }
589
590   // Class methods
591   // -------------------------------------------------------------------------
592
593   /**
594    * <p>Returns a {@link Set} of names of symmetric key block cipher algorithms
595    * available from this {@link Provider}.</p>
596    *
597    * @return a {@link Set} of cipher names (Strings).
598    */
599   public static final Set getCipherNames()
600   {
601     HashSet s = new HashSet();
602     s.addAll(CipherFactory.getNames());
603     s.add(Registry.ARCFOUR_PRNG);
604     return s;
605   }
606
607   /**
608    * <p>Returns a {@link Set} of names of MAC algorithms available from
609    * this {@link Provider}.</p>
610    *
611    * @return a {@link Set} of MAC names (Strings).
612    */
613   public static final Set getMacNames()
614   {
615     return MacFactory.getNames();
616   }
617
618   // Instance methods
619   // -------------------------------------------------------------------------
620 }