资源简介
Mac Lion已经内置了pcscd作为智能卡框架,以及向windows靠拢的pcsclite作为开发库,文件为在Mac上实现了智能卡连接的xcode工程。具体描述参见本人csdn博客。
代码片段和文件信息
//
// main.cpp
// Ululation
//
// Created by Caesar on 12-9-6.
// Copyright (c) 2012年 Caesar. All rights reserved.
//
#include
#include
int main(int argc const char * argv[])
{
SCARDCONTEXT m_hContext;
SCARDHANDLE m_hCard;
//Insert
if(SCARD_S_SUCCESS != SCardEstablishContext(SCARD_SCOPE_USER NULL NULL &m_hContext))
{
std::cerr << “Context error“;
return -1;
}
//List Reader
char pmszReaders[100];
uint32_t cch = 100;
if(SCARD_S_SUCCESS != SCardListReaders(m_hContext NULL pmszReaders &cch))
{
std::cerr << “List Reader error“;
return -2;
}
uint32_t i = 0;
std::cout<<“List Reader: “ << std::endl;
while(i std::cout<
i += strlen(pmszReaders);
i ++;
}
//Connect first Reader
SCARD_IO_REQUEST io;
io.cbPciLength = sizeof(SCARD_IO_REQUEST);
if(SCARD_S_SUCCESS != SCardConnect(m_hContext pmszReaders SCARD_SHARE_SHARED SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1 &m_hCard &io.dwProtocol)) {
std::cerr << “Connect Card error“;
return -3;
}
//Transmit APDU
unsigned char CAPDU[] = {0x000xA40x040x000x00};
unsigned char RAPDU[256+2];
uint32_t RecvLength = 256+2;
if(SCARD_S_SUCCESS != SCardTransmit(m_hCard &io CAPDU 5 NULL RAPDU &RecvLength))
{
std::cerr << “Transmit APDU error“;
return -4;
}
//echo
std::cout<<“Transmit APDU: “ << std::endl;
std::cout << “CAPDU: “;
for(i=0;i<5;i++)
{
char hexbuf[3];
sprintf(hexbuf “%02X“ CAPDU[i]);
std::cout << hexbuf;
}
std::cout << std::endl;
std::cout << “RAPDU: “;
for(i=0;i {
char hexbuf[3];
sprintf(hexbuf “%02X“ RAPDU[i]);
std::cout << hexbuf;
}
std::cout << std::endl;
//Disconnect
SCardDisconnect(m_hCard SCARD_EJECT_CARD);
//Eject
SCardReleaseContext(m_hContext);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-09-18 16:55 Ululation\
文件 6148 2012-09-18 18:03 Ululation\.DS_Store
目录 0 2012-09-20 14:02 __MACOSX\
目录 0 2012-09-20 14:02 __MACOSX\Ululation\
文件 82 2012-09-18 18:03 __MACOSX\Ululation\._.DS_Store
目录 0 2012-09-06 16:58 Ululation\Ululation\
文件 2129 2012-09-06 16:58 Ululation\Ululation\main.cpp
目录 0 2012-09-20 14:02 __MACOSX\Ululation\Ululation\
文件 171 2012-09-06 16:58 __MACOSX\Ululation\Ululation\._main.cpp
文件 3123 2012-09-06 15:25 Ululation\Ululation\Ululation.1
文件 171 2012-09-06 15:25 __MACOSX\Ululation\Ululation\._Ululation.1
目录 0 2012-09-06 16:26 Ululation\Ululation.xcodeproj\
文件 7126 2012-09-06 16:26 Ululation\Ululation.xcodeproj\project.pbxproj
目录 0 2012-09-06 15:25 Ululation\Ululation.xcodeproj\project.xcworkspace\
文件 154 2012-09-06 15:25 Ululation\Ululation.xcodeproj\project.xcworkspace\contents.xcworkspacedata
目录 0 2012-09-06 15:25 Ululation\Ululation.xcodeproj\project.xcworkspace\xcuserdata\
目录 0 2012-09-18 18:03 Ululation\Ululation.xcodeproj\project.xcworkspace\xcuserdata\mac.xcuserdatad\
文件 14957 2012-09-18 18:03 Ululation\Ululation.xcodeproj\project.xcworkspace\xcuserdata\mac.xcuserdatad\UserInterfaceState.xcuserstate
目录 0 2012-09-06 15:25 Ululation\Ululation.xcodeproj\xcuserdata\
目录 0 2012-09-06 16:52 Ululation\Ululation.xcodeproj\xcuserdata\mac.xcuserdatad\
目录 0 2012-09-18 16:55 Ululation\Ululation.xcodeproj\xcuserdata\mac.xcuserdatad\xcdebugger\
文件 635 2012-09-18 16:55 Ululation\Ululation.xcodeproj\xcuserdata\mac.xcuserdatad\xcdebugger\Breakpoints.xcbkptlist
目录 0 2012-09-06 15:25 Ululation\Ululation.xcodeproj\xcuserdata\mac.xcuserdatad\xcschemes\
文件 3143 2012-09-06 15:25 Ululation\Ululation.xcodeproj\xcuserdata\mac.xcuserdatad\xcschemes\Ululation.xcscheme
文件 481 2012-09-06 15:25 Ululation\Ululation.xcodeproj\xcuserdata\mac.xcuserdatad\xcschemes\xcschememanagement.plist
- 上一篇:UDP实现P2P
- 下一篇:二维相位和差测角详细推导
相关资源
- CMAC源码 小脑神经网络
- 笔记本台式黑苹果安装教程 傻瓜式安
- 百兆以太网MAC和MII的VHDL源码,我也是
- jdk1.8 Mac 64位
- 黑苹果超级懒人版链接
- Multi-hop WSN论文及中文翻译
- MacFilterCalloutInstaller
- 黑苹果 macOS10.14.2 HD5000/5500/6000 改好的
- 用于提取硬盘序列号、CPU相关信息、
- MacOS系统镜像
- Hash计算工具
- macOS 修改终端Terminal配色方案 所需文
- 硬盘安装助手
-
TP-li
nk_Installer_For_Mac tp无线网卡mac版 - 虚拟机MacOS10.14
- 黑果显卡驱动NvidiaGraphicsFixup.kext V1.
- CH340USB转串口芯片mac os驱动程序
- MAC安装第三方驱动无法启动的解决方
- steelseries exact mouse 解决 mac 外接显示
- ACPI Patcher
- des mac地址 加密 源码
- IBM SPSS 25 序列号Windows、macOS、Linux适用
- machine learning SVM classify algorithm
- CFXR Mac版
- macos High Sierra10.13.6苹果原版系统
- 一键安装macOS多合一U盘系统安装U盘制
- edraw v8.4版本破解版.txt
- macos big sur 系统 parallels 启动脚本
-
JbmCM字体Fontli
nk到等距更纱黑体SC及 - vmware15+macos10.14+unlocker3.0+darwin
评论
共有 条评论