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 117public void adicionarCreditos(short valor) {if ((short) (valor + creditos) > VALOR_MAXIMO_CREDITOS) {ISOException.throwIt(SW_VALOR_MAXIMO_CREDITO_EXCEDIDO);}creditos += valor;}public void removerCreditos(short valor) {if (valor > creditos) {ISOException.throwIt(SW_CREDITOS_INSUFICIENTES);}creditos -= valor;}}public short getCreditos() {return creditos;}A.2 Classe UserApplet.javaimport javacard.framework.APDU;import javacard.framework.Applet;import javacard.framework.ISO7816;import javacard.framework.ISOException;import javacard.framework.OwnerPIN;import javacard.framework.Util;public class UsuarioApplet extends Applet {public static final byte CLA_SMARTESCOLA = (byte) 0x80;public static final byte INS_VERIFICAR_SENHA = (byte) 0x00;public static final byte INS_SET_MATRICULA = (byte) 0x11;public static final byte INS_SET_TIPO = (byte) 0x12;public static final byte INS_GET_MATRICULA = (byte) 0x21;public static final byte INS_GET_TIPO = (byte) 0x22;public static final byte INS_ADICIONAR_LOCAL = (byte) 0x13;public static final byte INS_VERIFICAR_LOCAL = (byte) 0x23;public static final byte INS_REMOVER_LOCAL = (byte) 0x33;public static final byte INS_ADICIONAR_CREDITOS = (byte) 0x14;public static final byte INS_VERIFICAR_CREDITOS = (byte) 0x24;public static final byte INS_REMOVER_CREDITOS = (byte) 0x34;public static final short SW_SENHA_INVALIDA = (short) 0x6301;public static final short SW_AUTENTICACAO_INVALIDA = (short) 0x6302;public static final byte MAXIMO_TENTATIVAS_PIN = 3;public static final byte TAMANHO_MAXIMO_PIN = 10;private OwnerPIN pin;private Usuario u;

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

Saved successfully!

Ooh no, something went wrong!