etnt commented on code in PR #933:
URL: https://github.com/apache/mina-sshd/pull/933#discussion_r4348376677
##########
sshd-common/src/main/java/org/apache/sshd/common/util/security/bouncycastle/BouncyCastleSecurityProviderRegistrar.java:
##########
@@ -108,6 +113,34 @@ 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 {
+ Provider provider = getSecurityProvider();
+ if (provider == null) {
+ return Boolean.FALSE;
+ }
+ if (KeyFactory.class.isAssignableFrom(entityType)) {
+ KeyFactory.getInstance(name, provider);
+ } else if
(KeyPairGenerator.class.isAssignableFrom(entityType)) {
+ KeyPairGenerator.getInstance(name, provider);
+ } else if (Signature.class.isAssignableFrom(entityType)) {
+ Signature.getInstance(name, provider);
+ } else {
+ return Boolean.FALSE;
+ }
+ return Boolean.TRUE;
+ } catch (GeneralSecurityException | RuntimeException e) {
+ return Boolean.FALSE;
+ }
+ }).booleanValue();
+ if (!available) {
+ return false;
+ }
+ return super.isSecurityEntitySupported(entityType, name);
+ }
Review Comment:
the support probe now uses the canonical variant.getJceName(). That name
goes to KeyFactory, KeyPairGenerator and
Signature.getInstance, to the cache key, and to
super.isSecurityEntitySupported. The generic ML-DSA name stays as
SecurityUtils.ML_DSA.
--
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]