Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/ec/SunECEntries.java
38830 views
/*1* Copyright (c) 2009, 2014, 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.ec;2627import java.util.Collection;28import java.util.Map;2930import java.util.regex.Pattern;31import sun.security.util.CurveDB;32import sun.security.util.NamedCurve;3334/**35* Defines the entries of the SunEC provider.36*37* @since 1.738*/39final class SunECEntries {4041private SunECEntries() {42// empty43}4445static void putEntries(Map<Object, Object> map,46boolean useFullImplementation) {4748/*49* Key Factory engine50*/51map.put("KeyFactory.EC", "sun.security.ec.ECKeyFactory");52map.put("Alg.Alias.KeyFactory.EllipticCurve", "EC");5354map.put("KeyFactory.EC ImplementedIn", "Software");5556/*57* Algorithm Parameter engine58*/59map.put("AlgorithmParameters.EC", "sun.security.util.ECParameters");60map.put("Alg.Alias.AlgorithmParameters.EllipticCurve", "EC");61map.put("Alg.Alias.AlgorithmParameters.1.2.840.10045.2.1", "EC");6263map.put("AlgorithmParameters.EC KeySize", "256");6465map.put("AlgorithmParameters.EC ImplementedIn", "Software");6667// "AlgorithmParameters.EC SupportedCurves" prop used by unit test68boolean firstCurve = true;69StringBuilder names = new StringBuilder();70Pattern nameSplitPattern = Pattern.compile(CurveDB.SPLIT_PATTERN);7172Collection<? extends NamedCurve> supportedCurves =73CurveDB.getSupportedCurves();74for (NamedCurve namedCurve : supportedCurves) {75if (!firstCurve) {76names.append("|");77} else {78firstCurve = false;79}8081names.append("[");8283String[] commonNames = nameSplitPattern.split(namedCurve.getName());84for (String commonName : commonNames) {85names.append(commonName.trim());86names.append(",");87}8889names.append(namedCurve.getObjectId());90names.append("]");91}9293map.put("AlgorithmParameters.EC SupportedCurves", names.toString());9495/*96* Register the algorithms below only when the full ECC implementation97* is available98*/99if (!useFullImplementation) {100return;101}102103/*104* Signature engines105*/106map.put("Signature.NONEwithECDSA",107"sun.security.ec.ECDSASignature$Raw");108map.put("Signature.SHA1withECDSA",109"sun.security.ec.ECDSASignature$SHA1");110map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.1", "SHA1withECDSA");111map.put("Alg.Alias.Signature.1.2.840.10045.4.1", "SHA1withECDSA");112113map.put("Signature.SHA224withECDSA",114"sun.security.ec.ECDSASignature$SHA224");115map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.1", "SHA224withECDSA");116map.put("Alg.Alias.Signature.1.2.840.10045.4.3.1", "SHA224withECDSA");117118map.put("Signature.SHA256withECDSA",119"sun.security.ec.ECDSASignature$SHA256");120map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.2", "SHA256withECDSA");121map.put("Alg.Alias.Signature.1.2.840.10045.4.3.2", "SHA256withECDSA");122123map.put("Signature.SHA384withECDSA",124"sun.security.ec.ECDSASignature$SHA384");125map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.3", "SHA384withECDSA");126map.put("Alg.Alias.Signature.1.2.840.10045.4.3.3", "SHA384withECDSA");127128map.put("Signature.SHA512withECDSA",129"sun.security.ec.ECDSASignature$SHA512");130map.put("Alg.Alias.Signature.OID.1.2.840.10045.4.3.4", "SHA512withECDSA");131map.put("Alg.Alias.Signature.1.2.840.10045.4.3.4", "SHA512withECDSA");132133String ecKeyClasses = "java.security.interfaces.ECPublicKey" +134"|java.security.interfaces.ECPrivateKey";135map.put("Signature.NONEwithECDSA SupportedKeyClasses", ecKeyClasses);136map.put("Signature.SHA1withECDSA SupportedKeyClasses", ecKeyClasses);137map.put("Signature.SHA224withECDSA SupportedKeyClasses", ecKeyClasses);138map.put("Signature.SHA256withECDSA SupportedKeyClasses", ecKeyClasses);139map.put("Signature.SHA384withECDSA SupportedKeyClasses", ecKeyClasses);140map.put("Signature.SHA512withECDSA SupportedKeyClasses", ecKeyClasses);141142map.put("Signature.SHA1withECDSA KeySize", "256");143144map.put("Signature.NONEwithECDSA ImplementedIn", "Software");145map.put("Signature.SHA1withECDSA ImplementedIn", "Software");146map.put("Signature.SHA224withECDSA ImplementedIn", "Software");147map.put("Signature.SHA256withECDSA ImplementedIn", "Software");148map.put("Signature.SHA384withECDSA ImplementedIn", "Software");149map.put("Signature.SHA512withECDSA ImplementedIn", "Software");150151/*152* Key Pair Generator engine153*/154map.put("KeyPairGenerator.EC", "sun.security.ec.ECKeyPairGenerator");155map.put("Alg.Alias.KeyPairGenerator.EllipticCurve", "EC");156157map.put("KeyPairGenerator.EC KeySize", "256");158159map.put("KeyPairGenerator.EC ImplementedIn", "Software");160161/*162* Key Agreement engine163*/164map.put("KeyAgreement.ECDH", "sun.security.ec.ECDHKeyAgreement");165166map.put("KeyAgreement.ECDH SupportedKeyClasses", ecKeyClasses);167168map.put("KeyAgreement.ECDH ImplementedIn", "Software");169}170}171172173