1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.security.rsa;
  27 
  28 import java.util.Map;
  29 
  30 /**
  31  * Defines the entries of the SunRsaSign provider.
  32  *
  33  * @author  Andreas Sterbenz
  34  */
  35 public final class SunRsaSignEntries {
  36 
  37     private SunRsaSignEntries() {
  38         // empty
  39     }
  40 
  41     public static void putEntries(Map<Object, Object> map) {
  42 
  43         // main algorithms
  44         map.put("KeyFactory.RSA",
  45                 "sun.security.rsa.RSAKeyFactory$Legacy");
  46         map.put("KeyPairGenerator.RSA",
  47                 "sun.security.rsa.RSAKeyPairGenerator$Legacy");
  48         map.put("Signature.MD2withRSA",
  49                 "sun.security.rsa.RSASignature$MD2withRSA");
  50         map.put("Signature.MD5withRSA",
  51                 "sun.security.rsa.RSASignature$MD5withRSA");
  52         map.put("Signature.SHA1withRSA",
  53                 "sun.security.rsa.RSASignature$SHA1withRSA");
  54         map.put("Signature.SHA224withRSA",
  55                 "sun.security.rsa.RSASignature$SHA224withRSA");
  56         map.put("Signature.SHA256withRSA",
  57                 "sun.security.rsa.RSASignature$SHA256withRSA");
  58         map.put("Signature.SHA384withRSA",
  59                 "sun.security.rsa.RSASignature$SHA384withRSA");
  60         map.put("Signature.SHA512withRSA",
  61                 "sun.security.rsa.RSASignature$SHA512withRSA");
  62         map.put("Signature.SHA512/224withRSA",
  63                 "sun.security.rsa.RSASignature$SHA512_224withRSA");
  64         map.put("Signature.SHA512/256withRSA",
  65                 "sun.security.rsa.RSASignature$SHA512_256withRSA");
  66 
  67         map.put("KeyFactory.RSASSA-PSS",
  68                 "sun.security.rsa.RSAKeyFactory$PSS");
  69         map.put("KeyPairGenerator.RSASSA-PSS",
  70                 "sun.security.rsa.RSAKeyPairGenerator$PSS");
  71         map.put("Signature.RSASSA-PSS",
  72                 "sun.security.rsa.RSAPSSSignature");
  73         map.put("AlgorithmParameters.RSASSA-PSS",
  74                 "sun.security.rsa.PSSParameters");
  75 
  76         // attributes for supported key classes
  77         String rsaKeyClasses = "java.security.interfaces.RSAPublicKey" +
  78                 "|java.security.interfaces.RSAPrivateKey";
  79         map.put("Signature.MD2withRSA SupportedKeyClasses", rsaKeyClasses);
  80         map.put("Signature.MD5withRSA SupportedKeyClasses", rsaKeyClasses);
  81         map.put("Signature.SHA1withRSA SupportedKeyClasses", rsaKeyClasses);
  82         map.put("Signature.SHA224withRSA SupportedKeyClasses", rsaKeyClasses);
  83         map.put("Signature.SHA256withRSA SupportedKeyClasses", rsaKeyClasses);
  84         map.put("Signature.SHA384withRSA SupportedKeyClasses", rsaKeyClasses);
  85         map.put("Signature.SHA512withRSA SupportedKeyClasses", rsaKeyClasses);
  86         map.put("Signature.SHA512/224withRSA SupportedKeyClasses", rsaKeyClasses);
  87         map.put("Signature.SHA512/256withRSA SupportedKeyClasses", rsaKeyClasses);
  88         map.put("Signature.RSASSA-PSS SupportedKeyClasses", rsaKeyClasses);
  89 
  90         // aliases
  91         map.put("Alg.Alias.KeyFactory.1.2.840.113549.1.1",     "RSA");
  92         map.put("Alg.Alias.KeyFactory.OID.1.2.840.113549.1.1", "RSA");
  93 
  94         map.put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1",     "RSA");
  95         map.put("Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.1", "RSA");
  96 
  97         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.2",     "MD2withRSA");
  98         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.2", "MD2withRSA");
  99 
 100         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.4",     "MD5withRSA");
 101         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.4", "MD5withRSA");
 102 
 103         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.5",     "SHA1withRSA");
 104         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.5", "SHA1withRSA");
 105         map.put("Alg.Alias.Signature.1.3.14.3.2.29",            "SHA1withRSA");
 106 
 107         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.14",     "SHA224withRSA");
 108         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.14", "SHA224withRSA");
 109 
 110         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.11",     "SHA256withRSA");
 111         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.11", "SHA256withRSA");
 112 
 113         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.12",     "SHA384withRSA");
 114         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.12", "SHA384withRSA");
 115 
 116         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.13",     "SHA512withRSA");
 117         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.13", "SHA512withRSA");
 118         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.15",     "SHA512/224withRSA");
 119         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.15", "SHA512/224withRSA");
 120         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.16",     "SHA512/256withRSA");
 121         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.16", "SHA512/256withRSA");
 122 
 123         map.put("Alg.Alias.KeyFactory.1.2.840.113549.1.1.10",     "RSASSA-PSS");
 124         map.put("Alg.Alias.KeyFactory.OID.1.2.840.113549.1.1.10", "RSASSA-PSS");
 125 
 126         map.put("Alg.Alias.KeyPairGenerator.1.2.840.113549.1.1.10",     "RSASSA-PSS");
 127         map.put("Alg.Alias.KeyPairGenerator.OID.1.2.840.113549.1.1.10", "RSASSA-PSS");
 128 
 129         map.put("Alg.Alias.Signature.1.2.840.113549.1.1.10",     "RSASSA-PSS");
 130         map.put("Alg.Alias.Signature.OID.1.2.840.113549.1.1.10", "RSASSA-PSS");
 131 
 132         map.put("Alg.Alias.AlgorithmParameters.1.2.840.113549.1.1.10",     "RSASSA-PSS");
 133         map.put("Alg.Alias.AlgorithmParameters.OID.1.2.840.113549.1.1.10", "RSASSA-PSS");
 134     }
 135 }