Skip to content

Commit 0b89f53

Browse files
phrwlkatkinsonholly
authored andcommitted
accounts/keystore: clear decrypted key after use (ethereum#33090)
1 parent 07c3b63 commit 0b89f53

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

accounts/keystore/keystore.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ func (ks *KeyStore) Export(a accounts.Account, passphrase, newPassphrase string)
418418
if err != nil {
419419
return nil, err
420420
}
421+
defer zeroKey(key.PrivateKey)
421422
var N, P int
422423
if store, ok := ks.storage.(*keyStorePassphrase); ok {
423424
N, P = store.scryptN, store.scryptP
@@ -477,6 +478,7 @@ func (ks *KeyStore) Update(a accounts.Account, passphrase, newPassphrase string)
477478
if err != nil {
478479
return err
479480
}
481+
defer zeroKey(key.PrivateKey)
480482
return ks.storage.StoreKey(a.URL.Path, key, newPassphrase)
481483
}
482484

0 commit comments

Comments
 (0)