cryptutil: more explicit decryption error (#1607)

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
This commit is contained in:
bobby 2020-11-23 07:57:30 -08:00 committed by GitHub
parent 7e19780d70
commit f980517b7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View file

@ -44,7 +44,7 @@ func Decrypt(a cipher.AEAD, data, ad []byte) ([]byte, error) {
nonce := data[size:]
plaintext, err := a.Open(nil, nonce, ciphertext, ad)
if err != nil {
return nil, err
return nil, fmt.Errorf("cryptutil: decryption failed (mismatched keys?): %w", err)
}
return plaintext, nil
}