當前位置: 首頁>>代碼示例>>Java>>正文


Java CardConnection類代碼示例

本文整理匯總了Java中sasc.terminal.CardConnection的典型用法代碼示例。如果您正苦於以下問題:Java CardConnection類的具體用法?Java CardConnection怎麽用?Java CardConnection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CardConnection類屬於sasc.terminal包,在下文中一共展示了CardConnection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import sasc.terminal.CardConnection; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
    AID aid = new AID("A0 00 00 01 67 41 30 00 FF");
    JCOPApplication jcopApp = new JCOPApplication(aid, Util.fromHexString("B3 11 01 29 00 00 00 00 50 48 36 35 30 41 01 03 C1 3C 82"), null);
    System.out.println(jcopApp);
    
    CardConnection cardConnection = TerminalUtil.connect(TerminalUtil.State.CARD_INSERTED); //Waits for card insertion
    Log.info(Util.prettyPrintHexNoWrap(cardConnection.getATR()));
    Log.info(ATR_DB.searchATR(cardConnection.getATR()).toString());
    
    CardResponse selectJcopResponse = cardConnection.transmit(Util.fromHexString("00 a4 04 00 09 a0 00 00 01 67 41 30 00 ff 00"));
    System.out.println(selectJcopResponse);
    System.out.println(new JCOPApplication(aid, selectJcopResponse.getData(), null));

}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:15,代碼來源:JCOPApplication.java

示例2: main

import sasc.terminal.CardConnection; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
    CardConnection cardConnection = TerminalUtil.connect(TerminalUtil.State.CARD_INSERTED); //Waits for card present
    Log.info(Util.prettyPrintHexNoWrap(cardConnection.getATR()));
    Log.info(ATR_DB.searchATR(cardConnection.getATR()).toString());
    GlobalPlatformDriver gpd = new GlobalPlatformDriver();
    gpd.process(new AID(GPSD_AID), null, cardConnection);
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:8,代碼來源:GlobalPlatformDriver.java

