Interface PIN
-
- All Known Subinterfaces:
OwnerPINx
,OwnerPINxWithPredecrement
- All Known Implementing Classes:
OwnerPIN
public interface PIN
This interface represents a PIN. An implementation must maintain these internal values:- PIN value.
- Try limit - the maximum number of times an incorrect PIN can be presented before the PIN is blocked. When the PIN is blocked, it cannot be validated even on valid PIN presentation.
- Max PIN size - the maximum length of PIN allowed.
- Try counter - the remaining number of times an incorrect PIN
presentation is permitted before the
PIN
becomes blocked. - Validated flag - true if a valid PIN has been presented. This flag is reset on every card reset.
An owner implementation of this interface must provide a way to initialize/update the PIN value. The owner implementation of the interface must protect against attacks based on program flow prediction. In addition, even if a transaction is in progress, update of internal state such as the try counter, the validated flag, and the blocking state, shall not participate in the transaction during PIN presentation.
This interface does not make any assumptions about how the blocking state is internally represented: the blocking state is concomitant to the try counter value being equal to zero.
A typical card global PIN usage will combine an instance of the
OwnerPIN
class or of anOwnerPINx
-implementing class and a Proxy PIN interface which extends both thePIN
and theShareable
interfaces and re-declares the methods of the PIN interface. TheOwnerPIN
orOwnerPINx
instance would be manipulated only by the owner who has update privilege. All others would access the global PIN functionality via the proxy PIN interface.- See Also:
OwnerPIN
,OwnerPINx
,OwnerPINxWithPredecrement
,OwnerPINBuilder
,Shareable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
check(byte[] pin, short offset, byte length)
Comparespin
against the PIN value.byte
getTriesRemaining()
Returns the number of times remaining that an incorrect PIN can be presented before thePIN
is blocked.boolean
isValidated()
Returns the validated flag;true
if a valid PIN value has been presented since the last card reset and the validated flag was not reset since then by a call toreset
or by any owner PIN administrative method operations (seeOwnerPIN
andOwnerPINx
).void
reset()
If the validated flag is set, this method resets the validated flag.
-
-
-
Method Detail
-
getTriesRemaining
byte getTriesRemaining()
Returns the number of times remaining that an incorrect PIN can be presented before thePIN
is blocked.In addition to returning a
byte
result, platform-implementations of this method set the result in an internal state which can be rechecked using assertion methods of theSensitiveResult
class, if supported by the platform.- Returns:
- the number of times remaining
-
check
boolean check(byte[] pin, short offset, byte length) throws ArrayIndexOutOfBoundsException, NullPointerException
Comparespin
against the PIN value. If thePIN
is not already blocked then:- if the PIN value matches, it sets the validated flag and resets the try counter to its maximum;
- otherwise, it resets the validated flag, decrements the
try counter - if not assumed to having been pre-decremented - 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.
Note:
- If
NullPointerException
orArrayIndexOutOfBoundsException
is thrown, the validated flag must be set to false, the try counter must be decremented and, thePIN
blocked if the counter reaches zero. - If
offset
orlength
parameter is negative anArrayIndexOutOfBoundsException
exception is thrown. - If
offset+length
is greater thanpin.length
, the length of thepin
array, anArrayIndexOutOfBoundsException
exception is thrown. - If
pin
parameter isnull
aNullPointerException
exception is thrown.
In addition to returning a
boolean
result, platform-implementations of this method set the result in an internal state which can be rechecked using assertion methods of theSensitiveResult
class, if supported by the platform.- Parameters:
pin
- the byte array containing the PIN value being checkedoffset
- the starting offset in thepin
arraylength
- the length ofpin
- Returns:
true
if the PIN value matches;false
otherwise- Throws:
ArrayIndexOutOfBoundsException
- if the check operation would cause access of data outside array bounds.NullPointerException
- ifpin
isnull
-
isValidated
boolean isValidated()
Returns the validated flag;true
if a valid PIN value has been presented since the last card reset and the validated flag was not reset since then by a call toreset
or by any owner PIN administrative method operations (seeOwnerPIN
andOwnerPINx
).In addition to returning a
boolean
result, platform-implementations of this method set the result in an internal state which can be rechecked using assertion methods of theSensitiveResult
class, if supported by the platform.- Returns:
true
if validated;false
otherwise
-
reset
void reset()
If the validated flag is set, this method resets the validated flag. If the validated flag is not set, this method does nothing.
-
-