生成 AC 命令上的 Android isoDep.transceive 始终返回 6D00 不受支持

2023-11-29

我正在尝试模拟 PoS、销售点 :) 系统并使用在 2013 年 Nexus 7(无安全元件)v4.4.2 上运行的 Google 钱包完成交易。

我的 PoS 原型也在 2013 Nexus 7 v4.4.2 上运行。

我能够从 2PAY_SYS_DDF01 请求获取 NFC 响应。 我可以选择 MasterCard 应用程序 ID。 我可以获得处理选项。 当我读取记录时,Google 钱包似乎没有返回所有必填 EMV 字段。 最后,当我请求生成 AC 命令时,它总是返回 6D00 不受支持。

有问题的代码区域:

//set P1 to '40', to request an Transaction Certificate (offline transaction) 
//and execute the Generate AC command.

byte[] generateAC = new byte[] {(byte)0x80, (byte)0xAE, 0x40, 0x00,
                0x1D,                               //data length
                0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //amount1
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //amount2
                0x08, 0x40,                         //term country
                0x00, 0x00, 0x00, 0x00, 0x00,       //tvr
                0x09, 0x62,                         //tx curr
                0x14, 0x04, 0x1B,                   //tx date
                0x00,                               //tx type
                0x12, 0x34, 0x56, 0x78,             //random
                0x00};                              //le
response = isoDep.transceive(generateAC);

我正在关注蒂姆·贝克斯的视频https://www.youtube.com/watch?v=qqobg1-HrfY约。 46分钟后。 和蒂姆·贝克斯代码示例:https://github.com/a2800276/29c3/blob/master/smartshell.rb

UPDATE:

对 GPO 命令的响应(80 a8 00 00 02 83 00 00) is

770a820200009404080101009000

77 Response Message Template Format 2
    82 Application Interchange Profile
        0000
    94 Application File Locator (AFL)
        08010100

UPDATE:

I tried:

byte[] computeCC = new byte[] {
(byte)0x80, // CLA = proprietary
(byte)0x2A, // INS = COMPUTE CRYPTOGRAPHIC CHECKSUM
(byte)0x8E, // P1
(byte)0x80, // P2
(byte)0x04, // Lc
(byte)0x00, 0x00, (byte)0x00, (byte)0x99, // Unpredicatable Number (numeric)
(byte)0x00, // Le
};
response = isoDep.transceive(computeCC);

希望至少能得到一个错误,表明错误的不可预测的数字,但我返回了 6700 不正确的长度。

早些时候我收到了 Read Record 00 B2 01 0C 00 的回复 该响应的一部分是 卡认证相关数据[9F69]: 数据(二进制):XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX fDDA 版本号:9F (卡)不可预测的数字:6A 04 9F 7E

所以我尝试了那个不可预测的数字

byte[] computeCC = new byte[] {
(byte)0x80, // CLA = proprietary
(byte)0x2A, // INS = COMPUTE CRYPTOGRAPHIC CHECKSUM
(byte)0x8E, // P1
(byte)0x80, // P2
(byte)0x04, // Lc
(byte)0x6A, 0x04, (byte)0x9F, (byte)0x7E, // Unpredicatable Number (numeric)
(byte)0x00, // Le
};
response = isoDep.transceive(computeCC);

但我仍然得到 6700 错误的长度

UPDATE:

对 READ RECORD (Record = 1, SFI = 1) 命令的响应 (00 B2 01 0C 00) 是:

70 7c 9f 6c 02
00 01 9f 62 06
00 00 00 00 00
38 9f 63 06 00
00 00 00 03 c6
56 29 42 35 33
39 36 XX XX XX
XX 31 XX XX 39
XX XX XX XX 5e
20 2f 5e 31 34
30 37 31 30 31
34 30 31 30 30
30 30 30 30 30
30 30 30 9f 64
01 04 9f 65 02
00 38 9f 66 02
03 c6 9f 6b 13
53 96 XX XX 1X
X9 XX XX d1 40
71 01 40 10 00
00 00 00 0f 9f
67 01 04 9f 69
0f 9f 6a 04 9f
7e 01 9f 02 06
5f 2a 02 9f 1a
02 90 00

