Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Polish e-dowód #1831

Closed
2 tasks
majkrzak opened this issue Oct 17, 2019 · 76 comments
Closed
2 tasks

Add support for Polish e-dowód #1831

majkrzak opened this issue Oct 17, 2019 · 76 comments

Comments

@majkrzak
Copy link
Contributor

majkrzak commented Oct 17, 2019

Background

Since March 2019 new Polish ID card with electronic layer is available.

It contains some general information about ID holder like name, personal evidence number, photo etc. Also three default keys and certificates together with place for cusom ones.

With offical pkcs11 lib (which is opensc based see #1992 ) they are displayed as separate tokens:

pkcs11:model=PKCS%2315%20emulated;manufacturer=PWPW%20S.A.;serial=0000000000000000;token=E-Dow%C3%B3d%20%28Authentication%29
pkcs11:model=PKCS%2315%20emulated;manufacturer=PWPW%20S.A.;serial=0000000000000000;token=E-Dow%C3%B3d%20%28Presence%29
pkcs11:model=PKCS%2315%20emulated;manufacturer=PWPW%20S.A.;serial=0000000000000000;token=E-Dow%C3%B3d%20%28Authorization%29
pkcs11:model=PKCS%2315%20emulated;manufacturer=PWPW%20S.A.;serial=0000000000000000;token=E-Dow%C3%B3d%20%28Qualified%29

Card does not have contact interface and is protected with PACEv2 in probably similar way as German one.

Will be glad to get your assistance and guidance, so I can handle this issue and add new supported card.

Subtasks

  • Create base card driver (probably based on src/libopensc/card-npa.c)
  • Implement PACE2 CAN/MRZ authorization

Attachments

Polish

Engilsh

@Jakuje
Copy link
Member

Jakuje commented Oct 17, 2019

C_SetCAN is not a standard PKCS #11 function. It needed to be added to the API just for this card and to make both the card and the pkcs11 library useless with any other tools that support standard PKCS #11. This sounds for me like quite awful thing to do.

If you have their application, I would try to run pcscd in debug mode to list what APDUs are exchanged with the cards. This should give you some idea what they are sending when and hopefully some meaning and context to that (with the help of ISO 7816-4).

@majkrzak
Copy link
Contributor Author

@Jakuje I beet that instead of thins pkcs11 lib extensions npa-tool can be used.

@frankmorgner
Copy link
Member

Your card seems to have some proprietary extension in the front of the general authenticate response. 00 02 should not normally be there. See BSI TR-03110 pt. 3, from which also the ICAO documents are derived. Try patching sm-eac.c to skip the first two bytes.

The CAN protects the card's privacy via NFC. For the German ID card, the process would be

  1. Verify CAN
  2. Read out card (certificates, ...), which are now available
  3. Verify PIN
  4. Use key, which is now unlocked

However, most PKCS#11 applications aren't prepared to perform the first step. (Theoretically, you could do this via PKCS#11, but, again, no real world application is actually that flexible.) That's why I've decided to let the user hardcode her CAN in opensc.conf, to perform the first step transparently when the card is initialized.

@majkrzak
Copy link
Contributor Author

majkrzak commented Oct 19, 2019

Here is transmission dump from official initialization.
can1.log
can2.log

--- can1.log    2019-10-19 13:25:47.319940334 +0300
+++ can2.log    2019-10-19 13:23:09.220255419 +0300
@@ -105,10 +105,10 @@
 APDU: 00 22 C1 A4 12 80 0A 04 00 7F 00 07 02 02 04 02 04 83 01 02 84 01 10
 SW: 90 00
 APDU: 10 86 00 00 02 7C 00 00
-SW: 7C 12 80 10 CC 59 1B 38 DB 55 AB 27 1F 60 AE 72 E4 02 FB E4 90 00
-APDU: 10 86 00 00 65 7C 63 81 61 04 76 7F F8 45 37 BF 72 8C 24 96 EF 2A 5D 3C 2D 38 BD B3 4A A5 28 01 D7 45 77 44 CC 62 A8 6F AC 1F 5E C7 F6 D7 DC 88 86 5F 29 68 6C 65 CC 0A 57 63 3C 3B AB 9F C8 EF 48 71 1B 24 E1 E7 19 E6 5B F9 CE 11 68 10 A5 90 63 B1 88 40 32 9C F7 9A 85 52 8D E0 03 49 5B 48 D4 0E 0E FF 6E 30 15 06 D7 11 65
-SW: 7C 63 82 61 04 7B B8 A0 36 79 BC 1C AC 7D 50 14 A1 02 63 AF F9 D6 70 DA 8A 2E 10 89 40 7D 2B 47 C3 9E AC 96 54 A0 61 DB D1 25 02 93 10 D4 93 B6 B5 42 61 F8 40 4A C8 37 8B 45 03 23 B1 72 58 7A 3C B8 40 68 83 5E 57 E2 9B 01 BC 9A 31 38 FD 87 F1 84 F9 04 E6 04 11 80 7E A7 90 3E 1A 88 54 02 9E 67 B9 53 8E 90 00
-APDU: 10 86 00 00 65 7C 63 83 61 04 65 43 9B 2A 9D F5 73 B4 00 0A 57 D5 BA 83 91 A3 75 3B 49 96 D5 9D E8 2E BB 8B C5 98 C9 CE 7A 01 07 42 9C 67 E5 A5 0C BB D9 9B 10 E1 96 20 78 FD 1E C4 05 62 9B 32 9F E3 26 A8 69 4C 8D 05 04 D4 2D F9 7C 93 24 1F 74 A6 05 71 B1 46 00 4C B7 2B E5 A6 3E 23 4C 2C 3E 98 7D 04 20 CB E0 71 8D 70 65
-SW: 7C 63 84 61 04 23 BA EA 01 84 F2 A3 5F B0 A8 3E 30 95 12 52 8B 53 19 A8 6E 92 D5 04 53 27 4C D8 35 7D D4 0C AF 97 A7 B4 FC 17 DA 22 EE B9 42 BD 5B 61 C9 6F 2A 25 7D 53 E3 9B 2A 41 7B 5B 17 22 10 BB EF 31 DD 08 16 F1 0D C8 43 C2 C0 2E ED AC 44 17 DC 17 87 9E 1E 52 01 F2 94 07 AE 0B 9B 5C C6 6A 6B 2E 81 90 00
-APDU: 00 86 00 00 0C 7C 0A 85 08 26 46 F3 5E 67 D2 CC 6B 0C
-SW: 7C 0A 86 08 25 0A 72 A6 23 9B A4 11 90 00
+SW: 7C 12 80 10 E8 6B 0B CA 7C F5 8B ED 7E 08 68 AC 5D 0E D6 79 90 00
+APDU: 10 86 00 00 65 7C 63 81 61 04 07 05 34 76 8B AC 9B BA A8 ED 04 14 64 2C FB FE 1F 4F 7B E1 4D 4D A2 F7 E3 22 B0 3E 65 A0 66 DE 55 1E 36 58 4C 15 35 24 AF 3C CE F2 C7 05 C7 A3 03 1B B6 5D 6E C5 A3 E5 B0 BA 87 9D 36 EE 75 79 6A AC 70 B6 D8 D4 B3 6E 6E 80 2C A6 E0 75 E7 FD 9B B1 EB 1B A9 8F 3F C0 43 77 ED 36 B2 50 B2 9F 65
+SW: 7C 63 82 61 04 57 7D A3 9D 23 A2 36 1B CA 19 DA F5 6F 97 E7 9F C9 75 3A 20 3F F1 36 65 9E 4E DE 1E 65 79 A7 0C 66 17 85 62 1C B2 FA 70 0D FD 32 DC 56 48 22 A2 1D 7B AD 7F B9 C6 E8 71 48 FB 7D A5 13 96 9E 1A F7 81 2E 37 3B 07 A3 B6 88 43 05 2E 84 16 0C FA DA 47 3C 50 A3 E8 80 B3 92 1F FF 94 74 8E 26 8E 90 00
+APDU: 10 86 00 00 65 7C 63 83 61 04 1D FD C6 3D D1 FC 02 03 F2 16 6A 8E C2 C6 A0 4F F4 74 AC 01 D1 F5 76 08 56 3D A4 A3 5B B1 4B 9E 64 DC 6E 46 2F BE 91 C8 BF 40 77 B2 B4 B4 75 30 7F A4 FA 09 48 90 BA F3 5F CC 51 89 71 2C 5B E9 20 DF 71 41 A0 99 8D 7B F2 68 22 01 A4 C7 40 54 F8 68 ED 87 B7 7B 8E 2B 11 65 69 72 5C 8A BD FF 65
+SW: 7C 63 84 61 04 45 C4 58 30 47 E2 DB 86 70 01 A3 96 EB 22 26 69 69 F7 E8 CF 39 6B 2E F2 08 53 06 91 BB E9 33 15 28 3A 3C EF DE B2 81 83 10 DA FA E4 57 7F BC 5A 2A C0 44 53 F2 8D 93 78 61 61 99 29 38 B0 5A 0F 2C D6 49 BA 4B 57 ED E5 C3 89 5A 47 94 71 89 60 7B 61 3D E3 0C 4E CC 8E 0A 36 C8 09 E9 81 58 C9 90 00
+APDU: 00 86 00 00 0C 7C 0A 85 08 37 AD 23 D5 EA 89 71 E1 0C
+SW: 7C 0A 86 08 7A 47 9E 8F 47 03 AB E5 90 00

I'm afraid that npa-tool it might not be compliant enough 😞

APDU: 00 B0 9C 00 DF
SW: 31 14 30 12 06 0A 04 00 7F 00 07 02 02 04 02 04 02 01 02 02 01 10 90 00
APDU: 00 22 C1 A4 0F 80 0A 04 00 7F 00 07 02 02 04 02 04 83 01 02
SW: 90 00
APDU: 10 86 00 00 00 00 02 7C 00 00 00
SW: 00 02 7C 12 80 10 E4 83 4B 0E 93 4C E5 D1 AB 5B A1 79 67 D8 90 00

@majkrzak
Copy link
Contributor Author

I've authorized successfully with following code, but p11tool don't see the card yet

#include <stdio.h>
#include <stdlib.h>

#include <winscard.h>

#include <eac/eac.h>
#include <eac/pace.h>
#include <openssl/bio.h>
#include <string.h>
#include <time.h>


#define CHECK(f, rv) \
	if (SCARD_S_SUCCESS != rv) \
	{ \
		printf(f ": %s\n", pcsc_stringify_error(rv)); \
		return -1; \
	}



SCARDHANDLE hCard;
SCARDCONTEXT hContext;
BYTE pbRecvBuffer[258];
DWORD dwRecvLength;

BIO* bio;

EAC_CTX* pcd_ctx;

PACE_SEC* secret = NULL;


BUF_MEM* pcd_ephemeral_pubkey;
BUF_MEM* picc_ephemeral_pubkey;

int main(int argc, char** argv) {
	LONG rv;

	{
		bio = BIO_new_fp(stdout, BIO_NOCLOSE | BIO_FP_TEXT);
	}

	{
		EAC_init();
		pcd_ctx = EAC_CTX_new();
		EAC_CTX_init_pace(pcd_ctx, NID_id_PACE_ECDH_GM_AES_CBC_CMAC_256, 16);
	}

	{
		secret = PACE_SEC_new(argv[1], 6, PACE_CAN);
	}

	{
		DWORD dwActiveProtocol;

		unsigned int i;

		rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
		CHECK("SCardEstablishContext", rv)

		rv = SCardConnect(hContext, "Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00", SCARD_SHARE_SHARED,
		                  SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &hCard, &dwActiveProtocol);
		CHECK("SCardConnect", rv)

	}
	// STEP 1 – MSE:Set AT
	{
		unsigned char msg[] = {0x00, 0x22, 0xC1, 0xA4, 0x12, 0x80, 0x0A, 0x04, 0x00, 0x7F, 0x00, 0x07, 0x02, 0x02, 0x04, 0x02, 0x04, 0x83, 0x01, 0x02, 0x84, 0x01, 0x10};
		dwRecvLength = sizeof(pbRecvBuffer);
		rv = SCardTransmit(hCard, SCARD_PCI_T1, msg, sizeof msg, NULL, pbRecvBuffer, &dwRecvLength);
		CHECK("SCardTransmit", rv)
	}

	// STEP 2.1 – General Authenticate (Encrypted Nonce)
	{
		unsigned char msg[] = {0x10, 0x86, 0x00, 0x00, 0x02, 0x7C, 0x00, 0x00};
		dwRecvLength = sizeof(pbRecvBuffer);
		rv = SCardTransmit(hCard, SCARD_PCI_T1, msg, sizeof msg, NULL, pbRecvBuffer, &dwRecvLength);
		CHECK("SCardTransmit", rv)

		BUF_MEM* enc_nonce = BUF_MEM_new();
		BUF_MEM_grow(enc_nonce, 16);
		enc_nonce->length = 16, memcpy(enc_nonce->data, pbRecvBuffer + 4, 16);

		PACE_STEP2_dec_nonce(pcd_ctx, secret, enc_nonce);
	}

	// STEP 2.2 – General Authenticate (Map Nonce)
	{
		unsigned char msg[9 + 0x61 + 1] = {0x10, 0x86, 0x00, 0x00, 0x65, 0x7C, 0x63, 0x81, 0x61, [9 + 0x61] = 0x65};

		BUF_MEM* pcd_mapping_data = PACE_STEP3A_generate_mapping_data(pcd_ctx);
		memcpy(msg + 9, pcd_mapping_data->data, 0x61);

		dwRecvLength = sizeof(pbRecvBuffer);
		rv = SCardTransmit(hCard, SCARD_PCI_T1, msg, sizeof msg, NULL, pbRecvBuffer, &dwRecvLength);
		CHECK("SCardTransmit", rv)

		BUF_MEM* picc_mapping_data = BUF_MEM_new();
		BUF_MEM_grow(picc_mapping_data, 0x61);
		picc_mapping_data->length = 0x61, memcpy(picc_mapping_data->data, pbRecvBuffer + 4, 0x61);

		PACE_STEP3A_map_generator(pcd_ctx, picc_mapping_data);
	}

	// STEP 2.3 – General Authenticate (Perform Key Agreement)
	{
		unsigned char msg[9 + 0x61 + 1] = {0x10, 0x86, 0x00, 0x00, 0x65, 0x7C, 0x63, 0x83, 0x61, [9 + 0x61] = 0x65};

		pcd_ephemeral_pubkey = PACE_STEP3B_generate_ephemeral_key(pcd_ctx);
		memcpy(msg + 9, pcd_ephemeral_pubkey->data, 0x61);

		dwRecvLength = sizeof(pbRecvBuffer);
		rv = SCardTransmit(hCard, SCARD_PCI_T1, msg, sizeof msg, NULL, pbRecvBuffer, &dwRecvLength);
		CHECK("SCardTransmit", rv)

		picc_ephemeral_pubkey = BUF_MEM_new();
		BUF_MEM_grow(picc_ephemeral_pubkey, 0x61);
		picc_ephemeral_pubkey->length = 0x61, memcpy(picc_ephemeral_pubkey->data, pbRecvBuffer + 4, 0x61);

		PACE_STEP3B_compute_shared_secret(pcd_ctx, picc_ephemeral_pubkey);
	}

	PACE_STEP3C_derive_keys(pcd_ctx);

	// STEP 2.4 – General Authenticate (Mutual Authentication)
	{
		unsigned char msg[9 + 8 + 1] = {0x00, 0x86, 0x00, 0x00, 0x0C, 0x7C, 0x0A, 0x85, 0x08,  [9 + 8] =  0x0C};

		BUF_MEM* pcd_token = PACE_STEP3D_compute_authentication_token(pcd_ctx, picc_ephemeral_pubkey);
		BIO_dump_indent(bio, pcd_token->data, pcd_token->length, 4);
		memcpy(msg + 9, pcd_token->data, 8);

		dwRecvLength = sizeof(pbRecvBuffer);
		rv = SCardTransmit(hCard, SCARD_PCI_T1, msg, sizeof msg, NULL, pbRecvBuffer, &dwRecvLength);
		CHECK("SCardTransmit", rv)

		BUF_MEM* picc_token = BUF_MEM_new();
		BUF_MEM_grow(picc_token, 8);
		picc_token->length = 8, memcpy(picc_token->data, pbRecvBuffer + 4, 8);

		if (PACE_STEP3D_verify_authentication_token(pcd_ctx, picc_token) != 1) {
			return 1;
		}

		printf("success\n");


	}


	return 0;

}

@majkrzak
Copy link
Contributor Author

OK, after some debugging I think that there might be some global state in the pkcs11 library, which is initialized by some nonstandard extensions. The function which orchestrate initialization process is outside the pkcs11 library and looks like it is anonymous Qt event handler.

P.S. Am I right that sources of pkcs11 libraries should be opened. Original OpenSC are on LGPL

@szszszsz
Copy link

@majkrzak You mean the supposedly modified libraries provided with the custom handling app? I would think so. Some OSS license notification should be provided with it as well.

@majkrzak
Copy link
Contributor Author

I've requested access to the LGPL licensed sourcecode, but in the response I've got follwoing information (my translation):

... due to the security reasons, source code of the application is company secret and can not be shared.

According to the https://www.gnu.org/licenses/gpl-violation.html copyright owners are the one who can take further actions. @alonbl @CardContact @dengert @frankmorgner @LudovicRousseau @martinpaljak @mtrojnar @szikora @viktorTarasov ?

@majkrzak
Copy link
Contributor Author

@mtrojnar
Copy link
Member

Any progress?

@majkrzak Do you mean a progress dealing with copyright infringement? This issue is "Add support for Polish e-dowód", which is clearly a separate topic. Please open a new issue for copyright infringement. Please include the full vendor's response, and not just your partial translation. Which LGPL-licensed files are affected? Who are the copyright holders for those files? I presume you listed the current OpenSC team members, which are not necessarily the same people who contributed to some specific LGPL-licensed files throughout the long history of the OpenSC project.

@majkrzak
Copy link
Contributor Author

majkrzak commented Jan 6, 2020

@mtrojnar I had in my mind rearranging this ticket at the beginning of the year. I'll extract copyright issue separately.

@frankmorgner
Copy link
Member

above, you've said that npa-tool doesn't work.

APDU: 00 B0 9C 00 DF
SW: 31 14 30 12 06 0A 04 00 7F 00 07 02 02 04 02 04 02 01 02 02 01 10 90 00
APDU: 00 22 C1 A4 0F 80 0A 04 00 7F 00 07 02 02 04 02 04 83 01 02
SW: 90 00
APDU: 10 86 00 00 00 00 02 7C 00 00 00
SW: 00 02 7C 12 80 10 E4 83 4B 0E 93 4C E5 D1 AB 5B A1 79 67 D8 90 00

but your output doesn't indicate any error. Could you get a more verbose output (npa-tool -vvv --can=123456)?

@frankmorgner
Copy link
Member

do you have some documentation describing the detailed functionality of the card?

@majkrzak
Copy link
Contributor Author

Output of npa-tool -vvv -c ...

P:3789; T:0x139994107336512 10:27:47.828 [npa-tool] sc.c:315:sc_detect_card_presence: called
P:3789; T:0x139994107336512 10:27:47.828 [npa-tool] reader-pcsc.c:439:pcsc_detect_card_presence: called
P:3789; T:0x139994107336512 10:27:47.829 [npa-tool] reader-pcsc.c:332:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00 check
P:3789; T:0x139994107336512 10:27:47.829 [npa-tool] reader-pcsc.c:352:refresh_attributes: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.829 [npa-tool] reader-pcsc.c:444:pcsc_detect_card_presence: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.829 [npa-tool] sc.c:320:sc_detect_card_presence: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.829 [npa-tool] sc.c:315:sc_detect_card_presence: called
P:3789; T:0x139994107336512 10:27:47.829 [npa-tool] reader-pcsc.c:439:pcsc_detect_card_presence: called
P:3789; T:0x139994107336512 10:27:47.830 [npa-tool] reader-pcsc.c:332:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:3789; T:0x139994107336512 10:27:47.830 [npa-tool] reader-pcsc.c:352:refresh_attributes: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.830 [npa-tool] reader-pcsc.c:444:pcsc_detect_card_presence: returning with: 1
P:3789; T:0x139994107336512 10:27:47.830 [npa-tool] sc.c:320:sc_detect_card_presence: returning with: 1
Using reader with a card: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00
P:3789; T:0x139994107336512 10:27:47.830 [npa-tool] sc.c:315:sc_detect_card_presence: called
P:3789; T:0x139994107336512 10:27:47.830 [npa-tool] reader-pcsc.c:439:pcsc_detect_card_presence: called
P:3789; T:0x139994107336512 10:27:47.830 [npa-tool] reader-pcsc.c:332:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:3789; T:0x139994107336512 10:27:47.831 [npa-tool] reader-pcsc.c:352:refresh_attributes: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.831 [npa-tool] reader-pcsc.c:444:pcsc_detect_card_presence: returning with: 1
P:3789; T:0x139994107336512 10:27:47.831 [npa-tool] sc.c:320:sc_detect_card_presence: returning with: 1
Connecting to card in reader Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00...
P:3789; T:0x139994107336512 10:27:47.831 [npa-tool] card.c:256:sc_connect_card: called
P:3789; T:0x139994107336512 10:27:47.831 [npa-tool] reader-pcsc.c:572:pcsc_connect: called
P:3789; T:0x139994107336512 10:27:47.831 [npa-tool] reader-pcsc.c:332:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:3789; T:0x139994107336512 10:27:47.832 [npa-tool] reader-pcsc.c:352:refresh_attributes: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.832 [npa-tool] reader-pcsc.c:604:pcsc_connect: Initial protocol: T=1
P:3789; T:0x139994107336512 10:27:47.832 [npa-tool] card-default.c:47:default_init: called
P:3789; T:0x139994107336512 10:27:47.832 [npa-tool] card-default.c:52:default_init: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.832 [npa-tool] card.c:384:sc_connect_card: card info name:'Unsupported card', type:-1, flags:0x0, max_send/recv_size:255/256
P:3789; T:0x139994107336512 10:27:47.832 [npa-tool] card.c:1523:sc_card_sm_check: called
P:3789; T:0x139994107336512 10:27:47.833 [npa-tool] card.c:1528:sc_card_sm_check: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.833 [npa-tool] card.c:399:sc_connect_card: returning with: 0 (Success)
Using card driver Default driver for unknown cards.
P:3789; T:0x139994107336512 10:27:47.833 [npa-tool] apdu.c:546:sc_transmit_apdu: called
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] card.c:475:sc_lock: called
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] reader-pcsc.c:651:pcsc_lock: called
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] card.c:515:sc_lock: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] apdu.c:513:sc_transmit: called
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] apdu.c:363:sc_single_transmit: called
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:B0, P1:9C, P2:0, data(0) (nil)
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] reader-pcsc.c:296:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:3789; T:0x139994107336512 10:27:47.834 [npa-tool] reader-pcsc.c:297:pcsc_transmit: 
Outgoing APDU (5 bytes):
00 B0 9C 00 DF .....
P:3789; T:0x139994107336512 10:27:47.835 [npa-tool] reader-pcsc.c:216:pcsc_internal_transmit: called
P:3789; T:0x139994107336512 10:27:47.885 [npa-tool] reader-pcsc.c:306:pcsc_transmit: 
Incoming APDU (24 bytes):
31 14 30 12 06 0A 04 00 7F 00 07 02 02 04 02 04 1.0.............
02 01 02 02 01 10 90 00                         ........
P:3789; T:0x139994107336512 10:27:47.885 [npa-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.885 [npa-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.885 [npa-tool] card.c:525:sc_unlock: called
P:3789; T:0x139994107336512 10:27:47.886 [npa-tool] reader-pcsc.c:701:pcsc_unlock: called
P:3789; T:0x139994107336512 10:27:47.895 [npa-tool] apdu.c:546:sc_transmit_apdu: called
P:3789; T:0x139994107336512 10:27:47.895 [npa-tool] card.c:475:sc_lock: called
P:3789; T:0x139994107336512 10:27:47.896 [npa-tool] reader-pcsc.c:651:pcsc_lock: called
P:3789; T:0x139994107336512 10:27:47.896 [npa-tool] card.c:515:sc_lock: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.896 [npa-tool] apdu.c:513:sc_transmit: called
P:3789; T:0x139994107336512 10:27:47.897 [npa-tool] apdu.c:363:sc_single_transmit: called
P:3789; T:0x139994107336512 10:27:47.897 [npa-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:22, P1:C1, P2:A4, data(15) 0x5600131bc0a0
P:3789; T:0x139994107336512 10:27:47.897 [npa-tool] reader-pcsc.c:296:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:3789; T:0x139994107336512 10:27:47.897 [npa-tool] reader-pcsc.c:297:pcsc_transmit: 
Outgoing APDU (20 bytes):
00 22 C1 A4 0F 80 0A 04 00 7F 00 07 02 02 04 02 ."..............
04 83 01 02                                     ....
P:3789; T:0x139994107336512 10:27:47.898 [npa-tool] reader-pcsc.c:216:pcsc_internal_transmit: called
P:3789; T:0x139994107336512 10:27:47.944 [npa-tool] reader-pcsc.c:306:pcsc_transmit: 
Incoming APDU (2 bytes):
90 00 ..
P:3789; T:0x139994107336512 10:27:47.944 [npa-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.944 [npa-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.944 [npa-tool] card.c:525:sc_unlock: called
P:3789; T:0x139994107336512 10:27:47.945 [npa-tool] reader-pcsc.c:701:pcsc_unlock: called
P:3789; T:0x139994107336512 10:27:47.949 [npa-tool] apdu.c:546:sc_transmit_apdu: called
P:3789; T:0x139994107336512 10:27:47.950 [npa-tool] card.c:475:sc_lock: called
P:3789; T:0x139994107336512 10:27:47.950 [npa-tool] reader-pcsc.c:651:pcsc_lock: called
P:3789; T:0x139994107336512 10:27:47.950 [npa-tool] card.c:515:sc_lock: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:47.950 [npa-tool] apdu.c:513:sc_transmit: called
P:3789; T:0x139994107336512 10:27:47.950 [npa-tool] apdu.c:363:sc_single_transmit: called
P:3789; T:0x139994107336512 10:27:47.950 [npa-tool] apdu.c:367:sc_single_transmit: CLA:10, INS:86, P1:0, P2:0, data(2) 0x5600131bc0e0
P:3789; T:0x139994107336512 10:27:47.950 [npa-tool] reader-pcsc.c:296:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:3789; T:0x139994107336512 10:27:47.951 [npa-tool] reader-pcsc.c:297:pcsc_transmit: 
Outgoing APDU (11 bytes):
10 86 00 00 00 00 02 7C 00 00 00 .......|...
P:3789; T:0x139994107336512 10:27:47.951 [npa-tool] reader-pcsc.c:216:pcsc_internal_transmit: called
P:3789; T:0x139994107336512 10:27:48.039 [npa-tool] reader-pcsc.c:306:pcsc_transmit: 
Incoming APDU (22 bytes):
00 02 7C 12 80 10 16 4D 9E 2B 47 5C 19 F7 37 96 ..|....M.+G\..7.
6E B3 1A 5E 90 00                               n..^..
P:3789; T:0x139994107336512 10:27:48.040 [npa-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:48.040 [npa-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:48.040 [npa-tool] card.c:525:sc_unlock: called
P:3789; T:0x139994107336512 10:27:48.040 [npa-tool] reader-pcsc.c:701:pcsc_unlock: called
P:3789; T:0x139994107336512 10:27:48.051 [npa-tool] sm-eac.c:647:eac_gen_auth_1_encrypted_nonce: Could not parse general authenticate response data.
P:3789; T:0x139994107336512 10:27:48.052 [npa-tool] sm-eac.c:648:eac_gen_auth_1_encrypted_nonce: error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag
P:3789; T:0x139994107336512 10:27:48.052 [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:3789; T:0x139994107336512 10:27:48.052 [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:3789; T:0x139994107336512 10:27:48.052 [npa-tool] sm-eac.c:1176:perform_pace: Could not get encrypted nonce from card (General Authenticate step 1 failed).
P:3789; T:0x139994107336512 10:27:48.053 [npa-tool] reader-pcsc.c:501:pcsc_reconnect: Reconnecting to the card...
P:3789; T:0x139994107336512 10:27:48.053 [npa-tool] reader-pcsc.c:332:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:3789; T:0x139994107336512 10:27:48.054 [npa-tool] reader-pcsc.c:352:refresh_attributes: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:48.073 [npa-tool] reader-pcsc.c:524:pcsc_reconnect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00:SCardReconnect returned: 0x00000000
P:3789; T:0x139994107336512 10:27:48.073 [npa-tool] card.c:416:sc_disconnect_card: called
P:3789; T:0x139994107336512 10:27:48.073 [npa-tool] reader-pcsc.c:636:pcsc_disconnect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00:SCardDisconnect returned: 0x00000000
P:3789; T:0x139994107336512 10:27:48.074 [npa-tool] card.c:438:sc_disconnect_card: returning with: 0 (Success)
P:3789; T:0x139994107336512 10:27:48.074 [npa-tool] ctx.c:927:sc_release_context: called
P:3789; T:0x139994107336512 10:27:48.074 [npa-tool] reader-pcsc.c:938:pcsc_finish: called
Error: Internal error

@majkrzak
Copy link
Contributor Author

@mtrojnar I'm a bit occupied nowadays, can you handle the ticket you mentioned? It seems that you might have more experience with topic like this.

@frankmorgner

This comment has been minimized.

@frankmorgner
Copy link
Member

I just realized that the ASN.1 formatted response of the card is two bytes beyond the response buffer! In your example code above, you take 16 bytes from offset 4. So if you take

Incoming APDU (22 bytes):
00 02 7C 12 80 10 16 4D 9E 2B 47 5C 19 F7 37 96 ..|....M.+G\..7.
6E B3 1A 5E 90 00                               n..^..

then you are actually taking 80 10 16 4D 9E 2B 47 5C 19 F7 37 96 6E B3 1A 5E 90 00. However, 90 00 should not be part of the mapping data, this only indecates that the card responds success. The mapping data is specified with 0x7c (length 18), the actual data is specified with 80 (length 16)! But behind 80 10 there are only 14 bytes of mapping data and 2 bytes of smart card status!

Since you say that your code above worked successfully (taking 90 00 as part of the mapping data), this means that your card actually has a problem! You should contact the vendor, the card is missing two bytes of entropy!

However, this patch should make the card work until the above problem is resolved:

diff --git a/src/sm/sm-eac.c b/src/sm/sm-eac.c
index b1d660cc..83369304 100644
--- a/src/sm/sm-eac.c
+++ b/src/sm/sm-eac.c
@@ -642,8 +642,12 @@ static int eac_gen_auth_1_encrypted_nonce(sc_card_t *card,
 
        sc_debug_hex(card->ctx, SC_LOG_DEBUG_SM, "General authenticate (Encrypted Nonce) response data", apdu.resp, apdu.resplen);
 
+       /* card seems to take SW as part of the mapping data. Need to contact the
+        * vendor, because this IS A PROBLEM */
+       apdu.resp[apdu.resplen] = apdu.sw1;
+       apdu.resp[apdu.resplen+1] = apdu.sw2;
        if (!d2i_EAC_GEN_AUTH_PACE_R(&r_data,
-                               (const unsigned char **) &apdu.resp, apdu.resplen)) {
+                               (const unsigned char **) &apdu.resp+2, apdu.resplen)) {
                sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not parse general authenticate response data.");
                ssl_error(card->ctx);
                r = SC_ERROR_INTERNAL;
``

@majkrzak
Copy link
Contributor Author

majkrzak commented Jan 20, 2020

@frankmorgner I went through your post and one of my pervious one: #1831 (comment)

If you take a look you will see that my code and official app makes a request:

10 86 00 00 02 7C 00 00

while your code is sending:

10 86 00 00 00 00 02 7C 00 00 00

I would call it interesting, cause 00 02 are they bytes we can find in the response :D

Is there everything fine?
https://github.com/OpenSC/OpenSC/blob/master/src/sm/sm-eac.c#L629

Generally Polish e-id seem to not be able to handle data length in long form (00 00 02). It just expects 02. Why is OpenSC using long form?

Is this TODO releated?

/* TODO calculating the APDU case, Lc and Le should actually only be

@majkrzak
Copy link
Contributor Author

majkrzak commented Mar 25, 2020

Uff, I've managed to identify why it is happening like that.

Polish eID do not work with Extended APDU-s, at least in this step.

Max response length is set to 65 536 which causes the request length is also send in extended format.

unsigned char resp[SC_MAX_EXT_APDU_RESP_SIZE];

Can it be safely changed to the classic limit? Or maybe made dependent on the card attributes?

@majkrzak
Copy link
Contributor Author

P.S.
@frankmorgner Can you unbanme by the way, cause I can not even add a pull request to fix openpace 😅 I'm really sorry 😞
https://github.com/majkrzak/openpace/commit/721019c9bcdd67ab1d04685e0a681b215ef4e3e2

@majkrzak
Copy link
Contributor Author

majkrzak commented Mar 25, 2020

I've make some test with SC_MAX_EXT_APDU_RESP_SIZE changed to SC_MAX_APDU_RESP_SIZE.

  • npa-tool --can=123456 works ✔️
  • pkcs15-tool -D don't 😞 (PACE is not performed)
$ cat etc/opensc.conf
app default {
        # debug = 3;
        # debug_file = opensc-debug.txt;
        framework pkcs15 {
                # use_file_caching = true;
        }
        force_card_driver = npa;
        card_driver npa {
                can = 123456;
        }
}
$ ./src/tools/pkcs15-tool -D -vvvvvvv
P:61576; T:0x140128005117760 22:35:10.029 [pkcs15-tool] sc.c:325:sc_detect_card_presence: called
P:61576; T:0x140128005117760 22:35:10.030 [pkcs15-tool] reader-pcsc.c:469:pcsc_detect_card_presence: called
P:61576; T:0x140128005117760 22:35:10.030 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00 check
P:61576; T:0x140128005117760 22:35:10.031 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.032 [pkcs15-tool] reader-pcsc.c:474:pcsc_detect_card_presence: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.032 [pkcs15-tool] sc.c:330:sc_detect_card_presence: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.032 [pkcs15-tool] sc.c:325:sc_detect_card_presence: called
P:61576; T:0x140128005117760 22:35:10.032 [pkcs15-tool] reader-pcsc.c:469:pcsc_detect_card_presence: called
P:61576; T:0x140128005117760 22:35:10.032 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:61576; T:0x140128005117760 22:35:10.034 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.034 [pkcs15-tool] reader-pcsc.c:474:pcsc_detect_card_presence: returning with: 1
P:61576; T:0x140128005117760 22:35:10.034 [pkcs15-tool] sc.c:330:sc_detect_card_presence: returning with: 1
Using reader with a card: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00
P:61576; T:0x140128005117760 22:35:10.035 [pkcs15-tool] sc.c:325:sc_detect_card_presence: called
P:61576; T:0x140128005117760 22:35:10.035 [pkcs15-tool] reader-pcsc.c:469:pcsc_detect_card_presence: called
P:61576; T:0x140128005117760 22:35:10.035 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:61576; T:0x140128005117760 22:35:10.037 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.037 [pkcs15-tool] reader-pcsc.c:474:pcsc_detect_card_presence: returning with: 1
P:61576; T:0x140128005117760 22:35:10.037 [pkcs15-tool] sc.c:330:sc_detect_card_presence: returning with: 1
Connecting to card in reader Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00...
P:61576; T:0x140128005117760 22:35:10.037 [pkcs15-tool] card.c:254:sc_connect_card: called
P:61576; T:0x140128005117760 22:35:10.037 [pkcs15-tool] reader-pcsc.c:602:pcsc_connect: called
P:61576; T:0x140128005117760 22:35:10.038 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:61576; T:0x140128005117760 22:35:10.039 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.039 [pkcs15-tool] reader-pcsc.c:634:pcsc_connect: Initial protocol: T=1
P:61576; T:0x140128005117760 22:35:10.039 [pkcs15-tool] card.c:1147:match_atr_table: ATR     : 3b:84:80:01:47:43:50:43:12
P:61576; T:0x140128005117760 22:35:10.040 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:FE:18:00:00:81:31:FE:45:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:FA
P:61576; T:0x140128005117760 22:35:10.040 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.040 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8E:80:01:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:18
P:61576; T:0x140128005117760 22:35:10.040 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.040 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:DE:18:FF:81:91:FE:1F:C3:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:1C
P:61576; T:0x140128005117760 22:35:10.041 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.041 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:DE:96:FF:81:91:FE:1F:C3:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:92
P:61576; T:0x140128005117760 22:35:10.041 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.041 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:80:80:01:01
P:61576; T:0x140128005117760 22:35:10.041 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.042 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:84:80:01:47:6f:49:44:00
P:61576; T:0x140128005117760 22:35:10.042 [pkcs15-tool] card.c:1165:match_atr_table: ATR mask: FF:FF:FF:FF:FF:FF:FF:FF:00
P:61576; T:0x140128005117760 22:35:10.042 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:85:80:01:47:6f:49:44:00:00
P:61576; T:0x140128005117760 22:35:10.042 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.042 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:86:80:01:47:6f:49:44:00:00:00
P:61576; T:0x140128005117760 22:35:10.043 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.043 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:87:80:01:47:6f:49:44:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.043 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.043 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:88:80:01:47:6f:49:44:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.043 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.044 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:89:80:01:47:6f:49:44:00:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.044 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.044 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8a:80:01:47:6f:49:44:00:00:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.044 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.044 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8b:80:01:47:6f:49:44:00:00:00:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.045 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.045 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8c:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.045 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.045 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8d:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.045 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.046 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8e:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.046 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.046 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8f:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00:00:00:00
P:61576; T:0x140128005117760 22:35:10.046 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:61576; T:0x140128005117760 22:35:10.046 [pkcs15-tool] card.c:279:sc_connect_card: matching configured ATRs
P:61576; T:0x140128005117760 22:35:10.047 [pkcs15-tool] card.c:323:sc_connect_card: matching built-in ATRs
P:61576; T:0x140128005117760 22:35:10.047 [pkcs15-tool] card.c:341:sc_connect_card: trying driver 'npa'
P:61576; T:0x140128005117760 22:35:10.047 [pkcs15-tool] dir.c:167:sc_enum_apps: called
P:61576; T:0x140128005117760 22:35:10.047 [pkcs15-tool] card.c:817:sc_select_file: called; type=2, path=3f002f00
P:61576; T:0x140128005117760 22:35:10.047 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:61576; T:0x140128005117760 22:35:10.048 [pkcs15-tool] card.c:473:sc_lock: called
P:61576; T:0x140128005117760 22:35:10.048 [pkcs15-tool] reader-pcsc.c:681:pcsc_lock: called
P:61576; T:0x140128005117760 22:35:10.048 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.048 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:61576; T:0x140128005117760 22:35:10.049 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:61576; T:0x140128005117760 22:35:10.049 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:A4, P1:8, P2:0, data(2) 0x7ffe790aac32
P:61576; T:0x140128005117760 22:35:10.049 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:61576; T:0x140128005117760 22:35:10.049 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (8 bytes):
00 A4 08 00 02 2F 00 00 ...../..
P:61576; T:0x140128005117760 22:35:10.049 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:61576; T:0x140128005117760 22:35:10.096 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (2 bytes):
6A 86 j.
P:61576; T:0x140128005117760 22:35:10.096 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.096 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:61576; T:0x140128005117760 22:35:10.096 [pkcs15-tool] card.c:523:sc_unlock: called
P:61576; T:0x140128005117760 22:35:10.096 [pkcs15-tool] reader-pcsc.c:733:pcsc_unlock: called
P:61576; T:0x140128005117760 22:35:10.105 [pkcs15-tool] iso7816.c:128:iso7816_check_sw: Incorrect parameters P1-P2
P:61576; T:0x140128005117760 22:35:10.105 [pkcs15-tool] iso7816.c:599:iso7816_select_file: returning with: -1205 (Incorrect parameters in APDU)
P:61576; T:0x140128005117760 22:35:10.105 [pkcs15-tool] card.c:839:sc_select_file: 'SELECT' error: -1205 (Incorrect parameters in APDU)
P:61576; T:0x140128005117760 22:35:10.106 [pkcs15-tool] dir.c:176:sc_enum_apps: Cannot select EF.DIR file: -1205 (Incorrect parameters in APDU)
P:61576; T:0x140128005117760 22:35:10.106 [pkcs15-tool] card.c:371:sc_connect_card: unable to find driver for inserted card
P:61576; T:0x140128005117760 22:35:10.106 [pkcs15-tool] reader-pcsc.c:666:pcsc_disconnect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00:SCardDisconnect returned: 0x00000000
P:61576; T:0x140128005117760 22:35:10.107 [pkcs15-tool] card.c:403:sc_connect_card: returning with: -1210 (Card is invalid or cannot be handled)
Failed to connect to card: Card is invalid or cannot be handled
P:61576; T:0x140128005117760 22:35:10.107 [pkcs15-tool] ctx.c:928:sc_release_context: called
P:61576; T:0x140128005117760 22:35:10.107 [pkcs15-tool] reader-pcsc.c:970:pcsc_finish: called

@frankmorgner
Copy link
Member

frankmorgner commented Mar 30, 2020

I wasn't aware of a ban. That's fixed now.

Fine to hear that your card technically works now.

The changes to your opensc.confto force a driver are wrong. Try:

	card_atr 3b:84:80:01:47:43:50:43:12 {
		name = "Polish e-dowód";
		driver = "npa";
	}

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 4, 2020

Result is similar. Probably I have to start setting up new card driver for it.

P:5216; T:0x139786223523648 15:16:50.791 [pkcs15-tool] sc.c:325:sc_detect_card_presence: called
P:5216; T:0x139786223523648 15:16:50.791 [pkcs15-tool] reader-pcsc.c:469:pcsc_detect_card_presence: called
P:5216; T:0x139786223523648 15:16:50.791 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00 check
P:5216; T:0x139786223523648 15:16:50.792 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.793 [pkcs15-tool] reader-pcsc.c:474:pcsc_detect_card_presence: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.793 [pkcs15-tool] sc.c:330:sc_detect_card_presence: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.793 [pkcs15-tool] sc.c:325:sc_detect_card_presence: called
P:5216; T:0x139786223523648 15:16:50.793 [pkcs15-tool] reader-pcsc.c:469:pcsc_detect_card_presence: called
P:5216; T:0x139786223523648 15:16:50.793 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:5216; T:0x139786223523648 15:16:50.794 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.795 [pkcs15-tool] reader-pcsc.c:474:pcsc_detect_card_presence: returning with: 1
P:5216; T:0x139786223523648 15:16:50.795 [pkcs15-tool] sc.c:330:sc_detect_card_presence: returning with: 1
Using reader with a card: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00
P:5216; T:0x139786223523648 15:16:50.795 [pkcs15-tool] sc.c:325:sc_detect_card_presence: called
P:5216; T:0x139786223523648 15:16:50.795 [pkcs15-tool] reader-pcsc.c:469:pcsc_detect_card_presence: called
P:5216; T:0x139786223523648 15:16:50.795 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:5216; T:0x139786223523648 15:16:50.796 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.796 [pkcs15-tool] reader-pcsc.c:474:pcsc_detect_card_presence: returning with: 1
P:5216; T:0x139786223523648 15:16:50.797 [pkcs15-tool] sc.c:330:sc_detect_card_presence: returning with: 1
Connecting to card in reader Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00...
P:5216; T:0x139786223523648 15:16:50.797 [pkcs15-tool] card.c:254:sc_connect_card: called
P:5216; T:0x139786223523648 15:16:50.797 [pkcs15-tool] reader-pcsc.c:602:pcsc_connect: called
P:5216; T:0x139786223523648 15:16:50.797 [pkcs15-tool] reader-pcsc.c:356:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:5216; T:0x139786223523648 15:16:50.798 [pkcs15-tool] reader-pcsc.c:381:refresh_attributes: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.798 [pkcs15-tool] reader-pcsc.c:634:pcsc_connect: Initial protocol: T=1
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1147:match_atr_table: ATR     : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1147:match_atr_table: ATR     : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:FE:18:00:00:81:31:FE:45:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:FA
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8E:80:01:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:18
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:DE:18:FF:81:91:FE:1F:C3:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:1C
P:5216; T:0x139786223523648 15:16:50.799 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:DE:96:FF:81:91:FE:1F:C3:80:31:81:54:48:53:4D:31:73:80:21:40:81:07:92
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:80:80:01:01
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:84:80:01:47:6f:49:44:00
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1165:match_atr_table: ATR mask: FF:FF:FF:FF:FF:FF:FF:FF:00
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:85:80:01:47:6f:49:44:00:00
P:5216; T:0x139786223523648 15:16:50.800 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:86:80:01:47:6f:49:44:00:00:00
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:87:80:01:47:6f:49:44:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:88:80:01:47:6f:49:44:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:89:80:01:47:6f:49:44:00:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.801 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8a:80:01:47:6f:49:44:00:00:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8b:80:01:47:6f:49:44:00:00:00:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8c:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8d:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.802 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8e:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:8f:80:01:47:6f:49:44:00:00:00:00:00:00:00:00:00:00:00:00
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:279:sc_connect_card: matching configured ATRs
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:288:sc_connect_card: trying driver 'npa'
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:1147:match_atr_table: ATR     : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.803 [pkcs15-tool] card.c:293:sc_connect_card: matched driver 'German ID card (neuer Personalausweis, nPA)'
P:5216; T:0x139786223523648 15:16:50.804 [pkcs15-tool] dir.c:167:sc_enum_apps: called
P:5216; T:0x139786223523648 15:16:50.804 [pkcs15-tool] card.c:817:sc_select_file: called; type=2, path=3f002f00
P:5216; T:0x139786223523648 15:16:50.804 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:5216; T:0x139786223523648 15:16:50.804 [pkcs15-tool] card.c:473:sc_lock: called
P:5216; T:0x139786223523648 15:16:50.804 [pkcs15-tool] reader-pcsc.c:681:pcsc_lock: called
P:5216; T:0x139786223523648 15:16:50.804 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.804 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:5216; T:0x139786223523648 15:16:50.805 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:5216; T:0x139786223523648 15:16:50.805 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:A4, P1:8, P2:0, data(2) 0x7ffd3e0d6ec2
P:5216; T:0x139786223523648 15:16:50.805 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:5216; T:0x139786223523648 15:16:50.805 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (8 bytes):
00 A4 08 00 02 2F 00 00 ...../..
P:5216; T:0x139786223523648 15:16:50.805 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:5216; T:0x139786223523648 15:16:50.851 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (2 bytes):
6A 86 j.
P:5216; T:0x139786223523648 15:16:50.851 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.851 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.851 [pkcs15-tool] card.c:523:sc_unlock: called
P:5216; T:0x139786223523648 15:16:50.851 [pkcs15-tool] reader-pcsc.c:733:pcsc_unlock: called
P:5216; T:0x139786223523648 15:16:50.860 [pkcs15-tool] iso7816.c:128:iso7816_check_sw: Incorrect parameters P1-P2
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] iso7816.c:599:iso7816_select_file: returning with: -1205 (Incorrect parameters in APDU)
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] card.c:839:sc_select_file: 'SELECT' error: -1205 (Incorrect parameters in APDU)                                                                                                                          
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] dir.c:176:sc_enum_apps: Cannot select EF.DIR file: -1205 (Incorrect parameters in APDU)                                                                                                                  
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] card.c:311:sc_connect_card: driver 'German ID card (neuer Personalausweis, nPA)' match_card() failed: Success (will continue anyway)
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] card-npa.c:109:npa_load_options: Warning: Could not read (null).
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] card-npa.c:118:npa_load_options: Warning: Could not read (null).
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] card-npa.c:127:npa_load_options: Warning: Could not read (null).
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] card-npa.c:303:npa_unlock_esign: Will verify CAN first for unlocking eSign application.
P:5216; T:0x139786223523648 15:16:50.861 [pkcs15-tool] card-npa.c:313:npa_unlock_esign: QES requires a comfort reader (CAT-K) or a ST certificate.
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] card-npa.c:417:npa_init: Probably not all functionality will be available.
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] card.c:382:sc_connect_card: card info name:'Polish e-dowód', type:-1, flags:0x0, max_send/recv_size:1520/1520
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] card.c:1521:sc_card_sm_check: called
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] card.c:1147:match_atr_table: ATR     : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] card.c:1529:sc_card_sm_check: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] card.c:397:sc_connect_card: returning with: 0 (Success)
Using card driver German ID card (neuer Personalausweis, nPA).
Trying to find a PKCS#15 compatible card...
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] pkcs15.c:1208:sc_pkcs15_bind: called
P:5216; T:0x139786223523648 15:16:50.862 [pkcs15-tool] pkcs15.c:1209:sc_pkcs15_bind: application(aid:'empty')
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] pkcs15.c:1244:sc_pkcs15_bind: PKCS#15 options: use_file_cache=0 use_pin_cache=1 pin_cache_counter=10 pin_cache_ignore_user_consent=0 private_certificate=0
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] card.c:473:sc_lock: called
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] reader-pcsc.c:681:pcsc_lock: called
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] pkcs15.c:1257:sc_pkcs15_bind: PKCS#15 emulation enabled
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] pkcs15.c:962:sc_pkcs15_bind_internal: called
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] pkcs15.c:999:sc_pkcs15_bind_internal: application path '3f005015'
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] card.c:817:sc_select_file: called; type=2, path=3f005015
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] card.c:473:sc_lock: called
P:5216; T:0x139786223523648 15:16:50.863 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.864 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:5216; T:0x139786223523648 15:16:50.864 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:5216; T:0x139786223523648 15:16:50.864 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:A4, P1:8, P2:C, data(2) 0x7ffd3e0d71c2
P:5216; T:0x139786223523648 15:16:50.864 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:5216; T:0x139786223523648 15:16:50.864 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (7 bytes):
00 A4 08 0C 02 50 15 .....P.
P:5216; T:0x139786223523648 15:16:50.864 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (2 bytes):
6A 86 j.
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] card.c:523:sc_unlock: called
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] iso7816.c:128:iso7816_check_sw: Incorrect parameters P1-P2
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] card.c:473:sc_lock: called
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:A4, P1:8, P2:0, data(2) 0x7ffd3e0d71c2
P:5216; T:0x139786223523648 15:16:50.883 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:5216; T:0x139786223523648 15:16:50.884 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (7 bytes):
00 A4 08 00 02 50 15 .....P.
P:5216; T:0x139786223523648 15:16:50.884 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:5216; T:0x139786223523648 15:16:50.902 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (2 bytes):
6A 86 j.
P:5216; T:0x139786223523648 15:16:50.902 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.902 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] card.c:523:sc_unlock: called
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] iso7816.c:128:iso7816_check_sw: Incorrect parameters P1-P2
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] iso7816.c:594:iso7816_select_file: returning with: -1205 (Incorrect parameters in APDU)
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] card.c:839:sc_select_file: 'SELECT' error: -1205 (Incorrect parameters in APDU)                                                                                                                          
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] pkcs15.c:1025:sc_pkcs15_bind_internal: absolute path to EF(ODF) 3f005031
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] card.c:817:sc_select_file: called; type=2, path=3f005031
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] card.c:473:sc_lock: called
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:5216; T:0x139786223523648 15:16:50.903 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:A4, P1:8, P2:0, data(2) 0x7ffd3e0d71c2
P:5216; T:0x139786223523648 15:16:50.904 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:5216; T:0x139786223523648 15:16:50.904 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (8 bytes):
00 A4 08 00 02 50 31 00 .....P1.
P:5216; T:0x139786223523648 15:16:50.904 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:5216; T:0x139786223523648 15:16:50.922 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (2 bytes):
6A 86 j.
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] card.c:523:sc_unlock: called
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] iso7816.c:128:iso7816_check_sw: Incorrect parameters P1-P2
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] iso7816.c:599:iso7816_select_file: returning with: -1205 (Incorrect parameters in APDU)
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] card.c:839:sc_select_file: 'SELECT' error: -1205 (Incorrect parameters in APDU)                                                                                                                          
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15.c:1036:sc_pkcs15_bind_internal: EF(ODF) not found in '3f005031'
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15.c:1186:sc_pkcs15_bind_internal: returning with: -1205 (Incorrect parameters in APDU)
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15-syn.c:112:sc_pkcs15_bind_synthetic: called
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15-syn.c:152:sc_pkcs15_bind_synthetic: no emulator list in config file, trying all builtin emulators
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying westcos
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15-westcos.c:251:sc_pkcs15emu_westcos_init_ex: sc_pkcs15_init_func_ex westcos
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15-westcos.c:238:westcos_detect_card: westcos_detect_card (Polish e-dowód)
P:5216; T:0x139786223523648 15:16:50.923 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying openpgp
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying starcert
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying tcos
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying esteid
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying itacns
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-itacns.c:866:sc_pkcs15emu_itacns_init_ex: called
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying PIV-II
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-piv.c:1214:sc_pkcs15emu_piv_init_ex: called
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-piv.c:236:piv_detect_card: called
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying cac
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-cac.c:367:sc_pkcs15emu_cac_init_ex: called
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-cac.c:68:cac_detect_card: called
P:5216; T:0x139786223523648 15:16:50.924 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying idprime
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-idprime.c:281:sc_pkcs15emu_idprime_init_ex: called
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-idprime.c:43:idprime_detect_card: called
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying gemsafeGPK
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-gemsafeGPK.c:515:sc_pkcs15emu_gemsafeGPK_init_ex: Entering sc_pkcs15emu_gemsafeGPK_init_ex
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-gemsafeGPK.c:166:gemsafe_detect_card: called
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying gemsafeV1
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying actalis
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying atrust-acos
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying tccardos
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying entersafe
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-esinit.c:80:sc_pkcs15emu_entersafe_init_ex: called
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-esinit.c:36:entersafe_detect_card: called
P:5216; T:0x139786223523648 15:16:50.925 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying pteid
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-pteid.c:345:sc_pkcs15emu_pteid_init_ex: called
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-pteid.c:350:sc_pkcs15emu_pteid_init_ex: returning with: -1413 (Unsupported card)
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying oberthur
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-oberthur.c:1054:sc_pkcs15emu_oberthur_init_ex: called
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-oberthur.c:1042:oberthur_detect_card: called
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-oberthur.c:1044:oberthur_detect_card: returning with: -1413 (Unsupported card)
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-oberthur.c:1059:sc_pkcs15emu_oberthur_init_ex: returning with: -1413 (Unsupported card)
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying sc-hsm
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying dnie
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] pkcs15-dnie.c:284:sc_pkcs15emu_dnie_init_ex: called
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] card-dnie.c:738:dnie_match_card: called
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] card.c:1147:match_atr_table: ATR     : 3b:84:80:01:47:43:50:43:12
P:5216; T:0x139786223523648 15:16:50.926 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:7F:00:00:00:00:6A:44:4E:49:65:00:00:00:00:00:00:03:90:00
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] card.c:1158:match_atr_table: ATR try : 3B:7F:00:00:00:00:6A:44:4E:49:65:00:00:00:00:00:00:0F:65:81
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] card.c:1161:match_atr_table: ignored - wrong length
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] card-dnie.c:741:dnie_match_card: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-dnie.c:290:sc_pkcs15emu_dnie_init_ex: returning with: -1413 (Unsupported card)
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying gids
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying iasecc
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying jpki
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying coolkey
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-coolkey.c:727:sc_pkcs15emu_coolkey_init_ex: called
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-coolkey.c:63:coolkey_detect_card: called
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-coolkey.c:731:sc_pkcs15emu_coolkey_init_ex: returning with: -1413 (Unsupported card)
P:5216; T:0x139786223523648 15:16:50.927 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying din66291
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] pkcs15-din-66291.c:203:sc_pkcs15emu_din_66291_init_ex: called
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] card.c:817:sc_select_file: called; type=1, path=e828bd080fa000000167455349474e::
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] card.c:473:sc_lock: called
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:A4, P1:4, P2:C, data(15) 0x7ffd3e0d7530
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (20 bytes):
00 A4 04 0C 0F E8 28 BD 08 0F A0 00 00 01 67 45 ......(.......gE
53 49 47 4E                                     SIGN
P:5216; T:0x139786223523648 15:16:50.928 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:5216; T:0x139786223523648 15:16:50.952 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (2 bytes):
6A 82 j.
P:5216; T:0x139786223523648 15:16:50.952 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.952 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] card.c:523:sc_unlock: called
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] iso7816.c:128:iso7816_check_sw: File or application not found
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] iso7816.c:594:iso7816_select_file: returning with: -1201 (File not found)
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] card.c:839:sc_select_file: 'SELECT' error: -1201 (File not found)
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] pkcs15-syn.c:154:sc_pkcs15_bind_synthetic: trying esteid2018
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] pkcs15-syn.c:163:sc_pkcs15_bind_synthetic: searching for 'emulate foo { ... }' blocks
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] pkcs15-syn.c:165:sc_pkcs15_bind_synthetic: Blocks: 0x55b018007f00
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] pkcs15-syn.c:188:sc_pkcs15_bind_synthetic: returning with: -1413 (Unsupported card)
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] card.c:523:sc_unlock: called
P:5216; T:0x139786223523648 15:16:50.953 [pkcs15-tool] reader-pcsc.c:733:pcsc_unlock: called
P:5216; T:0x139786223523648 15:16:50.958 [pkcs15-tool] pkcs15.c:1287:sc_pkcs15_bind: returning with: -1413 (Unsupported card)
PKCS#15 binding failed: Unsupported card
P:5216; T:0x139786223523648 15:16:50.958 [pkcs15-tool] card.c:414:sc_disconnect_card: called
P:5216; T:0x139786223523648 15:16:50.958 [pkcs15-tool] reader-pcsc.c:666:pcsc_disconnect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00:SCardDisconnect returned: 0x00000000
P:5216; T:0x139786223523648 15:16:50.958 [pkcs15-tool] card.c:436:sc_disconnect_card: returning with: 0 (Success)
P:5216; T:0x139786223523648 15:16:50.959 [pkcs15-tool] ctx.c:928:sc_release_context: called
P:5216; T:0x139786223523648 15:16:50.959 [pkcs15-tool] reader-pcsc.c:970:pcsc_finish: called

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 4, 2020

I've made some investigation on a dump from PCSC while running the app (fetching personal data from the card and all the certs):
https://docs.google.com/spreadsheets/d/1o-S1x-VT0sfqUj_BVdG4quHIyWHKuviNvNMMoYvc-cU/edit?usp=sharing

I don't know exactly what is going there, but what is interesting for me is that PACE is established two times and that between that 00 A4 04 04 0A A0 00 00 01 67 45 53 49 47 4E 00 followed by 00 A4 02 04 02 50 32 00 is invoked, but it results in error. Also when 2nd PACE is already established there are 3 errors that are described as "wrong PIN", but I didn't take such action.

Do you think that there is some useful data that might help to recreate the driver?

@dengert
Copy link
Member

dengert commented Apr 4, 2020

"00 A4 04 04 0A A0 00 00 01 67 45 53 49 47 4E 00 is to select an AID A0 00 00 01 67 45 53 49 47 4E

Googled for: ISO 7816 AID A0 00 00 01 67 45 53 49 47 4E
leads to https://www.sis.se/api/document/preview/80000296/

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 5, 2020

I'm slowly implementing the driver, but now got stuck on generating first MSE command, which form some reason is missing Cryptographic mechanism reference part.

@frankmorgner do you know what might be wrong? (I'll try to publish some sane WIP code still today)

P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] card-edo.c:88:edo_init: called
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] card-edo.c:56:edo_unlock_esign: called
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] card-edo.c:63:edo_unlock_esign: Will verify CAN first for unlocking eSign application.
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] card.c:473:sc_lock: called
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] reader-pcsc.c:681:pcsc_lock: called
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:B0, P1:9C, P2:0, data(0) (nil)
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (5 bytes):
00 B0 9C 00 DF .....
P:127053; T:0x140429047473984 18:56:20.390 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:127053; T:0x140429047473984 18:56:20.440 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (24 bytes):
31 14 30 12 06 0A 04 00 7F 00 07 02 02 04 02 04 1.0.............
02 01 02 02 01 10 90 00                         ........
P:127053; T:0x140429047473984 18:56:20.440 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:127053; T:0x140429047473984 18:56:20.440 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:127053; T:0x140429047473984 18:56:20.440 [pkcs15-tool] card.c:523:sc_unlock: called
P:127053; T:0x140429047473984 18:56:20.440 [pkcs15-tool] reader-pcsc.c:733:pcsc_unlock: called
P:127053; T:0x140429047473984 18:56:20.449 [pkcs15-tool] sm-eac.c:1136:perform_pace: 
EF.CardAccess (22 bytes):
31 14 30 12 06 0A 04 00 7F 00 07 02 02 04 02 04 1.0.............
02 01 02 02 01 10                               ......
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] sm-eac.c:483:format_mse_cdata: 
MSE command data (3 bytes):
83 01 02 ...
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] card.c:473:sc_lock: called
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] reader-pcsc.c:681:pcsc_lock: called
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] apdu.c:367:sc_single_transmit: CLA:0, INS:22, P1:C1, P2:A4, data(3) 0x55cf24010400
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] reader-pcsc.c:319:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] reader-pcsc.c:320:pcsc_transmit: 
Outgoing APDU (8 bytes):
00 22 C1 A4 03 83 01 02 ."......
P:127053; T:0x140429047473984 18:56:20.450 [pkcs15-tool] reader-pcsc.c:238:pcsc_internal_transmit: called
P:127053; T:0x140429047473984 18:56:20.475 [pkcs15-tool] reader-pcsc.c:329:pcsc_transmit: 
Incoming APDU (2 bytes):
6A 80 j.
P:127053; T:0x140429047473984 18:56:20.475 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:127053; T:0x140429047473984 18:56:20.475 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:127053; T:0x140429047473984 18:56:20.475 [pkcs15-tool] card.c:523:sc_unlock: called
P:127053; T:0x140429047473984 18:56:20.475 [pkcs15-tool] reader-pcsc.c:733:pcsc_unlock: called
P:127053; T:0x140429047473984 18:56:20.480 [pkcs15-tool] iso7816.c:128:iso7816_check_sw: Incorrect parameters in the data field
P:127053; T:0x140429047473984 18:56:20.480 [pkcs15-tool] sm-eac.c:1165:perform_pace: Could not select protocol properties (MSE: Set AT failed).
P:127053; T:0x140429047473984 18:56:20.480 [pkcs15-tool] sm-eac.c:1367:perform_pace: returning with: -1205 (Incorrect parameters in APDU)

Similar part in npa_tool results in:

P:146312; T:0x139643075176256 19:10:16.963 [npa-tool] sm-eac.c:1136:perform_pace: 
EF.CardAccess (22 bytes):
31 14 30 12 06 0A 04 00 7F 00 07 02 02 04 02 04 1.0.............
02 01 02 02 01 10                               ......
P:146312; T:0x139643075176256 19:10:16.963 [npa-tool] sm-eac.c:483:format_mse_cdata: 
MSE command data (15 bytes):
80 0A 04 00 7F 00 07 02 02 04 02 04 83 01 02 ...............
P:146312; T:0x139643075176256 19:10:16.963 [npa-tool] apdu.c:546:sc_transmit_apdu: called

SOLVED
EAC_init() was not called, but for some reason it is not called in card-npa 🤔

~/D/OpenSC (card-edo|✚2…) $ grep -R EAC_init
src/libopensc/card-sc-hsm.c:    EAC_init();
src/libopensc/card-edo.c:       EAC_init();
src/tools/goid-tool.c:        EAC_init();
src/tools/npa-tool.c:   EAC_init();
src/tools/sceac-example.c:      EAC_init();

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 5, 2020

I've made some basic driver based on @frankmorgner card-npa. It looks like PACE with CAN taken from env works, but PKCS15 seems not to be able to scan apps 😞 Is there way to hardcore it somehow?

pkcs15-tool.log
https://github.com/majkrzak/OpenSC/

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 9, 2020

I'll try to attach somewhere in here:

#0  0x00007ffff6d966d0 in SCardTransmit () from /usr/lib/libpcsclite.so.1
#1  0x00007ffff71d6d3f in ?? () from /opt/e-dowod/libedowod.so
#2  0x00007ffff71d7473 in ?? () from /opt/e-dowod/libedowod.so
#3  0x00007ffff71976bf in ?? () from /opt/e-dowod/libedowod.so
#4  0x00007ffff719829f in ?? () from /opt/e-dowod/libedowod.so
#5  0x00007ffff71988fb in regular_transmit_apdu () from /opt/e-dowod/libedowod.so
#6  0x00007ffff71c8646 in ?? () from /opt/e-dowod/libedowod.so
#7  0x00007ffff71c8b2f in ?? () from /opt/e-dowod/libedowod.so
#8  0x00007ffff71c8ed5 in ?? () from /opt/e-dowod/libedowod.so
#9  0x00007ffff71cae75 in ?? () from /opt/e-dowod/libedowod.so
#10 0x00007ffff71ded9f in pace2_get_sm_apdu () from /opt/e-dowod/libedowod.so
#11 0x00007ffff71bef74 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
#12 0x00007ffff7197760 in ?? () from /opt/e-dowod/libedowod.so
#13 0x00007ffff719829f in ?? () from /opt/e-dowod/libedowod.so
#14 0x00007ffff71988fb in regular_transmit_apdu () from /opt/e-dowod/libedowod.so
#15 0x00007ffff71c8646 in ?? () from /opt/e-dowod/libedowod.so
#16 0x00007ffff71c8b2f in ?? () from /opt/e-dowod/libedowod.so
#17 0x00007ffff71cd21f in ?? () from /opt/e-dowod/libedowod.so
#18 0x00007ffff71be7f1 in sc_pin_cmd () from /opt/e-dowod/libedowod.so
#19 0x00007ffff75b8839 in C_GetTokenInfo () from /opt/e-dowod/e-dowod-pkcs11-64.so
#20 0x00007ffff7e343fc in ?? () from /usr/lib/libgnutls.so.30
#21 0x00007ffff7e37870 in ?? () from /usr/lib/libgnutls.so.30
#22 0x00007ffff7e3b301 in ?? () from /usr/lib/libgnutls.so.30
#23 0x00007ffff7e3c247 in gnutls_pkcs11_privkey_import_url () from /usr/lib/libgnutls.so.30
#24 0x00007ffff7e1517f in gnutls_privkey_import_url () from /usr/lib/libgnutls.so.30
#25 0x00005555555636fb in ?? ()
#26 0x0000555555561854 in ?? ()
#27 0x00007ffff7bee023 in __libc_start_main () from /usr/lib/libc.so.6
#28 0x0000555555561afe in ?? ()

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 9, 2020

I've also noticed that with:

LOG_TEST_RET(card->ctx, _sc_card_add_ec_alg(
	card, 384,
	SC_ALGORITHM_ECDSA_RAW | SC_ALGORITHM_ECDSA_HASH_NONE,
	SC_ALGORITHM_EXT_EC_NAMEDCURVE,
	&(struct sc_object_id) {{1, 3, 132, 0, 34, -1}}
), "Add ec alg failed");

[0x1042] CKM_ECDSA_SHA1 keysize range (384, 384) hw sign ec_namedcurve mehanics is added, but

Signing using ECDSA-SHA256... P:37203; T:0x140479524374848 21:49:42.841 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:37203; T:0x140479524374848 21:49:42.841 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:37203; T:0x140479524374848 21:49:42.841 [opensc-pkcs11] mechanism.c:250:sc_pkcs11_sign_init: called
P:37203; T:0x140479524374848 21:49:42.841 [opensc-pkcs11] mechanism.c:255:sc_pkcs11_sign_init: mechanism 0x1041, key-type 0x3
P:37203; T:0x140479524374848 21:49:42.841 [opensc-pkcs11] mechanism.c:259:sc_pkcs11_sign_init: returning with: 112
P:37203; T:0x140479524374848 21:49:42.841 [opensc-pkcs11] pkcs11-object.c:679:C_SignInit: C_SignInit() = CKR_MECHANISM_INVALID

(0x1041) is tried

When SHA1 is used, the request uses correct alg, but it allso fails

Signing using ECDSA-SHA1... P:37920; T:0x139736999426368 22:07:41.538 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:37920; T:0x139736999426368 22:07:41.538 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:37920; T:0x139736999426368 22:07:41.538 [opensc-pkcs11] mechanism.c:250:sc_pkcs11_sign_init: called
P:37920; T:0x139736999426368 22:07:41.538 [opensc-pkcs11] mechanism.c:255:sc_pkcs11_sign_init: mechanism 0x1041, key-type 0x3
P:37920; T:0x139736999426368 22:07:41.538 [opensc-pkcs11] mechanism.c:259:sc_pkcs11_sign_init: returning with: 112
P:37920; T:0x139736999426368 22:07:41.538 [opensc-pkcs11] pkcs11-object.c:679:C_SignInit: C_SignInit() = CKR_MECHANISM_INVALID

The issue I see is that iso7816_compute_signature is not even called 😞

@majkrzak
Copy link
Contributor Author

I need explanation what is going on here in the log of p11toll --test-sign

P:68373; T:0x140369098717504 17:51:27.176 [opensc-pkcs11] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.176 [opensc-pkcs11] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.176 [opensc-pkcs11] card.c:523:sc_unlock: called
P:68373; T:0x140369098717504 17:51:27.176 [opensc-pkcs11] sm-eac.c:2306:eac_sm_post_transmit: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.177 [opensc-pkcs11] asn1.c:1674:asn1_decode: called, left=14, depth 0
P:68373; T:0x140369098717504 17:51:27.177 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Cryptogram', tag 0x20000005, OPTIONAL
P:68373; T:0x140369098717504 17:51:27.177 [opensc-pkcs11] asn1.c:1714:asn1_decode: 'Cryptogram' not present
P:68373; T:0x140369098717504 17:51:27.177 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Padding-content indicator followed by cryptogram', tag 0x20000007, OPTIONAL
P:68373; T:0x140369098717504 17:51:27.178 [opensc-pkcs11] asn1.c:1714:asn1_decode: 'Padding-content indicator followed by cryptogram' not present
P:68373; T:0x140369098717504 17:51:27.178 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Processing Status', tag 0x20000019
P:68373; T:0x140369098717504 17:51:27.178 [opensc-pkcs11] asn1.c:1482:asn1_decode_entry: decoding 'Processing Status', raw data:9000
P:68373; T:0x140369098717504 17:51:27.178 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Cryptographic Checksum', tag 0x2000000e, OPTIONAL
P:68373; T:0x140369098717504 17:51:27.178 [opensc-pkcs11] asn1.c:1482:asn1_decode_entry: decoding 'Cryptographic Checksum', raw data:7B509CB9275406CA
P:68373; T:0x140369098717504 17:51:27.179 [opensc-pkcs11] asn1.c:1749:asn1_decode: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.179 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Cryptogram' (not present)
P:68373; T:0x140369098717504 17:51:27.179 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=0
P:68373; T:0x140369098717504 17:51:27.179 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Padding-content indicator followed by cryptogram' (not present)
P:68373; T:0x140369098717504 17:51:27.179 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=0
P:68373; T:0x140369098717504 17:51:27.180 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Processing Status'
P:68373; T:0x140369098717504 17:51:27.180 [opensc-pkcs11] asn1.c:1782:asn1_encode_entry: type=4, tag=0x20000019, parm=0x7ffd2327d046, len=2
P:68373; T:0x140369098717504 17:51:27.180 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=4
P:68373; T:0x140369098717504 17:51:27.180 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Cryptographic Checksum' (not present)
P:68373; T:0x140369098717504 17:51:27.181 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=0
P:68373; T:0x140369098717504 17:51:27.181 [opensc-pkcs11] sm-eac.c:2068:eac_sm_verify_authentication: Authentication data verified
P:68373; T:0x140369098717504 17:51:27.181 [opensc-pkcs11] sm-iso.c:610:sm_decrypt: Decrypted APDU sw1=90 sw2=00
P:68373; T:0x140369098717504 17:51:27.181 [opensc-pkcs11] sm-iso.c:612:sm_decrypt: 
Decrypted APDU response data (0 bytes):
P:68373; T:0x140369098717504 17:51:27.181 [opensc-pkcs11] sm-eac.c:2346:eac_sm_finish: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.182 [opensc-pkcs11] sm.c:173:sc_sm_single_transmit: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.182 [opensc-pkcs11] apdu.c:374:sc_single_transmit: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.182 [opensc-pkcs11] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.182 [opensc-pkcs11] card.c:523:sc_unlock: called
P:68373; T:0x140369098717504 17:51:27.182 [opensc-pkcs11] sec.c:256:sc_pin_cmd: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.183 [opensc-pkcs11] pkcs15-pin.c:455:sc_pkcs15_verify_pin_with_session_pin: PIN cmd result 0
P:68373; T:0x140369098717504 17:51:27.183 [opensc-pkcs11] pkcs15-pin.c:742:sc_pkcs15_pincache_add: called
P:68373; T:0x140369098717504 17:51:27.183 [opensc-pkcs11] pkcs15-pin.c:786:sc_pkcs15_pincache_add: PIN(Authentication) cached
P:68373; T:0x140369098717504 17:51:27.183 [opensc-pkcs11] card.c:523:sc_unlock: called
P:68373; T:0x140369098717504 17:51:27.183 [opensc-pkcs11] reader-pcsc.c:736:pcsc_unlock: called
P:68373; T:0x140369098717504 17:51:27.194 [opensc-pkcs11] pkcs15-pin.c:477:sc_pkcs15_verify_pin_with_session_pin: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.194 [opensc-pkcs11] pkcs15-pin.c:742:sc_pkcs15_pincache_add: called
P:68373; T:0x140369098717504 17:51:27.195 [opensc-pkcs11] pkcs15-pin.c:786:sc_pkcs15_pincache_add: PIN(Authentication) cached
P:68373; T:0x140369098717504 17:51:27.195 [opensc-pkcs11] pkcs15-pin.c:333:sc_pkcs15_verify_pin: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.195 [opensc-pkcs11] framework-pkcs15.c:1715:pkcs15_login: PKCS15 verify PIN returned 0
P:68373; T:0x140369098717504 17:51:27.195 [opensc-pkcs11] framework-pkcs15.c:1724:pkcs15_login: Check if pkcs15 object list can be completed.
P:68373; T:0x140369098717504 17:51:27.195 [opensc-pkcs11] pkcs11-session.c:322:C_Login: fLogin() rv 0
P:68373; T:0x140369098717504 17:51:27.196 [opensc-pkcs11] pkcs11-object.c:362:C_FindObjectsInit: C_FindObjectsInit(slot = 4)
P:68373; T:0x140369098717504 17:51:27.196 [opensc-pkcs11] pkcs11-object.c:363:C_FindObjectsInit: C_FindObjectsInit(): CKA_ID = 042432323961376263302D326339312D346361302D613033332D336635366534
P:68373; T:0x140369098717504 17:51:27.196 [opensc-pkcs11] pkcs11-object.c:363:C_FindObjectsInit: C_FindObjectsInit(): CKA_LABEL = eDO_pl-ID MSW
P:68373; T:0x140369098717504 17:51:27.196 [opensc-pkcs11] pkcs11-object.c:363:C_FindObjectsInit: C_FindObjectsInit(): CKA_CLASS = CKO_PRIVATE_KEY
P:68373; T:0x140369098717504 17:51:27.196 [opensc-pkcs11] misc.c:268:session_start_operation: called
P:68373; T:0x140369098717504 17:51:27.197 [opensc-pkcs11] misc.c:269:session_start_operation: Session 0x562aba06d590, type 0
P:68373; T:0x140369098717504 17:51:27.197 [opensc-pkcs11] pkcs11-object.c:384:C_FindObjectsInit: Object with handle 0x562aba066bd0
P:68373; T:0x140369098717504 17:51:27.197 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.197 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.198 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598160: Attribute 0x102 matches.
P:68373; T:0x140369098717504 17:51:27.198 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.198 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.198 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598160: Attribute 0x3 matches.
P:68373; T:0x140369098717504 17:51:27.199 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.199 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.199 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598160: Attribute 0x0 matches.
P:68373; T:0x140369098717504 17:51:27.199 [opensc-pkcs11] pkcs11-object.c:418:C_FindObjectsInit: Object 4/94741509598160 matches
P:68373; T:0x140369098717504 17:51:27.199 [opensc-pkcs11] pkcs11-object.c:423:C_FindObjectsInit: realloc for 32 handles
P:68373; T:0x140369098717504 17:51:27.200 [opensc-pkcs11] pkcs11-object.c:384:C_FindObjectsInit: Object with handle 0x562aba066cf0
P:68373; T:0x140369098717504 17:51:27.200 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.200 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.200 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598448: Attribute 0x102 matches.
P:68373; T:0x140369098717504 17:51:27.201 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.201 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.201 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598448: Attribute 0x3 matches.
P:68373; T:0x140369098717504 17:51:27.201 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.201 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.202 [opensc-pkcs11] pkcs11-object.c:403:C_FindObjectsInit: Object 4/94741509598448: Attribute 0x0 does NOT match.
P:68373; T:0x140369098717504 17:51:27.202 [opensc-pkcs11] pkcs11-object.c:384:C_FindObjectsInit: Object with handle 0x562aba069840
P:68373; T:0x140369098717504 17:51:27.202 [opensc-pkcs11] framework-pkcs15.c:3575:pkcs15_cert_cmp_attribute: pkcs15_cert_cmp_attribute() called
P:68373; T:0x140369098717504 17:51:27.202 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.203 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.203 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509609536: Attribute 0x102 matches.
P:68373; T:0x140369098717504 17:51:27.203 [opensc-pkcs11] framework-pkcs15.c:3575:pkcs15_cert_cmp_attribute: pkcs15_cert_cmp_attribute() called
P:68373; T:0x140369098717504 17:51:27.203 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.203 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.204 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509609536: Attribute 0x3 matches.
P:68373; T:0x140369098717504 17:51:27.204 [opensc-pkcs11] framework-pkcs15.c:3575:pkcs15_cert_cmp_attribute: pkcs15_cert_cmp_attribute() called
P:68373; T:0x140369098717504 17:51:27.204 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.204 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.205 [opensc-pkcs11] pkcs11-object.c:403:C_FindObjectsInit: Object 4/94741509609536: Attribute 0x0 does NOT match.
P:68373; T:0x140369098717504 17:51:27.205 [opensc-pkcs11] pkcs11-object.c:436:C_FindObjectsInit: 1 matching objects
P:68373; T:0x140369098717504 17:51:27.205 [opensc-pkcs11] misc.c:290:session_get_operation: called
P:68373; T:0x140369098717504 17:51:27.205 [opensc-pkcs11] misc.c:290:session_get_operation: called
P:68373; T:0x140369098717504 17:51:27.205 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.206 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598160: CKA_KEY_TYPE = CKK_ECDSA
P:68373; T:0x140369098717504 17:51:27.206 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06d590, hObject=0x562aba066bd0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.206 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.206 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598160: CKA_ALWAYS_AUTHENTICATE = FALSE
P:68373; T:0x140369098717504 17:51:27.207 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06d590, hObject=0x562aba066bd0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.207 [opensc-pkcs11] pkcs11-global.c:447:C_GetSlotList: C_GetSlotList(token=1, refresh)
P:68373; T:0x140369098717504 17:51:27.207 [opensc-pkcs11] pkcs11-global.c:449:C_GetSlotList: VSS C_GetSlotList before ctx_detect_detect
P:68373; T:0x140369098717504 17:51:27.207 [opensc-pkcs11] VSS size:8
P:68373; T:0x140369098717504 17:51:27.207 [opensc-pkcs11] VSS  [i] id   flags LU events nsessions slot_info.flags reader p11card description
P:68373; T:0x140369098717504 17:51:27.208 [opensc-pkcs11] VSS  [0] 0x00 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.208 [opensc-pkcs11] VSS  [1] 0x01 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.208 [opensc-pkcs11] VSS  [2] 0x02 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.208 [opensc-pkcs11] VSS  [3] 0x03 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.209 [opensc-pkcs11] VSS  [4] 0x04 0x0001 1  1  1 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.209 [opensc-pkcs11] VSS  [5] 0x05 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.209 [opensc-pkcs11] VSS  [6] 0x06 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.209 [opensc-pkcs11] VSS  [7] 0x07 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.209 [opensc-pkcs11] VSS END
P:68373; T:0x140369098717504 17:51:27.210 [opensc-pkcs11] pkcs11-global.c:455:C_GetSlotList: VSS C_GetSlotList after ctx_detect_readers
P:68373; T:0x140369098717504 17:51:27.210 [opensc-pkcs11] VSS size:8
P:68373; T:0x140369098717504 17:51:27.210 [opensc-pkcs11] VSS  [i] id   flags LU events nsessions slot_info.flags reader p11card description
P:68373; T:0x140369098717504 17:51:27.210 [opensc-pkcs11] VSS  [0] 0x00 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.210 [opensc-pkcs11] VSS  [1] 0x01 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.211 [opensc-pkcs11] VSS  [2] 0x02 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.211 [opensc-pkcs11] VSS  [3] 0x03 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.211 [opensc-pkcs11] VSS  [4] 0x04 0x0001 1  1  1 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.211 [opensc-pkcs11] VSS  [5] 0x05 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.211 [opensc-pkcs11] VSS  [6] 0x06 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.212 [opensc-pkcs11] VSS  [7] 0x07 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.212 [opensc-pkcs11] VSS END
P:68373; T:0x140369098717504 17:51:27.212 [opensc-pkcs11] slot.c:384:card_detect_all: Detect all cards
P:68373; T:0x140369098717504 17:51:27.212 [opensc-pkcs11] slot.c:210:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00: Detecting smart card
P:68373; T:0x140369098717504 17:51:27.212 [opensc-pkcs11] sc.c:325:sc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.213 [opensc-pkcs11] reader-pcsc.c:472:pcsc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.213 [opensc-pkcs11] reader-pcsc.c:360:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00 check
P:68373; T:0x140369098717504 17:51:27.215 [opensc-pkcs11] reader-pcsc.c:385:refresh_attributes: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.215 [opensc-pkcs11] reader-pcsc.c:477:pcsc_detect_card_presence: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.215 [opensc-pkcs11] sc.c:330:sc_detect_card_presence: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.215 [opensc-pkcs11] slot.c:219:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00: card absent
P:68373; T:0x140369098717504 17:51:27.215 [opensc-pkcs11] slot.c:171:card_removed: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00: card removed
P:68373; T:0x140369098717504 17:51:27.216 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x0)
P:68373; T:0x140369098717504 17:51:27.229 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x0) 1
P:68373; T:0x140369098717504 17:51:27.229 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x1)
P:68373; T:0x140369098717504 17:51:27.229 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x1) 1
P:68373; T:0x140369098717504 17:51:27.229 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x2)
P:68373; T:0x140369098717504 17:51:27.230 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x2) 1
P:68373; T:0x140369098717504 17:51:27.230 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x3)
P:68373; T:0x140369098717504 17:51:27.230 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x3) 1
P:68373; T:0x140369098717504 17:51:27.230 [opensc-pkcs11] slot.c:210:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00: Detecting smart card
P:68373; T:0x140369098717504 17:51:27.230 [opensc-pkcs11] sc.c:325:sc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.230 [opensc-pkcs11] reader-pcsc.c:472:pcsc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.230 [opensc-pkcs11] reader-pcsc.c:360:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] reader-pcsc.c:385:refresh_attributes: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] reader-pcsc.c:477:pcsc_detect_card_presence: returning with: 1
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] sc.c:330:sc_detect_card_presence: returning with: 1
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] slot.c:363:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00: Detection ended
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] slot.c:423:card_detect_all: All cards detected
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] pkcs11-global.c:490:C_GetSlotList: VSS C_GetSlotList after card_detect_all
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] VSS size:8
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] VSS  [i] id   flags LU events nsessions slot_info.flags reader p11card description
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] VSS  [0] 0x00 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] VSS  [1] 0x01 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] VSS  [2] 0x02 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.232 [opensc-pkcs11] VSS  [3] 0x03 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [4] 0x04 0x0001 1  1  1 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [5] 0x05 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [6] 0x06 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [7] 0x07 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS END
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] pkcs11-global.c:498:C_GetSlotList: VSS C_GetSlotList after slot->id reassigned
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS size:8
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [i] id   flags LU events nsessions slot_info.flags reader p11card description
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [0] 0x00 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [1] 0x01 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [2] 0x02 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [3] 0x03 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [4] 0x04 0x0001 1  1  1 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.233 [opensc-pkcs11] VSS  [5] 0x05 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [6] 0x06 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [7] 0x07 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS END
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] pkcs11-global.c:511:C_GetSlotList: returned 4 slots
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] pkcs11-global.c:512:C_GetSlotList: VSS Returning a new slot list
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS size:8
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [i] id   flags LU events nsessions slot_info.flags reader p11card description
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [0] 0x00 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [1] 0x01 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [2] 0x02 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [3] 0x03 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [4] 0x04 0x0001 1  1  1 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [5] 0x05 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.234 [opensc-pkcs11] VSS  [6] 0x06 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] VSS  [7] 0x07 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] VSS END
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] framework-pkcs15.c:545:C_GetTokenInfo: C_GetTokenInfo(4)
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] slot.c:463:slot_get_token: Slot(id=0x4): get token
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] slot.c:481:slot_get_token: Slot-get-token returns OK
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] framework-pkcs15.c:574:C_GetTokenInfo: C_GetTokenInfo() auth. object 0x562aba05d3e0, token-info flags 0x40D
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] pkcs15-pin.c:695:sc_pkcs15_get_pin_info: called
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] card.c:473:sc_lock: called
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] reader-pcsc.c:684:pcsc_lock: called
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] card.c:513:sc_lock: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] sec.c:200:sc_pin_cmd: called
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] iso7816.c:1144:iso7816_pin_cmd: Card does not support PIN status queries
P:68373; T:0x140369098717504 17:51:27.235 [opensc-pkcs11] sec.c:256:sc_pin_cmd: returning with: -1408 (Not supported)
P:68373; T:0x140369098717504 17:51:27.236 [opensc-pkcs11] card.c:523:sc_unlock: called
P:68373; T:0x140369098717504 17:51:27.236 [opensc-pkcs11] reader-pcsc.c:736:pcsc_unlock: called
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] pkcs15-pin.c:723:sc_pkcs15_get_pin_info: returning with: -1408 (Not supported)
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] framework-pkcs15.c:594:C_GetTokenInfo: C_GetTokenInfo(4) returns CKR_OK
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] pkcs11-global.c:560:C_GetSlotInfo: C_GetSlotInfo(0x4)
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] slot.c:384:card_detect_all: Detect all cards
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] slot.c:210:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00: Detecting smart card
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] sc.c:325:sc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] reader-pcsc.c:472:pcsc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.239 [opensc-pkcs11] reader-pcsc.c:360:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00 check
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] reader-pcsc.c:385:refresh_attributes: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] reader-pcsc.c:477:pcsc_detect_card_presence: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] sc.c:330:sc_detect_card_presence: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] slot.c:219:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00: card absent
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] slot.c:171:card_removed: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F Contact Reader] (55041747202849) 00 00: card removed
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x0)
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x0) 1
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x1)
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x1) 1
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x2)
P:68373; T:0x140369098717504 17:51:27.241 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x2) 1
P:68373; T:0x140369098717504 17:51:27.242 [opensc-pkcs11] slot.c:492:slot_token_removed: slot_token_removed(0x3)
P:68373; T:0x140369098717504 17:51:27.242 [opensc-pkcs11] pkcs11-session.c:143:sc_pkcs11_close_all_sessions: real C_CloseAllSessions(0x3) 1
P:68373; T:0x140369098717504 17:51:27.242 [opensc-pkcs11] slot.c:210:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00: Detecting smart card
P:68373; T:0x140369098717504 17:51:27.242 [opensc-pkcs11] sc.c:325:sc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.242 [opensc-pkcs11] reader-pcsc.c:472:pcsc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.242 [opensc-pkcs11] reader-pcsc.c:360:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] reader-pcsc.c:385:refresh_attributes: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] reader-pcsc.c:477:pcsc_detect_card_presence: returning with: 1
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] sc.c:330:sc_detect_card_presence: returning with: 1
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] slot.c:363:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00: Detection ended
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] slot.c:423:card_detect_all: All cards detected
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] pkcs11-global.c:572:C_GetSlotInfo: VSS C_GetSlotInfo found
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] VSS size:8
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] VSS  [i] id   flags LU events nsessions slot_info.flags reader p11card description
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] VSS  [0] 0x00 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] VSS  [1] 0x01 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] VSS  [2] 0x02 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.243 [opensc-pkcs11] VSS  [3] 0x03 0x0000 -1  0  0 0006  0x562aba02df30 (nil) Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] VSS *[4] 0x04 0x0001 1  1  1 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] VSS  [5] 0x05 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] VSS  [6] 0x06 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] VSS  [7] 0x07 0x0001 -1  1  0 0007  0x562aba02e0d0 0x562aba030040 Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4...
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] VSS END
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] pkcs11-global.c:573:C_GetSlotInfo: C_GetSlotInfo() get slot rv CKR_OK
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] slot.c:210:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00: Detecting smart card
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] sc.c:325:sc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] reader-pcsc.c:472:pcsc_detect_card_presence: called
P:68373; T:0x140369098717504 17:51:27.244 [opensc-pkcs11] reader-pcsc.c:360:refresh_attributes: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00 check
P:68373; T:0x140369098717504 17:51:27.245 [opensc-pkcs11] reader-pcsc.c:385:refresh_attributes: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.245 [opensc-pkcs11] reader-pcsc.c:477:pcsc_detect_card_presence: returning with: 1
P:68373; T:0x140369098717504 17:51:27.245 [opensc-pkcs11] sc.c:330:sc_detect_card_presence: returning with: 1
P:68373; T:0x140369098717504 17:51:27.245 [opensc-pkcs11] slot.c:363:card_detect: Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00: Detection ended
P:68373; T:0x140369098717504 17:51:27.245 [opensc-pkcs11] pkcs11-global.c:582:C_GetSlotInfo: C_GetSlotInfo() card detect rv 0x0
P:68373; T:0x140369098717504 17:51:27.245 [opensc-pkcs11] pkcs11-global.c:599:C_GetSlotInfo: C_GetSlotInfo() flags 0x7
P:68373; T:0x140369098717504 17:51:27.245 [opensc-pkcs11] pkcs11-global.c:600:C_GetSlotInfo: C_GetSlotInfo(0x4) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] pkcs11-session.c:58:C_OpenSession: C_OpenSession(0x4)
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] slot.c:463:slot_get_token: Slot(id=0x4): get token
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] slot.c:481:slot_get_token: Slot-get-token returns OK
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] pkcs11-session.c:94:C_OpenSession: C_OpenSession handle: 0x562aba06e4c0
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] pkcs11-session.c:97:C_OpenSession: C_OpenSession() = CKR_OK
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] pkcs11-session.c:206:C_GetSessionInfo: C_GetSessionInfo(hSession:0x562aba06e4c0)
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] pkcs11-session.c:214:C_GetSessionInfo: C_GetSessionInfo(slot:0x4)
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] pkcs15-pin.c:695:sc_pkcs15_get_pin_info: called
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] card.c:473:sc_lock: called
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] reader-pcsc.c:684:pcsc_lock: called
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] card.c:513:sc_lock: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] sec.c:200:sc_pin_cmd: called
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] iso7816.c:1144:iso7816_pin_cmd: Card does not support PIN status queries
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] sec.c:256:sc_pin_cmd: returning with: -1408 (Not supported)
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] card.c:523:sc_unlock: called
P:68373; T:0x140369098717504 17:51:27.246 [opensc-pkcs11] reader-pcsc.c:736:pcsc_unlock: called
P:68373; T:0x140369098717504 17:51:27.252 [opensc-pkcs11] pkcs15-pin.c:723:sc_pkcs15_get_pin_info: returning with: -1408 (Not supported)
P:68373; T:0x140369098717504 17:51:27.252 [opensc-pkcs11] pkcs11-session.c:238:C_GetSessionInfo: C_GetSessionInfo(0x562aba06e4c0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.252 [opensc-pkcs11] pkcs11-object.c:362:C_FindObjectsInit: C_FindObjectsInit(slot = 4)
P:68373; T:0x140369098717504 17:51:27.252 [opensc-pkcs11] pkcs11-object.c:363:C_FindObjectsInit: C_FindObjectsInit(): CKA_ID = 042432323961376263302D326339312D346361302D613033332D336635366534
P:68373; T:0x140369098717504 17:51:27.252 [opensc-pkcs11] pkcs11-object.c:363:C_FindObjectsInit: C_FindObjectsInit(): CKA_LABEL = eDO_pl-ID MSW
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] pkcs11-object.c:363:C_FindObjectsInit: C_FindObjectsInit(): CKA_CLASS = CKO_PUBLIC_KEY
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] misc.c:268:session_start_operation: called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] misc.c:269:session_start_operation: Session 0x562aba06e4c0, type 0
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] pkcs11-object.c:384:C_FindObjectsInit: Object with handle 0x562aba066bd0
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598160: Attribute 0x102 matches.
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598160: Attribute 0x3 matches.
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] pkcs11-object.c:403:C_FindObjectsInit: Object 4/94741509598160: Attribute 0x0 does NOT match.
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] pkcs11-object.c:384:C_FindObjectsInit: Object with handle 0x562aba066cf0
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.253 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598448: Attribute 0x102 matches.
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598448: Attribute 0x3 matches.
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509598448: Attribute 0x0 matches.
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] pkcs11-object.c:418:C_FindObjectsInit: Object 4/94741509598448 matches
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] pkcs11-object.c:423:C_FindObjectsInit: realloc for 32 handles
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] pkcs11-object.c:384:C_FindObjectsInit: Object with handle 0x562aba069840
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:3575:pkcs15_cert_cmp_attribute: pkcs15_cert_cmp_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509609536: Attribute 0x102 matches.
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:3575:pkcs15_cert_cmp_attribute: pkcs15_cert_cmp_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.254 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:411:C_FindObjectsInit: Object 4/94741509609536: Attribute 0x3 matches.
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] framework-pkcs15.c:3575:pkcs15_cert_cmp_attribute: pkcs15_cert_cmp_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] framework-pkcs15.c:3470:pkcs15_cert_get_attribute: pkcs15_cert_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:403:C_FindObjectsInit: Object 4/94741509609536: Attribute 0x0 does NOT match.
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:436:C_FindObjectsInit: 1 matching objects
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] misc.c:290:session_get_operation: called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_WRAP = FALSE
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_UNWRAP = <error>
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_ATTRIBUTE_TYPE_INVALID
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_PRIVATE = FALSE
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.255 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_TRUSTED = <error>
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_ATTRIBUTE_TYPE_INVALID
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_SENSITIVE = FALSE
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_EXTRACTABLE = FALSE
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_NEVER_EXTRACTABLE = <error>
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_ATTRIBUTE_TYPE_INVALID
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: Attribute 0x87 = <error>
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_ATTRIBUTE_TYPE_INVALID
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_ALWAYS_AUTHENTICATE = <error>
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_ATTRIBUTE_TYPE_INVALID
P:68373; T:0x140369098717504 17:51:27.256 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_LABEL = eDO_pl-ID MSW
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_ID = 042432323961376263302D326339312D346361302D613033332D336635366534
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs15-pubkey.c:762:sc_pkcs15_encode_pubkey_ec: called
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'ecpointQ'
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] asn1.c:1782:asn1_encode_entry: type=4, tag=0x04, parm=0x562aba069f00, len=97
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=99
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs15-pubkey.c:766:sc_pkcs15_encode_pubkey_ec: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_VALUE = <size inquiry>
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] pkcs15-pubkey.c:762:sc_pkcs15_encode_pubkey_ec: called
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'ecpointQ'
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] asn1.c:1782:asn1_encode_entry: type=4, tag=0x04, parm=0x562aba069f00, len=97
P:68373; T:0x140369098717504 17:51:27.257 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=99
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs15-pubkey.c:766:sc_pkcs15_encode_pubkey_ec: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_VALUE = 046104562CFDCACF6CF195A5B418289B158C9257BF7BDFE7AB14E8070E6E6B0D
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_KEY_TYPE = CKK_ECDSA
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_ECDSA_PARAMS = 06052B81040022
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs15-pubkey.c:762:sc_pkcs15_encode_pubkey_ec: called
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'ecpointQ'
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] asn1.c:1782:asn1_encode_entry: type=4, tag=0x04, parm=0x562aba069f00, len=97
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=99
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs15-pubkey.c:766:sc_pkcs15_encode_pubkey_ec: returning with: 0 (Success)
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_EC_POINT = 046104562CFDCACF6CF195A5B418289B158C9257BF7BDFE7AB14E8070E6E6B0D
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.258 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_ENCRYPT = FALSE
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_VERIFY = TRUE
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_VERIFY_RECOVER = TRUE
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_DERIVE = FALSE
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] framework-pkcs15.c:4519:pkcs15_pubkey_get_attribute: pkcs15_pubkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:263:C_GetAttributeValue: Object 94741509598448: CKA_WRAP = FALSE
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-object.c:284:C_GetAttributeValue: C_GetAttributeValue(hSession=0x562aba06e4c0, hObject=0x562aba066cf0) = CKR_OK
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] misc.c:290:session_get_operation: called
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-session.c:161:C_CloseSession: C_CloseSession(0x562aba06e4c0)
P:68373; T:0x140369098717504 17:51:27.259 [opensc-pkcs11] pkcs11-session.c:109:sc_pkcs11_close_session: real C_CloseSession(0x562aba06e4c0)
Signing using ECDSA-SHA256... P:68373; T:0x140369098717504 17:51:27.260 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.260 [opensc-pkcs11] framework-pkcs15.c:3676:pkcs15_prkey_get_attribute: pkcs15_prkey_get_attribute() called
P:68373; T:0x140369098717504 17:51:27.260 [opensc-pkcs11] mechanism.c:250:sc_pkcs11_sign_init: called
P:68373; T:0x140369098717504 17:51:27.260 [opensc-pkcs11] mechanism.c:255:sc_pkcs11_sign_init: mechanism 0x1041, key-type 0x3
P:68373; T:0x140369098717504 17:51:27.260 [opensc-pkcs11] mechanism.c:259:sc_pkcs11_sign_init: returning with: 112
P:68373; T:0x140369098717504 17:51:27.260 [opensc-pkcs11] pkcs11-object.c:679:C_SignInit: C_SignInit() = CKR_MECHANISM_INVALID
Cannot sign data: Nieobsługiwana właściwość PKCS #11

@dengert
Copy link
Member

dengert commented Apr 10, 2020

Try adding SC_ALGORITHM_EXT_EC_UNCOMPRESES to
``
LOG_TEST_RET(card->ctx, _sc_card_add_ec_alg(
card, 384,
SC_ALGORITHM_ECDSA_RAW | SC_ALGORITHM_ECDSA_HASH_NONE,
SC_ALGORITHM_EXT_EC_NAMEDCURVE | SC_ALGORITHM_EXT_EC_UNCOMPRESES,
NULL

Most other card drivers do this. 


@majkrzak
Copy link
Contributor Author

Result looks very similar 😞

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 10, 2020

I've omitted the card->algorithm_count=0; 😅 It seems I have to rest. Now I got stuck on: sec.c:109:sc_set_security_env: returning with: -1205 (Incorrect parameters in APDU)

@majkrzak
Copy link
Contributor Author

majkrzak commented Apr 11, 2020

Not the prettiest , but unPACEed dump of p11tool --provider /opt/e-dowod/e-dowod-pkcs11-64.so --test-sign --login "..."

Token 'E-Dowód (Authentication)' with URL 'pkcs11:model=PKCS%2315%20emulated;manufacturer=PWPW%20S.A.;serial=0000000000000000;token=E-Dow%C3%B3d%20%28Authentication%29' requires user PIN
Enter PIN: 

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$1 = {cse = 0x2, cla = 0x0, ins = 0xa4, p1 = 0x0, p2 = 0x0, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x7fffffffb760, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$2 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffb6d0, datalen = 0xa, resp = 0x7fffffffb760, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$3 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$4 = {cse = 0x3, cla = 0x0, ins = 0x20, p1 = 0x0, p2 = 0x8a, lc = 0x4, le = 0x0, data = 0x7fffffffb760, datalen = 0x4, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$5 = {0x31, 0x32, 0x33, 0x34}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$6 = {cse = 0x2, cla = 0x0, ins = 0xa4, p1 = 0x0, p2 = 0x0, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x7fffffffb4d0, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$7 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffb440, datalen = 0xa, resp = 0x7fffffffb4d0, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$8 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$9 = {cse = 0x1, cla = 0x0, ins = 0x20, p1 = 0x0, p2 = 0x8a, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$10 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x1, p2 = 0x0, lc = 0x2, le = 0x0, data = 0x7fffffffb420, datalen = 0x2, resp = 0x7fffffffb4d0, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$11 = {0xdf, 0xa}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$12 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffb440, datalen = 0xa, resp = 0x7fffffffb4d0, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$13 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}
Signing using ECDSA-SHA256... 
Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$14 = {cse = 0x2, cla = 0x0, ins = 0xa4, p1 = 0x0, p2 = 0x0, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x7fffffffb870, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$15 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffb7e0, datalen = 0xa, resp = 0x7fffffffb870, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$16 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$17 = {cse = 0x3, cla = 0x0, ins = 0x20, p1 = 0x0, p2 = 0x8a, lc = 0x4, le = 0x0, data = 0x7fffffffb870, datalen = 0x4, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$18 = {0x31, 0x32, 0x33, 0x34}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$19 = {cse = 0x3, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0xc, lc = 0xa, le = 0x0, data = 0x5555555fee68, datalen = 0xa, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$20 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$21 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x1, p2 = 0x0, lc = 0x2, le = 0x0, data = 0x7fffffffcf70, datalen = 0x2, resp = 0x7fffffffd020, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$22 = {0xdf, 0xa}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$23 = {cse = 0x2, cla = 0x0, ins = 0xa4, p1 = 0x0, p2 = 0x0, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x7fffffffc910, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$24 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffc880, datalen = 0xa, resp = 0x7fffffffc910, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$25 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$26 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x1, p2 = 0x0, lc = 0x2, le = 0x0, data = 0x7fffffffc860, datalen = 0x2, resp = 0x7fffffffc910, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$27 = {0xdf, 0xa}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$28 = {cse = 0x3, cla = 0x0, ins = 0x22, p1 = 0x41, p2 = 0xb6, lc = 0x6, le = 0x0, data = 0x7fffffffcea0, datalen = 0x6, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$29 = {0x80, 0x1, 0xcc, 0x84, 0x1, 0x8a}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$30 = {cse = 0x2, cla = 0x0, ins = 0xa4, p1 = 0x0, p2 = 0x0, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x7fffffffc830, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$31 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffc7a0, datalen = 0xa, resp = 0x7fffffffc830, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$32 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$33 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x1, p2 = 0x0, lc = 0x2, le = 0x0, data = 0x7fffffffc780, datalen = 0x2, resp = 0x7fffffffc830, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$34 = {0xdf, 0xa}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$35 = {cse = 0x3, cla = 0x0, ins = 0x22, p1 = 0x41, p2 = 0xb6, lc = 0x6, le = 0x0, data = 0x7fffffffcdc0, datalen = 0x6, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$36 = {0x80, 0x1, 0xcc, 0x84, 0x1, 0x8a}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$37 = {cse = 0x4, cla = 0x0, ins = 0x2a, p1 = 0x9e, p2 = 0x9a, lc = 0x20, le = 0x0, data = 0x7fffffffd4d0, datalen = 0x20, resp = 0x7fffffffde10, resplen = 0x200, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$38 = {0xcc, 0x89, 0x41, 0x33, 0x2f, 0x7, 0x48, 0xb9, 0xeb, 0x18, 0x58, 0x43, 0xee, 0x20, 0x61, 0xb5, 0x9, 0x1b, 0x90, 0xa4, 0x27, 0x62, 0xb9, 0xbe, 0x52, 0x41, 0x51, 0xec, 0xeb, 0xfe, 0x6e, 0xa9}
ok
Verifying against private key parameters... ok

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$39 = {cse = 0x2, cla = 0x0, ins = 0xa4, p1 = 0x0, p2 = 0x0, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x7fffffffb770, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$40 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffb6e0, datalen = 0xa, resp = 0x7fffffffb770, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$41 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$42 = {cse = 0x1, cla = 0x0, ins = 0x20, p1 = 0x0, p2 = 0x8a, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$43 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x1, p2 = 0x0, lc = 0x2, le = 0x0, data = 0x7fffffffb6c0, datalen = 0x2, resp = 0x7fffffffb770, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$44 = {0xdf, 0xa}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$45 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffb6e0, datalen = 0xa, resp = 0x7fffffffb770, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$46 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}
Verifying against public key in the token... ok

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$47 = {cse = 0x2, cla = 0x0, ins = 0xa4, p1 = 0x0, p2 = 0x0, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x7fffffffbc60, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$48 = {cse = 0x4, cla = 0x0, ins = 0xa4, p1 = 0x4, p2 = 0x0, lc = 0xa, le = 0x0, data = 0x7fffffffbbd0, datalen = 0xa, resp = 0x7fffffffbc60, resplen = 0x105, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
$49 = {0xa0, 0x0, 0x0, 0x1, 0x67, 0x45, 0x53, 0x49, 0x47, 0x4e}

Breakpoint 1, 0x00007ffff71beef0 in sc_sm_single_transmit () from /opt/e-dowod/libedowod.so
$50 = {cse = 0x1, cla = 0x0, ins = 0x20, p1 = 0xff, p2 = 0x8a, lc = 0x0, le = 0x0, data = 0x0, datalen = 0x0, resp = 0x0, resplen = 0x0, control = 0x0, allocation_flags = 0x0, sw1 = 0x0, sw2 = 0x0, mac = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, mac_len = 0x0, flags = 0x0, next = 0x0}
[Inferior 1 (process 12356) exited normally]

oryginal sec env data: 0x80, 0x1, 0xcc, 0x84, 0x1, 0x8a
default data: 80 01 80 81 02 DF 0A 84 01 0A 80 00 00 00 00 00

@majkrzak
Copy link
Contributor Author

Yupi 😊 another small step forward. It looks like I managed to make a signature. At least response from he card is positive, but OpenSC died on iso_sm due to the wrong length.

Security environment had to be established in slightly different way, and key DF had to be selected. I've changed a logic a bit, because even if, the last two bytes were not referring the EF but DF in that case. I'm not sure how they should be distinguished, but 0xDF seems to be working.

About SM, @frankmorgner might it be similar issue to the one you had fixed couple days ago?

P:49618; T:0x140405789772096 16:13:00.872 [opensc-pkcs11] sm-iso.c:489:sm_encrypt: 
ASN.1 encoded encrypted APDU data (64 bytes):
87 31 01 81 78 48 B2 D7 02 FF 59 92 BA 8A 40 44 .1..xH....Y...@D
C3 30 2D C9 AF 35 8F 90 C3 93 12 4C 9D 61 88 7D .0-..5.....L.a.}
C8 AF A4 C1 1E A0 18 15 93 8A B4 70 36 19 6B D3 ...........p6.k.
56 C7 B2 97 01 60 8E 08 88 64 3C 9F 39 8E CC 68 V....`...d<.9..h
P:49618; T:0x140405789772096 16:13:00.872 [opensc-pkcs11] apdu.c:546:sc_transmit_apdu: called
P:49618; T:0x140405789772096 16:13:00.872 [opensc-pkcs11] card.c:473:sc_lock: called
P:49618; T:0x140405789772096 16:13:00.872 [opensc-pkcs11] card.c:513:sc_lock: returning with: 0 (Success)
P:49618; T:0x140405789772096 16:13:00.873 [opensc-pkcs11] apdu.c:513:sc_transmit: called
P:49618; T:0x140405789772096 16:13:00.873 [opensc-pkcs11] apdu.c:363:sc_single_transmit: called
P:49618; T:0x140405789772096 16:13:00.873 [opensc-pkcs11] apdu.c:367:sc_single_transmit: CLA:C, INS:2A, P1:9E, P2:9A, data(64) 0x561ad6276180
P:49618; T:0x140405789772096 16:13:00.873 [opensc-pkcs11] reader-pcsc.c:323:pcsc_transmit: reader 'Identiv Identiv uTrust 4701 F Dual Interface Reader [uTrust 4701 F CL Reader] (55041747202849) 01 00'
P:49618; T:0x140405789772096 16:13:00.873 [opensc-pkcs11] reader-pcsc.c:324:pcsc_transmit: 
Outgoing APDU (70 bytes):
0C 2A 9E 9A 40 87 31 01 81 78 48 B2 D7 02 FF 59 .*[email protected]
92 BA 8A 40 44 C3 30 2D C9 AF 35 8F 90 C3 93 12 [email protected].....
4C 9D 61 88 7D C8 AF A4 C1 1E A0 18 15 93 8A B4 L.a.}...........
70 36 19 6B D3 56 C7 B2 97 01 60 8E 08 88 64 3C p6.k.V....`...d<
9F 39 8E CC 68 00                               .9..h.
P:49618; T:0x140405789772096 16:13:00.874 [opensc-pkcs11] reader-pcsc.c:242:pcsc_internal_transmit: called
P:49618; T:0x140405789772096 16:13:01.064 [opensc-pkcs11] reader-pcsc.c:333:pcsc_transmit: 
Incoming APDU (131 bytes):
87 71 01 65 5F AA B4 E6 49 90 1B 80 A1 58 CA 1B .q.e_...I....X..
A2 11 2A A2 C1 68 B9 04 10 70 AF 93 5B 5E 71 3F ..*..h...p..[^q?
A7 A9 4C 6B 06 B4 2E 52 84 0F D4 6A 25 68 26 02 ..Lk...R...j%h&.
29 42 60 01 15 72 88 0D 9A B6 24 83 D4 5B 3A 85 )B`..r....$..[:.
39 E0 32 CC F0 BC C6 48 C7 D7 A3 E9 C8 69 4E B0 9.2....H.....iN.
3A D4 29 FC 85 EB 24 23 2C 65 F6 53 49 19 68 C3 :.)...$#,e.SI.h.
92 A8 76 DF C5 99 8B D2 E3 4D EB 53 91 20 5D DB ..v......M.S. ].
42 F3 82 99 02 90 00 8E 08 1B 7A E8 7D 8F CE 20 B.........z.}.. 
3D 90 00                                        =..
P:49618; T:0x140405789772096 16:13:01.064 [opensc-pkcs11] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:49618; T:0x140405789772096 16:13:01.064 [opensc-pkcs11] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:49618; T:0x140405789772096 16:13:01.064 [opensc-pkcs11] card.c:523:sc_unlock: called
P:49618; T:0x140405789772096 16:13:01.065 [opensc-pkcs11] sm-eac.c:2306:eac_sm_post_transmit: returning with: 0 (Success)
P:49618; T:0x140405789772096 16:13:01.065 [opensc-pkcs11] asn1.c:1674:asn1_decode: called, left=129, depth 0
P:49618; T:0x140405789772096 16:13:01.065 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Cryptogram', tag 0x20000005, OPTIONAL
P:49618; T:0x140405789772096 16:13:01.065 [opensc-pkcs11] asn1.c:1714:asn1_decode: 'Cryptogram' not present
P:49618; T:0x140405789772096 16:13:01.065 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Padding-content indicator followed by cryptogram', tag 0x20000007, OPTIONAL
P:49618; T:0x140405789772096 16:13:01.066 [opensc-pkcs11] asn1.c:1482:asn1_decode_entry: decoding 'Padding-content indicator followed by cryptogram', raw data:01655FAAB4E649901B80A158CA1BA211...
P:49618; T:0x140405789772096 16:13:01.066 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Processing Status', tag 0x20000019
P:49618; T:0x140405789772096 16:13:01.066 [opensc-pkcs11] asn1.c:1482:asn1_decode_entry: decoding 'Processing Status', raw data:9000
P:49618; T:0x140405789772096 16:13:01.066 [opensc-pkcs11] asn1.c:1698:asn1_decode: Looking for 'Cryptographic Checksum', tag 0x2000000e, OPTIONAL
P:49618; T:0x140405789772096 16:13:01.067 [opensc-pkcs11] asn1.c:1482:asn1_decode_entry: decoding 'Cryptographic Checksum', raw data:1B7AE87D8FCE203D
P:49618; T:0x140405789772096 16:13:01.067 [opensc-pkcs11] asn1.c:1749:asn1_decode: returning with: 0 (Success)
P:49618; T:0x140405789772096 16:13:01.067 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Cryptogram' (not present)
P:49618; T:0x140405789772096 16:13:01.067 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=0
P:49618; T:0x140405789772096 16:13:01.067 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Padding-content indicator followed by cryptogram'
P:49618; T:0x140405789772096 16:13:01.068 [opensc-pkcs11] asn1.c:1782:asn1_encode_entry: type=4, tag=0x20000007, parm=0x7fff97b49a00, len=113
P:49618; T:0x140405789772096 16:13:01.068 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=115
P:49618; T:0x140405789772096 16:13:01.068 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Processing Status'
P:49618; T:0x140405789772096 16:13:01.068 [opensc-pkcs11] asn1.c:1782:asn1_encode_entry: type=4, tag=0x20000019, parm=0x7fff97b499f6, len=2
P:49618; T:0x140405789772096 16:13:01.068 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=4
P:49618; T:0x140405789772096 16:13:01.069 [opensc-pkcs11] asn1.c:1777:asn1_encode_entry: encoding 'Cryptographic Checksum' (not present)
P:49618; T:0x140405789772096 16:13:01.069 [opensc-pkcs11] asn1.c:1975:asn1_encode_entry: length of encoded item=0
P:49618; T:0x140405789772096 16:13:01.069 [opensc-pkcs11] sm-eac.c:2068:eac_sm_verify_authentication: Authentication data verified
P:49618; T:0x140405789772096 16:13:01.070 [opensc-pkcs11] sm-iso.c:582:sm_decrypt: Response of SM APDU 7 bytes too long
P:49618; T:0x140405789772096 16:13:01.070 [opensc-pkcs11] sm-iso.c:660:iso_rm_sm: Could not decrypt APDU: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.070 [opensc-pkcs11] sm.c:173:sc_sm_single_transmit: returning with: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.070 [opensc-pkcs11] apdu.c:374:sc_single_transmit: returning with: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.071 [opensc-pkcs11] apdu.c:516:sc_transmit: transmit APDU failed: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.071 [opensc-pkcs11] card.c:523:sc_unlock: called
P:49618; T:0x140405789772096 16:13:01.071 [opensc-pkcs11] iso7816.c:974:iso7816_compute_signature: APDU transmit failed: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.071 [opensc-pkcs11] sec.c:63:sc_compute_signature: returning with: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.072 [opensc-pkcs11] card.c:523:sc_unlock: called
P:49618; T:0x140405789772096 16:13:01.072 [opensc-pkcs11] pkcs15-sec.c:707:sc_pkcs15_compute_signature: use_key() failed: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.072 [opensc-pkcs11] card.c:523:sc_unlock: called
P:49618; T:0x140405789772096 16:13:01.073 [opensc-pkcs11] reader-pcsc.c:736:pcsc_unlock: called
P:49618; T:0x140405789772096 16:13:01.082 [opensc-pkcs11] framework-pkcs15.c:4068:pkcs15_prkey_sign: Sign complete. Result -1404.
P:49618; T:0x140405789772096 16:13:01.082 [opensc-pkcs11] misc.c:71:sc_to_cryptoki_error_common: libopensc return value: -1404 (Out of memory)
P:49618; T:0x140405789772096 16:13:01.082 [opensc-pkcs11] mechanism.c:478:sc_pkcs11_signature_final: returning with: 2
P:49618; T:0x140405789772096 16:13:01.083 [opensc-pkcs11] mechanism.c:336:sc_pkcs11_sign_final: returning with: 2
P:49618; T:0x140405789772096 16:13:01.083 [opensc-pkcs11] pkcs11-object.c:727:C_Sign: C_Sign() = CKR_HOST_MEMORY

@majkrzak
Copy link
Contributor Author

If I will get some clues how to resolve above sm issue, I might be able to push it forward during the weekend.

@wiedzmin26
Copy link

@majkrzak
pkcs11-tool.exe --module e-dowod-pkcs11-64.dll --slot-index 3 --pin 0 --sign --mechanism ECDSA-SHA384 --signature-format openssl --id 042461313766336464372d366538352d346532662d616633372d613632366339343835343761 --input-file wejscie_male2 --output-file podpis_obecnosc_maly
pkcs11-tool.exe --module e-dowod-pkcs11-64.dll --slot-index 3 --pin 0 --sign --mechanism ECDSA-SHA384 --signature-format openssl --label "eDO_pl-ID NFZ" --input-file wejscie_male2 --output-file podpis_obecnosc_maly
?

@majkrzak
Copy link
Contributor Author

majkrzak commented May 3, 2020

@wiedzmin26 It seems that the my implementation is able to trigger the signature on the card. Issue is with receiving it from the card. Probably due to the some error or incompatibility in the iso-sm. Figuring this out is beyond my capabilities, I hope @frankmorgner or someone familiar with the topic will take a look into it or give me some clues.

@frankmorgner
Copy link
Member

The SM stuff looks all fine. However, it appears that the card sends more data than you've requested. You requested 0x60 bytes for a signature, but the card returns 0x67 bytes. The SM layer allocates an extra block due to the padding (16 bytes), so those extra 7 bytes do not matter. But when returning that data back to you, it errors.

Try using a bigger response buffer when requesting the signature. libedowod.so uses 0x200 as size for the response buffer, for example (see resplen in your debug log above. This, by the way, is 256 bytes more than needed, because the encrypted PSO encodes only requests 256 bytes from the card (see authenticated Le 97 01 00 of encrypted PSO above).

@majkrzak
Copy link
Contributor Author

majkrzak commented May 4, 2020

Looks that sc_pkcs11_signature_size returns 0x60

case CKK_EC:
/* TODO: -DEE we should use something other then CKA_MODULUS_BITS... */
rv = key->ops->get_attribute(operation->session, key, &attr);
*pLength = ((*pLength + 7)/8) * 2 ; /* 2*nLen in bytes */
break;

After hardcoding 0x67 (0x69 finally due to the 48/49 point length) it goes through, but fails on signature verification.

Received signature looks correct

Decrypted APDU response data (102 bytes):
30 64 02 30 1E C7 6D 87 80 D6 DB 74 A7 EC F2 3D 0d.0..m....t...=
67 18 C5 7D F8 CA 28 25 BD 2F CC 91 13 B9 4A 87 g..}..(%./....J.
2F 99 01 0C CA FA 00 84 DF E5 C2 7B 40 05 52 35 /..........{@.R5
29 BE 6B 94 02 30 07 1A 34 B2 6A 32 56 BE C2 26 ).k..0..4.j2V..&
0D 8C B7 9E 64 15 56 7F 27 26 4F 01 67 C4 0B A9 ....d.V.'&O.g...
9F 41 70 8A 65 29 45 57 D7 CB 5B 71 96 0A 49 63 .Ap.e)EW..[q..Ic
C0 35 DE D8 F3 50
openssl asn1parse -inform DER < sig.der 
    0:d=0  hl=2 l= 100 cons: SEQUENCE          
    2:d=1  hl=2 l=  48 prim: INTEGER           :1EC76D8780D6DB74A7ECF23D6718C57DF8CA2825BD2FCC9113B94A872F99010CCAFA0084DFE5C27B4005523529BE6B94
   52:d=1  hl=2 l=  48 prim: INTEGER           :071A34B26A3256BEC2260D8CB79E6415567F27264F0167C40BA99F41708A65294557D7CB5B71960A4963C035DED8F350

I'm not sure, but it might be that ASN1 wrapper around signature was not expected 🤔

Looks like i found answer in ISO applet implementation
https://github.com/OpenSC/OpenSC/blob/bdca524aa8810bcfa2ff36744be0b261db0be448/src/libopensc/card-isoApplet.c#L1192,L1193

@majkrzak
Copy link
Contributor Author

majkrzak commented May 4, 2020

Yep, it works. 💪
https://github.com/majkrzak/OpenSC/commit/07668210b1659ccc0e5c19070f96e4f4aea54583

p11tool --provider=(pwd)/src/pkcs11/.libs/opensc-pkcs11.so --test-sign --login "pkcs11:...;type=private"
Signing using ECDSA-SHA256... ok
Verifying against private key parameters... ok
Verifying against public key in the token... ok

I'll deliver initial PR by the end of the weekend.

@frankmorgner
Copy link
Member

I'm not sure, but it might be that ASN1 wrapper around signature was not expected 🤔

Looks like i found answer in ISO applet implementation
https://github.com/OpenSC/OpenSC/blob/bdca524aa8810bcfa2ff36744be0b261db0be448/src/libopensc/card-isoApplet.c#L1192,L1193

You could add the fix as general improvement.

@wiedzmin26
Copy link

@majkrzak Good Job :)
How can I test your solution? How can I connect to e-dowód using the CAN code? Can you share the compiled opensc-pkcs11.so file?

@marad26
Copy link

marad26 commented Aug 2, 2020

@majkrzak Hi, while trying to use your solution i stumbled into a problem, when i run pkcs15-tool -D or pkcs11-tool --test --login I'm getting:

decoding of ASN.1 object 'preferredLanguage' failed: Buffer too small
decoding of ASN.1 object 'TokenInfo' failed: Buffer too small

Can you give me a hint what should i do with that?

Part of the log:

ASN.1 encoded encrypted APDU data (13 bytes):
97 01 14 8E 08 E9 2E E7 01 A5 C2 E5 40 ............@
P:5619; T:0x139881651414848 17:12:25.440 [pkcs15-tool] apdu.c:546:sc_transmit_apdu: called
P:5619; T:0x139881651414848 17:12:25.444 [pkcs15-tool] card.c:473:sc_lock: called
P:5619; T:0x139881651414848 17:12:25.450 [pkcs15-tool] card.c:513:sc_lock: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.457 [pkcs15-tool] apdu.c:513:sc_transmit: called
P:5619; T:0x139881651414848 17:12:25.463 [pkcs15-tool] apdu.c:363:sc_single_transmit: called
P:5619; T:0x139881651414848 17:12:25.467 [pkcs15-tool] apdu.c:370:sc_single_transmit: CLA:C, INS:B0, P1:1, P2:BE, data(13) 0x56159e47eeb0
P:5619; T:0x139881651414848 17:12:25.472 [pkcs15-tool] reader-pcsc.c:323:pcsc_transmit: reader 'Virtual PCD 00 00'
P:5619; T:0x139881651414848 17:12:25.474 [pkcs15-tool] reader-pcsc.c:324:pcsc_transmit:
Outgoing APDU (19 bytes):
0C B0 01 BE 0D 97 01 14 8E 08 E9 2E E7 01 A5 C2 ................
E5 40 00                                        .@.
P:5619; T:0x139881651414848 17:12:25.476 [pkcs15-tool] reader-pcsc.c:242:pcsc_internal_transmit: called
P:5619; T:0x139881651414848 17:12:25.562 [pkcs15-tool] reader-pcsc.c:333:pcsc_transmit:
Incoming APDU (51 bytes):
87 21 01 25 76 B1 3B 9C C9 E2 9D F3 95 5F 13 05 .!.%v.;......_..
7B 99 E2 4B 3B FE 41 A5 BB 03 D9 72 BD BF C6 C5 {..K;.A....r....
C6 67 64 99 02 90 00 8E 08 53 0A 6D C7 A2 2F 14 .gd......S.m../.
04 90 00                                        ...
P:5619; T:0x139881651414848 17:12:25.568 [pkcs15-tool] apdu.c:382:sc_single_transmit: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.570 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.571 [pkcs15-tool] card.c:523:sc_unlock: called
P:5619; T:0x139881651414848 17:12:25.572 [pkcs15-tool] sm-eac.c:2298:eac_sm_post_transmit: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.576 [pkcs15-tool] asn1.c:1679:asn1_decode: called, left=49, depth 0
P:5619; T:0x139881651414848 17:12:25.577 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'Cryptogram', tag 0x20000005, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.580 [pkcs15-tool] asn1.c:1717:asn1_decode: 'Cryptogram' not present
P:5619; T:0x139881651414848 17:12:25.582 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'Padding-content indicator followed by cryptogram', tag 0x20000007, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.583 [pkcs15-tool] asn1.c:1488:asn1_decode_entry: decoding 'Padding-content indicator followed by cryptogram', raw data:012576B13B9CC9E29DF3955F13057B99...
P:5619; T:0x139881651414848 17:12:25.584 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'Processing Status', tag 0x20000019
P:5619; T:0x139881651414848 17:12:25.587 [pkcs15-tool] asn1.c:1488:asn1_decode_entry: decoding 'Processing Status', raw data:9000
P:5619; T:0x139881651414848 17:12:25.588 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'Cryptographic Checksum', tag 0x2000000e, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.595 [pkcs15-tool] asn1.c:1488:asn1_decode_entry: decoding 'Cryptographic Checksum', raw data:530A6DC7A22F1404
P:5619; T:0x139881651414848 17:12:25.596 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.598 [pkcs15-tool] asn1.c:1782:asn1_encode_entry: encoding 'Cryptogram' (not present)
P:5619; T:0x139881651414848 17:12:25.602 [pkcs15-tool] asn1.c:1980:asn1_encode_entry: length of encoded item=0
P:5619; T:0x139881651414848 17:12:25.607 [pkcs15-tool] asn1.c:1782:asn1_encode_entry: encoding 'Padding-content indicator followed by cryptogram'
P:5619; T:0x139881651414848 17:12:25.609 [pkcs15-tool] asn1.c:1788:asn1_encode_entry: type=4, tag=0x20000007, parm=0x7fff1213dcc0, len=33
P:5619; T:0x139881651414848 17:12:25.610 [pkcs15-tool] asn1.c:1980:asn1_encode_entry: length of encoded item=35
P:5619; T:0x139881651414848 17:12:25.612 [pkcs15-tool] asn1.c:1782:asn1_encode_entry: encoding 'Processing Status'
P:5619; T:0x139881651414848 17:12:25.613 [pkcs15-tool] asn1.c:1788:asn1_encode_entry: type=4, tag=0x20000019, parm=0x7fff1213dcb6, len=2
P:5619; T:0x139881651414848 17:12:25.616 [pkcs15-tool] asn1.c:1980:asn1_encode_entry: length of encoded item=4
P:5619; T:0x139881651414848 17:12:25.617 [pkcs15-tool] asn1.c:1782:asn1_encode_entry: encoding 'Cryptographic Checksum' (not present)
P:5619; T:0x139881651414848 17:12:25.622 [pkcs15-tool] asn1.c:1980:asn1_encode_entry: length of encoded item=0
P:5619; T:0x139881651414848 17:12:25.623 [pkcs15-tool] sm-eac.c:2059:eac_sm_verify_authentication: Authentication data verified
P:5619; T:0x139881651414848 17:12:25.625 [pkcs15-tool] sm-iso.c:611:sm_decrypt: Decrypted APDU sw1=90 sw2=00
P:5619; T:0x139881651414848 17:12:25.626 [pkcs15-tool] sm-iso.c:613:sm_decrypt:
Decrypted APDU response data (20 bytes):
4F 2F 49 45 43 20 37 38 31 36 2D 34 3A 32 30 31 O/IEC 7816-4:201
33 28 45 29                                     3(E)
P:5619; T:0x139881651414848 17:12:25.627 [pkcs15-tool] sm-eac.c:2337:eac_sm_finish: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.628 [pkcs15-tool] sm.c:173:sc_sm_single_transmit: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.629 [pkcs15-tool] apdu.c:374:sc_single_transmit: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.630 [pkcs15-tool] apdu.c:535:sc_transmit: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.631 [pkcs15-tool] card.c:523:sc_unlock: called
P:5619; T:0x139881651414848 17:12:25.631 [pkcs15-tool] iso7816.c:164:iso7816_read_binary: returning with: 20
P:5619; T:0x139881651414848 17:12:25.632 [pkcs15-tool] card.c:523:sc_unlock: called
P:5619; T:0x139881651414848 17:12:25.633 [pkcs15-tool] card.c:672:sc_read_binary: returning with: 466
P:5619; T:0x139881651414848 17:12:25.634 [pkcs15-tool] asn1.c:1679:asn1_decode: called, left=466, depth 0
P:5619; T:0x139881651414848 17:12:25.635 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'TokenInfo', tag 0x1000010
P:5619; T:0x139881651414848 17:12:25.636 [pkcs15-tool] asn1.c:1488:asn1_decode_entry: decoding 'TokenInfo', raw data:020102040C0000000000000000000000...
P:5619; T:0x139881651414848 17:12:25.637 [pkcs15-tool] asn1.c:1679:asn1_decode:  called, left=462, depth 1
P:5619; T:0x139881651414848 17:12:25.637 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'version', tag 0x2
P:5619; T:0x139881651414848 17:12:25.638 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'version', raw data:02
P:5619; T:0x139881651414848 17:12:25.639 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:  decoding 'version' returned 2
P:5619; T:0x139881651414848 17:12:25.641 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'serialNumber', tag 0x4, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.644 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'serialNumber', raw data:000000000000000000000000
P:5619; T:0x139881651414848 17:12:25.646 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'manufacturerID', tag 0xc, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.647 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'manufacturerID', raw data:5057505720532E412E
P:5619; T:0x139881651414848 17:12:25.648 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'label', tag 0x20000000, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.649 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'label', raw data:452D446F77C3B364
P:5619; T:0x139881651414848 17:12:25.649 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'label-tw', tag 0x21000000, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.650 [pkcs15-tool] asn1.c:1717:asn1_decode: 'label-tw' not present
P:5619; T:0x139881651414848 17:12:25.651 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'tokenflags', tag 0x3
P:5619; T:0x139881651414848 17:12:25.652 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'tokenflags', raw data:0560
P:5619; T:0x139881651414848 17:12:25.653 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'seInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.654 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'seInfo', raw data:300F020101040AA00000016745534947...
P:5619; T:0x139881651414848 17:12:25.655 [pkcs15-tool] asn1.c:1679:asn1_decode:   called, left=68, depth 2
P:5619; T:0x139881651414848 17:12:25.662 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'seInfo', tag 0x1000010
P:5619; T:0x139881651414848 17:12:25.664 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'seInfo', raw data:020101040AA000000167455349474E
P:5619; T:0x139881651414848 17:12:25.665 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=15, depth 3
P:5619; T:0x139881651414848 17:12:25.666 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'se', tag 0x2
P:5619; T:0x139881651414848 17:12:25.667 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'se', raw data:01
P:5619; T:0x139881651414848 17:12:25.668 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'se' returned 1
P:5619; T:0x139881651414848 17:12:25.670 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'owner', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.672 [pkcs15-tool] asn1.c:1717:asn1_decode: 'owner' not present
P:5619; T:0x139881651414848 17:12:25.676 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'aid', tag 0x4, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.677 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'aid', raw data:A000000167455349474E
P:5619; T:0x139881651414848 17:12:25.678 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.679 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.681 [pkcs15-tool] asn1.c:1679:asn1_decode:   called, left=51, depth 2
P:5619; T:0x139881651414848 17:12:25.682 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'seInfo', tag 0x1000010
P:5619; T:0x139881651414848 17:12:25.682 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'seInfo', raw data:020102040AA000000167455349474E
P:5619; T:0x139881651414848 17:12:25.683 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=15, depth 3
P:5619; T:0x139881651414848 17:12:25.684 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'se', tag 0x2
P:5619; T:0x139881651414848 17:12:25.685 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'se', raw data:02
P:5619; T:0x139881651414848 17:12:25.686 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'se' returned 2
P:5619; T:0x139881651414848 17:12:25.687 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'owner', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.688 [pkcs15-tool] asn1.c:1717:asn1_decode: 'owner' not present
P:5619; T:0x139881651414848 17:12:25.689 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'aid', tag 0x4, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.690 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'aid', raw data:A000000167455349474E
P:5619; T:0x139881651414848 17:12:25.692 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.692 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.693 [pkcs15-tool] asn1.c:1679:asn1_decode:   called, left=34, depth 2
P:5619; T:0x139881651414848 17:12:25.694 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'seInfo', tag 0x1000010
P:5619; T:0x139881651414848 17:12:25.696 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'seInfo', raw data:020103040AA000000167455349474E
P:5619; T:0x139881651414848 17:12:25.697 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=15, depth 3
P:5619; T:0x139881651414848 17:12:25.698 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'se', tag 0x2
P:5619; T:0x139881651414848 17:12:25.699 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'se', raw data:03
P:5619; T:0x139881651414848 17:12:25.699 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'se' returned 3
P:5619; T:0x139881651414848 17:12:25.699 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'owner', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.700 [pkcs15-tool] asn1.c:1717:asn1_decode: 'owner' not present
P:5619; T:0x139881651414848 17:12:25.701 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'aid', tag 0x4, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.702 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'aid', raw data:A000000167455349474E
P:5619; T:0x139881651414848 17:12:25.708 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.713 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.714 [pkcs15-tool] asn1.c:1679:asn1_decode:   called, left=17, depth 2
P:5619; T:0x139881651414848 17:12:25.715 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'seInfo', tag 0x1000010
P:5619; T:0x139881651414848 17:12:25.716 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'seInfo', raw data:020104040AA000000167455349474E
P:5619; T:0x139881651414848 17:12:25.718 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=15, depth 3
P:5619; T:0x139881651414848 17:12:25.720 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'se', tag 0x2
P:5619; T:0x139881651414848 17:12:25.723 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'se', raw data:04
P:5619; T:0x139881651414848 17:12:25.727 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'se' returned 4
P:5619; T:0x139881651414848 17:12:25.728 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'owner', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.734 [pkcs15-tool] asn1.c:1717:asn1_decode: 'owner' not present
P:5619; T:0x139881651414848 17:12:25.736 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'aid', tag 0x4, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.738 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'aid', raw data:A000000167455349474E
P:5619; T:0x139881651414848 17:12:25.740 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.743 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.746 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'recordInfo', tag 0x21000001, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.748 [pkcs15-tool] asn1.c:1717:asn1_decode: 'recordInfo' not present
P:5619; T:0x139881651414848 17:12:25.749 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedAlgorithms', tag 0x21000002, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.750 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'supportedAlgorithms', raw data:301B0201010201010500030307450006...
P:5619; T:0x139881651414848 17:12:25.754 [pkcs15-tool] asn1.c:1679:asn1_decode:   called, left=306, depth 2
P:5619; T:0x139881651414848 17:12:25.757 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.758 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201010201010500030307450006092A...
P:5619; T:0x139881651414848 17:12:25.760 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=27, depth 3
P:5619; T:0x139881651414848 17:12:25.761 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.764 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:01
P:5619; T:0x139881651414848 17:12:25.765 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 1
P:5619; T:0x139881651414848 17:12:25.766 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.768 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.769 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.770 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.773 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=21, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.774 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.776 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.777 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.779 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.780 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074500
P:5619; T:0x139881651414848 17:12:25.781 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.782 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2A864886F70D01010B
P:5619; T:0x139881651414848 17:12:25.788 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.790 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:01
P:5619; T:0x139881651414848 17:12:25.792 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 1
P:5619; T:0x139881651414848 17:12:25.792 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.792 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.793 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201020201010500030307450006092A...
P:5619; T:0x139881651414848 17:12:25.793 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=27, depth 3
P:5619; T:0x139881651414848 17:12:25.793 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.794 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:02
P:5619; T:0x139881651414848 17:12:25.795 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 2
P:5619; T:0x139881651414848 17:12:25.796 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.796 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.796 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.797 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.797 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=21, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.797 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.798 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.798 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.798 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.799 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074500
P:5619; T:0x139881651414848 17:12:25.799 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.799 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2A864886F70D01010B
P:5619; T:0x139881651414848 17:12:25.800 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.800 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:02
P:5619; T:0x139881651414848 17:12:25.801 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 2
P:5619; T:0x139881651414848 17:12:25.801 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.802 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.802 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201030201010500030307490006052B...
P:5619; T:0x139881651414848 17:12:25.802 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=23, depth 3
P:5619; T:0x139881651414848 17:12:25.803 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.803 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:03
P:5619; T:0x139881651414848 17:12:25.803 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 3
P:5619; T:0x139881651414848 17:12:25.804 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.805 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.805 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.806 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.807 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=17, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.809 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.815 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.818 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.821 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.824 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:25.827 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.828 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B81040021
P:5619; T:0x139881651414848 17:12:25.830 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.831 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:0A
P:5619; T:0x139881651414848 17:12:25.832 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 10
P:5619; T:0x139881651414848 17:12:25.833 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.834 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.836 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201040201010500030307490006082A...
P:5619; T:0x139881651414848 17:12:25.837 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=26, depth 3
P:5619; T:0x139881651414848 17:12:25.839 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.841 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:04
P:5619; T:0x139881651414848 17:12:25.844 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 4
P:5619; T:0x139881651414848 17:12:25.846 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.848 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.850 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.852 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.856 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=20, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.857 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.859 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.862 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.864 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.865 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:25.867 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.868 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2A8648CE3D030107
P:5619; T:0x139881651414848 17:12:25.869 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.870 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:0C
P:5619; T:0x139881651414848 17:12:25.871 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 12
P:5619; T:0x139881651414848 17:12:25.872 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.874 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.876 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201050201010500030307490006052B...
P:5619; T:0x139881651414848 17:12:25.878 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=23, depth 3
P:5619; T:0x139881651414848 17:12:25.879 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.880 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:05
P:5619; T:0x139881651414848 17:12:25.880 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 5
P:5619; T:0x139881651414848 17:12:25.881 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.882 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.882 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.883 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.883 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=17, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.884 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.884 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.885 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.885 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.886 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:25.886 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.887 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B81040022
P:5619; T:0x139881651414848 17:12:25.888 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.888 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:0F
P:5619; T:0x139881651414848 17:12:25.889 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 15
P:5619; T:0x139881651414848 17:12:25.889 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.891 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.892 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201060201010500030307490006052B...
P:5619; T:0x139881651414848 17:12:25.894 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=23, depth 3
P:5619; T:0x139881651414848 17:12:25.895 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.895 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:06
P:5619; T:0x139881651414848 17:12:25.896 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 6
P:5619; T:0x139881651414848 17:12:25.896 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.897 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.898 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.903 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.906 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=17, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.910 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.912 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.914 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.915 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.918 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:25.922 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.925 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B81040023
P:5619; T:0x139881651414848 17:12:25.927 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.928 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:12
P:5619; T:0x139881651414848 17:12:25.929 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 18
P:5619; T:0x139881651414848 17:12:25.931 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.933 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.935 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201070201010500030307490006092B...
P:5619; T:0x139881651414848 17:12:25.938 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=27, depth 3
P:5619; T:0x139881651414848 17:12:25.940 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.943 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:07
P:5619; T:0x139881651414848 17:12:25.946 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 7
P:5619; T:0x139881651414848 17:12:25.947 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.948 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.950 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.952 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.955 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=21, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.957 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.960 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.964 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.968 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.973 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:25.975 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.976 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B2403030208010105
P:5619; T:0x139881651414848 17:12:25.978 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.979 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:0B
P:5619; T:0x139881651414848 17:12:25.980 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 11
P:5619; T:0x139881651414848 17:12:25.981 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.983 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.983 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201080201010500030307490006092B...
P:5619; T:0x139881651414848 17:12:25.983 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=27, depth 3
P:5619; T:0x139881651414848 17:12:25.984 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.984 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:08
P:5619; T:0x139881651414848 17:12:25.985 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 8
P:5619; T:0x139881651414848 17:12:25.985 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.985 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.986 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.986 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.987 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=21, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.987 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.988 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.988 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.989 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.989 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:25.989 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.990 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B2403030208010107
P:5619; T:0x139881651414848 17:12:25.991 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.992 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:0D
P:5619; T:0x139881651414848 17:12:25.992 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 13
P:5619; T:0x139881651414848 17:12:25.993 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.994 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:25.994 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:0201090201010500030307490006092B...
P:5619; T:0x139881651414848 17:12:25.994 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=27, depth 3
P:5619; T:0x139881651414848 17:12:25.995 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:25.995 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:09
P:5619; T:0x139881651414848 17:12:25.995 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 9
P:5619; T:0x139881651414848 17:12:25.996 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:25.996 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:25.997 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:25.997 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:25.997 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=21, depth 4, choice
P:5619; T:0x139881651414848 17:12:25.998 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:25.998 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:25.999 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:25.999 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:25.999 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:26.000 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.000 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B2403030208010109
P:5619; T:0x139881651414848 17:12:26.000 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.001 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:0E
P:5619; T:0x139881651414848 17:12:26.001 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 14
P:5619; T:0x139881651414848 17:12:26.002 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:26.002 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.005 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:02010A0201010500030307490006092B...
P:5619; T:0x139881651414848 17:12:26.012 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=27, depth 3
P:5619; T:0x139881651414848 17:12:26.017 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:26.018 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:0A
P:5619; T:0x139881651414848 17:12:26.019 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 10
P:5619; T:0x139881651414848 17:12:26.021 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:26.022 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:26.025 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:26.027 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:26.033 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=21, depth 4, choice
P:5619; T:0x139881651414848 17:12:26.035 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:26.036 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:26.038 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:26.040 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:26.045 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:26.046 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.048 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B240303020801010B
P:5619; T:0x139881651414848 17:12:26.049 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.049 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:10
P:5619; T:0x139881651414848 17:12:26.050 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 16
P:5619; T:0x139881651414848 17:12:26.051 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:26.052 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.053 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:   decoding 'algorithmInfo', raw data:02010B0201010500030307490006092B...
P:5619; T:0x139881651414848 17:12:26.054 [pkcs15-tool] asn1.c:1679:asn1_decode:    called, left=27, depth 3
P:5619; T:0x139881651414848 17:12:26.057 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'reference', tag 0x2
P:5619; T:0x139881651414848 17:12:26.059 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'reference', raw data:0B
P:5619; T:0x139881651414848 17:12:26.062 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'reference' returned 11
P:5619; T:0x139881651414848 17:12:26.065 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmPKCS#11', tag 0x2
P:5619; T:0x139881651414848 17:12:26.068 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algorithmPKCS#11', raw data:01
P:5619; T:0x139881651414848 17:12:26.069 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algorithmPKCS#11' returned 1
P:5619; T:0x139881651414848 17:12:26.070 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'parameters', tag 0x0
P:5619; T:0x139881651414848 17:12:26.071 [pkcs15-tool] asn1.c:1679:asn1_decode:     called, left=21, depth 4, choice
P:5619; T:0x139881651414848 17:12:26.072 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'PKCS15RSAParameters', tag 0x5, CHOICE
P:5619; T:0x139881651414848 17:12:26.075 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:     decoding 'PKCS15RSAParameters', raw data:
P:5619; T:0x139881651414848 17:12:26.079 [pkcs15-tool] asn1.c:1751:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:26.081 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'supportedOperations', tag 0x3
P:5619; T:0x139881651414848 17:12:26.082 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'supportedOperations', raw data:074900
P:5619; T:0x139881651414848 17:12:26.082 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'objId', tag 0x6, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.082 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'objId', raw data:2B240303020801010D
P:5619; T:0x139881651414848 17:12:26.083 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algRef', tag 0x2, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.084 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:    decoding 'algRef', raw data:11
P:5619; T:0x139881651414848 17:12:26.084 [pkcs15-tool] asn1.c:1514:asn1_decode_entry:    decoding 'algRef' returned 17
P:5619; T:0x139881651414848 17:12:26.085 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:26.085 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.086 [pkcs15-tool] asn1.c:1717:asn1_decode: 'algorithmInfo' not present
P:5619; T:0x139881651414848 17:12:26.086 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.087 [pkcs15-tool] asn1.c:1717:asn1_decode: 'algorithmInfo' not present
P:5619; T:0x139881651414848 17:12:26.087 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.088 [pkcs15-tool] asn1.c:1717:asn1_decode: 'algorithmInfo' not present
P:5619; T:0x139881651414848 17:12:26.088 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.089 [pkcs15-tool] asn1.c:1717:asn1_decode: 'algorithmInfo' not present
P:5619; T:0x139881651414848 17:12:26.089 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'algorithmInfo', tag 0x1000010, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.089 [pkcs15-tool] asn1.c:1717:asn1_decode: 'algorithmInfo' not present
P:5619; T:0x139881651414848 17:12:26.090 [pkcs15-tool] asn1.c:1752:asn1_decode: returning with: 0 (Success)
P:5619; T:0x139881651414848 17:12:26.090 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'issuerId', tag 0x20000003, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.091 [pkcs15-tool] asn1.c:1717:asn1_decode: 'issuerId' not present
P:5619; T:0x139881651414848 17:12:26.092 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'holderId', tag 0x20000004, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.092 [pkcs15-tool] asn1.c:1717:asn1_decode: 'holderId' not present
P:5619; T:0x139881651414848 17:12:26.093 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'lastUpdate', tag 0x21000005, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.093 [pkcs15-tool] asn1.c:1717:asn1_decode: 'lastUpdate' not present
P:5619; T:0x139881651414848 17:12:26.094 [pkcs15-tool] asn1.c:1703:asn1_decode: Looking for 'preferredLanguage', tag 0x13, OPTIONAL
P:5619; T:0x139881651414848 17:12:26.095 [pkcs15-tool] asn1.c:1488:asn1_decode_entry:  decoding 'preferredLanguage', raw data:706C2D504C
P:5619; T:0x139881651414848 17:12:26.095 [pkcs15-tool] asn1.c:1661:asn1_decode_entry: decoding of ASN.1 object 'preferredLanguage' failed: Buffer too small
P:5619; T:0x139881651414848 17:12:26.096 [pkcs15-tool] asn1.c:1661:asn1_decode_entry: decoding of ASN.1 object 'TokenInfo' failed: Buffer too small
P:5619; T:0x139881651414848 17:12:26.096 [pkcs15-tool] pkcs15.c:220:sc_pkcs15_parse_tokeninfo: ASN.1 parsing of EF(TokenInfo) failed: -1303 (Buffer too small)
P:5619; T:0x139881651414848 17:12:26.097 [pkcs15-tool] pkcs15.c:1151:sc_pkcs15_bind_internal: cannot parse TokenInfo content: Buffer too small
P:5619; T:0x139881651414848 17:12:26.097 [pkcs15-tool] pkcs15.c:1184:sc_pkcs15_bind_internal: returning with: -1303 (Buffer too small)

@dengert
Copy link
Member

dengert commented Aug 3, 2020

The ASN1 says "preferred Language" is "706C2D504C" in ASCII: pl-PL

pkcs15.c has:

118         { "preferredLanguage", SC_ASN1_PRINTABLESTRING, SC_ASN1_TAG_PRINTABLESTRING, SC_ASN1_OPTIONAL, NULL, NULL },

148         u8 preferred_language[3];
149         size_t lang_length = sizeof(preferred_language);

215         sc_format_asn1_entry(asn1_toki_attrs + 12, preferred_language, &lang_length, 0);

259         if (asn1_toki_attrs[12].flags & SC_ASN1_PRESENT) {
260                 preferred_language[2] = 0;
261                 ti->preferred_language = strdup((char *)preferred_language);
262                 if (ti->preferred_language == NULL)
263                         return SC_ERROR_OUT_OF_MEMORY;
264         }

Why it sets the limit to 3 is not clear.
You could change line 148 to say 8 and also change line 260 to preferred_language[7] = 0;

Or do something like this untested diff:

pkcs15.c.diff.txt

Note the same could be done for options that also end up using strdup.

@polishcode
Copy link

Resurrecting topic. Hi @majkrzak; currently working in this context. Wanted to ask - what is the status of the technical specification of polish edo card. Is it publicly available?

@majkrzak
Copy link
Contributor Author

majkrzak commented Mar 7, 2023

@polishcode I'm not aware about that. Personally I doubt if it even exists. As far as I remember edo is more or less compliant with some international standards, so for example german resources may be treated as some kind of documentation.

@polishcode
Copy link

polishcode commented Mar 7, 2023

Thanks for response. Yeah, have the same impression. Taxpayers' money well spent :/
I am currently trying to retrieve data from EFs (Name, DOB etc.). Have SM setup based on PACE with CAN. However, cannot find FIDs of Elementary Files that keep that info. Looking at BSI spec Table 3 it does not look like it applies to eDO. Any hints?

Additional facts I found surprising in the current eDO implementation:

  • DF A0000001674553494740 is no longer present (SW 6982)
  • looks like "main" DF is in selected state by default (you can start by selecting EF.CardAccess 00A4020402011C00 and it works)

@ncortines
Copy link

ncortines commented Sep 6, 2023

Hi @majkrzak

I just got a fresh new e-dowód and thought I could perhaps use your driver. Unfortunately it does not seem to work.

pkcs11-tool --test --login         
Using slot 0 with a present token (0x0)
error: PKCS11 function C_GetTokenInfo failed: rv = CKR_TOKEN_NOT_RECOGNIZED (0xe1)
opensc-tool --reader 0 --name
Unsupported card

opensc.conf

app default {
	# debug = 3;
	# debug_file = opensc-debug.txt;
	framework pkcs15 {
		# use_file_caching = public;
	}
	card_driver edo {
		can = 123456;
	}
}
opensc-tool --list-readers
# Detected readers (pcsc)
Nr.  Card  Features  Name
0    Yes             ACS ACR1252 Dual Reader
opensc-tool --atr
Using reader with a card: ACS ACR1252 Dual Reader
3b:89:80:01:02:4d:4b:4d:57:4b:53:4b:54:11

I'm happy to provide any other logs/information/etc.

Environment:
macOS Ventura 13.5
OpenSC 0.23.0

Thanks

@ncortines
Copy link

ncortines commented Sep 11, 2023

Based on the result from opensc-tool --atr, this is going to require a new driver. Is it correct?
What could be a good name for the new driver? card-edo-v2.c, card-edo-2023.c?

@steelman
Copy link

I guess card-edo2.c seems pretty good since the "original" e-dowod-pkcs11-64.so contains similar versioning. The dependable strings suggest there are currently three models of eDO smartcards in use.

  • 1.0 based on NXP P60 (ATR: 3b:84:80:01:47:43:50:43:12)
  • 2.0 based on NXP P71 (ATR: 3b:89:80:01:02:4d:4b:4d:57:4b:53:4b:54:11)
  • 2.1 based on Thales(?) MultiApp(?) V 5.0 (ATR: 3b:8f:80:01:80:31:80:65:b0:85:05:.... I guess)

I may be able to figure out something about 2.0, we'll see.

@frankmorgner
Copy link
Member

initial support was integrated long ago. for bug reports (or support for new versions of the card please open a new issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

12 participants