OSDN Git Service

02f509dc2d58625e9cb8f44ca8e4dc1ccfecc3dd
[pf3gnuchains/gcc-fork.git] / libjava / gnu / java / security / provider / Gnu.java
1 /* Gnu.java --- Gnu provider main class
2    Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
3
4 This file is 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, or (at your option)
9 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; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 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.java.security.provider;
40
41 import java.security.AccessController;
42 import java.security.PrivilegedAction;
43 import java.security.Provider;
44
45 public final class Gnu extends Provider
46 {
47   public Gnu()
48   {
49     super("GNU", 1.0, "GNU provider v1.0 implementing SHA-1, MD5, DSA, RSA, X.509 Certificates and CRLs, PKIX certificate path validators, Collection cert stores");
50
51     AccessController.doPrivileged (new PrivilegedAction()
52     {
53       public Object run()
54       {
55         // Note that all implementation class names are referenced by using
56         // Class.getName(). That way when we staticly link the Gnu provider
57         // we automatically get all the implementation classes.
58
59         // Signature
60         put("Signature.SHA1withDSA",
61             gnu.java.security.provider.DSASignature.class.getName());
62
63         put("Alg.Alias.Signature.DSS", "SHA1withDSA");
64         put("Alg.Alias.Signature.DSA", "SHA1withDSA");
65         put("Alg.Alias.Signature.SHAwithDSA", "SHA1withDSA");
66         put("Alg.Alias.Signature.DSAwithSHA", "SHA1withDSA");
67         put("Alg.Alias.Signature.DSAwithSHA1", "SHA1withDSA");
68         put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA");
69         put("Alg.Alias.Signature.SHA-1/DSA", "SHA1withDSA");
70         put("Alg.Alias.Signature.SHA1/DSA", "SHA1withDSA");
71         put("Alg.Alias.Signature.OID.1.2.840.10040.4.3", "SHA1withDSA");
72         put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA");
73         put("Alg.Alias.Signature.1.3.14.3.2.13", "SHA1withDSA");
74         put("Alg.Alias.Signature.1.3.14.3.2.27", "SHA1withDSA");
75
76         put("Signature.MD2withRSA", MD2withRSA.class.getName());
77         put("Signature.MD2withRSA ImplementedIn", "Software");
78         put("Alg.Alias.Signature.md2WithRSAEncryption", "MD2withRSA");
79         put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.2", "MD2withRSA");
80         put("Alg.Alias.Signature.1.2.840.113549.1.1.2", "MD2withRSA");
81
82         put("Signature.MD4withRSA", MD4withRSA.class.getName());
83         put("Signature.MD4withRSA ImplementedIn", "Software");
84         put("Alg.Alias.Signature.md4WithRSAEncryption", "MD4withRSA");
85         put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.3", "MD4withRSA");
86         put("Alg.Alias.Signature.1.2.840.113549.1.1.3", "MD4withRSA");
87
88         put("Signature.MD5withRSA", MD5withRSA.class.getName());
89         put("Signature.MD5withRSA ImplementedIn", "Software");
90         put("Alg.Alias.Signature.md5WithRSAEncryption", "MD5withRSA");
91         put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.4", "MD5withRSA");
92         put("Alg.Alias.Signature.1.2.840.113549.1.1.4", "MD5withRSA");
93
94         put("Signature.SHA1withRSA", SHA1withRSA.class.getName());
95         put("Signature.SHA1withRSA ImplementedIn", "Software");
96         put("Alg.Alias.Signature.sha-1WithRSAEncryption", "SHA1withRSA");
97         put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.5", "SHA1withRSA");
98         put("Alg.Alias.Signature.1.2.840.113549.1.1.5", "SHA1withRSA");
99
100         // Key Pair Generator
101         put("KeyPairGenerator.DSA",
102             gnu.java.security.provider.DSAKeyPairGenerator.class.getName());
103
104         put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
105         put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
106         put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
107
108         // Key Factory
109         put("KeyFactory.DSA",
110             gnu.java.security.provider.DSAKeyFactory.class.getName());
111
112         put("KeyFactory.Encoded", EncodedKeyFactory.class.getName());
113         put("KeyFactory.Encoded ImplementedIn", "Software");
114         put("Alg.Alias.KeyFactory.X.509", "Encoded");
115         put("Alg.Alias.KeyFactory.X509", "Encoded");
116         put("Alg.Alias.KeyFactory.PKCS#8", "Encoded");
117         put("Alg.Alias.KeyFactory.PKCS8", "Encoded");
118
119         put("KeyFactory.RSA", RSAKeyFactory.class.getName());
120
121         put("Alg.Alias.KeyFactory.OID.1.2.840.10040.4.1", "DSA");
122         put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
123         put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
124
125         // Message Digests
126         put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName());
127         put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName());
128
129         // Format "Alias", "Actual Name"
130         put("Alg.Alias.MessageDigest.SHA1", "SHA");
131         put("Alg.Alias.MessageDigest.SHA-1", "SHA");
132
133         // Algorithm Parameters
134         put("AlgorithmParameters.DSA",
135             gnu.java.security.provider.DSAParameters.class.getName());
136
137         put("Alg.Alias.AlgorithmParameters.DSS", "DSA");
138         put("Alg.Alias.AlgorithmParameters.SHAwithDSA", "DSA");
139         put("Alg.Alias.AlgorithmParameters.OID.1.2.840.10040.4.3", "DSA");
140         put("Alg.Alias.AlgorithmParameters.1.2.840.10040.4.3", "DSA");
141
142         // Algorithm Parameter Generator
143         put("AlgorithmParameterGenerator.DSA",
144             gnu.java.security.provider.DSAParameterGenerator.class.getName());
145
146         // SecureRandom
147         put("SecureRandom.SHA1PRNG",
148             gnu.java.security.provider.SHA1PRNG.class.getName());
149
150         // CertificateFactory
151         put("CertificateFactory.X509", X509CertificateFactory.class.getName());
152
153         put("CertificateFactory.X509 ImplementedIn", "Software");
154         put("Alg.Alias.CertificateFactory.X.509", "X509");
155
156         // CertPathValidator
157         put("CertPathValidator.PKIX", PKIXCertPathValidatorImpl.class.getName());
158         put("CertPathValidator.PKIX ImplementedIn", "Software");
159
160         // CertStore
161         put("CertStore.Collection", CollectionCertStoreImpl.class.getName());
162
163         return null;
164       }
165     });
166   }
167 }