12.07.2015 Views

JCML - Java Card Modeling Language: Definição e ... - Ifrn

JCML - Java Card Modeling Language: Definição e ... - Ifrn

JCML - Java Card Modeling Language: Definição e ... - Ifrn

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APÊNDICE A. CLASSES DA APLICAÇÃO DE CONTROLE DE USUÁRIO 121private void removerLocal(APDU apdu) {if (!pin.isValidated()) {ISOException.throwIt(SW_AUTENTICACAO_INVALIDA);}}byte[] buffer = apdu.getBuffer();byte tam_local = (byte) apdu.setIncomingAndReceive();if (tam_local != Usuario.TAMANHO_LOCAL) {ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);}byte local = buffer[ISO7816.OFFSET_CDATA];u.removerLocal(local);private void adicionarCreditos(APDU apdu) {if (!pin.isValidated()) {ISOException.throwIt(SW_AUTENTICACAO_INVALIDA);}}byte[] buffer = apdu.getBuffer();byte tam_creditos = (byte) apdu.setIncomingAndReceive();if (tam_creditos != Usuario.TAMANHO_CREDITOS) {ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);}short valor_creditos = Util.getShort(buffer, ISO7816.OFFSET_CDATA);u.adicionarCreditos(valor_creditos);private void removerCreditos(APDU apdu) {if (!pin.isValidated()) {ISOException.throwIt(SW_AUTENTICACAO_INVALIDA);}}byte[] buffer = apdu.getBuffer();byte tam_creditos = (byte) apdu.setIncomingAndReceive();if (tam_creditos != Usuario.TAMANHO_CREDITOS) {ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);}short valor_creditos = Util.getShort(buffer, ISO7816.OFFSET_CDATA);u.removerCreditos(valor_creditos);}private void verificarCreditos(APDU apdu) {byte[] buffer = apdu.getBuffer();byte tam_esperado = (byte) apdu.setOutgoing();if (tam_esperado != Usuario.TAMANHO_CREDITOS) {ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);}apdu.setOutgoingLength(Usuario.TAMANHO_CREDITOS);short indice_inicio = 0;Util.setShort(buffer, indice_inicio, u.getCreditos());apdu.sendBytes(indice_inicio, Usuario.TAMANHO_CREDITOS);}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!