mirror of
https://github.com/status-im/status-keycard.git
synced 2025-01-12 14:54:54 +00:00
closes #48
This commit is contained in:
parent
3e49fe9626
commit
ac3c24852f
@ -542,6 +542,10 @@ public class KeycardApplet extends Applet {
|
||||
byte[] apduBuffer = apdu.getBuffer();
|
||||
byte len = (byte) secureChannel.preprocessAPDU(apduBuffer);
|
||||
|
||||
if (!(len == PIN_LENGTH && allDigits(apduBuffer, ISO7816.OFFSET_CDATA, len))) {
|
||||
ISOException.throwIt(ISO7816.SW_WRONG_DATA);
|
||||
}
|
||||
|
||||
if (!pin.check(apduBuffer, ISO7816.OFFSET_CDATA, len)) {
|
||||
ISOException.throwIt((short)((short) 0x63c0 | (short) pin.getTriesRemaining()));
|
||||
}
|
||||
|
@ -513,6 +513,13 @@ public class KeycardTest {
|
||||
|
||||
cmdSet.autoOpenSecureChannel();
|
||||
|
||||
// Wrong format
|
||||
response = cmdSet.verifyPIN("12345");
|
||||
assertEquals(0x6a80, response.getSw());
|
||||
|
||||
response = cmdSet.verifyPIN("12345a");
|
||||
assertEquals(0x6a80, response.getSw());
|
||||
|
||||
// Wrong PIN
|
||||
response = cmdSet.verifyPIN("123456");
|
||||
assertEquals(0x63C2, response.getSw());
|
||||
|
Loading…
x
Reference in New Issue
Block a user