Package uk.co.nimp.smartcard

Examples of uk.co.nimp.smartcard.AnswerToReset


        status = win32Stcp250Dll.MPS_OnCmm(couplerId, clkHertz, atrLenRef, atrBuf);
        if (RET_OK != status) {
            throw new MP300Exception("MPS_OnCmm failed", status);
        }
        short len = atrLenRef.getValue();
        AnswerToReset out=new AnswerToReset(atrBuf,0,len);
        int fi=out.getSupportedFiDi()>>4;
        int di=out.getSupportedFiDi()&0x0F;
        //System.out.println("ATR:" + out.toString());
        if(out.acceptPps() & (out.getSupportedFiDi()!=0x11)){
            byte ppsBuf[] = new byte[10];
            for (int i = 0; i < ppsBuf.length; i++) {
                ppsBuf[i] = 0;
            }
            int p=0;
            if(GenericTerminal.PROTOCOL_T_1==protocol)
                p=1;
           
           
            if(7==di){
                //not supported by STAR265
                byte fakeAtr[]=out.getData();
                di=0x06;
                fakeAtr[2]=(byte) ((out.getSupportedFiDi()&0xF0)|di);
                status = win32Stcp250Dll.MPS_ChangeProtocolParameters(couplerId, win32Stcp250Dll.CPP_SIM_ATR ,fakeAtr,fakeAtr.length);
                if (RET_OK != status) {
                    throw new MP300Exception("MPS_ChangeProtocolParameters failed",status);
                }
            }
View Full Code Here


                throw new IllegalArgumentException("protocol = " + GenericTerminal.getProtocolName(protocol));
        }
        byte atrBuf[] = new byte[2];
        atrBuf[0]=0x3F;
        atrBuf[1]=0;
        AnswerToReset out=new AnswerToReset(atrBuf);
        cyclesPerEtu.value=372;
        delay();
        return out;
    }
View Full Code Here

        }
        byte atrBuf[] = new byte[2];
        startDllCall();
        atrBuf[0]=0x3F;
        atrBuf[1]=0;
        AnswerToReset out=new AnswerToReset(atrBuf);
        cyclesPerEtu.value=372;
        delay();
        stopDllCall();
        return out;
    }
View Full Code Here

    static AnswerToReset SCardConnect(IoServer context) throws ScardException {
        if(!context.isConnected()) throw new ScardException("card disconnected");
        byte atrBuf[] = new byte[2];
        atrBuf[0]=0x3F;
        atrBuf[1]=0;
        AnswerToReset out=new AnswerToReset(atrBuf);
        return out;
    }
View Full Code Here

        status = win32Mp300ComDll.MPS_OnCmm(couplerId, clkHertz, atrLenRef, atrBuf);
        if (RET_OK != status) {
            throw new MP300Exception("MPS_OnCmm failed", status);
        }
        short len = atrLenRef.getValue();
        AnswerToReset out=new AnswerToReset(atrBuf,0,len);

        if(autoPps && out.acceptPps() && (out.getSupportedFiDi()!=0x11)){
            byte ppsBuf[] = new byte[10];
            for (int i = 0; i < ppsBuf.length; i++) {
                ppsBuf[i] = 0;
            }
            int pps=0x10000000+(out.getSupportedFiDi()<<16);
            if(GenericTerminal.PROTOCOL_T_1==protocol)
                pps|=0x01000000;
            status = win32Mp300ComDll.MPS_SendPPS2(couplerId, pps, ppsBuf);
            if (RET_OK != status) {
                throw new MP300Exception("MPS_SendPPS2 failed",status);
View Full Code Here

        if (null == cardId) {
            try {
                cardId = SCardConnect(contextId, name, sharingMode, connectProtocol);
                byte[] status = new byte[2];
                byte[] atrBytes = SCardStatus(cardId, status);
                atr = new AnswerToReset(atrBytes);
                if (ACTIVATION_ANY == activation) {
                    logAtr(atr);
                }
                this.protocol = NimpPcScTerminalManager.win32Protocol2GenericTerminalProtocol(status[1]);
                //basicChannel = new ChannelImpl(this, 0);
                state = State.CARD_PRESENT;
            } catch (PcScException e) {
                if (e.code == NimpPcScTerminalManager.SCARD_W_REMOVED_CARD) {
                    throw new CardNotPresentException("No card present", e);
                } else {
                    throw new ScardException("connect() failed", e);
                }
            }
        }
        if ((null == atr) || (ACTIVATION_ANY != activation)) {
            try {
                SCardReconnect(cardId, sharingMode, connectProtocol, activationPolicy);
                byte[] status = new byte[2];
                byte[] atrBytes = SCardStatus(cardId, status);
                atr = new AnswerToReset(atrBytes);
                logAtr(atr);
                this.protocol = NimpPcScTerminalManager.win32Protocol2GenericTerminalProtocol(status[1]);
                //basicChannel = new ChannelImpl(this, 0);
                state = State.CARD_PRESENT;
            } catch (PcScException e) {
View Full Code Here

        //if ((null == atr) || (ACTIVATION_ANY != activation)) {
            try {
                SCardReconnect(cardId, sharingMode, connectProtocol, activationPolicy);
                byte[] status = new byte[2];
                byte[] atrBytes = SCardStatus(cardId, status);
                atr = new AnswerToReset(atrBytes);
                logAtr(atr);
                this.protocol = PcScTerminalManager.win32Protocol2GenericTerminalProtocol(status[1]);
                //basicChannel = new ChannelImpl(this, 0);
                state = State.CARD_PRESENT;
            } catch (PcScException e) {
View Full Code Here

                throw new IllegalArgumentException("protocol = " + GenericTerminal.getProtocolName(protocol));
        }
        byte atrBuf[] = new byte[2];
        atrBuf[0]=0x3F;
        atrBuf[1]=0;
        AnswerToReset out=new AnswerToReset(atrBuf);
        cyclesPerEtu.value=372;
        return out;
    }
View Full Code Here

            terminal.coldConnect();
        }
        if(terminal.getActivationCounter()==lastActivationCounter)
            return lastCard;
        lastActivationCounter=terminal.getActivationCounter();
        AnswerToReset atr=terminal.getAtr();

        List<IdentifiableCard> compatibleCards=supportedCards;
        List<IdentifiableCard> candidates=new ArrayList<IdentifiableCard>();
        for(int i=0;i<supportedCards.size();i++){
            IdentifiableCard card=supportedCards.get(i);
View Full Code Here

            }
        }
        //status=win32CardDll.card_CardCfgX(card, configX);    // get parameters
        //System.out.println("WI="+configX.WI+", WWT="+configX.WWT);

        AnswerToReset out = new AnswerToReset(card.ATR, 0, card.ATRLg);

        //System.out.println("ATR:" + out.toString());
        int fiDi = out.getSupportedFiDi();
        if(autoPps && out.acceptPps() && (out.getSupportedFiDi()!=0x11)){
            int pLngOut[] = new int[1];
            pLngOut[0] = 10;
            byte ppsBuf[] = new byte[pLngOut[0]];
            ppsBuf[0] = (byte) 0xFF;
            if (GenericTerminal.PROTOCOL_T_1 == protocol) {
View Full Code Here

TOP

Related Classes of uk.co.nimp.smartcard.AnswerToReset

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.