Source for gnu.java.security.provider.Gnu

   1: /* Gnu.java --- Gnu provider main class
   2:    Copyright (C) 1999, 2002, 2003, 2005 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., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 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, Diffie-Hellman key agreement and key pair generator");
  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:         put("KeyPairGenerator.DiffieHellman", DiffieHellmanKeyPairGeneratorImpl.class.getName ());
 104: 
 105:         put("Alg.Alias.KeyPairGenerator.OID.1.2.840.10040.4.1", "DSA");
 106:         put("Alg.Alias.KeyPairGenerator.1.2.840.10040.4.1", "DSA");
 107:         put("Alg.Alias.KeyPairGenerator.1.3.14.3.2.12", "DSA");
 108:         put("Alg.Alias.KeyPairGenerator.DH", "DiffieHellman");
 109: 
 110:         // Key Factory
 111:         put("KeyFactory.DSA",
 112:             gnu.java.security.provider.DSAKeyFactory.class.getName());
 113: 
 114:         put("KeyFactory.Encoded", EncodedKeyFactory.class.getName());
 115:         put("KeyFactory.Encoded ImplementedIn", "Software");
 116:         put("Alg.Alias.KeyFactory.X.509", "Encoded");
 117:         put("Alg.Alias.KeyFactory.X509", "Encoded");
 118:         put("Alg.Alias.KeyFactory.PKCS#8", "Encoded");
 119:         put("Alg.Alias.KeyFactory.PKCS8", "Encoded");
 120: 
 121:         put("KeyFactory.RSA", RSAKeyFactory.class.getName());
 122: 
 123:         put("Alg.Alias.KeyFactory.OID.1.2.840.10040.4.1", "DSA");
 124:         put("Alg.Alias.KeyFactory.1.2.840.10040.4.1", "DSA");
 125:         put("Alg.Alias.KeyFactory.1.3.14.3.2.12", "DSA");
 126: 
 127:         put("KeyFactory.DiffieHellman", DiffieHellmanKeyFactoryImpl.class.getName());
 128:         put("Alg.Alias.KeyFactory.DH", "DiffieHellman");
 129: 
 130:         // Message Digests
 131:         put("MessageDigest.SHA", gnu.java.security.provider.SHA.class.getName());
 132:         put("MessageDigest.MD5", gnu.java.security.provider.MD5.class.getName());
 133: 
 134:         // Format "Alias", "Actual Name"
 135:         put("Alg.Alias.MessageDigest.SHA1", "SHA");
 136:         put("Alg.Alias.MessageDigest.SHA-1", "SHA");
 137:         put("Alg.Alias.MessageDigest.SHA-160", "SHA");
 138: 
 139:         // Algorithm Parameters
 140:         put("AlgorithmParameters.DSA",
 141:             gnu.java.security.provider.DSAParameters.class.getName());
 142: 
 143:         put("Alg.Alias.AlgorithmParameters.DSS", "DSA");
 144:         put("Alg.Alias.AlgorithmParameters.SHAwithDSA", "DSA");
 145:         put("Alg.Alias.AlgorithmParameters.OID.1.2.840.10040.4.3", "DSA");
 146:         put("Alg.Alias.AlgorithmParameters.1.2.840.10040.4.3", "DSA");
 147: 
 148:         // Algorithm Parameter Generator
 149:         put("AlgorithmParameterGenerator.DSA",
 150:             gnu.java.security.provider.DSAParameterGenerator.class.getName());
 151: 
 152:         // SecureRandom
 153:         put("SecureRandom.SHA1PRNG",
 154:             gnu.java.security.provider.SHA1PRNG.class.getName());
 155: 
 156:         // CertificateFactory
 157:         put("CertificateFactory.X509", X509CertificateFactory.class.getName());
 158: 
 159:         put("CertificateFactory.X509 ImplementedIn", "Software");
 160:         put("Alg.Alias.CertificateFactory.X.509", "X509");
 161: 
 162:         // CertPathValidator
 163:         put("CertPathValidator.PKIX", PKIXCertPathValidatorImpl.class.getName());
 164:         put("CertPathValidator.PKIX ImplementedIn", "Software");
 165: 
 166:         // CertStore
 167:         put("CertStore.Collection", CollectionCertStoreImpl.class.getName());
 168: 
 169:         // KeyAgreement
 170:         put("KeyAgreement.DiffieHellman", gnu.javax.crypto.DiffieHellmanImpl.class.getName());
 171:         put("Alg.Alias.KeyAgreement.DH", "DiffieHellman");
 172: 
 173:         // Cipher
 174:         put("Cipher.RSAES-PKCS1-v1_5", gnu.javax.crypto.RSACipherImpl.class.getName());
 175:         put("Alg.Alias.Cipher.RSA", "RSAES-PKCS1-v1_5");
 176: 
 177:         return null;
 178:       }
 179:     });
 180:   }
 181: }