Package org.infotechservice.smartcard.utils

Examples of org.infotechservice.smartcard.utils.Messages


                //(byte)0x32, 0x50, 0x41, 0x59, 0x2E, (byte)0x53, (byte)0x59, (byte)0x53, 0x2E, 0x44, 0x44, 0x46, 0x30, 0x31 //PSE
                (byte)0xA0, 0x00, 0x00, 0x00, 0x04, (byte)0x10, (byte)0x10 //MASTERCARD
            }
        );
        ResponseAPDU r = channel.transmit(select);
        Messages msg = Messages.findMessage(r);
        if (!msg.isOk()) {
            System.out.println("Cannot select applet");
            return;
        }

        for(int file = 0; file<16; file++) {
            System.out.println("READ FILE:" + file);
            for(int rec = 0; rec<16; rec++) {
                int EF = getFile(file);
                CommandAPDU command = new CommandAPDU(0x00, 0xB2, rec, EF, 256);
                r = channel.transmit(command);
                msg = Messages.findMessage(r);
                if (msg.isOk()) {
                    System.out.println("\nFOUND RECORD OK: file:" + file + "rec:" + rec);
                    //System.out.println("REQUEST: " + Converter.hexDump(command.getBytes()));
                    System.out.println("response: " + r.toString());
                    System.out.println("raw: " + Converter.hexDump(r.getData()));
                    System.out.println("cp1251: " + new String(r.getData(), "windows-1251"));
View Full Code Here


        record1_7 = getRecord(READ_FILE_1_7);
    }

    private byte[] getRecord(CommandAPDU apdu) throws CardException {
        ResponseAPDU responce = exec(apdu, "Unable read user info");
        Messages msg = Messages.findMessage(responce);
        if (!msg.isOk()) {
            throw new CardException(msg.getMessage());
        }
        return responce.getData();
    }
View Full Code Here

     * @return
     * @throws CardException
     */
    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);
            }
View Full Code Here

TOP

Related Classes of org.infotechservice.smartcard.utils.Messages

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.