Skip to content

Commit e7010a4

Browse files
make error type private
UnsupportedCipherError was exported, for no good reason. It has now been made private.
1 parent 37eb491 commit e7010a4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ssh/keys.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,12 +1271,12 @@ func (*PassphraseMissingError) Error() string {
12711271
return "ssh: this private key is passphrase protected"
12721272
}
12731273

1274-
type UnsupportedCipherError struct {
1274+
type unsupportedCipherError struct {
12751275
BadCipher string
12761276
SupportedCiphers []string
12771277
}
12781278

1279-
func (e *UnsupportedCipherError) Error() string {
1279+
func (e *unsupportedCipherError) Error() string {
12801280
return fmt.Sprintf("ssh: unknown cipher %q, only supports one of %q", e.BadCipher, strings.Join(e.SupportedCiphers, ","))
12811281
}
12821282

@@ -1438,7 +1438,7 @@ func passphraseProtectedOpenSSHKey(passphrase []byte) openSSHDecryptFunc {
14381438
cbc := cipher.NewCBCDecrypter(c, iv)
14391439
cbc.CryptBlocks(privKeyBlock, privKeyBlock)
14401440
default:
1441-
return nil, &UnsupportedCipherError{
1441+
return nil, &unsupportedCipherError{
14421442
BadCipher: cipherName,
14431443
SupportedCiphers: []string{"aes256-ctr", "aes256-cbc"},
14441444
}

ssh/keys_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func TestParseEncryptedPrivateKeysWithUnsupportedCiphers(t *testing.T) {
275275
for _, tt := range testdata.PEMEncryptedKeysForUnsupportedCiphers {
276276
t.Run(tt.Name, func(t *testing.T) {
277277
_, err := ParsePrivateKeyWithPassphrase(tt.PEMBytes, []byte(tt.EncryptionKey))
278-
var e *UnsupportedCipherError
278+
var e *unsupportedCipherError
279279
if !errors.As(err, &e) {
280280
t.Errorf("got error %v, want UnsupportedCipherError", err)
281281
}

0 commit comments

Comments
 (0)