Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacardx.framework
Interface Password

All Known Subinterfaces:
  SharedPasswordAuth

    @TransactionType(value=NOT_SUPPORTED)
    @SensitiveType(sensitivity=FULL)
    public interface Password

This interface represents a Password. An implementation must maintain these internal values:

- Password value.
- Try limit - the maximum number of times an incorrect Password can be presented before the Password is blocked. When the Password is blocked, it cannot be validated even on valid Password presentation.
- Try counter - the remaining number of times an incorrect Password presentation is permitted before the `Password` becomes blocked.
- Validated flag - true if a valid Password has been presented. This flag is reset on every card reset.

This interface does not make any assumptions about where the data for the Password value comparison is stored.

An owner implementation of this interface must provide a way to initialize/update the Password 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 Password presentation.

A typical password usage will combine an instance of `OwnerBioTemplate` returned by `BioBuilder` for the type `PASSWORD` and a Proxy Password interface (such as `SharedPasswordAuth`) which extends both the `Password` and the `Shareable` interfaces and re-declares the methods of the `Password` interface. The `OwnerBioTemplate` instance would be manipulated only by the owner who has update privilege. All others would access the password functionality via the proxy password interface.

Since:
  Java Card 3.0
See Also:
  `OwnerBioTemplate`, `BioBuilder`, `BioBuilder.PASSWORD`, `SharedPasswordAuth`, `Shareable`

Method Summary
`boolean` | `check(String password)` Compares `password` against the Password value.
`byte` | `getTriesRemaining()` Returns the number of times remaining that an incorrect password can be presented before the `Password` is blocked.
`boolean` | `isValidated()` Returns `true` if a valid password value has been presented since the last card reset or last call to `reset()`.
`void` | `reset()` If the validated flag is set, this method resets the validated flag and resets the `Password` try counter to the value of the `Password` try limit.

Method Detail

### getTriesRemaining

    byte getTriesRemaining()

  Returns the number of times remaining that an incorrect password can be presented before the `Password` is blocked.

  Returns:
    the number of times remaining

### isValidated

    boolean isValidated()

  Returns `true` if a valid password value has been presented since the last card reset or last call to `reset()`.

  Returns:
    `true` if validated; `false` otherwise

### reset

    void reset()

  If the validated flag is set, this method resets the validated flag and resets the `Password` try counter to the value of the `Password` try limit. If the validated flag is not set, this method does nothing.

### check

    boolean check(String password)

  Compares `password` against the Password value. If they match and the `Password` 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 `Password`. 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` is thrown, the validated flag must be set to false, the try counter must be decremented and, the `Password` blocked if the counter reaches zero.
  - If `Password` parameter is `null` a `NullPointerException` exception is thrown.

  Parameters:
    `password` - the String containing the Password value being checked
  Returns:
    `true` if the Password value matches; `false` otherwise
  Throws:
    `NullPointerException` - if `password` is `null`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.