mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8311592: ECKeySizeParameterSpec causes too many exceptions on third party providers
Reviewed-by: hchao, valeriep
This commit is contained in:
parent
9606cbcd23
commit
e554fdee25
1 changed files with 11 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -128,17 +128,19 @@ public final class KeyUtil {
|
||||||
*/
|
*/
|
||||||
public static final int getKeySize(AlgorithmParameters parameters) {
|
public static final int getKeySize(AlgorithmParameters parameters) {
|
||||||
|
|
||||||
String algorithm = parameters.getAlgorithm();
|
switch (parameters.getAlgorithm()) {
|
||||||
switch (algorithm) {
|
|
||||||
case "EC":
|
case "EC":
|
||||||
try {
|
// ECKeySizeParameterSpec is SunEC internal only
|
||||||
ECKeySizeParameterSpec ps = parameters.getParameterSpec(
|
if (parameters.getProvider().getName().equals("SunEC")) {
|
||||||
|
try {
|
||||||
|
ECKeySizeParameterSpec ps = parameters.getParameterSpec(
|
||||||
ECKeySizeParameterSpec.class);
|
ECKeySizeParameterSpec.class);
|
||||||
if (ps != null) {
|
if (ps != null) {
|
||||||
return ps.getKeySize();
|
return ps.getKeySize();
|
||||||
|
}
|
||||||
|
} catch (InvalidParameterSpecException ipse) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
} catch (InvalidParameterSpecException ipse) {
|
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue