本文整理汇总了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));
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例6: CardSession
import sasc.terminal.CardConnection; //导入依赖的package包/类
private CardSession(CardConnection terminal, SessionProcessingEnv sessionEnv){
this.terminal = terminal;
this.sessionEnv = sessionEnv;
}
示例7: createSession
import sasc.terminal.CardConnection; //导入依赖的package包/类
public static CardSession createSession(CardConnection terminal, SessionProcessingEnv sessionEnv) {
return new CardSession(terminal, sessionEnv);
}
示例8: CardScanner
import sasc.terminal.CardConnection; //导入依赖的package包/类
public CardScanner(SmartCard smartCard, CardConnection terminal, SessionProcessingEnv sessionEnv) {
this.smartCard = smartCard;
this.terminal = terminal;
this.sessionEnv = sessionEnv;
}
示例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
}
示例10: connect
import sasc.terminal.CardConnection; //导入依赖的package包/类
@Override
public CardConnection connect() throws TerminalException {
throw new IllegalStateException("Already connected.");
}
示例11: connectAnyTerminal
import sasc.terminal.CardConnection; //导入依赖的package包/类
@Override
public CardConnection connectAnyTerminal() throws TerminalException {
return terminalProvider.connectAnyTerminal();
}
示例12: connectAnyTerminalWithCardPresent
import sasc.terminal.CardConnection; //导入依赖的package包/类
@Override
public CardConnection connectAnyTerminalWithCardPresent(String protocol) throws TerminalException {
return terminalProvider.connectAnyTerminalWithCardPresent(protocol);
}
示例13: connectTerminal
import sasc.terminal.CardConnection; //导入依赖的package包/类
@Override
public CardConnection connectTerminal(String name) throws TerminalException {
return terminalProvider.connectTerminal(name);
}
示例14: connectAnyTerminal
import sasc.terminal.CardConnection; //导入依赖的package包/类
@Override
public CardConnection connectAnyTerminal() throws TerminalException {
return connectAnyTerminal("*");
}
示例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);
}