Path: blob/master/src/java.base/share/classes/sun/security/rsa/SunRsaSignEntries.java
41159 views
/*1* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.security.rsa;2627import java.util.*;28import java.security.Provider;29import static sun.security.util.SecurityProviderConstants.getAliases;3031/**32* Defines the entries of the SunRsaSign provider.33*34* @author Andreas Sterbenz35*/36public final class SunRsaSignEntries {3738private void add(Provider p, String type, String algo, String cn,39List<String> aliases, HashMap<String, String> attrs) {40services.add(new Provider.Service(p, type, algo, cn,41aliases, attrs));42}4344private void addA(Provider p, String type, String algo, String cn,45HashMap<String, String> attrs) {46services.add(new Provider.Service(p, type, algo, cn,47getAliases(algo), attrs));48}4950// extend LinkedHashSet for consistency with SunEntries51// used by sun.security.provider.VerificationProvider52public SunRsaSignEntries(Provider p) {53services = new LinkedHashSet<>(20, 0.9f);5455// start populating content using the specified provider56// common attribute map57HashMap<String, String> attrs = new HashMap<>(3);58attrs.put("SupportedKeyClasses",59"java.security.interfaces.RSAPublicKey" +60"|java.security.interfaces.RSAPrivateKey");6162add(p, "KeyFactory", "RSA",63"sun.security.rsa.RSAKeyFactory$Legacy",64getAliases("PKCS1"), null);65add(p, "KeyPairGenerator", "RSA",66"sun.security.rsa.RSAKeyPairGenerator$Legacy",67getAliases("PKCS1"), null);68addA(p, "Signature", "MD2withRSA",69"sun.security.rsa.RSASignature$MD2withRSA", attrs);70addA(p, "Signature", "MD5withRSA",71"sun.security.rsa.RSASignature$MD5withRSA", attrs);72addA(p, "Signature", "SHA1withRSA",73"sun.security.rsa.RSASignature$SHA1withRSA", attrs);74addA(p, "Signature", "SHA224withRSA",75"sun.security.rsa.RSASignature$SHA224withRSA", attrs);76addA(p, "Signature", "SHA256withRSA",77"sun.security.rsa.RSASignature$SHA256withRSA", attrs);78addA(p, "Signature", "SHA384withRSA",79"sun.security.rsa.RSASignature$SHA384withRSA", attrs);80addA(p, "Signature", "SHA512withRSA",81"sun.security.rsa.RSASignature$SHA512withRSA", attrs);82addA(p, "Signature", "SHA512/224withRSA",83"sun.security.rsa.RSASignature$SHA512_224withRSA", attrs);84addA(p, "Signature", "SHA512/256withRSA",85"sun.security.rsa.RSASignature$SHA512_256withRSA", attrs);86addA(p, "Signature", "SHA3-224withRSA",87"sun.security.rsa.RSASignature$SHA3_224withRSA", attrs);88addA(p, "Signature", "SHA3-256withRSA",89"sun.security.rsa.RSASignature$SHA3_256withRSA", attrs);90addA(p, "Signature", "SHA3-384withRSA",91"sun.security.rsa.RSASignature$SHA3_384withRSA", attrs);92addA(p, "Signature", "SHA3-512withRSA",93"sun.security.rsa.RSASignature$SHA3_512withRSA", attrs);9495addA(p, "KeyFactory", "RSASSA-PSS",96"sun.security.rsa.RSAKeyFactory$PSS", attrs);97addA(p, "KeyPairGenerator", "RSASSA-PSS",98"sun.security.rsa.RSAKeyPairGenerator$PSS", attrs);99addA(p, "Signature", "RSASSA-PSS",100"sun.security.rsa.RSAPSSSignature", attrs);101addA(p, "AlgorithmParameters", "RSASSA-PSS",102"sun.security.rsa.PSSParameters", null);103}104105public Iterator<Provider.Service> iterator() {106return services.iterator();107}108109private LinkedHashSet<Provider.Service> services;110}111112113