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 1
1
/*
2
- * Copyright (c) 2012, 2021 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2012, 2023 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -144,17 +144,19 @@ public static final int getKeySize(Key key) {
144
144
*/
145
145
public static final int getKeySize (AlgorithmParameters parameters ) {
146
146
147
- String algorithm = parameters .getAlgorithm ();
148
- switch (algorithm ) {
147
+ switch (parameters .getAlgorithm ()) {
149
148
case "EC" :
150
- try {
151
- ECKeySizeParameterSpec ps = parameters .getParameterSpec (
149
+ // ECKeySizeParameterSpec is SunEC internal only
150
+ if (parameters .getProvider ().getName ().equals ("SunEC" )) {
151
+ try {
152
+ ECKeySizeParameterSpec ps = parameters .getParameterSpec (
152
153
ECKeySizeParameterSpec .class );
153
- if (ps != null ) {
154
- return ps .getKeySize ();
154
+ if (ps != null ) {
155
+ return ps .getKeySize ();
156
+ }
157
+ } catch (InvalidParameterSpecException ipse ) {
158
+ // ignore
155
159
}
156
- } catch (InvalidParameterSpecException ipse ) {
157
- // ignore
158
160
}
159
161
160
162
try {
You can’t perform that action at this time.
0 commit comments