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, 2022 , 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
@@ -128,17 +128,19 @@ public static int getKeySize(Key key) {
128
128
*/
129
129
public static final int getKeySize (AlgorithmParameters parameters ) {
130
130
131
- String algorithm = parameters .getAlgorithm ();
132
- switch (algorithm ) {
131
+ switch (parameters .getAlgorithm ()) {
133
132
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 (
136
137
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
139
143
}
140
- } catch (InvalidParameterSpecException ipse ) {
141
- // ignore
142
144
}
143
145
144
146
try {
You can’t perform that action at this time.
0 commit comments