lgoldstein commented on a change in pull request #119: Add support for openssh 
host key certificates
URL: https://github.com/apache/mina-sshd/pull/119#discussion_r409327626
 
 

 ##########
 File path: 
sshd-core/src/main/java/org/apache/sshd/server/session/AbstractServerSession.java
 ##########
 @@ -367,9 +382,26 @@ protected String 
resolveAvailableSignaturesProposal(FactoryManager proposedManag
 
         KeyPairProvider kpp = getKeyPairProvider();
         boolean debugEnabled = log.isDebugEnabled();
-        Iterable<String> provided;
+        Set<String> provided = null;
         try {
-            provided = (kpp == null) ? null : kpp.getKeyTypes(this);
+            if (kpp != null) {
+                provided = 
StreamSupport.stream(kpp.getKeyTypes(this).spliterator(), false)
+                    .collect(Collectors.toSet());
+
+                HostKeyCertificateProvider hostKeyCertificateProvider = 
getHostKeyCertificateProvider();
+                if (hostKeyCertificateProvider != null) {
+                    Iterable<OpenSshCertificate> certificates = 
hostKeyCertificateProvider.loadCertificates(this);
+                    for (OpenSshCertificate certificate : certificates) {
+                        // Add the certificate alg only if the corresponding 
keyPair type is available
+                        if (provided.contains(certificate.getRawKeyType())) {
+                            provided.add(certificate.getKeyType());
+                        } else {
 
 Review comment:
   This code interferes with a lazy-load feature (see SSHD-860) that we 
implemented since it consumes all available key types thus defeating the 
purpose of the lazy-load. We need to figure out a way to preserve that 
capability

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to