Page 1 of 1

PIN_TRY_COUNTER

Posted: Sat May 19, 2018 4:28 am
by vishalxz
can any one tell how to block pin in java card if pin retry counter is zero and how to decrease pin try counter.

Thanks in advance

Re: PIN_TRY_COUNTER

Posted: Sun May 20, 2018 11:33 pm
by wumindejia
You can send the command of unblock pin or reload pin. The function is not implemented in the "WalletDemoApplet". You can only uninstall the instance.

Re: PIN_TRY_COUNTER

Posted: Mon May 21, 2018 12:52 am
by vishalxz
sir can u refer any example...to block pin and to decrease pin try counter.

Re: PIN_TRY_COUNTER

Posted: Mon May 21, 2018 3:02 am
by wumindejia
vishalxz wrote:sir can u refer any example...to block pin and to decrease pin try counter.

You can download LoyaltyCard-Applet-v1.0.zip in the viewtopic.php?f=17&t=1027, function is UpdatePin(APDU apdu).

Re: PIN_TRY_COUNTER

Posted: Mon May 21, 2018 3:05 am
by jennyvenus
for( i = 0; i < (byte)( pin_max_time - pin_current_time ); i++ )
{
PIN
.check( r, (short)0x00, (byte)0x10 );
}


check several time, pin will blocked

Re: PIN_TRY_COUNTER

Posted: Mon May 21, 2018 4:12 am
by roundtable
please read documemt of javacard API: javacard.framework.OwnerPIN

to decrease try count, just call check(..) with wrong PIN, follwoing is fragment of method check ():

ublic boolean check(byte[] pin,
short offset,
byte length)
throws ArrayIndexOutOfBoundsException,
NullPointerException
Compares pin against the PIN value. If they match and the PIN is not blocked, it sets the validated flag and resets the try counter to its maximum. If it does not match, it decrements the try counter and, if the counter has reached zero, blocks the PIN. Even if a transaction is in progress, update of internal state - the try counter, the validated flag, and the blocking state, shall not participate in the transaction.

if you want unblock PIN, just call resetAndUnblock()