- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
遵循描述的例程 on this card reader project ,并使用 this AID List ,我能够读取 VISA 卡而没有任何问题强制 AID 列表。现在我在阅读来自德国的 EC-Karten (Sparkasse Girocard) 时遇到了问题。
当我尝试强制读取 AID 列表时,使用
foreach (byte[] aid in aidList)
{
byte[] atrValue = this.cardUpdater.GetAttribute(SCARD_ATTR_VALUE.ATR_STRING);
string strATR = ByteArrayToString(atrValue);
APDUCommand apduSelectEMVApl = null;
APDUResponse apdu2 = null;
apduSelectEMVApl = new APDUCommand(0x00, 0xA4, 0x04, 0x00, aid, 95);
apdu2 = this.cardUpdater.Transmit(apduSelectEMVApl);
if (apdu2.SW1 == 0x90)
{
//Label = ASCIIEncoding.ASCII.GetString(apdu2.Data, 15, apdu2.Data[14]);
//found it!
m_EMVAID = aid;
if (apdu2.Data[0] == 0x6f) //fci template
{
ExtractData(ReadTagData(apdu2.Data, 0));
}
return true;
}
}
return false;
Note: AID Successfuly read for selection is A0000003591010028001
如果我没有将 APDU 命令的长度参数专门设置为 95,而不是所有项目中看到的标准 0(以获得最大长度),它不会响应 90-00(成功)。我只是通过迭代找到了这个值,看看哪个长度是可以接受的。为什么?
通过此过程,我能够读取 BIC 和卡类型(“girocard”)以及 PDOL 等数据:
9F33029F35019F4001
然后我尝试根据 this post 提高安全级别.但是在我的例子中,那些用于选择和读取的 APDU 命令不会抛出 90-00(而是 6700)。
我已经尝试通过 SFI 记录
APDUCommand apduGPO = new APDUCommand(0x80, 0xa8, 0, 0, new byte[] { 0x83, 0 }, 0);
APDUResponse apdu1 = this.cardUpdater.Transmit(apduGPO);
if (apdu1.SW1 != 0x90) throw new Exception("Read GPO Data fail");
//two possible forms, 0x80 and 0x77
if (apdu1.Data[0] == 0x80)
{
for (int i = 4; i < apdu1.Data.Length; i += 4)
{
byte sfi = (byte)((apdu1.Data[i] >> 3) & 0xf);
byte lowRange = apdu1.Data[i + 1];
byte hiRange = apdu1.Data[i + 2];
byte[] records = new byte[hiRange - lowRange + 1];
for (int j = lowRange; j <= hiRange; j++)
records[j - lowRange] = (byte)j;
sfiRecords.Add(new SFIRecords(sfi, records));
}
}
else if (apdu1.Data[0] == 0x77)
{
//look for the application file locator AFL
int a, tag;
for (a = 2; (tag = ReadTag(apdu1.Data, a)) != 0x94; a = SkipTag(apdu1.Data, a)) ;
if (tag == 0x94)
{
//found it
a++;
int len = apdu1.Data[a++];
for (int i = a; i < a + len; i += 4)
{
byte sfi = (byte)((apdu1.Data[i] >> 3) & 0xf);
byte lowRange = apdu1.Data[i + 1];
byte hiRange = apdu1.Data[i + 2];
byte[] records = new byte[hiRange - lowRange + 1];
for (int j = lowRange; j <= hiRange; j++)
records[j - lowRange] = (byte)j;
sfiRecords.Add(new SFIRecords(sfi, records));
}
}
}
else
throw new Exception("Unknown GPO template");
正如我从许多其他来源读到的,包括 Openscdp's Initiate Application Process , 但将 PDOL 发送为
APDUCommand apduGPO = new APDUCommand(0x80, 0xa8, 0, 0, pdol, 0);
APDUResponse apdu1 = this.cardUpdater.Transmit(apduGPO);
或
APDUCommand apduGPO = new APDUCommand(0x80, 0xa8, 0, 0, new byte[]{0x83, 0x00}, 0);
APDUResponse apdu1 = this.cardUpdater.Transmit(apduGPO);
在 apduGPOResponse 上不再继续(再次出现错误 6700,抛出异常读取 GPO 失败,结果不成功),因此我无法将 SFI 记录添加到列表中以进一步迭代数据 [0] 和寻找要阅读的记录。没有 90-00 响应。
关于我缺少什么的任何想法?
已更新
我运行这段代码直接强制读取所有可能的值,而不使用 GPO:
APDUCommand apduReadAll = null;
APDUResponse apdu1 = null;
for (var sfi = 1; sfi <= 31; sfi++)
{
for (var rec = 1; rec <= 16; rec++)
{
for (byte le = 0; le < 255; le++)
{
apduReadAll = new APDUCommand(0x00, 0xB2, (byte)rec, (byte)((sfi << 3) | 4), null, le);
apdu1 = this.cardUpdater.Transmit(apduReadAll);
if (apdu1.SW1 == 0x90)
{
Console.WriteLine("SFI " + sfi.ToString() + " record #" + rec);
if (apdu1.Data[0] == 0x70 || apdu1.Data[0] == 0x77)
{
Console.WriteLine("Chalk one here " + sfi.ToString() + " record #" + rec + " len " + le);
try
{
ExtractData(ReadTagData(apdu1.Data, 0));
}
catch
{
}
//if (!String.IsNullOrEmpty(NumberString) && !String.IsNullOrEmpty(Name) &&
// !String.IsNullOrEmpty(ExpiryString) && !String.IsNullOrEmpty(CardType) &&
// !String.IsNullOrEmpty(Label))
// return; //we have all info we need
}
}
}
}
}
foreach (TagData tag in Properties)
{
Console.WriteLine(tag.Name + " " + tag.DataString);
strAllData += tag.Name + " " + tag.DataString + "\r\n";
}
在结果中我找到了一些我需要的信息(现在我可以直接指向我需要加速这个过程的数据),以及一些其他有趣的信息:
Application Label girocard
Application Priority Indicator 02
Application Identifier (AID) - card A0 00 00 00 59 45 43 01 00
Application Label girocard
Application Priority Indicator 04
Application Identifier (AID) - card A0 00 00 03 59 10 10 02 80 01
Application Label girocard
Application Priority Indicator 04
Application Identifier (AID) - card A0 00 00 00 04 30 60
Application Label Maestro
Application Priority Indicator 07
Application Identifier (AID) - card D2 76 00 00 25 45 50 02 00
Application Label GeldKarte
Application Identifier (AID) - card A0 00 00 04 86 01 01
Application Label girocard
Application Priority Indicator 05
我将使用从卡返回的上述 AID 值运行相同的程序来比较结果,看看会发生什么以便更好地理解。感谢您为我指明正确的方向。
最佳答案
原因是该项目中 Transmit()
的实现有问题。当您传递一个 Le 设置为 0 的 APDUCommand 对象时,它会错误地将这种情况视为 Le 不存在,因此不会发送 Le 字段。参见 CardNative.cs on line 446 .因此,
...Transmit(new APDUCommand(0x00, 0xA4, 0x04, 0x00, new byte[] { 1, 2, 3, 4, 5 }, 0));
导致以下 APDU 被发送到卡:
00 A4 0400 05 0102030405
然而,您真正想要的是以下 APDU(它有一个 Le 字段):
00 A4 0400 05 0102030405 00
这可以通过区分 Le 不存在(表示没有预期响应数据,Ne = 0)和 Le 为 0(表示预期响应数据高达 256 字节,Ne = 256)这两种情况来解决。
由于您没有透露所选应用程序的 AID(或者更好的是 SELECT 响应),因此无法判断它可能使用哪种协议(protocol)。 到目前为止,所有命令似乎都被错误地拒绝了length error (SW = 0x6700
),好像和第一个问题的问题有关。
由于您引用的 AID 列表表明 Girocard 应用程序符合某种形式的 EMV,并且您收到了 9F33029F35019F4001
的 PDOL 值,您可以尝试发出 GET PROCESSING OPTIONS 命令(类似于你目前正在尝试做)。由于卡片提供了PDOL,需要在GPO命令中将PDOL相关数据对象填入期望值。
PDOL 列出了以下元素:
因此您可以尝试创建一个用零填充所有这些元素的 PDOL 相关数据对象:
0000 00 00
请注意,您的卡片可能需要一些特定的值。由于 PDOL 中的数据对象与其在 EMV 中的定义不匹配(9F33(终端功能)的长度应为 3,而 9F40(附加终端功能)的长度应为 5),我不能'不要说出它们的实际含义/编码。
GPO 命令可能如下所示:
APDUCommand apduGPO = new APDUCommand(0x80, 0xa8, 0, 0, new byte[] { 0x83, 4, 0, 0, 0, 0 }, 0);
同样,这只有在您解决 Le 字段的问题时才有效。
关于c# - Girocard-Maestro 智能卡读卡器问题,读取持卡人姓名和 IBAN,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34355279/
我有一个读卡器(没有插入内存棒)。 当我插入我的电脑时,它在我的电脑中显示一个空驱动器... 是否有可能知道驱动器是否有媒体(抱歉,我不确定如何调用它)... 最佳答案 我发现 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,当您将手机放在阅读器上方时,阅读器开始发出哔哔声和闪烁。
我是一名优秀的程序员,十分优秀!