--------------------------TLV------------------------------- 
Output:
READ RECORD Response Message Template [70]:
    Card Transaction Qualifiers (CTQ) [9F6C]:
    Data (Binary):  00 01 
Bit flags set:
    1Bxb8: 0 - Online PIN not Required
    1Bxb7: 0 - Signature Not Required
    1Bxb6: 0 - Not applicable: Go Online if Offline Data Authentication     Fails and Reader is online capable.
    1Bxb5: 0 - Not applicable: Switch Interface if Offline Data     Authentication fails and Reader supports VIS.
    1Bxb4: 0 - Not applicable: Go Online if Application Expired
    1Bxb3: 0 - Not applicable: Switch Interface for Cash Transactions
    1Bxb2: 0 - Not applicable: Switch Interface for Cashback Transactions
    1Bxb1: 0 - RFU
    2Bxb8: 0 - Consumer Device CVM not Performed
    2Bxb7: 0 - Card doesn't support Issuer Update Processing at the POS
    2Bxb6: 0 - RFU
    2Bxb5: 0 - RFU
    2Bxb4: 0 - RFU
    2Bxb3: 0 - RFU
    2Bxb2: 0 - RFU
    2Bxb1: 1 - RFU
PCVC3 (Track1) [9F62]:
    Data (Binary):  00 00 00 00 00 38 
Offline Counter Initial Value [9F63]:
    Data (Binary):  00 00 00 00 03 C6 
Track 1 Data [56]:

    Data (ASCII):   B5396XXXXXXXXXXXX^ /^14071014010000000000
NATC (Track1) [9F64]:
    Data (Binary):  04 
PCVC3 (Track2) [9F65]:
    Data (Binary):  00 38 
Terminal Transaction Qualifiers (TTQ) [9F66]:
    Data (Binary):  03 C6 
Card CVM Limit [9F6B]:
    Data (Binary):  53 96 48 50 17 69 62 32 D1 40 71 01 40 10 00 00 00 00 0F 
MSD Offset [9F67]:
    Data (Binary):  04 
Card Authentication Related Data [9F69]:
    Data (Binary):  9F 6A 04 9F 7E 01 9F 02 06 5F 2A 02 9F 1A 02 
fDDA Version Number: 9F
(Card) Unpredictable Number: 6A 04 9F 7E
Card Transaction Qualifiers: 01 9F
----------------------------------------

对 GET PROCESSING OPTIONS 命令的响应指示以下应用程序交换配置文件 (AIP):

82 Application Interchange Profile
    0000

Google Wallet 基本上是一个 MasterCard(EMV 非接触式内核 2),因此根据内核 2 的规则解码 AIP 会产生以下结果:

Byte 1, b7 = 0: no SDA supported
        b6 = 0: no DDA supported
        b5 = 0: no cardholder verification supported
        b4 = 0: no terminal risk management to be performed
        b3 = 0: no issuer authentication supported
        b2 = 0: no on-device cardholder verification supported
        b1 = 0: no CDA supported
Byte 2, b8 = 0: no EMV mode supported

重要的部分是字节2,位8:它表明您的卡不支持EMV模式。因此,您的卡/Google 钱包是仅支持磁条模式的 PayPass 卡。因此,您无法使用 GENERATE AC 来验证交易。相反,您只能使用 COMPUTE CRYPTOGRAPHIC CHECKSUM 让卡生成动态卡验证码 (CVC3):

byte[] computeCC = new byte[] {
    (byte)0x80, // CLA = proprietary
    (byte)0x2A, // INS = COMPUTE CRYPTOGRAPHIC CHECKSUM
    (byte)0x8E, // P1
    (byte)0x80, // P2
    (byte)0x04, // Lc
    (byte)0xWW, (byte)0xXX, (byte)0xYY, (byte)0xZZ, // Unpredicatable Number (numeric)
    (byte)0x00, // Le
};
response = isoDep.transceive(computeCC);

请注意,COMPUTE CRYPTOGRAPHIC CHECKSUM 命令的数据字段必须根据 UDOL 填充值(如果没有 UDOL,则默认 UDOL 为9F6A04,表示不可预测的数字,numeric)。

