Beispiel #1
0
const vector<unsigned char> ePACard::get_ef_cardsecurity(void)
{
	if (m_ef_cardsecurity.empty()
			/* read EF.CardSecurity in chunks that fit into short length APDU */
			&& !readFile(SFID_EF_CARDSECURITY, 0xDF, m_ef_cardsecurity))
		throw WrongHandle();

	return m_ef_cardsecurity;
}
Beispiel #2
0
vector <unsigned char> PCSCReader::sendAPDU(
	const vector<unsigned char>& cmd)
{
	BYTE res[RAPDU::RAPDU_EXTENDED_MAX];
	DWORD reslen = sizeof res;
	DWORD r = SCARD_S_SUCCESS;
	vector <unsigned char> result;

	if (0x00 == m_hCard)
		throw WrongHandle();

	r = SCardTransmit(m_hCard, SCARD_PCI_T1, cmd.data(),
					  (DWORD) cmd.size(), NULL, res, &reslen);

	if (r != SCARD_S_SUCCESS)
		throw TransactionFailed();

	return vector<unsigned char>(res, res + reslen);
}
Beispiel #3
0
ePACard::ePACard(IReader *hSubSystem) : ICard(hSubSystem)
{
	if (!selectMF()
		|| !readFile(SFID_EF_CARDACCESS, CAPDU::DATA_EXTENDED_MAX, m_ef_cardaccess))
		throw WrongHandle();
}