- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Ubuntu 18 并尝试编写代码以使用智能卡。
我正在使用 ACS APG8201-b2 智能卡读卡器,并且已安装 the official driver(PC/SC 驱动程序包 3.04 MB,版本 1.1.8,2020 年 1 月 10 日)和 libpcsclite-dev
。
作为起点,我正在尝试运行 Ludovic Rousseau 的示例 C 代码 here 。
我可以将我的代码 ApduTool.c
编译为:
#ifdef WIN32
#undef UNICODE
#endif
#include <stdio.h>
#include <stdlib.h>
#include <winscard.h>
#ifdef WIN32
static char *pcsc_stringify_error(LONG rv)
{
static char out[20];
sprintf_s(out, sizeof(out), "0x%08X", rv);
return out;
}
#endif
#define CHECK(f, rv) \
if (SCARD_S_SUCCESS != rv) \
{ \
printf(f ": %s\n", pcsc_stringify_error(rv)); \
return -1; \
}
int main(void)
{
LONG rv;
SCARDCONTEXT hContext;
LPTSTR mszReaders;
SCARDHANDLE hCard;
DWORD dwReaders, dwActiveProtocol, dwRecvLength;
SCARD_IO_REQUEST pioSendPci;
BYTE pbRecvBuffer[258];
BYTE cmd1[] = { 0x00, 0xA4, 0x04, 0x00, 0x0A, 0xA0, 0x00, 0x00, 0x00, 0x62, 0x03, 0x01, 0x0C, 0x06, 0x01 };
BYTE cmd2[] = { 0x00, 0x00, 0x00, 0x00 };
unsigned int i;
rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
CHECK("SCardEstablishContext", rv)
#ifdef SCARD_AUTOALLOCATE
dwReaders = SCARD_AUTOALLOCATE;
rv = SCardListReaders(hContext, NULL, (LPTSTR)&mszReaders, &dwReaders);
CHECK("SCardListReaders", rv)
#else
rv = SCardListReaders(hContext, NULL, NULL, &dwReaders);
CHECK("SCardListReaders", rv)
mszReaders = calloc(dwReaders, sizeof(char));
rv = SCardListReaders(hContext, NULL, mszReaders, &dwReaders);
CHECK("SCardListReaders", rv)
#endif
printf("reader name: %s\n", mszReaders);
return 0;
}
使用
Makefile
:
all: ApduTool.c
gcc -c ApduTool.c -lsqlite3 -lpcsclite -lcrypto -lssl -I/usr/local/include/PCSC/ -I/usr/lib/ -I.
gcc ApduTool.o -o ApduTool -lsqlite3 -lpcsclite -lcrypto -lssl -I/usr/local/include/PCSC/ -I/usr/lib/ -I.
clean:
rm -f ApduTool *.o
当我运行 ApduTool 二进制文件时,
SCardListReaders
函数返回:
SCardListReaders: Cannot find a smart card reader.
我猜不出问题出在哪里,因为我在运行
lsusb
时可以看到我的 USB 阅读器:
Bus 001 Device 003: ID 072f:8206 Advanced Card Systems, Ltd
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
并且我在运行代码时运行了 PCSC 守护程序(
pcscd
)。
最佳答案
pcscd 应该记录正在发生的事情以及是否找到了读卡器驱动程序。
见 https://pcsclite.apdu.fr/#support了解如何生成正确的 pcscd 日志。
关于Ubuntu 无法识别我的智能卡读卡器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70054099/
我有一个读卡器(没有插入内存棒)。 当我插入我的电脑时,它在我的电脑中显示一个空驱动器... 是否有可能知道驱动器是否有媒体(抱歉,我不确定如何调用它)... 最佳答案 我发现 MSalters 使用
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 5 年前。 Improve this qu
我有一台运行 Debian Wheezy 的三星 RF711 Core i7 笔记本电脑,带有集成的 USB Multi Flash 读卡器,但这个问题可能适用于任何在 USB 端口上带有 SD 卡读
我正在开始一个新项目,我是使用 EMV 阅读器和 Javax SmartCardIO 的新手。 我有每种卡的 RID 列表,但是在不知道卡类型的情况下我唯一可以访问的是 ATR,我想知道是否有办法获取
是否可以在没有实际卡“连接”的情况下使用 javax.smartcardio 将 APDU 发送到 NFC 读卡器(例如 ACR1222L)?根据我的 API 调查,您只能使用从 Card 获取的 C
你好, 我正在使用 编写 Java 应用程序 javax.smartcardio.*; 德国身份证的uid(32位)是在每次访问时随机生成的。atr(152 位)保持不变。 目前,我采用 rfid 卡
我无法在 BackTrack 5 R3 (Linux) 中使用 ACR120U 阅读器,我已经下载了必要的 drivers并安装了它们。 lsusb 显示 ACR 阅读器已连接,但如何使用它,nfc-
我试图理解 android 设备中的一个概念,即将新硬件连接到 android 设备。ir 是如何实现的。没有蓝牙。假设我有一个 RF 读卡器,我想使用该硬件读取 RF id 卡,并且我想向我显示该号
这是在我的应用中检测到 NFC 标签的频率: protected void onNewIntent(Intent intent) { if (intent.getAction().e
我想重新打开old question关于从 Android(使用 Android Beam)向基于 PC 的 nfc 阅读器发送一条 NDEF 消息的可能性。有人知道我能否实现吗? 我还需要知道是否存
我正在使用通过 USB 连接的 ACS ACR1252U 读卡器 ( http://www.acs.com.hk/en/products/342/acr1252u-usb-nfc-reader-iii
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 8 年前。 Improve this ques
我有这个OMNIKEY CardMan 3121 USB,这是一个读卡器,比如读比利时身份证。我现在通过 USB 将它连接到我的 Ubuntu。 如何在Linux下使用BASH或Python或Java
我正在构建一个 Windows/Java 程序(使用 javax.smartcardio),以使用 ACR122U 设备(内部带有 PN532 NFC Controller 芯片)与 Jewel/To
我之前使用过 ACR 122,它与 Android < 4.1 手机完美配合。我用它来交换 P2P SNEP 消息...但是由于手机是 4.1,当您将手机放在阅读器上方时,阅读器开始发出哔哔声和闪烁。
我是一名优秀的程序员,十分优秀!