不可预测的数字(数字)是磁条数据文件定义的范围内的 BCD 编码数字(请参阅 AFL)。过去,对于 Google 钱包,该值介于 0 到 99 之间(即WW='00', XX='00', YY='00', ZZ='00'..'99').

UPDATE:

从卡中读取的数据解码如下:

70 7c
  9f6c 02    Mag-stripe application version number = Version 1
    00 01
  9f62 06    Track 1 bit map for CVC3
    00 00 00 00 00 38
  9f63 06    Track 1 bit map for UN and ATC
    00 00 00 00 03 c6
  56 29      Track 1 data
    42         ISO/IEC 7813 structure "B" format
    35333936 XXXXXXXX 31XXXX39 XXXXXXXX    PAN (ASCII)
    5e         Field separator "^"
    202f       Cardholder name " /" (empty, see MC requirements)
    5e         Field separator "^"
    31343037   Expiry date "14"/"07"
    313031     Service code "101"
    34303130303030303030303030    Track 1 discretionary data
  9f64 01    Track 1 number of ATC digits
    04
  9f65 02    Track 2 bit map for CVC3
    00 38
  9f66 02    Track 2 bit map for UN and ATC
    03 c6
  9f6b 13    Track 2 data
    5396 XXXX 1XX9 XXXX    PAN (BCD)
    d          Field separator
    1407       Expiry date
    101        Service code
    4010000000000    Track 2 discretionary data
    f          Padding
  9f67 01      Track 2 number of ATC digits
    04
  9f69 0f      UDOL
    9f6a 04      Unpredictable number (numeric)
    9f7e 01      Mobile support indicator
    9f02 06      Amount authorized (numeric)
    5f2a 02      Transaction currency code
    9f1a 02      Terminal country code

所以卡does提供 UDOL。因此,必须相应地调整 COMPUTE CRYPTOGRAPHIC CHECKSUM 命令:

