什么是 CAN 以及如何提供它

What is CAN and how to provide it

我正在研究受 CAN 代码保护的波兰电子身份证。需要提供此代码才能解锁卡并能够列出令牌。

我找不到任何相关信息。

使用官方应用时 https://www.gov.pl/web/e-dowod 插入卡后系统会提示您输入此号码。

根据日志,调用了 e-dowod-pkcs11-64.so 中的神秘函数 C_SetCAN。它没有记录在 http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html and also not present in https://github.com/OpenSC/OpenSC/blob/master/src/pkcs11/pkcs11-global.c#L320 中,根据日志

它应该在什么地方
0x7f9bca95c700 23:18:32.251 [opensc-pkcs11] pkcs11-global.c:320:C_SetCAN: C_SetCAN(0x5)
0x7f9bca95c700 23:18:32.251 [opensc-pkcs11] pkcs11-global.c:329:C_SetCAN: C_SetCAN() get slot rv 0

这让我觉得它可能是一些自定义扩展,但由于 opensc 在 LGPL 上,所以也应该提供它的来源,对吗?

当我试图用 gdb 打破它时,但我已经登陆:

#0  0x00007fffeadd5b70 in C_SetCAN () from /opt/e-dowod/e-dowod-pkcs11-64.so
#1  0x000000000041d49c in ?? ()
#2  0x0000000000418907 in ?? ()
#3  0x00000000004199bc in ?? ()
#4  0x000000000041ed58 in ?? ()
#5  0x00007ffff686e0e1 in QObject::event(QEvent*) () from /opt/e-dowod/./libQt5Core.so.5
#6  0x00007ffff7691e2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /opt/e-dowod/./libQt5Widgets.so.5

为什么没有调用者和参数信息?

我也尝试过使用 https://github.com/OpenSC/OpenSC/blob/master/src/tools/npa-tool.c,它似乎具有所需的功能,但很可能没有成功。

P:91478; T:0x140627504822080 17:59:48.916 [npa-tool] sm-eac.c:643:eac_gen_auth_1_encrypted_nonce: 
General authenticate (Encrypted Nonce) response data (20 bytes):
00 02 7C 12 80 10 D1 0A 98 E5 3B DC 7C F5 DC FA ..|.......;.|...
58 60 24 BA                                     X`$.
P:91478; T:0x140627504822080 17:59:48.917 [npa-tool] sm-eac.c:647:eac_gen_auth_1_encrypted_nonce: Could not parse general authenticate response data.
P:91478; T:0x140627504822080 17:59:48.917 [npa-tool] sm-eac.c:648:eac_gen_auth_1_encrypted_nonce: error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag
P:91478; T:0x140627504822080 17:59:48.917 [npa-tool] sm-eac.c:648:eac_gen_auth_1_encrypted_nonce: error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error
P:91478; T:0x140627504822080 17:59:48.917 [npa-tool] sm-eac.c:648:eac_gen_auth_1_encrypted_nonce: error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error
P:91478; T:0x140627504822080 17:59:48.917 [npa-tool] sm-eac.c:1176:perform_pace: Could not get encrypted nonce from card (General Authenticate step 1 failed).
P:91478; T:0x140627504822080 17:59:48.917 [npa-tool] sm-eac.c:1364:perform_pace: returning with: -1400 (Internal error)

It make me thing that it might be some custom extension, but as opensc is on LGPL, sources of it should also be provided, right?

是的,您是对的,C_SetCAN 似乎是供应商定义的扩展方法。如果您的政府分发的 PKCS#11 库基于 LGPL 2.1 许可的 OpenSC 代码,那么他们必须提供包含所有更改的源代码。海事组织你所要做的就是要求它。你有吗?

罐号印在电子身份证上。当我收到卡时,我必须在密码键盘上输入代码。