Skip to content

Commit

Permalink
8279801: EC KeyFactory and KeyPairGenerator do not have aliases for O…
Browse files Browse the repository at this point in the history
…ID format

Reviewed-by: xuelei, valeriep
  • Loading branch information
wangweij committed Jan 13, 2022
1 parent 6fcaa32 commit 0a839b4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -208,9 +208,8 @@ void putEntries() {
/*
* Key Factory engine
*/
putService(new ProviderService(this, "KeyFactory",
"EC", "sun.security.ec.ECKeyFactory",
List.of("EllipticCurve"), ATTRS));
putService(new ProviderServiceA(this, "KeyFactory",
"EC", "sun.security.ec.ECKeyFactory", ATTRS));

/*
* Algorithm Parameter engine
Expand Down Expand Up @@ -319,9 +318,8 @@ void putEntries() {
/*
* Key Pair Generator engine
*/
putService(new ProviderService(this, "KeyPairGenerator",
"EC", "sun.security.ec.ECKeyPairGenerator",
List.of("EllipticCurve"), ATTRS));
putService(new ProviderServiceA(this, "KeyPairGenerator",
"EC", "sun.security.ec.ECKeyPairGenerator", ATTRS));

/*
* Key Agreement engine
Expand Down
45 changes: 45 additions & 0 deletions test/jdk/sun/security/ec/OidInstance.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/

/*
* @test
* @bug 8279801
* @summary EC KeyFactory and KeyPairGenerator do not have aliases for OID format
* @modules java.base/sun.security.util
* jdk.crypto.ec
*/

import sun.security.util.KnownOIDs;

import java.security.AlgorithmParameters;
import java.security.KeyFactory;
import java.security.KeyPairGenerator;

public class OidInstance {
public static void main(String[] args) throws Exception {
String oid = KnownOIDs.EC.value();
KeyFactory.getInstance(oid, "SunEC");
KeyPairGenerator.getInstance(oid, "SunEC");
AlgorithmParameters.getInstance(oid, "SunEC");
}
}

0 comments on commit 0a839b4

Please sign in to comment.