File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
src/java.base/share/classes/sun/security/util Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2012, 2022 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2012, 2023 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -128,17 +128,19 @@ public static int getKeySize(Key key) {
128128 */
129129 public static final int getKeySize (AlgorithmParameters parameters ) {
130130
131- String algorithm = parameters .getAlgorithm ();
132- switch (algorithm ) {
131+ switch (parameters .getAlgorithm ()) {
133132 case "EC" :
134- try {
135- ECKeySizeParameterSpec ps = parameters .getParameterSpec (
133+ // ECKeySizeParameterSpec is SunEC internal only
134+ if (parameters .getProvider ().getName ().equals ("SunEC" )) {
135+ try {
136+ ECKeySizeParameterSpec ps = parameters .getParameterSpec (
136137 ECKeySizeParameterSpec .class );
137- if (ps != null ) {
138- return ps .getKeySize ();
138+ if (ps != null ) {
139+ return ps .getKeySize ();
140+ }
141+ } catch (InvalidParameterSpecException ipse ) {
142+ // ignore
139143 }
140- } catch (InvalidParameterSpecException ipse ) {
141- // ignore
142144 }
143145
144146 try {
You can’t perform that action at this time.
0 commit comments