mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 12:26:45 +00:00
Merge pull request #1187 from Toporin/patch-satochip-error-0x9C01
satochip: flush card cache where cache memory is full
This commit is contained in:
commit
20b4d5a1b5
1 changed files with 8 additions and 2 deletions
|
@ -347,8 +347,14 @@ public class SatochipCommandSet {
|
|||
public APDUResponse cardBip32GetExtendedKey(byte[] bytePath) {
|
||||
byte p1 = (byte) (bytePath.length / 4);
|
||||
|
||||
APDUCommand plainApdu = new APDUCommand(0xB0, INS_BIP32_GET_EXTENDED_KEY, p1, 0x40, bytePath);
|
||||
return this.cardTransmit(plainApdu);
|
||||
APDUCommand capdu = new APDUCommand(0xB0, INS_BIP32_GET_EXTENDED_KEY, p1, 0x40, bytePath);
|
||||
APDUResponse rapdu = this.cardTransmit(capdu);
|
||||
if(rapdu.getSw() == 0x9C01) {
|
||||
// error 0X9C01: no memory available for key derivation => flush memory cache in card
|
||||
capdu = new APDUCommand(0xB0, INS_BIP32_GET_EXTENDED_KEY, p1, 0x80, bytePath);
|
||||
rapdu = this.cardTransmit(capdu);
|
||||
}
|
||||
return rapdu;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue