use of es.gob.jmulticard.apdu.ceres.CeresVerifyApduCommand in project jmulticard by ctt-gob-es.
the class Ceres method verifyPin.
@Override
public void verifyPin(final PasswordCallback pinPc) throws ApduConnectionException, PinException {
if (pinPc == null) {
// $NON-NLS-1$
throw new PinException("No se ha establecido un PasswordCallback");
}
final CommandApdu chv = new CeresVerifyApduCommand(CLA, pinPc);
final ResponseApdu verifyResponse = sendArbitraryApdu(chv);
if (!verifyResponse.isOk()) {
if (verifyResponse.getStatusWord().getMsb() == ERROR_PIN_SW1 || verifyResponse.getStatusWord().getMsb() == ERROR_PIN_SW2) {
if (AUTO_RETRY) {
this.passwordCallback = null;
verifyPin(getInternalPasswordCallback());
return;
}
throw new BadPinException(verifyResponse.getStatusWord().getLsb() - (byte) 0xC0);
} else if (new StatusWord((byte) 0x69, (byte) 0x83).equals(verifyResponse.getStatusWord())) {
throw new AuthenticationModeLockedException();
}
throw new ApduConnectionException(new Iso7816FourCardException(// $NON-NLS-1$ //$NON-NLS-2$
"Error en la verificacion de PIN (" + verifyResponse.getStatusWord() + ")", verifyResponse.getStatusWord()));
}
}
Aggregations