mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
Satochip: add check pin size
This commit is contained in:
parent
5b203a6c61
commit
fdc1186280
1 changed files with 5 additions and 0 deletions
|
|
@ -129,6 +129,7 @@ public class SatochipCommandSet {
|
|||
log.error("SATOCHIP: SatochipCommandSet cardTransmit() sw12==0x9C06: PIN required!");
|
||||
//TODO: throw?
|
||||
//TODO: verify PIN?
|
||||
throw new RuntimeException("PIN required!");
|
||||
}
|
||||
// SecureChannel is not initialized
|
||||
else if (sw12==0x9C21){
|
||||
|
|
@ -297,7 +298,11 @@ public class SatochipCommandSet {
|
|||
}
|
||||
pin = this.pinCached;
|
||||
}
|
||||
|
||||
byte[] pinBytes = pin.getBytes(StandardCharsets.UTF_8);
|
||||
if (pinBytes.length > 16){
|
||||
throw new RuntimeException("PIN should be maximum 16 characters!");
|
||||
}
|
||||
|
||||
APDUCommand capdu = new APDUCommand(0xB0, INS_VERIFY_PIN, (byte)pinNbr, 0x00, pinBytes);
|
||||
log.trace("SATOCHIP SatochipCommandSet cardVerifyPIN() capdu:"+ capdu.toHexString());
|
||||
|
|
|
|||
Loading…
Reference in a new issue