remove ineffective eckey clear

This commit is contained in:
Craig Raw
2026-08-02 15:45:11 +02:00
parent 3979694e2f
commit 1636c7e2f0
11 changed files with 2 additions and 19 deletions
+1 -1
Submodule drongo updated: fa1bb4eec2...51ebbc515a
@@ -1431,7 +1431,6 @@ public class AppController implements Initializable {
} catch(IOException | StorageException | MnemonicException e) {
log.error("Error saving imported wallet", e);
} finally {
encryptionFullKey.clear();
if(key != null) {
key.clear();
}
@@ -2423,13 +2422,11 @@ public class AppController implements Initializable {
keyDerivationService = new Storage.KeyDerivationService(storage, password.get(), true);
keyDerivationService.setOnSucceeded(workerStateEvent -> {
EventManager.get().post(new StorageEvent(selectedWalletForm.getWalletId(), TimedEvent.Action.END, "Done"));
ECKey encryptionFullKey = keyDerivationService.getValue();
try {
tabs.getTabs().remove(tabs.getSelectionModel().getSelectedItem());
deleteStorage(storage, true);
} finally {
encryptionFullKey.clear();
keyDerivationService = null;
}
});
@@ -1146,7 +1146,6 @@ public class AppServices {
showErrorDialog("Error authenticating", "Failed to authenticate.\n\n" + e.getMessage());
} finally {
key.clear();
encryptionFullKey.clear();
password.get().clear();
}
});
@@ -392,7 +392,6 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
if(decryptedWallet.getPolicyType() == PolicyType.SINGLE_SP) {
ECKey spendPrivKey = keystore.getSpendPrivateKey(Collections.emptyMap());
signatureText = Bip322.signMessageBip322Sp(walletNode.getAddress(), message.getText().trim(), spendPrivKey, walletNode.getSilentPaymentTweak());
spendPrivKey.clear();
} else {
ECKey privKey = keystore.getKey(walletNode);
if(isBip322()) {
@@ -402,7 +401,6 @@ public class MessageSignDialog extends Dialog<ButtonBar.ButtonData> {
ScriptType scriptType = isElectrumSignatureFormat() ? ScriptType.P2PKH : decryptedWallet.getScriptType();
signatureText = privKey.signMessage(message.getText().trim(), scriptType);
}
privKey.clear();
}
signature.clear();
signature.appendText(signatureText);
@@ -201,7 +201,7 @@ public class Storage {
keystore.setExtendedPublicKey(derivedKeystore.getExtendedPublicKey());
keystore.setBip47ExtendedPrivateKey(derivedKeystore.getBip47ExtendedPrivateKey());
keystore.setSilentPaymentScanAddress(derivedKeystore.getSilentPaymentScanAddress());
copyKeystore.getMasterPrivateKey().clear();
copyKeystore.getMasterPrivateExtendedKey().clear();
}
}
}
@@ -35,9 +35,6 @@ public class WalletAndKey implements Comparable<WalletAndKey> {
}
public void clear() {
if(encryptionKey != null) {
encryptionKey.clear();
}
if(key != null) {
key.clear();
}
@@ -108,7 +108,6 @@ public class MasterActionListBox extends ActionListBox {
Storage.KeyDerivationService keyDerivationService = new Storage.KeyDerivationService(storage, new SecureString(password), true);
keyDerivationService.setOnSucceeded(workerStateEvent -> {
EventManager.get().post(new StorageEvent(walletId, TimedEvent.Action.END, "Done"));
keyDerivationService.getValue().clear();
SparrowTerminal.get().unlockWallet(storage);
SparrowTerminal.get().getGuiThread().invokeLater(() -> LoadWallet.getOpeningDialog(storage, wallet).showDialog(SparrowTerminal.get().getGui()));
});
@@ -172,7 +172,6 @@ public abstract class NewWalletDialog extends DialogWindow {
} catch(IOException | StorageException | MnemonicException e) {
log.error("Error saving imported wallet", e);
} finally {
encryptionFullKey.clear();
if(key != null) {
key.clear();
}
@@ -148,7 +148,6 @@ public class SettingsDialog extends WalletDialog {
copy.decrypt(key);
showSuccessDialog("Wallet Seed", copy.getKeystores().get(0).getSeed().getMnemonicString().asString());
} finally {
encryptionFullKey.clear();
if(key != null) {
key.clear();
}
@@ -247,7 +246,6 @@ public class SettingsDialog extends WalletDialog {
log.error("Error saving wallet", e);
AppServices.showErrorDialog("Error saving wallet", e.getMessage());
} finally {
encryptionFullKey.clear();
if(key != null) {
key.clear();
}
@@ -83,7 +83,6 @@ public class WalletDialog extends DialogWindow {
EventManager.get().post(new StorageEvent(walletId, TimedEvent.Action.END, "Done"));
ECKey encryptionFullKey = keyDerivationService.getValue();
Key key = new Key(encryptionFullKey.getPrivKeyBytes(), getWalletForm().getStorage().getKeyDeriver().getSalt(), EncryptionType.Deriver.ARGON2);
encryptionFullKey.clear();
masterWallet.decrypt(key);
addAndEncryptAccount(masterWallet, standardAccount, key);
if(postAddition != null) {
@@ -573,7 +573,6 @@ public class SettingsController extends WalletFormController implements Initiali
log.error("Error restoring public keys from seed", e);
} finally {
key.clear();
encryptionFullKey.clear();
password.get().clear();
}
});
@@ -680,7 +679,6 @@ public class SettingsController extends WalletFormController implements Initiali
EventManager.get().post(new StorageEvent(walletId, TimedEvent.Action.END, "Done"));
ECKey encryptionFullKey = keyDerivationService.getValue();
Key key = new Key(encryptionFullKey.getPrivKeyBytes(), walletForm.getStorage().getKeyDeriver().getSalt(), EncryptionType.Deriver.ARGON2);
encryptionFullKey.clear();
masterWallet.decrypt(key);
if(masterWallet.getKeystores().stream().anyMatch(ks -> ks.getSource() != KeystoreSource.SW_SEED)) {
@@ -1047,7 +1045,6 @@ public class SettingsController extends WalletFormController implements Initiali
revert.setDisable(false);
apply.setDisable(false);
} finally {
encryptionFullKey.clear();
if(key != null) {
key.clear();
}