aboutsummaryrefslogtreecommitdiff
path: root/ssh/keys_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/keys_test.go')
-rw-r--r--ssh/keys_test.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/ssh/keys_test.go b/ssh/keys_test.go
index 661e3cb..a1165ec 100644
--- a/ssh/keys_test.go
+++ b/ssh/keys_test.go
@@ -271,6 +271,21 @@ func TestParseEncryptedPrivateKeysWithPassphrase(t *testing.T) {
}
}
+func TestParseEncryptedPrivateKeysWithUnsupportedCiphers(t *testing.T) {
+ for _, tt := range testdata.UnsupportedCipherData {
+ t.Run(tt.Name, func(t *testing.T){
+ _, err := ParsePrivateKeyWithPassphrase(tt.PEMBytes, []byte(tt.EncryptionKey))
+ if err == nil {
+ t.Fatalf("expected 'unknown cipher' error for %q, got nil", tt.Name)
+ // If this cipher is now supported, remove it from testdata.UnsupportedCipherData
+ }
+ if !strings.Contains(err.Error(), "unknown cipher") {
+ t.Errorf("wanted 'unknown cipher' error, got %v", err.Error())
+ }
+ })
+ }
+}
+
func TestParseEncryptedPrivateKeysWithIncorrectPassphrase(t *testing.T) {
pem := testdata.PEMEncryptedKeys[0].PEMBytes
for i := 0; i < 4096; i++ {