0N/A/*
2362N/A * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage sun.security.provider;
0N/A
0N/Aimport java.util.Map;
0N/Aimport java.security.*;
0N/A
0N/A/**
0N/A * Defines the entries of the SUN provider.
0N/A *
0N/A * Algorithms supported, and their names:
0N/A *
0N/A * - SHA is the message digest scheme described in FIPS 180-1.
0N/A * Aliases for SHA are SHA-1 and SHA1.
0N/A *
0N/A * - SHA1withDSA is the signature scheme described in FIPS 186.
0N/A * (SHA used in DSA is SHA-1: FIPS 186 with Change No 1.)
0N/A * Aliases for SHA1withDSA are DSA, DSS, SHA/DSA, SHA-1/DSA, SHA1/DSA,
0N/A * SHAwithDSA, DSAWithSHA1, and the object
0N/A * identifier strings "OID.1.3.14.3.2.13", "OID.1.3.14.3.2.27" and
0N/A * "OID.1.2.840.10040.4.3".
0N/A *
0N/A * - DSA is the key generation scheme as described in FIPS 186.
0N/A * Aliases for DSA include the OID strings "OID.1.3.14.3.2.12"
0N/A * and "OID.1.2.840.10040.4.1".
0N/A *
0N/A * - MD5 is the message digest scheme described in RFC 1321.
0N/A * There are no aliases for MD5.
0N/A *
0N/A * - X.509 is the certificate factory type for X.509 certificates
0N/A * and CRLs. Aliases for X.509 are X509.
0N/A *
0N/A * - PKIX is the certification path validation algorithm described
0N/A * in RFC 3280. The ValidationAlgorithm attribute notes the
0N/A * specification that this provider implements.
0N/A *
0N/A * - LDAP is the CertStore type for LDAP repositories. The
0N/A * LDAPSchema attribute notes the specification defining the
0N/A * schema that this provider uses to find certificates and CRLs.
0N/A *
0N/A * - JavaPolicy is the default file-based Policy type.
0N/A *
0N/A * - JavaLoginConfig is the default file-based LoginModule Configuration type.
0N/A */
0N/A
0N/Afinal class SunEntries {
0N/A
0N/A private SunEntries() {
0N/A // empty
0N/A }
0N/A
0N/A static void putEntries(Map<Object, Object> map) {
0N/A
0N/A /*
0N/A * SecureRandom
0N/A *
0N/A * Register these first to speed up "new SecureRandom()",
0N/A * which iterates through the list of algorithms
0N/A */
0N/A // register the native PRNG, if available
0N/A // if user selected /dev/urandom, we put it before SHA1PRNG,
0N/A // otherwise after it
0N/A boolean nativeAvailable = NativePRNG.isAvailable();
0N/A boolean useUrandom = seedSource.equals(URL_DEV_URANDOM);
0N/A if (nativeAvailable && useUrandom) {
0N/A map.put("SecureRandom.NativePRNG",
0N/A "sun.security.provider.NativePRNG");
0N/A }
0N/A map.put("SecureRandom.SHA1PRNG",
0N/A "sun.security.provider.SecureRandom");
0N/A if (nativeAvailable && !useUrandom) {
0N/A map.put("SecureRandom.NativePRNG",
0N/A "sun.security.provider.NativePRNG");
0N/A }
0N/A
0N/A /*
0N/A * Signature engines
0N/A */
0N/A map.put("Signature.SHA1withDSA", "sun.security.provider.DSA$SHA1withDSA");
0N/A map.put("Signature.NONEwithDSA", "sun.security.provider.DSA$RawDSA");
0N/A map.put("Alg.Alias.Signature.RawDSA", "NONEwithDSA");
0N/A
0N/A String dsaKeyClasses = "java.security.interfaces.DSAPublicKey" +
0N/A "|java.security.interfaces.DSAPrivateKey";
0N/A map.put("Signature.SHA1withDSA SupportedKeyClasses", dsaKeyClasses);
0N/A map.put("Signature.NONEwithDSA SupportedKeyClasses", dsaKeyClasses);
0N/A
0N/A map.put("Alg.Alias.Signature.DSA", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.DSS", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.SHA/DSA", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.SHA-1/DSA", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.SHA1/DSA", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.SHAwithDSA", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.DSAWithSHA1", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.OID.1.2.840.10040.4.3",
0N/A "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.1.2.840.10040.4.3", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.1.3.14.3.2.13", "SHA1withDSA");
0N/A map.put("Alg.Alias.Signature.1.3.14.3.2.27", "SHA1withDSA");
0N/A
0N/A /*
0N/A * Key Pair Generator engines
0N/A */
0N/A map.put("KeyPairGenerator.DSA",
0N/A "sun.security.provider.DSAKeyPairGenerator");
0N/A map.put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
0N/A map.put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
0N/A map.put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
0N/A
0N/A /*
0N/A * Digest engines
0N/A */
0N/A map.put("MessageDigest.MD2", "sun.security.provider.MD2");
0N/A map.put("MessageDigest.MD5", "sun.security.provider.MD5");
0N/A map.put("MessageDigest.SHA", "sun.security.provider.SHA");
0N/A
0N/A map.put("Alg.Alias.MessageDigest.SHA-1", "SHA");
0N/A map.put("Alg.Alias.MessageDigest.SHA1", "SHA");
0N/A
0N/A map.put("MessageDigest.SHA-256", "sun.security.provider.SHA2");
0N/A map.put("MessageDigest.SHA-384", "sun.security.provider.SHA5$SHA384");
0N/A map.put("MessageDigest.SHA-512", "sun.security.provider.SHA5$SHA512");
0N/A
0N/A /*
0N/A * Algorithm Parameter Generator engines
0N/A */
0N/A map.put("AlgorithmParameterGenerator.DSA",
0N/A "sun.security.provider.DSAParameterGenerator");
0N/A
0N/A /*
0N/A * Algorithm Parameter engines
0N/A */
0N/A map.put("AlgorithmParameters.DSA",
0N/A "sun.security.provider.DSAParameters");
0N/A map.put("Alg.Alias.AlgorithmParameters.1.3.14.3.2.12", "DSA");
0N/A map.put("Alg.Alias.AlgorithmParameters.1.2.840.10040.4.1", "DSA");
0N/A
0N/A /*
0N/A * Key factories
0N/A */
0N/A map.put("KeyFactory.DSA", "sun.security.provider.DSAKeyFactory");
0N/A map.put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
0N/A map.put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
0N/A
0N/A /*
0N/A * Certificates
0N/A */
0N/A map.put("CertificateFactory.X.509",
0N/A "sun.security.provider.X509Factory");
0N/A map.put("Alg.Alias.CertificateFactory.X509", "X.509");
0N/A
0N/A /*
0N/A * KeyStore
0N/A */
0N/A map.put("KeyStore.JKS", "sun.security.provider.JavaKeyStore$JKS");
0N/A map.put("KeyStore.CaseExactJKS",
0N/A "sun.security.provider.JavaKeyStore$CaseExactJKS");
0N/A
0N/A /*
0N/A * Policy
0N/A */
0N/A map.put("Policy.JavaPolicy", "sun.security.provider.PolicySpiFile");
0N/A
0N/A /*
0N/A * Configuration
0N/A */
0N/A map.put("Configuration.JavaLoginConfig",
0N/A "sun.security.provider.ConfigSpiFile");
0N/A
0N/A /*
0N/A * CertPathBuilder
0N/A */
0N/A map.put("CertPathBuilder.PKIX",
0N/A "sun.security.provider.certpath.SunCertPathBuilder");
0N/A map.put("CertPathBuilder.PKIX ValidationAlgorithm",
0N/A "RFC3280");
0N/A
0N/A /*
0N/A * CertPathValidator
0N/A */
0N/A map.put("CertPathValidator.PKIX",
0N/A "sun.security.provider.certpath.PKIXCertPathValidator");
0N/A map.put("CertPathValidator.PKIX ValidationAlgorithm",
0N/A "RFC3280");
0N/A
0N/A /*
0N/A * CertStores
0N/A */
0N/A map.put("CertStore.LDAP",
1746N/A "sun.security.provider.certpath.ldap.LDAPCertStore");
0N/A map.put("CertStore.LDAP LDAPSchema", "RFC2587");
0N/A map.put("CertStore.Collection",
0N/A "sun.security.provider.certpath.CollectionCertStore");
0N/A map.put("CertStore.com.sun.security.IndexedCollection",
0N/A "sun.security.provider.certpath.IndexedCollectionCertStore");
0N/A
0N/A /*
0N/A * KeySize
0N/A */
0N/A map.put("Signature.SHA1withDSA KeySize", "1024");
0N/A map.put("KeyPairGenerator.DSA KeySize", "1024");
0N/A map.put("AlgorithmParameterGenerator.DSA KeySize", "1024");
0N/A
0N/A /*
0N/A * Implementation type: software or hardware
0N/A */
0N/A map.put("Signature.SHA1withDSA ImplementedIn", "Software");
0N/A map.put("KeyPairGenerator.DSA ImplementedIn", "Software");
0N/A map.put("MessageDigest.MD5 ImplementedIn", "Software");
0N/A map.put("MessageDigest.SHA ImplementedIn", "Software");
0N/A map.put("AlgorithmParameterGenerator.DSA ImplementedIn",
0N/A "Software");
0N/A map.put("AlgorithmParameters.DSA ImplementedIn", "Software");
0N/A map.put("KeyFactory.DSA ImplementedIn", "Software");
0N/A map.put("SecureRandom.SHA1PRNG ImplementedIn", "Software");
0N/A map.put("CertificateFactory.X.509 ImplementedIn", "Software");
0N/A map.put("KeyStore.JKS ImplementedIn", "Software");
0N/A map.put("CertPathValidator.PKIX ImplementedIn", "Software");
0N/A map.put("CertPathBuilder.PKIX ImplementedIn", "Software");
0N/A map.put("CertStore.LDAP ImplementedIn", "Software");
0N/A map.put("CertStore.Collection ImplementedIn", "Software");
0N/A map.put("CertStore.com.sun.security.IndexedCollection ImplementedIn",
0N/A "Software");
0N/A
0N/A }
0N/A
0N/A // name of the *System* property, takes precedence over PROP_RNDSOURCE
0N/A private final static String PROP_EGD = "java.security.egd";
0N/A // name of the *Security* property
0N/A private final static String PROP_RNDSOURCE = "securerandom.source";
0N/A
0N/A final static String URL_DEV_RANDOM = "file:/dev/random";
0N/A final static String URL_DEV_URANDOM = "file:/dev/urandom";
0N/A
0N/A private static final String seedSource;
0N/A
0N/A static {
0N/A seedSource = AccessController.doPrivileged(
0N/A new PrivilegedAction<String>() {
0N/A
0N/A public String run() {
0N/A String egdSource = System.getProperty(PROP_EGD, "");
0N/A if (egdSource.length() != 0) {
0N/A return egdSource;
0N/A }
0N/A egdSource = Security.getProperty(PROP_RNDSOURCE);
0N/A if (egdSource == null) {
0N/A return "";
0N/A }
0N/A return egdSource;
0N/A }
0N/A });
0N/A }
0N/A
0N/A static String getSeedSource() {
0N/A return seedSource;
0N/A }
0N/A
0N/A}