Search in sources :

Example 1 with VerifyApduCommand

use of es.gob.jmulticard.apdu.bit4id.stcm.VerifyApduCommand in project jmulticard by ctt-gob-es.

the class StCard method verifyPin.

@Override
public void verifyPin(final PasswordCallback pinPc) throws ApduConnectionException, PinException {
    if (pinPc == null) {
        // $NON-NLS-1$
        throw new BadPinException("No se ha establecido un PasswordCallback");
    }
    final CommandApdu chv = new VerifyApduCommand(CLA, pinPc);
    final ResponseApdu verifyResponse = sendArbitraryApdu(chv);
    if (!verifyResponse.isOk()) {
        if (verifyResponse.getStatusWord().getMsb() == ERROR_PIN_SW1) {
            throw new BadPinException(verifyResponse.getStatusWord().getLsb() - (byte) 0xC0);
        }
        throw new ApduConnectionException(// $NON-NLS-1$
        "Error en el envio de la verificacion de PIN con respuesta: " + verifyResponse.getStatusWord());
    }
}
Also used : CommandApdu(es.gob.jmulticard.apdu.CommandApdu) BadPinException(es.gob.jmulticard.card.BadPinException) ResponseApdu(es.gob.jmulticard.apdu.ResponseApdu) VerifyApduCommand(es.gob.jmulticard.apdu.bit4id.stcm.VerifyApduCommand) ApduConnectionException(es.gob.jmulticard.apdu.connection.ApduConnectionException)

Aggregations

CommandApdu (es.gob.jmulticard.apdu.CommandApdu)1 ResponseApdu (es.gob.jmulticard.apdu.ResponseApdu)1 VerifyApduCommand (es.gob.jmulticard.apdu.bit4id.stcm.VerifyApduCommand)1 ApduConnectionException (es.gob.jmulticard.apdu.connection.ApduConnectionException)1 BadPinException (es.gob.jmulticard.card.BadPinException)1