当前位置: 首页>>代码示例>>Java>>正文


Java ATR类代码示例

本文整理汇总了Java中javax.smartcardio.ATR的典型用法代码示例。如果您正苦于以下问题:Java ATR类的具体用法?Java ATR怎么用?Java ATR使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ATR类属于javax.smartcardio包,在下文中一共展示了ATR类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SimulatedBeIDCard

import javax.smartcardio.ATR; //导入依赖的package包/类
public SimulatedBeIDCard(final String profile) {
	super(null);

	final InputStream atrInputStream = SimulatedBeIDCard.class
			.getResourceAsStream("/" + profile + "_ATR.bin");

	try {
		setATR(new ATR(IOUtils.toByteArray(atrInputStream)));
	} catch (final IOException ioex) {
		// missing _ATR file, set ATR from testcard
		setATR(new ATR(new byte[]{0x3b, (byte) 0x98, 0x13, 0x40, 0x0a,
				(byte) 0xa5, 0x03, 0x01, 0x01, 0x01, (byte) 0xad, 0x13,
				0x11}));
	}

	setFilesFromProfile(profile);
}
 
开发者ID:e-Contract,项目名称:commons-eid,代码行数:18,代码来源:SimulatedBeIDCard.java

示例2: setUp

import javax.smartcardio.ATR; //导入依赖的package包/类
@Before
public void setUp() {
	this.simulatedBeIDCard = new ArrayList<SimulatedCard>(numberOfCards);
	for (int i = 0; i < numberOfCards; i++) {
		this.simulatedBeIDCard.add(new SimulatedCard(new ATR(new byte[]{
				0x3b, (byte) 0x98, (byte) i, 0x40, (byte) i, (byte) i,
				(byte) i, (byte) i, 0x01, 0x01, (byte) 0xad, 0x13, 0x10})));
	}
	this.simulatedCardTerminal = new ArrayList<SimulatedCardTerminal>(
			numberOfTerminals);
	for (int i = 0; i < numberOfTerminals; i++) {
		this.simulatedCardTerminal.add(new SimulatedCardTerminal(
				"Fedix SCR " + i));
	}

	this.simulatedCardTerminals = new SimulatedCardTerminals();
}
 
开发者ID:e-Contract,项目名称:commons-eid,代码行数:18,代码来源:CardAndTerminalManagerTests.java

示例3: connect

import javax.smartcardio.ATR; //导入依赖的package包/类
@Override
public Card connect(String protocol) throws CardException {
	try {
		HashMap<String, Object> m = new HashMap<>();
		m.put("cmd", "CONNECT");
		m.put("protocol", protocol);
		client.send(m);

		// Read back the response
		Map<String, Object> r = client.recv();
		if (r.containsKey("CONNECT") && ((String)r.get("CONNECT")).equals("OK")) {

			if (r.containsKey("atr") && r.containsKey("protocol") && r.containsKey("reader")) {
				terminalName = (String) r.get("reader");
				atr = new ATR(HexUtils.stringToBin((String) r.get("atr")));
				this.protocol = ((String) r.get("protocol"));
				return new JSONCard(this);
			}
		}
		throw new CardException("Could not connect to client");
	} catch (IOException e) {
		throw new CardException("Could not connect to client", e);
	}

}
 
开发者ID:martinpaljak,项目名称:apdu4j,代码行数:26,代码来源:JSONCardTerminal.java

示例4: CardImpl

import javax.smartcardio.ATR; //导入依赖的package包/类
CardImpl(TerminalImpl terminal, String protocol) throws PCSCException {
this.terminal = terminal;
int sharingMode = SCARD_SHARE_SHARED;
int connectProtocol;
if (protocol.equals("*")) {
    connectProtocol = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1;
} else if (protocol.equalsIgnoreCase("T=0")) {
    connectProtocol = SCARD_PROTOCOL_T0;
} else if (protocol.equalsIgnoreCase("T=1")) {
    connectProtocol = SCARD_PROTOCOL_T1;
} else if (protocol.equalsIgnoreCase("direct")) {
    // testing
    connectProtocol = 0;
    sharingMode = SCARD_SHARE_DIRECT;
} else {
    throw new IllegalArgumentException("Unsupported protocol " + protocol);
}
cardId = SCardConnect(terminal.contextId, terminal.name, sharingMode, connectProtocol);
byte[] status = new byte[2];
byte[] atrBytes = SCardStatus(cardId, status);
atr = new ATR(atrBytes);
this.protocol = status[1] & 0xff;
basicChannel = new ChannelImpl(this, 0);
state = State.OK;
   }
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:26,代码来源:CardImpl.java

示例5: matchesEidAtr

