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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

APÊNDICE A. CLASSES DA APLICAÇÃO DE CONTROLE DE USUÁRIO 119}}case INS_ADICIONAR_LOCAL:// Adicionar um localthis.adicionarLocal(apdu);break;case INS_VERIFICAR_LOCAL:// Verificar se um local é permitidothis.verificarLocal(apdu);break;case INS_REMOVER_LOCAL:// Remover um local permitidothis.removerLocal(apdu);break;case INS_ADICIONAR_CREDITOS:// Adicionar créditosthis.adicionarCreditos(apdu);break;default:ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);private void verificarSenha(APDU apdu) {byte tam_senha = (byte) apdu.setIncomingAndReceive();byte[] buffer = apdu.getBuffer();if (!pin.check(buffer, ISO7816.OFFSET_CDATA, tam_senha)) {ISOException.throwIt(SW_SENHA_INVALIDA);}}private void setMatricula(APDU apdu) {if (!pin.isValidated()) {ISOException.throwIt(SW_AUTENTICACAO_INVALIDA);}}byte[] buffer = apdu.getBuffer();byte tam_entrada = (byte) apdu.setIncomingAndReceive();byte lc = buffer[ISO7816.OFFSET_LC];if (tam_entrada != lc) {ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);}if (tam_entrada > Usuario.TAMANHO_MAXIMO_MATRICULA) {ISOException.throwIt(Usuario.SW_TAMANHO_MATRICULA_INVALIDO);}byte[] nova_matricula = new byte[tam_entrada];Util.arrayCopy(buffer, ISO7816.OFFSET_CDATA, nova_matricula,(short) 0, tam_entrada);u.setMatricula(nova_matricula);private void getMatricula(APDU apdu) {byte tam_saida = (byte) apdu.setOutgoing();if (tam_saida > Usuario.TAMANHO_MAXIMO_MATRICULA) {ISOException.throwIt(Usuario.SW_TAMANHO_MATRICULA_INVALIDO);}apdu.setOutgoingLength(tam_saida);apdu.sendBytesLong(u.getMatricula(), (short) 0, tam_saida);}

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

Saved successfully!

Ooh no, something went wrong!