Skip to content

Commit b4a5150

Browse files
authored
Merge pull request ibmruntimes#965 from sarwat12/sarwat_pkcs11Debug
Add error visibility for SunPKCS11 provider configuration failures
2 parents f498188 + 73aae5e commit b4a5150

File tree

1 file changed

+14
-1
lines changed
  • src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11

1 file changed

+14
-1
lines changed

src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/*
2727
* ===========================================================================
28-
* (c) Copyright IBM Corp. 2023, 2023 All Rights Reserved
28+
* (c) Copyright IBM Corp. 2023, 2025 All Rights Reserved
2929
* ===========================================================================
3030
*/
3131

@@ -37,6 +37,7 @@
3737
import java.nio.charset.StandardCharsets;
3838
import java.util.*;
3939

40+
import sun.security.util.Debug;
4041
import sun.security.util.PropertyExpander;
4142

4243
import sun.security.pkcs11.wrapper.*;
@@ -1084,11 +1085,23 @@ private void parseHandleStartupErrors(String keyword) throws IOException {
10841085
class ConfigurationException extends IOException {
10851086
@Serial
10861087
private static final long serialVersionUID = 254492758807673194L;
1088+
1089+
private static final Debug configDebug = Debug.getInstance("sunpkcs11");
1090+
1091+
private static void debug(String msg) {
1092+
// If debugging is enabled, use the Debug class for additional sunpkcs11 logging.
1093+
if (configDebug != null) {
1094+
configDebug.println(msg);
1095+
}
1096+
}
1097+
10871098
ConfigurationException(String msg) {
10881099
super(msg);
1100+
debug(msg);
10891101
}
10901102

10911103
ConfigurationException(String msg, Throwable e) {
10921104
super(msg, e);
1105+
debug(msg);
10931106
}
10941107
}

0 commit comments

Comments
 (0)