protected ResponseAPDU exec(CommandAPDU command, String errorMesssage) throws CardException {
ResponseAPDU responce = smartcard.getCard().getBasicChannel().transmit(command);
Messages msg = Messages.findMessage(responce);
if (msg.isError()) {
if (errorMesssage == null) {
throw new CardFrameworkException(msg);
} else {
throw new CardFrameworkException(errorMesssage, msg);
}
}
return responce;
}