From 0135904f7d3e1c0e763adaefe267c736616e3d26 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 16 Nov 2016 19:28:52 -0500 Subject: Upgrading server dependancies (#4566) --- vendor/golang.org/x/crypto/ssh/keys_test.go | 36 +++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'vendor/golang.org/x/crypto/ssh/keys_test.go') diff --git a/vendor/golang.org/x/crypto/ssh/keys_test.go b/vendor/golang.org/x/crypto/ssh/keys_test.go index 4c4c5bef6..0739c6627 100644 --- a/vendor/golang.org/x/crypto/ssh/keys_test.go +++ b/vendor/golang.org/x/crypto/ssh/keys_test.go @@ -132,6 +132,22 @@ func TestParseECPrivateKey(t *testing.T) { } } +// See Issue https://github.com/golang/go/issues/6650. +func TestParseEncryptedPrivateKeysFails(t *testing.T) { + const wantSubstring = "encrypted" + for i, tt := range testdata.PEMEncryptedKeys { + _, err := ParsePrivateKey(tt.PEMBytes) + if err == nil { + t.Errorf("#%d key %s: ParsePrivateKey successfully parsed, expected an error", i, tt.Name) + continue + } + + if !strings.Contains(err.Error(), wantSubstring) { + t.Errorf("#%d key %s: got error %q, want substring %q", i, tt.Name, err, wantSubstring) + } + } +} + func TestParseDSA(t *testing.T) { // We actually exercise the ParsePrivateKey codepath here, as opposed to // using the ParseRawPrivateKey+NewSignerFromKey path that testdata_test.go @@ -309,14 +325,14 @@ func TestInvalidEntry(t *testing.T) { } var knownHostsParseTests = []struct { - input string - err string - - marker string - comment string - hosts []string - rest string -} { + input string + err string + + marker string + comment string + hosts []string + rest string +}{ { "", "EOF", @@ -375,13 +391,13 @@ var knownHostsParseTests = []struct { "localhost,[host2:123]\tssh-rsa {RSAPUB}\tcomment comment", "", - "", "comment comment", []string{"localhost","[host2:123]"}, "", + "", "comment comment", []string{"localhost", "[host2:123]"}, "", }, { "@marker \tlocalhost,[host2:123]\tssh-rsa {RSAPUB}", "", - "marker", "", []string{"localhost","[host2:123]"}, "", + "marker", "", []string{"localhost", "[host2:123]"}, "", }, { "@marker \tlocalhost,[host2:123]\tssh-rsa aabbccdd", -- cgit v1.2.3-1-g7c22