aboutsummaryrefslogtreecommitdiff
path: root/ssh/common_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/common_test.go')
-rw-r--r--ssh/common_test.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/ssh/common_test.go b/ssh/common_test.go
index 67cf1f4..80aa2df 100644
--- a/ssh/common_test.go
+++ b/ssh/common_test.go
@@ -5,7 +5,9 @@
package ssh
import (
+ "maps"
"reflect"
+ "slices"
"testing"
)
@@ -174,3 +176,21 @@ func TestFindAgreedAlgorithms(t *testing.T) {
})
}
}
+
+func TestKeyFormatAlgorithms(t *testing.T) {
+ supportedAlgos := SupportedAlgorithms()
+ insecureAlgos := InsecureAlgorithms()
+ algoritms := append(supportedAlgos.PublicKeyAuths, insecureAlgos.PublicKeyAuths...)
+ algoritms = append(algoritms, slices.Collect(maps.Keys(certKeyAlgoNames))...)
+
+ for _, algo := range algoritms {
+ keyFormat := keyFormatForAlgorithm(algo)
+ if keyFormat == "" {
+ t.Errorf("got empty key format for algorithm %q", algo)
+ }
+ if !slices.Contains(algorithmsForKeyFormat(keyFormat), algo) {
+ t.Errorf("algorithms for key format %q, does not contain %q", keyFormat, algo)
+ }
+
+ }
+}