Search in sources :

Example 1 with RetriesLeftApduCommand

use of es.gob.jmulticard.apdu.gide.RetriesLeftApduCommand in project jmulticard by ctt-gob-es.

the class SmartCafePkcs15Applet method getPinRetriesLeft.

private int getPinRetriesLeft() throws PinException {
    final CommandApdu verifyCommandApdu = new RetriesLeftApduCommand();
    final ResponseApdu verifyResponse;
    try {
        verifyResponse = getConnection().transmit(verifyCommandApdu);
    } catch (final ApduConnectionException e) {
        throw new PinException(// $NON-NLS-1$
        "Error obteniendo el PIN del CallbackHandler: " + e, // $NON-NLS-1$
        e);
    }
    if (verifyResponse.isOk() || verifyResponse.getBytes().length > 2) {
        return verifyResponse.getBytes()[1];
    }
    throw new PinException(// $NON-NLS-1$
    "Error comprobando los intentos restantes de PIN con respuesta: " + HexUtils.hexify(verifyResponse.getBytes(), true));
}
Also used : CommandApdu(es.gob.jmulticard.apdu.CommandApdu) ResponseApdu(es.gob.jmulticard.apdu.ResponseApdu) BadPinException(es.gob.jmulticard.card.BadPinException) PinException(es.gob.jmulticard.card.PinException) RetriesLeftApduCommand(es.gob.jmulticard.apdu.gide.RetriesLeftApduCommand) ApduConnectionException(es.gob.jmulticard.apdu.connection.ApduConnectionException)

Aggregations

CommandApdu (es.gob.jmulticard.apdu.CommandApdu)1 ResponseApdu (es.gob.jmulticard.apdu.ResponseApdu)1 ApduConnectionException (es.gob.jmulticard.apdu.connection.ApduConnectionException)1 RetriesLeftApduCommand (es.gob.jmulticard.apdu.gide.RetriesLeftApduCommand)1 BadPinException (es.gob.jmulticard.card.BadPinException)1 PinException (es.gob.jmulticard.card.PinException)1