Skip to content

Commit ea179d2

Browse files
authored
accounts/keystore: clear decrypted key after use#33090 (#1790)
1 parent 627d77a commit ea179d2

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
@@ -417,6 +417,7 @@ func (ks *KeyStore) Export(a accounts.Account, passphrase, newPassphrase string)
417417
if err != nil {
418418
return nil, err
419419
}
420+
defer zeroKey(key.PrivateKey)
420421
var N, P int
421422
if store, ok := ks.storage.(*keyStorePassphrase); ok {
422423
N, P = store.scryptN, store.scryptP
@@ -476,6 +477,7 @@ func (ks *KeyStore) Update(a accounts.Account, passphrase, newPassphrase string)
476477
if err != nil {
477478
return err
478479
}
480+
defer zeroKey(key.PrivateKey)
479481
return ks.storage.StoreKey(a.URL.Path, key, newPassphrase)
480482
}
481483

0 commit comments

Comments
 (0)