etnt commented on code in PR #932:
URL: https://github.com/apache/mina-sshd/pull/932#discussion_r4336448715
##########
sshd-common/src/main/java/org/apache/sshd/common/util/security/bouncycastle/BouncyCastleSecurityProviderRegistrar.java:
##########
@@ -108,6 +113,28 @@ public boolean isSecurityEntitySupported(Class<?>
entityType, String name) {
return false;
}
+ if (SecurityUtils.ML_DSA.equalsIgnoreCase(name) ||
MLDSAParameterSets.fromJceName(name) != null) {
+ String probeKey = entityType.getName() + ":" +
name.toUpperCase(Locale.ROOT);
+ boolean available =
mlDSAServiceSupportHolder.computeIfAbsent(probeKey, k -> {
+ try {
+ if (KeyFactory.class.isAssignableFrom(entityType)) {
+ KeyFactory.getInstance(name, getSecurityProvider());
+ } else if
(KeyPairGenerator.class.isAssignableFrom(entityType)) {
+ KeyPairGenerator.getInstance(name,
getSecurityProvider());
+ } else {
+ return Boolean.FALSE;
+ }
+ return Boolean.TRUE;
+ } catch (GeneralSecurityException e) {
+ return Boolean.FALSE;
+ }
+ }).booleanValue();
Review Comment:
isSecurityEntitySupported now gets the provider once and returns false if it
is null. It also catches RuntimeException, so a missing provider no longer
makes it throw.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]