Skip to content

Commit

Permalink
chore: return generic errors #499
Browse files Browse the repository at this point in the history
  • Loading branch information
developerfred committed Jan 5, 2020
1 parent f823427 commit ff0c66d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crypto/cipher/aes256cbc/decrypter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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))
Expand Down

0 comments on commit ff0c66d

Please sign in to comment.