OSDN Git Service

2006-08-14 Mark Wielaard <mark@klomp.org>
[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  * The additional GNU algorithm implementation as a Java Cryptographic Extension
53  * (JCE) Provider.
54  * 
55  * @see java.security.Provider
56  */
57 public final class GnuCrypto
58     extends Provider
59 {
60   public GnuCrypto()
61   {
62     super(Registry.GNU_CRYPTO, 2.1, "GNU Crypto JCE Provider");
63
64     AccessController.doPrivileged(new PrivilegedAction()
65     {
66       public Object run()
67       {
68         // Cipher
69         put("Cipher.ANUBIS",
70             gnu.javax.crypto.jce.cipher.AnubisSpi.class.getName());
71         put("Cipher.ANUBIS ImplementedIn", "Software");
72         put("Cipher.ARCFOUR",
73             gnu.javax.crypto.jce.cipher.ARCFourSpi.class.getName());
74         put("Cipher.ARCFOUR ImplementedIn", "Software");
75         put("Cipher.BLOWFISH",
76             gnu.javax.crypto.jce.cipher.BlowfishSpi.class.getName());
77         put("Cipher.BLOWFISH ImplementedIn", "Software");
78         put("Cipher.DES", gnu.javax.crypto.jce.cipher.DESSpi.class.getName());
79         put("Cipher.DES ImplementedIn", "Software");
80         put("Cipher.KHAZAD",
81             gnu.javax.crypto.jce.cipher.KhazadSpi.class.getName());
82         put("Cipher.KHAZAD ImplementedIn", "Software");
83         put("Cipher.NULL",
84             gnu.javax.crypto.jce.cipher.NullCipherSpi.class.getName());
85         put("Cipher.NULL ImplementedIn", "Software");
86         put("Cipher.AES",
87             gnu.javax.crypto.jce.cipher.RijndaelSpi.class.getName());
88         put("Cipher.AES ImplementedIn", "Software");
89         put("Cipher.RIJNDAEL",
90             gnu.javax.crypto.jce.cipher.RijndaelSpi.class.getName());
91         put("Cipher.RIJNDAEL ImplementedIn", "Software");
92         put("Cipher.SERPENT",
93             gnu.javax.crypto.jce.cipher.SerpentSpi.class.getName());
94         put("Cipher.SERPENT ImplementedIn", "Software");
95         put("Cipher.SQUARE",
96             gnu.javax.crypto.jce.cipher.SquareSpi.class.getName());
97         put("Cipher.SQUARE ImplementedIn", "Software");
98         put("Cipher.TRIPLEDES",
99             gnu.javax.crypto.jce.cipher.TripleDESSpi.class.getName());
100         put("Cipher.TRIPLEDES ImplementedIn", "Software");
101         put("Cipher.TWOFISH",
102             gnu.javax.crypto.jce.cipher.TwofishSpi.class.getName());
103         put("Cipher.TWOFISH ImplementedIn", "Software");
104         put("Cipher.CAST5",
105             gnu.javax.crypto.jce.cipher.Cast5Spi.class.getName());
106         put("Cipher.CAST5 ImplementedIn", "Software");
107
108         // PBES2 ciphers.
109         put("Cipher.PBEWithHMacHavalAndAES",
110             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.AES.class.getName());
111         put("Cipher.PBEWithHMacHavalAndAnubis",
112             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Anubis.class.getName());
113         put("Cipher.PBEWithHMacHavalAndBlowfish",
114             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Blowfish.class.getName());
115         put("Cipher.PBEWithHMacHavalAndCast5",
116             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Cast5.class.getName());
117         put("Cipher.PBEWithHMacHavalAndDES",
118             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.DES.class.getName());
119         put("Cipher.PBEWithHMacHavalAndKhazad",
120             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Khazad.class.getName());
121         put("Cipher.PBEWithHMacHavalAndSerpent",
122             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Serpent.class.getName());
123         put("Cipher.PBEWithHMacHavalAndSquare",
124             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Square.class.getName());
125         put("Cipher.PBEWithHMacHavalAndTripleDES",
126             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.TripleDES.class.getName());
127         put("Cipher.PBEWithHMacHavalAndTwofish",
128             gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Twofish.class.getName());
129
130         put("Cipher.PBEWithHMacMD2AndAES",
131             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.AES.class.getName());
132         put("Cipher.PBEWithHMacMD2AndAnubis",
133             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Anubis.class.getName());
134         put("Cipher.PBEWithHMacMD2AndBlowfish",
135             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Blowfish.class.getName());
136         put("Cipher.PBEWithHMacMD2AndCast5",
137             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Cast5.class.getName());
138         put("Cipher.PBEWithHMacMD2AndDES",
139             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.DES.class.getName());
140         put("Cipher.PBEWithHMacMD2AndKhazad",
141             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Khazad.class.getName());
142         put("Cipher.PBEWithHMacMD2AndSerpent",
143             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Serpent.class.getName());
144         put("Cipher.PBEWithHMacMD2AndSquare",
145             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Square.class.getName());
146         put("Cipher.PBEWithHMacMD2AndTripleDES",
147             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.TripleDES.class.getName());
148         put("Cipher.PBEWithHMacMD2AndTwofish",
149             gnu.javax.crypto.jce.cipher.PBES2.HMacMD2.Twofish.class.getName());
150
151         put("Cipher.PBEWithHMacMD4AndAES",
152             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.AES.class.getName());
153         put("Cipher.PBEWithHMacMD4AndAnubis",
154             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Anubis.class.getName());
155         put("Cipher.PBEWithHMacMD4AndBlowfish",
156             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Blowfish.class.getName());
157         put("Cipher.PBEWithHMacMD4AndCast5",
158             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Cast5.class.getName());
159         put("Cipher.PBEWithHMacMD4AndDES",
160             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.DES.class.getName());
161         put("Cipher.PBEWithHMacMD4AndKhazad",
162             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Khazad.class.getName());
163         put("Cipher.PBEWithHMacMD4AndSerpent",
164             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Serpent.class.getName());
165         put("Cipher.PBEWithHMacMD4AndSquare",
166             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Square.class.getName());
167         put("Cipher.PBEWithHMacMD4AndTripleDES",
168             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.TripleDES.class.getName());
169         put("Cipher.PBEWithHMacMD4AndTwofish",
170             gnu.javax.crypto.jce.cipher.PBES2.HMacMD4.Twofish.class.getName());
171
172         put("Cipher.PBEWithHMacMD5AndAES",
173             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.AES.class.getName());
174         put("Cipher.PBEWithHMacMD5AndAnubis",
175             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Anubis.class.getName());
176         put("Cipher.PBEWithHMacMD5AndBlowfish",
177             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Blowfish.class.getName());
178         put("Cipher.PBEWithHMacMD5AndCast5",
179             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Cast5.class.getName());
180         put("Cipher.PBEWithHMacMD5AndDES",
181             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.DES.class.getName());
182         put("Cipher.PBEWithHMacMD5AndKhazad",
183             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Khazad.class.getName());
184         put("Cipher.PBEWithHMacMD5AndSerpent",
185             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Serpent.class.getName());
186         put("Cipher.PBEWithHMacMD5AndSquare",
187             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Square.class.getName());
188         put("Cipher.PBEWithHMacMD5AndTripleDES",
189             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.TripleDES.class.getName());
190         put("Cipher.PBEWithHMacMD5AndTwofish",
191             gnu.javax.crypto.jce.cipher.PBES2.HMacMD5.Twofish.class.getName());
192
193         put("Cipher.PBEWithHMacSHA1AndAES",
194             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.AES.class.getName());
195         put("Cipher.PBEWithHMacSHA1AndAnubis",
196             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Anubis.class.getName());
197         put("Cipher.PBEWithHMacSHA1AndBlowfish",
198             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Blowfish.class.getName());
199         put("Cipher.PBEWithHMacSHA1AndCast5",
200             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Cast5.class.getName());
201         put("Cipher.PBEWithHMacSHA1AndDES",
202             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.DES.class.getName());
203         put("Cipher.PBEWithHMacSHA1AndKhazad",
204             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Khazad.class.getName());
205         put("Cipher.PBEWithHMacSHA1AndSerpent",
206             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Serpent.class.getName());
207         put("Cipher.PBEWithHMacSHA1AndSquare",
208             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Square.class.getName());
209         put(
210             "Cipher.PBEWithHMacSHA1AndTripleDES",
211             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.TripleDES.class.getName());
212         put("Cipher.PBEWithHMacSHA1AndTwofish",
213             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA1.Twofish.class.getName());
214
215         put("Cipher.PBEWithHMacSHA256AndAES",
216             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.AES.class.getName());
217         put("Cipher.PBEWithHMacSHA256AndAnubis",
218             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Anubis.class.getName());
219         put("Cipher.PBEWithHMacSHA256AndBlowfish",
220             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Blowfish.class.getName());
221         put("Cipher.PBEWithHMacSHA256AndCast5",
222             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Cast5.class.getName());
223         put("Cipher.PBEWithHMacSHA256AndDES",
224             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.DES.class.getName());
225         put("Cipher.PBEWithHMacSHA256AndKhazad",
226             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Khazad.class.getName());
227         put("Cipher.PBEWithHMacSHA256AndSerpent",
228             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Serpent.class.getName());
229         put("Cipher.PBEWithHMacSHA256AndSquare",
230             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Square.class.getName());
231         put("Cipher.PBEWithHMacSHA256AndTripleDES",
232             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.TripleDES.class.getName());
233         put("Cipher.PBEWithHMacSHA256AndTwofish",
234             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Twofish.class.getName());
235
236         put("Cipher.PBEWithHMacSHA384AndAES",
237             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.AES.class.getName());
238         put("Cipher.PBEWithHMacSHA384AndAnubis",
239             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Anubis.class.getName());
240         put("Cipher.PBEWithHMacSHA384AndBlowfish",
241             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Blowfish.class.getName());
242         put("Cipher.PBEWithHMacSHA384AndCast5",
243             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Cast5.class.getName());
244         put("Cipher.PBEWithHMacSHA384AndDES",
245             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.DES.class.getName());
246         put("Cipher.PBEWithHMacSHA384AndKhazad",
247             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Khazad.class.getName());
248         put("Cipher.PBEWithHMacSHA384AndSerpent",
249             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Serpent.class.getName());
250         put("Cipher.PBEWithHMacSHA384AndSquare",
251             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Square.class.getName());
252         put("Cipher.PBEWithHMacSHA384AndTripleDES",
253             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.TripleDES.class.getName());
254         put("Cipher.PBEWithHMacSHA384AndTwofish",
255             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Twofish.class.getName());
256
257         put("Cipher.PBEWithHMacSHA512AndAES",
258             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.AES.class.getName());
259         put("Cipher.PBEWithHMacSHA512AndAnubis",
260             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Anubis.class.getName());
261         put("Cipher.PBEWithHMacSHA512AndBlowfish",
262             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Blowfish.class.getName());
263         put("Cipher.PBEWithHMacSHA512AndCast5",
264             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Cast5.class.getName());
265         put("Cipher.PBEWithHMacSHA512AndDES",
266             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.DES.class.getName());
267         put("Cipher.PBEWithHMacSHA512AndKhazad",
268             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Khazad.class.getName());
269         put("Cipher.PBEWithHMacSHA512AndSerpent",
270             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Serpent.class.getName());
271         put("Cipher.PBEWithHMacSHA512AndSquare",
272             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Square.class.getName());
273         put("Cipher.PBEWithHMacSHA512AndTripleDES",
274             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.TripleDES.class.getName());
275         put("Cipher.PBEWithHMacSHA512AndTwofish",
276             gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Twofish.class.getName());
277
278         put("Cipher.PBEWithHMacTigerAndAES",
279             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.AES.class.getName());
280         put("Cipher.PBEWithHMacTigerAndAnubis",
281             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Anubis.class.getName());
282         put("Cipher.PBEWithHMacTigerAndBlowfish",
283             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Blowfish.class.getName());
284         put("Cipher.PBEWithHMacTigerAndCast5",
285             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Cast5.class.getName());
286         put("Cipher.PBEWithHMacTigerAndDES",
287             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.DES.class.getName());
288         put("Cipher.PBEWithHMacTigerAndKhazad",
289             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Khazad.class.getName());
290         put("Cipher.PBEWithHMacTigerAndSerpent",
291             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Serpent.class.getName());
292         put("Cipher.PBEWithHMacTigerAndSquare",
293             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Square.class.getName());
294         put("Cipher.PBEWithHMacTigerAndTripleDES",
295             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.TripleDES.class.getName());
296         put("Cipher.PBEWithHMacTigerAndTwofish",
297             gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Twofish.class.getName());
298
299         put("Cipher.PBEWithHMacWhirlpoolAndAES",
300             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.AES.class.getName());
301         put("Cipher.PBEWithHMacWhirlpoolAndAnubis",
302             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Anubis.class.getName());
303         put("Cipher.PBEWithHMacWhirlpoolAndBlowfish",
304             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Blowfish.class.getName());
305         put("Cipher.PBEWithHMacWhirlpoolAndCast5",
306             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Cast5.class.getName());
307         put("Cipher.PBEWithHMacWhirlpoolAndDES",
308             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.DES.class.getName());
309         put("Cipher.PBEWithHMacWhirlpoolAndKhazad",
310             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Khazad.class.getName());
311         put("Cipher.PBEWithHMacWhirlpoolAndSerpent",
312             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Serpent.class.getName());
313         put("Cipher.PBEWithHMacWhirlpoolAndSquare",
314             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Square.class.getName());
315         put("Cipher.PBEWithHMacWhirlpoolAndTripleDES",
316             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.TripleDES.class.getName());
317         put("Cipher.PBEWithHMacWhirlpoolAndTwofish",
318             gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Twofish.class.getName());
319
320         // Key Wrapping Algorithm cipher
321         put("Cipher." + Registry.AES128_KWA,
322             gnu.javax.crypto.jce.cipher.AES128KeyWrapSpi.class.getName());
323         put("Cipher." + Registry.AES192_KWA,
324             gnu.javax.crypto.jce.cipher.AES192KeyWrapSpi.class.getName());
325         put("Cipher." + Registry.AES256_KWA,
326             gnu.javax.crypto.jce.cipher.AES256KeyWrapSpi.class.getName());
327         put("Cipher." + Registry.TRIPLEDES_KWA,
328             gnu.javax.crypto.jce.cipher.TripleDESKeyWrapSpi.class.getName());
329
330         // SecretKeyFactory interface to PBKDF2.
331         put("SecretKeyFactory.PBKDF2WithHMacHaval",
332             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacHaval.class.getName());
333         put("SecretKeyFactory.PBKDF2WithHMacMD2",
334             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD2.class.getName());
335         put("SecretKeyFactory.PBKDF2WithHMacMD4",
336             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD4.class.getName());
337         put("SecretKeyFactory.PBKDF2WithHMacMD5",
338             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD5.class.getName());
339         put("SecretKeyFactory.PBKDF2WithHMacSHA1",
340             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA1.class.getName());
341         put("SecretKeyFactory.PBKDF2WithHMacSHA256",
342             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA256.class.getName());
343         put("SecretKeyFactory.PBKDF2WithHMacSHA384",
344             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA384.class.getName());
345         put("SecretKeyFactory.PBKDF2WithHMacSHA512",
346             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA512.class.getName());
347         put("SecretKeyFactory.PBKDF2WithHMacTiger",
348             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacTiger.class.getName());
349         put("SecretKeyFactory.PBKDF2WithHMacWhirlpool",
350             gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacWhirlpool.class.getName());
351
352         // Simple SecretKeyFactory implementations.
353         put("SecretKeyFactory.Anubis",
354             gnu.javax.crypto.jce.key.AnubisSecretKeyFactoryImpl.class.getName());
355         put("SecretKeyFactory.Blowfish",
356             gnu.javax.crypto.jce.key.BlowfishSecretKeyFactoryImpl.class.getName());
357         put("SecretKeyFactory.Cast5",
358             gnu.javax.crypto.jce.key.Cast5SecretKeyFactoryImpl.class.getName());
359         put("SecretKeyFactory.DES",
360             gnu.javax.crypto.jce.key.DESSecretKeyFactoryImpl.class.getName());
361         put("SecretKeyFactory.Khazad",
362             gnu.javax.crypto.jce.key.KhazadSecretKeyFactoryImpl.class.getName());
363         put("SecretKeyFactory.Rijndael",
364             gnu.javax.crypto.jce.key.RijndaelSecretKeyFactoryImpl.class.getName());
365         put("SecretKeyFactory.Serpent",
366             gnu.javax.crypto.jce.key.SerpentSecretKeyFactoryImpl.class.getName());
367         put("SecretKeyFactory.Square",
368             gnu.javax.crypto.jce.key.SquareSecretKeyFactoryImpl.class.getName());
369         put("SecretKeyFactory.TripleDES",
370             gnu.javax.crypto.jce.key.DESedeSecretKeyFactoryImpl.class.getName());
371         put("Alg.Alias.SecretKeyFactory.AES", "Rijndael");
372         put("Alg.Alias.SecretKeyFactory.DESede", "TripleDES");
373         put("Alg.Alias.SecretKeyFactory.3-DES", "TripleDES");
374         put("Alg.Alias.SecretKeyFactory.3DES", "TripleDES");
375
376         put("AlgorithmParameters.BlockCipherParameters",
377             gnu.javax.crypto.jce.params.BlockCipherParameters.class.getName());
378         put("Alg.Alias.AlgorithmParameters.Anubis", "BlockCipherParameters");
379         put("Alg.Alias.AlgorithmParameters.Blowfish", "BlockCipherParameters");
380         put("Alg.Alias.AlgorithmParameters.Cast5", "BlockCipherParameters");
381         put("Alg.Alias.AlgorithmParameters.DES", "BlockCipherParameters");
382         put("Alg.Alias.AlgorithmParameters.Khazad", "BlockCipherParameters");
383         put("Alg.Alias.AlgorithmParameters.Rijndael", "BlockCipherParameters");
384         put("Alg.Alias.AlgorithmParameters.AES", "BlockCipherParameters");
385         put("Alg.Alias.AlgorithmParameters.Serpent", "BlockCipherParameters");
386         put("Alg.Alias.AlgorithmParameters.Square", "BlockCipherParameters");
387         put("Alg.Alias.AlgorithmParameters.TripleDES", "BlockCipherParameters");
388         put("Alg.Alias.AlgorithmParameters.DESede", "BlockCipherParameters");
389         put("Alg.Alias.AlgorithmParameters.3-DES", "BlockCipherParameters");
390         put("Alg.Alias.AlgorithmParameters.3DES", "BlockCipherParameters");
391
392         // KeyGenerator Adapter implementations
393         put("KeyGenerator.Anubis",
394             gnu.javax.crypto.jce.key.AnubisKeyGeneratorImpl.class.getName());
395         put("KeyGenerator.Blowfish",
396             gnu.javax.crypto.jce.key.BlowfishKeyGeneratorImpl.class.getName());
397         put("KeyGenerator.Cast5",
398             gnu.javax.crypto.jce.key.Cast5KeyGeneratorImpl.class.getName());
399         put("KeyGenerator.DES",
400             gnu.javax.crypto.jce.key.DESKeyGeneratorImpl.class.getName());
401         put("KeyGenerator.Khazad",
402             gnu.javax.crypto.jce.key.KhazadKeyGeneratorImpl.class.getName());
403         put("KeyGenerator.Rijndael",
404             gnu.javax.crypto.jce.key.RijndaelKeyGeneratorImpl.class.getName());
405         put("KeyGenerator.Serpent",
406             gnu.javax.crypto.jce.key.SerpentKeyGeneratorImpl.class.getName());
407         put("KeyGenerator.Square",
408             gnu.javax.crypto.jce.key.SquareKeyGeneratorImpl.class.getName());
409         put("KeyGenerator.TripleDES",
410             gnu.javax.crypto.jce.key.TripleDESKeyGeneratorImpl.class.getName());
411         put("Alg.Alias.KeyGenerator.AES", "Rijndael");
412         put("Alg.Alias.KeyGenerator.DESede", "TripleDES");
413         put("Alg.Alias.KeyGenerator.3-DES", "TripleDES");
414         put("Alg.Alias.KeyGenerator.3DES", "TripleDES");
415
416         // MAC
417         put("Mac.HMAC-MD2", gnu.javax.crypto.jce.mac.HMacMD2Spi.class.getName());
418         put("Mac.HMAC-MD4", gnu.javax.crypto.jce.mac.HMacMD4Spi.class.getName());
419         put("Mac.HMAC-MD5", gnu.javax.crypto.jce.mac.HMacMD5Spi.class.getName());
420         put("Mac.HMAC-RIPEMD128",
421             gnu.javax.crypto.jce.mac.HMacRipeMD128Spi.class.getName());
422         put("Mac.HMAC-RIPEMD160",
423             gnu.javax.crypto.jce.mac.HMacRipeMD160Spi.class.getName());
424         put("Mac.HMAC-SHA160",
425             gnu.javax.crypto.jce.mac.HMacSHA160Spi.class.getName());
426         put("Mac.HMAC-SHA256",
427             gnu.javax.crypto.jce.mac.HMacSHA256Spi.class.getName());
428         put("Mac.HMAC-SHA384",
429             gnu.javax.crypto.jce.mac.HMacSHA384Spi.class.getName());
430         put("Mac.HMAC-SHA512",
431             gnu.javax.crypto.jce.mac.HMacSHA512Spi.class.getName());
432         put("Mac.HMAC-TIGER",
433             gnu.javax.crypto.jce.mac.HMacTigerSpi.class.getName());
434         put("Mac.HMAC-HAVAL",
435             gnu.javax.crypto.jce.mac.HMacHavalSpi.class.getName());
436         put("Mac.HMAC-WHIRLPOOL",
437             gnu.javax.crypto.jce.mac.HMacWhirlpoolSpi.class.getName());
438         put("Mac.TMMH16", gnu.javax.crypto.jce.mac.TMMH16Spi.class.getName());
439         put("Mac.UHASH32", gnu.javax.crypto.jce.mac.UHash32Spi.class.getName());
440         put("Mac.UMAC32", gnu.javax.crypto.jce.mac.UMac32Spi.class.getName());
441
442         put("Mac.OMAC-ANUBIS",
443             gnu.javax.crypto.jce.mac.OMacAnubisImpl.class.getName());
444         put("Mac.OMAC-BLOWFISH",
445             gnu.javax.crypto.jce.mac.OMacBlowfishImpl.class.getName());
446         put("Mac.OMAC-CAST5",
447             gnu.javax.crypto.jce.mac.OMacCast5Impl.class.getName());
448         put("Mac.OMAC-DES",
449             gnu.javax.crypto.jce.mac.OMacDESImpl.class.getName());
450         put("Mac.OMAC-KHAZAD",
451             gnu.javax.crypto.jce.mac.OMacKhazadImpl.class.getName());
452         put("Mac.OMAC-RIJNDAEL",
453             gnu.javax.crypto.jce.mac.OMacRijndaelImpl.class.getName());
454         put("Mac.OMAC-SERPENT",
455             gnu.javax.crypto.jce.mac.OMacSerpentImpl.class.getName());
456         put("Mac.OMAC-SQUARE",
457             gnu.javax.crypto.jce.mac.OMacSquareImpl.class.getName());
458         put("Mac.OMAC-TRIPLEDES",
459             gnu.javax.crypto.jce.mac.OMacTripleDESImpl.class.getName());
460         put("Mac.OMAC-TWOFISH",
461             gnu.javax.crypto.jce.mac.OMacTwofishImpl.class.getName());
462
463         // Aliases
464         put("Alg.Alias.AlgorithmParameters.AES", "BlockCipherParameters");
465         put("Alg.Alias.AlgorithmParameters.BLOWFISH", "BlockCipherParameters");
466         put("Alg.Alias.AlgorithmParameters.ANUBIS", "BlockCipherParameters");
467         put("Alg.Alias.AlgorithmParameters.KHAZAD", "BlockCipherParameters");
468         put("Alg.Alias.AlgorithmParameters.NULL", "BlockCipherParameters");
469         put("Alg.Alias.AlgorithmParameters.RIJNDAEL", "BlockCipherParameters");
470         put("Alg.Alias.AlgorithmParameters.SERPENT", "BlockCipherParameters");
471         put("Alg.Alias.AlgorithmParameters.SQUARE", "BlockCipherParameters");
472         put("Alg.Alias.AlgorithmParameters.TWOFISH", "BlockCipherParameters");
473         put("Alg.Alias.Cipher.RC4", "ARCFOUR");
474         put("Alg.Alias.Cipher.3-DES", "TRIPLEDES");
475         put("Alg.Alias.Cipher.3DES", "TRIPLEDES");
476         put("Alg.Alias.Cipher.DES-EDE", "TRIPLEDES");
477         put("Alg.Alias.Cipher.DESede", "TRIPLEDES");
478         put("Alg.Alias.Cipher.CAST128", "CAST5");
479         put("Alg.Alias.Cipher.CAST-128", "CAST5");
480         put("Alg.Alias.Mac.HMAC-SHS", "HMAC-SHA160");
481         put("Alg.Alias.Mac.HMAC-SHA", "HMAC-SHA160");
482         put("Alg.Alias.Mac.HMAC-SHA1", "HMAC-SHA160");
483         put("Alg.Alias.Mac.HMAC-SHA-160", "HMAC-SHA160");
484         put("Alg.Alias.Mac.HMAC-SHA-256", "HMAC-SHA256");
485         put("Alg.Alias.Mac.HMAC-SHA-384", "HMAC-SHA384");
486         put("Alg.Alias.Mac.HMAC-SHA-512", "HMAC-SHA512");
487         put("Alg.Alias.Mac.HMAC-RIPEMD-160", "HMAC-RIPEMD160");
488         put("Alg.Alias.Mac.HMAC-RIPEMD-128", "HMAC-RIPEMD128");
489         put("Alg.Alias.Mac.OMAC-AES", "OMAC-RIJNDAEL");
490         put("Alg.Alias.Mac.OMAC-3DES", "OMAC-3DES");
491         put("Alg.Alias.Mac.HmacMD4", "HMAC-MD4");
492         put("Alg.Alias.Mac.HmacMD5", "HMAC-MD5");
493         put("Alg.Alias.Mac.HmacSHA-1", "HMAC-SHA-1");
494         put("Alg.Alias.Mac.HmacSHA1", "HMAC-SHA1");
495         put("Alg.Alias.Mac.HmacSHA-160", "HMAC-SHA-160");
496         put("Alg.Alias.Mac.HmacSHA160", "HMAC-SHA-160");
497         put("Alg.Alias.Mac.HmacSHA-256", "HMAC-SHA-256");
498         put("Alg.Alias.Mac.HmacSHA256", "HMAC-SHA-256");
499         put("Alg.Alias.Mac.HmacSHA-384", "HMAC-SHA-384");
500         put("Alg.Alias.Mac.HmacSHA384", "HMAC-SHA-384");
501         put("Alg.Alias.Mac.HmacSHA-512", "HMAC-SHA-512");
502         put("Alg.Alias.Mac.HmacSHA512", "HMAC-SHA-512");
503         put("Alg.Alias.Mac.HmacRIPEMD128", "HMAC-RIPEMD128");
504         put("Alg.Alias.Mac.HmacRIPEMD-128", "HMAC-RIPEMD128");
505         put("Alg.Alias.Mac.HmacRIPEMD160", "HMAC-RIPEMD160");
506         put("Alg.Alias.Mac.HmacRIPEMD-160", "HMAC-RIPEMD160");
507         put("Alg.Alias.Mac.HmacTiger", "HMAC-TIGER");
508         put("Alg.Alias.Mac.HmacHaval", "HMAC-HAVAL");
509         put("Alg.Alias.Mac.HmacWhirlpool", "HMAC-WHIRLPOOL");
510
511         // KeyAgreement
512         put("KeyAgreement.DH",
513             gnu.javax.crypto.jce.DiffieHellmanImpl.class.getName());
514         put("Alg.Alias.KeyAgreement.DiffieHellman", "DH");
515
516         // Cipher
517         put("Cipher.RSAES-PKCS1-v1_5",
518             gnu.javax.crypto.RSACipherImpl.class.getName());
519         put("Alg.Alias.Cipher.RSA", "RSAES-PKCS1-v1_5");
520
521         // SecureRandom
522         put("SecureRandom.ARCFOUR",
523             gnu.javax.crypto.jce.prng.ARCFourRandomSpi.class.getName());
524         put("SecureRandom.ARCFOUR ImplementedIn", "Software");
525         put("SecureRandom.CSPRNG",
526             gnu.javax.crypto.jce.prng.CSPRNGSpi.class.getName());
527         put("SecureRandom.CSPRNG ImplementedIn", "Software");
528         put("SecureRandom.ICM",
529             gnu.javax.crypto.jce.prng.ICMRandomSpi.class.getName());
530         put("SecureRandom.ICM ImplementedIn", "Software");
531         put("SecureRandom.UMAC-KDF",
532             gnu.javax.crypto.jce.prng.UMacRandomSpi.class.getName());
533         put("SecureRandom.UMAC-KDF ImplementedIn", "Software");
534         put("SecureRandom.Fortuna",
535             gnu.javax.crypto.jce.prng.FortunaImpl.class.getName());
536         put("SecureRandom.Fortuna ImplementedIn", "Software");
537
538         // KeyStore
539         put("KeyStore.GKR",
540             gnu.javax.crypto.jce.keyring.GnuKeyring.class.getName());
541         put("Alg.Alias.KeyStore.GnuKeyring", "GKR");
542
543         // KeyPairGenerator ---------------------------------------------------
544         put("KeyPairGenerator.DH",
545             gnu.javax.crypto.jce.sig.DHKeyPairGeneratorSpi.class.getName());
546         put("KeyPairGenerator.DH KeySize", "512");
547         put("KeyPairGenerator.DH ImplementedIn", "Software");
548
549         put("Alg.Alias.KeyPairGenerator.DiffieHellman", "DH");
550
551         // KeyFactory ---------------------------------------------------------
552         put("KeyFactory.DH",
553             gnu.javax.crypto.jce.sig.DHKeyFactory.class.getName());
554
555         put("Alg.Alias,KeyFactory.DiffieHellman", "DH");
556
557         // Algorithm Parameters -----------------------------------------------
558         put("AlgorithmParameters.DH",
559             gnu.javax.crypto.jce.sig.DHParameters.class.getName());
560
561         put("Alg.Alias.AlgorithmParameters.DiffieHellman", "DH");
562
563         // Algorithm Parameters Generator -------------------------------------
564         put("AlgorithmParameterGenerator.DH",
565             gnu.javax.crypto.jce.sig.DHParametersGenerator.class.getName());
566
567         put("Alg.Alias.AlgorithmParameterGenerator.DiffieHellman", "DH");
568
569         return null;
570       }
571     });
572   }
573
574   /**
575    * Returns a {@link Set} of names of symmetric key block cipher algorithms
576    * available from this {@link Provider}.
577    * 
578    * @return a {@link Set} of cipher names (Strings).
579    */
580   public static final Set getCipherNames()
581   {
582     HashSet s = new HashSet();
583     s.addAll(CipherFactory.getNames());
584     s.add(Registry.ARCFOUR_PRNG);
585     return s;
586   }
587
588   /**
589    * Returns a {@link Set} of names of MAC algorithms available from this
590    * {@link Provider}.
591    * 
592    * @return a {@link Set} of MAC names (Strings).
593    */
594   public static final Set getMacNames()
595   {
596     return MacFactory.getNames();
597   }
598 }