示例3: connectTerminal

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public CardConnection connectTerminal(String name) throws TerminalException {
    try {
        CardTerminal smartCardIOTerminal = terminals.getTerminal(name);
        Card _card = smartCardIOTerminal.connect("*");
        return new SmartcardioCardConnection(_card, smartCardIOTerminal);
    } catch (CardException ex) {
        throw new TerminalException(ex);
    } 
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:11,代碼來源:SmartcardioTerminalProviderImpl.java

示例4: connect

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public CardConnection connect() throws TerminalException {
    try {
        card = smartCardIOTerminal.connect("*");
        return new SmartcardioCardConnection(card, smartCardIOTerminal);
    } catch (CardException ex) {
        throw new TerminalException(ex);
    }
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:10,代碼來源:SmartcardioTerminalProviderImpl.java

示例5: startSession

import sasc.terminal.CardConnection; //導入依賴的package包/類
public static SEEMVSession startSession(Application appCtx,
        CardConnection seConn) {
    if (seConn == null) {
        throw new IllegalArgumentException(
                "Needs initialized SE connection.");
    }

    return new SEEMVSession(seConn);
}
 
開發者ID:gsbabil,項目名稱:ClassicNFC,代碼行數:10,代碼來源:SEEMVSession.java

示例6: CardSession

import sasc.terminal.CardConnection; //導入依賴的package包/類
private CardSession(CardConnection terminal, SessionProcessingEnv sessionEnv){
    this.terminal = terminal;
    this.sessionEnv = sessionEnv;
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:5,代碼來源:CardSession.java

示例7: createSession

import sasc.terminal.CardConnection; //導入依賴的package包/類
public static CardSession createSession(CardConnection terminal, SessionProcessingEnv sessionEnv) {
    return new CardSession(terminal, sessionEnv);
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:4,代碼來源:CardSession.java

示例8: CardScanner

import sasc.terminal.CardConnection; //導入依賴的package包/類
public CardScanner(SmartCard smartCard, CardConnection terminal, SessionProcessingEnv sessionEnv) {
    this.smartCard = smartCard;
    this.terminal = terminal;
    this.sessionEnv = sessionEnv;
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:6,代碼來源:CardScanner.java

示例9: process

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public boolean process(SmartCard card, CardConnection terminal) throws TerminalException {
    Log.debug("Attempting to read storage card");
    
    byte SW1;
    byte SW2;
    byte[] command;
    CardResponse response;
    byte[] data;
    
    //6a 81 = Function not supported
    //90 00 = Success 
    Log.commandHeader("PS/SC GET DATA: UID (Command handled by terminal when card is contactless)");

    command = Util.fromHexString("ff ca 00 00 00"); //PC/SC 2.01 part 3 GetData: UID
    response = EMVUtil.sendCmdNoParse(terminal, command);
    SW1 = (byte) response.getSW1();
    SW2 = (byte) response.getSW2();
    if (response.getSW() == SW.SUCCESS.getSW()) {
        
    }
    
    Log.commandHeader("PC/SC GET DATA: Historical bytes (Command handled by terminal when card is contactless)");

    command = Util.fromHexString("ff ca 01 00 00"); //PC/SC 2.01 part 3 GetData: historical bytes from the ATS of a ISO 14443 A card without CRC
    response = EMVUtil.sendCmdNoParse(terminal, command);
    SW1 = (byte) response.getSW1();
    SW2 = (byte) response.getSW2();
    if (response.getSW() == SW.SUCCESS.getSW()) {
        
    }
    
    //Read Binary

    //    Warning
    //      6281 Part of returned data may be corrupted.
    //        82 End of file reached before reading expected number of bytes.
    //      6981 Command incompatible.
    //        82 Security status not satisfied.
    //        86 Command not allowed.
    //      6A81 Function not supported.
    //        82 File not found / Addressed block or byte does not exist.
    //
    //    Error
    //      6CXX Wrong length (wrong number Le; 'XX' is the exact number). 
    
    int addressMSB = 0;
    int addressLSB = 0;
    while(addressMSB < 256) {
        Log.commandHeader("PC/SC Read Binary (Storage Card)");
        command = Util.fromHexString("FF B0 00 00 00"); //with Le
        command[2] = (byte)addressMSB;
        command[3] = (byte)addressLSB;
        response = EMVUtil.sendCmdNoParse(terminal, command);
        SW1 = response.getSW1();
        SW2 = response.getSW2();
        data = response.getData();
        if(data.length > 0 && response.getSW() == SW.SUCCESS.getSW()){
            addressLSB++;
            if(addressLSB > 255) {
                addressLSB = 0;
                addressMSB++;
            }
            continue;
        }
        break;
    } 
    return false; //Don't handle exclusively. The card may have more applications or other functionality
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:70,代碼來源:StorageCardHandler.java

示例10: connect

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public CardConnection connect() throws TerminalException {
    throw new IllegalStateException("Already connected.");
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:5,代碼來源:SmartcardioCardConnection.java

示例11: connectAnyTerminal

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public CardConnection connectAnyTerminal() throws TerminalException {
    return terminalProvider.connectAnyTerminal();
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:5,代碼來源:SmartcardioTerminalProvider.java

示例12: connectAnyTerminalWithCardPresent

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public CardConnection connectAnyTerminalWithCardPresent(String protocol) throws TerminalException {
    return terminalProvider.connectAnyTerminalWithCardPresent(protocol);
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:5,代碼來源:SmartcardioTerminalProvider.java

示例13: connectTerminal

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public CardConnection connectTerminal(String name) throws TerminalException {
    return terminalProvider.connectTerminal(name);
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:5,代碼來源:SmartcardioTerminalProvider.java

示例14: connectAnyTerminal

import sasc.terminal.CardConnection; //導入依賴的package包/類
@Override
public CardConnection connectAnyTerminal() throws TerminalException {
    return connectAnyTerminal("*");
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:5,代碼來源:SmartcardioTerminalProviderImpl.java

示例15: startSession

import sasc.terminal.CardConnection; //導入依賴的package包/類
public static EMVSession startSession(SmartCard card, CardConnection terminal) {
    if (card == null || terminal == null) {
        throw new IllegalArgumentException("Arguments cannot be null");
    }
    return new EMVSession(card, terminal);
}
 
開發者ID:yinheli,項目名稱:javaemvreader,代碼行數:7,代碼來源:EMVSession.java


注:本文中的sasc.terminal.CardConnection類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。