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