Improve PUK (aka Reset Code) handling
This commit is contained in:
parent
981899718f
commit
5022bca0b5
@ -241,7 +241,14 @@ public final class Persistent {
|
|||||||
user_pin.resetAndUnblock();
|
user_pin.resetAndUnblock();
|
||||||
Common.commitTransaction(isRegistering);
|
Common.commitTransaction(isRegistering);
|
||||||
|
|
||||||
user_puk_length = 0;
|
Common.beginTransaction(isRegistering);
|
||||||
|
user_puk_length = (short)0;
|
||||||
|
/* Ensures any previously defined PUK code is blocked at factory reset */
|
||||||
|
byte[] emptyPin = new byte[0];
|
||||||
|
while(user_puk.getTriesRemaining() > 0) {
|
||||||
|
user_puk.check(emptyPin, (short)0, (byte)0);
|
||||||
|
}
|
||||||
|
Common.commitTransaction(isRegistering);
|
||||||
|
|
||||||
Common.beginTransaction(isRegistering);
|
Common.beginTransaction(isRegistering);
|
||||||
admin_pin_length = (byte)Constants.ADMIN_PIN_DEFAULT.length;
|
admin_pin_length = (byte)Constants.ADMIN_PIN_DEFAULT.length;
|
||||||
|
@ -154,11 +154,7 @@ public final class SmartPGPApplet extends Applet {
|
|||||||
buf[off++] = Constants.ADMIN_PIN_MAX_SIZE;
|
buf[off++] = Constants.ADMIN_PIN_MAX_SIZE;
|
||||||
|
|
||||||
buf[off++] = data.user_pin.getTriesRemaining();
|
buf[off++] = data.user_pin.getTriesRemaining();
|
||||||
if(data.user_puk_length > 0) {
|
buf[off++] = data.user_puk.getTriesRemaining();
|
||||||
buf[off++] = data.user_puk.getTriesRemaining();
|
|
||||||
} else {
|
|
||||||
buf[off++] = (byte)0x00;
|
|
||||||
}
|
|
||||||
buf[off++] = data.admin_pin.getTriesRemaining();
|
buf[off++] = data.admin_pin.getTriesRemaining();
|
||||||
|
|
||||||
return off;
|
return off;
|
||||||
|
Loading…
Reference in New Issue
Block a user