import javax.smartcardio.ATR; //导入依赖的package包/类
private boolean matchesEidAtr(ATR atr) {
	byte[] atrBytes = atr.getBytes();
	if (atrBytes.length != ATR_PATTERN.length) {
		return false;
	}
	for (int idx = 0; idx < atrBytes.length; idx++) {
		atrBytes[idx] &= ATR_MASK[idx];
	}
	if (Arrays.equals(atrBytes, ATR_PATTERN)) {
		return true;
	}
	return false;
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:14,代码来源:PcscEid.java

示例6: Emulator_connection_card

import javax.smartcardio.ATR; //导入依赖的package包/类
Emulator_connection_card(Emulator_connection_terminal terminal,
                         JCard jcard, ATR atr, int verbosity) 
{
    if(verbosity > 0) {
        System.out.println("JC card constructor");
    }
    this.terminal = terminal;
    this.jcard = jcard;
    this.smio_atr = atr;
    this.verbosity = verbosity;
    owner = null;
}
 
开发者ID:rafmeeusen,项目名称:rjct,代码行数:13,代码来源:Emulator_connection_card.java

示例7: getATR

import javax.smartcardio.ATR; //导入依赖的package包/类
@Override
public ATR getATR() {
	if (mSession.getATR() != null) {
		return new ATR(mSession.getATR());
	}
	return null;
}
 
开发者ID:mobilesec,项目名称:secure-element-gpdroid-nfc,代码行数:8,代码来源:OpenMobileAPICard.java

示例8: setUp

import javax.smartcardio.ATR; //导入依赖的package包/类
@Before
public void setUp() {
	this.simulatedBeIDCards = new ArrayList<BeIDCard>(numberOfCards);
	for (int i = 0; i < numberOfCards; i++) {
		this.simulatedBeIDCards.add(new BeIDCard(new SimulatedCard(new ATR(
				new byte[]{0x3b, (byte) 0x98, (byte) i, 0x40, (byte) i,
						(byte) i, (byte) i, (byte) i, 0x01, 0x01,
						(byte) 0xad, 0x13, 0x10}))));
	}
}
 
开发者ID:e-Contract,项目名称:commons-eid,代码行数:11,代码来源:DefaultBeIDCardsDialogTests.java

示例9: matchesEidAtr

import javax.smartcardio.ATR; //导入依赖的package包/类
private boolean matchesEidAtr(final ATR atr) {
	final byte[] atrBytes = atr.getBytes();
	if (atrBytes.length != ATR_PATTERN.length) {
		return false;
	}
	for (int idx = 0; idx < atrBytes.length; idx++) {
		atrBytes[idx] &= ATR_MASK[idx];
	}
	if (Arrays.equals(atrBytes, ATR_PATTERN)) {
		return true;
	}
	return false;
}
 
开发者ID:e-Contract,项目名称:commons-eid,代码行数:14,代码来源:BeIDCardManager.java

示例10: matchesEidAtr

import javax.smartcardio.ATR; //导入依赖的package包/类
public static boolean matchesEidAtr(ATR atr) { // from eid-applet-core...PcscEid.java
	byte[] atrBytes = atr.getBytes();
	if (atrBytes.length != ATR_PATTERN.length) {
		return false;
	}
	for (int idx = 0; idx < atrBytes.length; idx++) {
		atrBytes[idx] &= ATR_MASK[idx];
	}
	if (Arrays.equals(atrBytes, ATR_PATTERN)) {
		return true;
	}
	return false;
}
 
开发者ID:lsaffre,项目名称:eidreader,代码行数:14,代码来源:EIDReader.java

示例11: JnaCard

import javax.smartcardio.ATR; //导入依赖的package包/类
public JnaCard(Winscard.WinscardLibInfo libInfo, JnaCardTerminal cardTerminal, Winscard.SCardHandle scardHandle, ATR atr, int protocol) {
	this.libInfo = libInfo;
	this.cardTerminal = cardTerminal;
	this.scardHandle = scardHandle;
	this.atr = atr;
	this.protocol = protocol;
	getProtocol();  // make sure it is valid.
}
 
开发者ID:jnasmartcardio,项目名称:jnasmartcardio,代码行数:9,代码来源:Smartcardio.java

示例12: testGetAtr

import javax.smartcardio.ATR; //导入依赖的package包/类
@Test public void testGetAtr() throws CardException {
	List<CardTerminal> terminalList = terminals.list();
	CardTerminal terminal = terminalList.get(0);
	Card connection = terminal.connect("*");
	ATR atr = connection.getATR();
	byte[] atrBytes = atr.getBytes();
	assertNotSame(0, atrBytes.length);
	boolean hasNonZeroAtr = false;
	for (int i = 0; i < atrBytes.length; i++) {
		hasNonZeroAtr = hasNonZeroAtr || atrBytes[i] != 0;
	}
	assertTrue(hasNonZeroAtr);
}
 
开发者ID:jnasmartcardio,项目名称:jnasmartcardio,代码行数:14,代码来源:WinscardReaderTestWithCardPresent.java

示例13: getATR

import javax.smartcardio.ATR; //导入依赖的package包/类
@Override
public ATR getATR() {
    throw new UnsupportedOperationException("Not supported yet."); 
}
 
开发者ID:OpenCryptoProject,项目名称:JCMathLib,代码行数:5,代码来源:SimulatedCard.java

示例14: getATR

import javax.smartcardio.ATR; //导入依赖的package包/类
@Override
public ATR getATR() {
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
 
开发者ID:OpenCryptoProject,项目名称:Myst,代码行数:5,代码来源:SimulatedCard.java

示例15: getATR

import javax.smartcardio.ATR; //导入依赖的package包/类
public ATR getATR() {
    return smio_atr;
}
 
开发者ID:rafmeeusen,项目名称:rjct,代码行数:4,代码来源:Emulator_connection_card.java


注:本文中的javax.smartcardio.ATR类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。