diff options
author | Gustav Simonsson <gustav.simonsson@gmail.com> | 2016-09-24 03:42:29 +0800 |
---|---|---|
committer | Gustav Simonsson <gustav.simonsson@gmail.com> | 2016-09-28 01:07:33 +0800 |
commit | 7cc6b801e0967e5ebfa26b9f670675acea6e3a20 (patch) | |
tree | 4f27977539b92569659c67751c4d4a209d6af95f /accounts/key_store_passphrase.go | |
parent | 863d166c7b0250cf2e99c8aad69578cdd144d386 (diff) | |
download | go-tangerine-7cc6b801e0967e5ebfa26b9f670675acea6e3a20.tar go-tangerine-7cc6b801e0967e5ebfa26b9f670675acea6e3a20.tar.gz go-tangerine-7cc6b801e0967e5ebfa26b9f670675acea6e3a20.tar.bz2 go-tangerine-7cc6b801e0967e5ebfa26b9f670675acea6e3a20.tar.lz go-tangerine-7cc6b801e0967e5ebfa26b9f670675acea6e3a20.tar.xz go-tangerine-7cc6b801e0967e5ebfa26b9f670675acea6e3a20.tar.zst go-tangerine-7cc6b801e0967e5ebfa26b9f670675acea6e3a20.zip |
accounts: left pad keybytes-to-encrypt, add 30/31 byte keys tests
Diffstat (limited to 'accounts/key_store_passphrase.go')
-rw-r--r-- | accounts/key_store_passphrase.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/accounts/key_store_passphrase.go b/accounts/key_store_passphrase.go index 87c7cb98f..3a5155e13 100644 --- a/accounts/key_store_passphrase.go +++ b/accounts/key_store_passphrase.go @@ -107,7 +107,8 @@ func EncryptKey(key *Key, auth string, scryptN, scryptP int) ([]byte, error) { return nil, err } encryptKey := derivedKey[:16] - keyBytes := crypto.FromECDSA(key.PrivateKey) + keyBytes0 := crypto.FromECDSA(key.PrivateKey) + keyBytes := common.LeftPadBytes(keyBytes0, 32) iv := randentropy.GetEntropyCSPRNG(aes.BlockSize) // 16 cipherText, err := aesCTRXOR(encryptKey, keyBytes, iv) |