diff options
author | Felix Lange <fjl@twurst.com> | 2016-04-02 04:41:47 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2016-04-12 21:58:07 +0800 |
commit | 6f1ca0bc910b65b517277f72ca52dadcdc713570 (patch) | |
tree | 11cd425e341f6952a0142fa0abbb9445ea917b7d /accounts/key_store_passphrase.go | |
parent | a9f26dcd0d14c0cb9f309ebccf81e8f741fc4636 (diff) | |
download | go-tangerine-6f1ca0bc910b65b517277f72ca52dadcdc713570.tar go-tangerine-6f1ca0bc910b65b517277f72ca52dadcdc713570.tar.gz go-tangerine-6f1ca0bc910b65b517277f72ca52dadcdc713570.tar.bz2 go-tangerine-6f1ca0bc910b65b517277f72ca52dadcdc713570.tar.lz go-tangerine-6f1ca0bc910b65b517277f72ca52dadcdc713570.tar.xz go-tangerine-6f1ca0bc910b65b517277f72ca52dadcdc713570.tar.zst go-tangerine-6f1ca0bc910b65b517277f72ca52dadcdc713570.zip |
accounts: add ErrDecrypt
Diffstat (limited to 'accounts/key_store_passphrase.go')
-rw-r--r-- | accounts/key_store_passphrase.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/accounts/key_store_passphrase.go b/accounts/key_store_passphrase.go index 0cc598bbc..87c7cb98f 100644 --- a/accounts/key_store_passphrase.go +++ b/accounts/key_store_passphrase.go @@ -31,7 +31,6 @@ import ( "crypto/sha256" "encoding/hex" "encoding/json" - "errors" "fmt" "io/ioutil" "path/filepath" @@ -214,7 +213,7 @@ func decryptKeyV3(keyProtected *encryptedKeyJSONV3, auth string) (keyBytes []byt calculatedMAC := crypto.Keccak256(derivedKey[16:32], cipherText) if !bytes.Equal(calculatedMAC, mac) { - return nil, nil, errors.New("Decryption failed: MAC mismatch") + return nil, nil, ErrDecrypt } plainText, err := aesCTRXOR(derivedKey[:16], cipherText, iv) @@ -248,7 +247,7 @@ func decryptKeyV1(keyProtected *encryptedKeyJSONV1, auth string) (keyBytes []byt calculatedMAC := crypto.Keccak256(derivedKey[16:32], cipherText) if !bytes.Equal(calculatedMAC, mac) { - return nil, nil, errors.New("Decryption failed: MAC mismatch") + return nil, nil, ErrDecrypt } plainText, err := aesCBCDecrypt(crypto.Keccak256(derivedKey[:16])[:16], cipherText, iv) |