001: /*
002: * @(#)Sun.java 1.4 06/10/10
003: *
004: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: *
026: */
027:
028: /*
029: * Note that there are three versions of the Sun security provider
030: * in this tree: this subsetted one for the CDC/FP, one for the
031: * CDC/FP optional security package, and a severely subsetted
032: * one for CDC. Make sure you're editing the right one!
033: */
034:
035: package sun.security.provider;
036:
037: import java.io.*;
038: import java.util.*;
039: import java.security.*;
040:
041: /**
042: * The SUN Security Provider.
043: *
044: * @author Benjamin Renaud
045: *
046: * @version 1.30, 02/02/00
047: */
048:
049: /**
050: * Defines the SUN provider.
051: *
052: * Algorithms supported, and their names:
053: *
054: * - SHA is the message digest scheme described in FIPS 180-1.
055: * Aliases for SHA are SHA-1 and SHA1.
056: *
057: * - SHA1withDSA is the signature scheme described in FIPS 186.
058: * (SHA used in DSA is SHA-1: FIPS 186 with Change No 1.)
059: * Aliases for SHA1withDSA are DSA, DSS, SHA/DSA, SHA-1/DSA, SHA1/DSA,
060: * SHAwithDSA, DSAWithSHA1, and the object
061: * identifier strings "OID.1.3.14.3.2.13", "OID.1.3.14.3.2.27" and
062: * "OID.1.2.840.10040.4.3".
063: *
064: * - DSA is the key generation scheme as described in FIPS 186.
065: * Aliases for DSA include the OID strings "OID.1.3.14.3.2.12"
066: * and "OID.1.2.840.10040.4.1".
067: *
068: * - MD5 is the message digest scheme described in RFC 1321.
069: * There are no aliases for MD5.
070: *
071: * - X.509 is the certificate factory type for X.509 certificates
072: * and CRLs. Aliases for X.509 are X509.
073: *
074: * - PKIX is the certification path validation algorithm described
075: * in RFC 3280. The ValidationAlgorithm attribute notes the
076: * specification that this provider implements.
077: *
078: * - LDAP is the CertStore type for LDAP repositories. The
079: * LDAPSchema attribute notes the specification defining the
080: * schema that this provider uses to find certificates and CRLs.
081: */
082:
083: public final class Sun extends Provider {
084:
085: private static final String INFO = "SUN "
086: + "(DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; "
087: + "SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; "
088: + "PKIX CertPathBuilder; LDAP, Collection CertStores)";
089:
090: public Sun() {
091: /* We are the SUN provider */
092: super ("SUN", 1.42, INFO);
093:
094: final Map map = new HashMap();
095:
096: /*
097: * Signature engines
098: */
099: map.put("Signature.SHA1withDSA", "sun.security.provider.DSA");
100:
101: map.put("Alg.Alias.Signature.DSA", "SHA1withDSA");
102: map.put("Alg.Alias.Signature.DSS", "SHA1withDSA");
103: map.put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA");
104: map.put("Alg.Alias.Signature.SHA-1/DSA", "SHA1withDSA");
105: map.put("Alg.Alias.Signature.SHA1/DSA", "SHA1withDSA");
106: map.put("Alg.Alias.Signature.SHAwithDSA", "SHA1withDSA");
107: map.put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA");
108: map.put("Alg.Alias.Signature.OID.1.2.840.10040.4.3",
109: "SHA1withDSA");
110: map.put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA");
111: map.put("Alg.Alias.Signature.1.3.14.3.2.13", "SHA1withDSA");
112: map.put("Alg.Alias.Signature.1.3.14.3.2.27", "SHA1withDSA");
113:
114: /*
115: * Key Pair Generator engines
116: */
117: map.put("KeyPairGenerator.DSA",
118: "sun.security.provider.DSAKeyPairGenerator");
119: map.put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1",
120: "DSA");
121: map.put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
122: map.put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
123:
124: /*
125: * Digest engines
126: */
127: map.put("MessageDigest.MD5", "sun.security.provider.MD5");
128: map.put("MessageDigest.SHA", "sun.security.provider.SHA");
129:
130: map.put("Alg.Alias.MessageDigest.SHA-1", "SHA");
131: map.put("Alg.Alias.MessageDigest.SHA1", "SHA");
132:
133: map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2");
134: map.put("MessageDigest.SHA-384", "sun.security.provider.SHA3");
135: map.put("MessageDigest.SHA-512", "sun.security.provider.SHA5");
136:
137: /*
138: * Algorithm Parameter Generator engines
139: */
140: map.put("AlgorithmParameterGenerator.DSA",
141: "sun.security.provider.DSAParameterGenerator");
142:
143: /*
144: * Algorithm Parameter engines
145: */
146: map.put("AlgorithmParameters.DSA",
147: "sun.security.provider.DSAParameters");
148: map.put("Alg.Alias.AlgorithmParameters.1.3.14.3.2.12", "DSA");
149: map.put("Alg.Alias.AlgorithmParameters.1.2.840.10040.4.1",
150: "DSA");
151:
152: /*
153: * Key factories
154: */
155: map
156: .put("KeyFactory.DSA",
157: "sun.security.provider.DSAKeyFactory");
158: map.put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
159: map.put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
160:
161: /*
162: * SecureRandom
163: */
164: map.put("SecureRandom.SHA1PRNG",
165: "sun.security.provider.SecureRandom");
166:
167: /*
168: * Certificates
169: */
170: map.put("CertificateFactory.X.509",
171: "sun.security.provider.X509Factory");
172: map.put("Alg.Alias.CertificateFactory.X509", "X.509");
173:
174: /*
175: * KeyStore
176: */
177: map.put("KeyStore.JKS", "sun.security.provider.JavaKeyStore");
178:
179: /*
180: * CertPathBuilder
181: * Sun provider functionality subsetted for CDC/FP.
182: map.put("CertPathBuilder.PKIX",
183: "sun.security.provider.certpath.SunCertPathBuilder");
184: map.put("CertPathBuilder.PKIX ValidationAlgorithm",
185: "RFC3280");
186: */
187:
188: /*
189: * CertPathValidator
190: * Sun provider functionality subsetted for CDC/FP.
191: map.put("CertPathValidator.PKIX",
192: "sun.security.provider.certpath.PKIXCertPathValidator");
193: map.put("CertPathValidator.PKIX ValidationAlgorithm",
194: "RFC3280");
195: */
196:
197: /*
198: * CertStores
199: * Sun provider functionality subsetted for CDC/FP.
200: map.put("CertStore.LDAP",
201: "sun.security.provider.certpath.LDAPCertStore");
202: map.put("CertStore.LDAP LDAPSchema", "RFC2587");
203: map.put("CertStore.Collection",
204: "sun.security.provider.certpath.CollectionCertStore");
205: map.put("CertStore.com.sun.security.IndexedCollection",
206: "sun.security.provider.certpath.IndexedCollectionCertStore");
207: */
208:
209: /*
210: * KeySize
211: */
212: map.put("Signature.SHA1withDSA KeySize", "1024");
213: map.put("KeyPairGenerator.DSA KeySize", "1024");
214: map.put("AlgorithmParameterGenerator.DSA KeySize", "1024");
215:
216: /*
217: * Implementation type: software or hardware
218: */
219: map.put("Signature.SHA1withDSA ImplementedIn", "Software");
220: map.put("KeyPairGenerator.DSA ImplementedIn", "Software");
221: map.put("MessageDigest.MD5 ImplementedIn", "Software");
222: map.put("MessageDigest.SHA ImplementedIn", "Software");
223: map.put("AlgorithmParameterGenerator.DSA ImplementedIn",
224: "Software");
225: map.put("AlgorithmParameters.DSA ImplementedIn", "Software");
226: map.put("KeyFactory.DSA ImplementedIn", "Software");
227: map.put("SecureRandom.SHA1PRNG ImplementedIn", "Software");
228: map.put("CertificateFactory.X.509 ImplementedIn", "Software");
229: map.put("KeyStore.JKS ImplementedIn", "Software");
230: map.put("CertPathValidator.PKIX ImplementedIn", "Software");
231: map.put("CertPathBuilder.PKIX ImplementedIn", "Software");
232: map.put("CertStore.LDAP ImplementedIn", "Software");
233: /*
234: * Sun provider functionality subsetted for CDC/FP.
235: map.put("CertStore.Collection ImplementedIn", "Software");
236: map.put("CertStore.com.sun.security.IndexedCollection ImplementedIn",
237: "Software");
238: */
239:
240: AccessController
241: .doPrivileged(new java.security.PrivilegedAction() {
242: public Object run() {
243: putAll(map);
244: return null;
245: }
246: });
247: }
248: }
|