Unfortunately it doesn't yield much.
I added both -Djavax.net.debug, -Djava.security.debug=sunpkcs11 and -Djava.security.debug=pkcs11keystore to standalone.conf for good measure, restarted WildFly and configured logging with JBoss CLI
/subsystem=logging/logger=sun.security:add(level=TRACE)
/subsystem=logging/logger=org.wildfly.security:add(level=TRACE)
The output in the log is:
2021-09-29 14:02:51,660 TRACE [org.wildfly.security] (management-handler-thread - 1) KeyStoreCredentialStore: contains exact type
2021-09-29 14:02:51,867 TRACE [org.wildfly.security] (management-handler-thread - 1) CredentialStoreCredentialSource: obtaining credential: type = hsm algorithm = class org.wildfly.security.credential.PasswordCredential exists = true
2021-09-29 14:02:51,867 TRACE [org.wildfly.security] (management-handler-thread - 1) KeyStoreCredentialStore: contains exact type
2021-09-29 14:02:51,988 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("generate-certificate-signing-request") failed - address: ([
("subsystem" => "elytron"),
("key-store" => "httpsKSInHSM")
]) - failure description: "ELY10014: Failed to sign certification request info"
It feels like the exception message is swallowed? 😟