byte[] computeCC = new byte[] {
    (byte)0x80, // CLA = proprietary
    (byte)0x2A, // INS = COMPUTE CRYPTOGRAPHIC CHECKSUM
    (byte)0x8E, // P1
    (byte)0x80, // P2
    (byte)0x0F, // Lc
    // 9f6a 04      Unpredictable number (numeric)
    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x12, // two digits according to UN/ATC bit map and number of ATC digits: 6 - 4 = 2
    // 9f7e 01      Mobile support indicator
    (byte)0x00, // no offline PIN required, no mobile support
    // 9f02 06      Amount authorized (numeric)
    (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, // 1.00
    // 5f2a 02      Transaction currency code
    (byte)0x09, (byte)0x78, // Euro
    // 9f1a 02      Terminal country code
    (byte)0x00, (byte)0x40, // Austria
    (byte)0x00, // Le
};
response = isoDep.transceive(computeCC);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

生成 AC 命令上的 Android isoDep.transceive 始终返回 6D00 不受支持 的相关文章

  • 已发布的 Flutter 应用程序在启动时崩溃

    编辑 此问题的解决方案是将您的 flutter 版本升级到较新的 dev 版本 then 1 7 0 您还可以上传单独的 APK 版本 但我个人不喜欢这个选项 请确保您没有从 flutter github 开发存储库下载 错误的构建 因为那
  • Android 上的 Firebase:如何检查 Firebase 身份验证失败原因?

    我在 Android 上使用 Firebase 和 Firebase Auth 功能 I try FirebaseAuth signInWithEmailAndPassword如果失败 我想知道为什么登录过程失败 The signInWit
  • 为什么我将可绘制文件重命名为 .9.png 后出现“Some file crunching failed”?

    我正在测试 9 patch 图像 在一切正常之前 我重命名drawable file ic button beat box default png to ic button beat box default 9 png 然后我收到错误 某些
  • AppCompat v21 工具栏更改徽标大小

    我正在从以前的操作栏迁移到 appcompat v21 中的新工具栏功能 我仍然想将徽标保留在操作栏 工具栏 的左上角 为此 我在布局中添加了支持工具栏 并为其创建了一个新的工具栏 app theme style NewToolBarSty
  • 如何将 EditText 传递给另一个活动?

    Intent intent new Intent this Name class intent putExtra key et getText toString startActivity intent Intent intent getI
  • 如何使用 adb 在设备上安装现有的 Android 应用程序?

    在开发过程中 我使用类似的东西 adb s 192 168 1 77 5555 uninstall com myApp app adb s 192 168 1 77 5555 install path to android debug ap
  • SQLite (Android):使用 ORDER BY 更新查询

    Android SQLite 我想要在 myTable 中的其他行之间插入行在android中使用SQLite 为此 我尝试增加从第 3 行开始的所有行的 id 这样 我就可以在位置 3 处插入新行 myTable 的主键是列 id 表中没
  • React Native Android 发布 apk 是调试,而不是发布

    我有一个现有的 Android 应用程序 我已根据以下内容将 React Native v0 30 活动添加到项目中docs http facebook github io react native releases next docs i
  • 为什么按钮上的 maxWidth 不起作用以及如何解决它?

    我的布局上有两个按钮 在大屏幕设备 平板电脑 上我想限制它们的宽度 这样它们看起来就不会很荒谬 我希望使用 maxWidth 属性 但它显然在我的场景中没有任何作用 这是布局定义 按钮使用布局的整个宽度 忽略 maxWidth 中的任何值
  • Android-工具栏中的SearchView

    我只想在我的应用程序中添加 searchview 但我不想搜索任何东西 只是我想要用户输入的查询 到目前为止 我尝试了这段代码 但是当我运行我的应用程序时它崩溃了 Update 我尝试了这个 但即使我的应用程序崩溃了 main menu x
  • Android Studio - 如何关闭“单词‘word’中的拼写错误?”

    当命名变量或给出字符串参数时 Android Studio 似乎对我如何标记事物有问题 有办法把它关掉吗 是的 打开Preferences gt Editor gt Inspections gt Spelling gt 关闭Typo并按OK
  • android 确定设备是否采用从右到左的语言/布局

    有没有办法确定设备是否使用从右到左的语言 例如阿拉伯语 而不是从左到右的语言 英语 与较旧的 API 级别 低至 10 兼容的东西是必要的 SOLUTION 我最终在接受的答案中使用了 xml 方法 接下来 我还添加了此处指示的代码 以应对
  • 获取可以共享数据的应用程序列表

    此代码显示默认共享对话框 Intent sharingIntent new Intent Intent ACTION SEND sharingIntent setType text html sharingIntent putExtra a
  • 如何从android获取应用程序安装时间

    我尝试了一些方法 但没有成功 请帮助我 PackageManager pm context getPackageManager ApplicationInfo appInfo pm getApplicationInfo app packag
  • 加快 ImageView 中的缩放功能

    我目前正在处理非常大的图像 7 10mb 由于多种原因无法调整大小或压缩 现在 我们的想法是在自定义 ImageView 中显示它们 使用户能够进行双击缩放 捏合缩放等 我使用这个库来完成这项工作 https github com Mike
  • android 中camera.setParameters 失败

    我已将相机功能包含在我的应用程序中 我还在市场上推出了该应用程序 我从一位用户那里收到一条错误消息 称他在打开相机时遇到错误 我已经在 2 1 的设备上测试了该应用程序 我从用户那里得到的错误是使用 Nexus One 它主要运行 2 2
  • Android:打开和关闭SQLite数据库

    我正在开发Android应用程序 我经常在其中访问本地数据库 该数据库可以从不同的主题访问 因此我遇到了数据库的协调问题 我使用以下open and close method public void open mDb mDbHelper g
  • 内部存储的安全性如何?

    我需要的 对于 Android 我需要永久保存数据 但也能够编辑 并且显然是读取 它 用户不应访问此数据 它可以包含诸如高分之类的内容 用户不得对其进行编辑 我的问题 我会 并且已经 使用过Internal Storage 但我不确定它实际
  • 在状态栏下方显示DialogFragment内容

    我试图显示高度和宽度均具有 match parent 的 DialogFragment 但碰巧在顶部 DialogFragment 显示在 StatusBar 下方 DialogFragment 正在应用一些默认值来填充底部 右侧 左侧和顶
  • 通过powershell运行ADB命令

    所以我尝试通过 powershell 脚本运行一些 ADB 命令 这是我正在尝试做的一个简单示例 adb shell echo in adb shell su root echo you are now root ls cd data da

随机推荐