Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #182 from secrethub/feature/credential-malformed-e…
Browse files Browse the repository at this point in the history
…rror

Malformed credential error
  • Loading branch information
jpcoenen authored Jun 5, 2020
2 parents 18cee00 + b5efabf commit 55b2ebc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/secrethub/credentials/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var (
ErrCannotDecodeCredentialPayload = errCredentials.Code("invalid_credential_header").ErrorPref("cannot decode credential payload: %v")
ErrCannotDecodeEncryptedCredential = errCredentials.Code("cannot_decode_encrypted_credential").Error("cannot decode an encrypted credential without a key")
ErrCannotDecryptCredential = errCredentials.Code("cannot_decrypt_credential").Error("passphrase is incorrect")
ErrMalformedCredential = errCredentials.Code("malformed_credential").ErrorPref("credential is malformed: %v")
ErrInvalidKey = errCredentials.Code("invalid_key").Error("the given key is not valid for the encryption algorithm")
)

Expand Down Expand Up @@ -226,7 +227,7 @@ type rsaPrivateKeyDecoder struct{}
func (d rsaPrivateKeyDecoder) Decode(payload []byte) (*RSACredential, error) {
key, err := x509.ParsePKCS1PrivateKey(payload)
if err != nil {
return nil, err
return nil, ErrMalformedCredential(err)
}

return &RSACredential{
Expand Down

0 comments on commit 55b2ebc

Please sign in to comment.