mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +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.
|
||||
*
|
||||
* 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) {
|
||||
|
||||
String algorithm = parameters.getAlgorithm();
|
||||
switch (algorithm) {
|
||||
switch (parameters.getAlgorithm()) {
|
||||
case "EC":
|
||||
try {
|
||||
ECKeySizeParameterSpec ps = parameters.getParameterSpec(
|
||||
// ECKeySizeParameterSpec is SunEC internal only
|
||||
if (parameters.getProvider().getName().equals("SunEC")) {
|
||||
try {
|
||||
ECKeySizeParameterSpec ps = parameters.getParameterSpec(
|
||||
ECKeySizeParameterSpec.class);
|
||||
if (ps != null) {
|
||||
return ps.getKeySize();
|
||||
if (ps != null) {
|
||||
return ps.getKeySize();
|
||||
}
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
// ignore
|
||||
}
|
||||
} catch (InvalidParameterSpecException ipse) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue