compare the ecies mac in constant time and test the invalid password cause

This commit is contained in:
Craig Raw
2026-08-21 09:27:58 +02:00
parent 325ab3b71b
commit 4e2903fe60
2 changed files with 12 additions and 1 deletions
+1 -1
Submodule drongo updated: cee00202dc...31130261ea
@@ -3,6 +3,7 @@ package com.sparrowwallet.sparrow.io;
import com.google.common.io.ByteStreams;
import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.Utils;
import com.sparrowwallet.drongo.crypto.InvalidPasswordException;
import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.MnemonicException;
@@ -107,6 +108,16 @@ public class ElectrumTest extends IoTest {
Assertions.assertEquals("xpub69iSRreMB6fu24sU8Tdxv7yYGqzPkDwPkwqUfKJTxW3p8afW7XvTewVCapuX3dQjdD197iF65WcjYaNpFbwWT3RyuZ1KJ3ToJNVWKWyAJ6f", wallet.getKeystores().get(0).getExtendedPublicKey().toString());
}
@Test
public void testEncryptedImportInvalidPassword() throws IOException {
Electrum electrum = new Electrum();
byte[] walletBytes = ByteStreams.toByteArray(getInputStream("electrum-encrypted"));
ImportException importException = Assertions.assertThrows(ImportException.class, () -> electrum.importWallet(new ByteArrayInputStream(walletBytes), "wrong"));
//FileImportPane reports "Invalid wallet password" by unwrapping this cause - dropping it degrades the message to a generic import error
Assertions.assertInstanceOf(InvalidPasswordException.class, importException.getCause());
}
@Test
public void testSinglesigSeedExport() throws ImportException, ExportException, IOException, MnemonicException {
Electrum electrum = new Electrum();