You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by GitBox <gi...@apache.org> on 2020/08/14 09:24:35 UTC

[GitHub] [mina-sshd] lgoldstein commented on a change in pull request #158: [SSHD-1053] Fix OpenSSH client "key type does not match" error when use Mina SSHD with OpenSSH Host Public Key Cert

lgoldstein commented on a change in pull request #158:
URL: https://github.com/apache/mina-sshd/pull/158#discussion_r470512809



##########
File path: sshd-common/src/main/java/org/apache/sshd/common/config/keys/KeyUtils.java
##########
@@ -141,6 +142,13 @@
     public static final String RSA_SHA256_CERT_TYPE_ALIAS = "rsa-sha2-256-cert-v01@openssh.com";
     public static final String RSA_SHA512_CERT_TYPE_ALIAS = "rsa-sha2-512-cert-v01@openssh.com";
 
+    private static final Map<String, String> CERT_TYPE_HASH_ALGORITHM_TYPE

Review comment:
       This should be wrapped inside a `Collections.unmodifiableMap`

##########
File path: sshd-common/src/main/java/org/apache/sshd/common/config/keys/KeyUtils.java
##########
@@ -1196,4 +1204,13 @@ public static boolean compareSkEd25519Keys(SkED25519PublicKey k1, SkED25519Publi
                     && SecurityUtils.compareEDDSAPPublicKeys(k1.getDelegatePublicKey(), k2.getDelegatePublicKey());
         }
     }
+
+    public static String getHashAlgorithmType(String keyType) {
+        String hashAlgorithmType = CERT_TYPE_HASH_ALGORITHM_TYPE.get(keyType);
+        if (hashAlgorithmType != null) {
+            return hashAlgorithmType;
+        } else {
+            return keyType;
+        }
+    }

Review comment:
       Code can be simplified as `return CERT_TYPE_HASH_ALGORITHM_TYPE.getOrDefault(keyYpe, keyType)`




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org