From ff0c66dd03df95ce068eff102ee75e7fc8ecaea0 Mon Sep 17 00:00:00 2001 From: Developer Fred Date: Sun, 5 Jan 2020 20:07:25 -0300 Subject: [PATCH] chore: return generic errors #499 --- crypto/cipher/aes256cbc/decrypter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/cipher/aes256cbc/decrypter.go b/crypto/cipher/aes256cbc/decrypter.go index 5cd47f434..8279bbf6e 100644 --- a/crypto/cipher/aes256cbc/decrypter.go +++ b/crypto/cipher/aes256cbc/decrypter.go @@ -58,7 +58,7 @@ func decryptEncryptedData(privKey crypto.PrivateKey, data *encryptedData) ([]byt recipientPrivKey, err := asPrivateECIES(privKey) if err != nil { - return nil, err + return nil, mc.ErrDecrypt } sharedSecret, err := deriveSharedSecret(ephemeralPublicKey, recipientPrivKey) @@ -75,14 +75,14 @@ func decryptEncryptedData(privKey crypto.PrivateKey, data *encryptedData) ([]byt if subtle.ConstantTimeCompare(data.MessageAuthenticationCode, mac) != 1 { return nil, mc.ErrDecrypt - + } return decryptCBC(encryptionKey, data.InitializationVector, data.Ciphertext) } func decryptCBC(key, iv, ciphertext []byte) ([]byte, error) { block, err := aes.NewCipher(key) if err != nil { - return nil, err + return nil, mc.ErrDecrypt } plaintext := make([]byte, len(ciphertext))