Hi,

Could this fix that Andre has proposed be committed to trunk?
It should work for all cards, since it only makes two elements of the TokenInfo 
optional.

Kind regards,
Toni

> -----Original Message-----
> From: Andre Zepezauer [mailto:andre.zepeza...@student.uni-halle.de]
> Sent: 10. tammikuuta 2011 16:24
> To: Aventra development
> Cc: opensc-devel@lists.opensc-project.org
> Subject: Re: [opensc-devel] Braking change in OpenSC 0.12.0 tokenInfo
> 
> This patch should fix it:
> 
> Index: libopensc/pkcs15.c
> ===================================================================
> --- libopensc/pkcs15.c        (revision 5078)
> +++ libopensc/pkcs15.c        (working copy)
> @@ -42,8 +42,8 @@
>       { "algorithmPKCS#11",   SC_ASN1_INTEGER,        SC_ASN1_TAG_INTEGER,
>       0, NULL, NULL },
>       { "parameters",         SC_ASN1_NULL,           SC_ASN1_TAG_NULL,       
> 0,
> NULL, NULL },
>       { "supportedOperations",SC_ASN1_BIT_FIELD,      SC_ASN1_TAG_BIT_STRING,
>       0, NULL, NULL },
> -     { "objId",              SC_ASN1_OBJECT,         SC_ASN1_TAG_OBJECT,     
> 0,
> NULL, NULL },
> -     { "algRef",             SC_ASN1_INTEGER,        SC_ASN1_TAG_INTEGER,    
> 0,
> NULL, NULL },
> +     { "objId",              SC_ASN1_OBJECT,         SC_ASN1_TAG_OBJECT,
>       SC_ASN1_OPTIONAL, NULL, NULL },
> +     { "algRef",             SC_ASN1_INTEGER,        SC_ASN1_TAG_INTEGER,
>       SC_ASN1_OPTIONAL, NULL, NULL },
>       { NULL, 0, 0, 0, NULL, NULL }
>  };
> 
> On Mon, 2011-01-10 at 11:21 +0200, Aventra development wrote:
> > Hi,
> >
> >
> >
> > I have been testing the new release and sadly found a braking change
> > that causes cards that are not initialized with (the current version
> > of) OpenSC to result in the message “Unsupported card”. The cause is
> > the token info (5032 file). There is some element that OpenSC
> > requires, otherwise it results in “Unsupported Card”.
> >
> >
> >
> > Previously OpenSC worked well with cards not initialized with it, but
> > now it seems that it does not. Does anybody know what changed and why?
> >
> > I tried to browse the source and the changes, but did not manage to
> > track it back to any change that affected this… I’m not even sure when
> > this change has been done, but somewhere between versions 0.11.13 and
> > 0.12.0.
> >
> >
> >
> > Any help would be appreciated. Below is a log that shows the error and
> > the content of the tokenInfo file. The major difference is that cards
> > not initialized by OpenSC does not have the lastUpdate value.
> >
> >
> >
> > Debug log and below that there is a more detailed log about ASN.1
> > parsing:
> >
> >
> >
> > 2011-01-05 12:26:07.066 [pkcs15-tool] card.c:548:sc_select_file:
> > called; type=2, path=3f0050155032
> >
> > 2011-01-05 12:26:07.066 [pkcs15-tool]
> > card-myeid.c:202:myeid_select_file: called
> >
> >
> >
> > 2011-01-05 12:26:07.066 [pkcs15-tool] apdu.c:527:sc_transmit_apdu:
> > called
> >
> > 2011-01-05 12:26:07.066 [pkcs15-tool] card.c:295:sc_lock: called
> >
> > 2011-01-05 12:26:07.081 [pkcs15-tool] reader-pcsc.c:242:pcsc_transmit:
> > reader 'O2 O2Micro CCID SC Reader 0'
> >
> > 2011-01-05 12:26:07.081 [pkcs15-tool] apdu.c:187:sc_apdu_log:
> >
> > Outgoing APDU data [   10 bytes] =====================================
> >
> > 00 A4 08 00 04 50 15 50 32 FF .....P.P2.
> >
> > ======================================================================
> >
> > 2011-01-05 12:26:07.081 [pkcs15-tool]
> > reader-pcsc.c:175:pcsc_internal_transmit: called
> >
> > 2011-01-05 12:26:07.175 [pkcs15-tool] apdu.c:187:sc_apdu_log:
> >
> > Incoming APDU data [   27 bytes] =====================================
> >
> > 6F 17 80 02 00 46 82 01 01 83 02 50 32 86 03 03 o....F.....P2...
> >
> > 3F FF 85 02 00 00 8A 01 07 90 00                ?..........
> >
> > ======================================================================
> >
> > 2011-01-05 12:26:07.175 [pkcs15-tool] card.c:329:sc_unlock: called
> >
> > 2011-01-05 12:26:07.175 [pkcs15-tool]
> > card-myeid.c:240:myeid_process_fci: called
> >
> >
> >
> > 2011-01-05 12:26:07.191 [pkcs15-tool]
> > iso7816.c:304:iso7816_process_fci: processing FCI bytes
> >
> > 2011-01-05 12:26:07.191 [pkcs15-tool]
> > iso7816.c:309:iso7816_process_fci:   file identifier: 0x5032
> >
> > 2011-01-05 12:26:07.191 [pkcs15-tool]
> > iso7816.c:316:iso7816_process_fci:   bytes in file: 70
> >
> > 2011-01-05 12:26:07.191 [pkcs15-tool]
> > iso7816.c:335:iso7816_process_fci:   shareable: no
> >
> > 2011-01-05 12:26:07.191 [pkcs15-tool]
> > iso7816.c:355:iso7816_process_fci:   type: working EF
> >
> > 2011-01-05 12:26:07.206 [pkcs15-tool]
> > iso7816.c:357:iso7816_process_fci:   EF structure: 1
> >
> > 2011-01-05 12:26:07.206 [pkcs15-tool]
> > card-myeid.c:256:myeid_process_fci: id (5032) sec_attr (3 3F FF)
> >
> > 2011-01-05 12:26:07.206 [pkcs15-tool]
> > card-myeid.c:269:myeid_process_fci: File id (5032) status
> > SC_FILE_STATUS_ACTIVATED (0x7)
> >
> > 2011-01-05 12:26:07.222 [pkcs15-tool]
> > card-myeid.c:274:myeid_process_fci: returning with: 0 (Success)
> >
> > 2011-01-05 12:26:07.222 [pkcs15-tool]
> > card-myeid.c:208:myeid_select_file: returning with: 0 (Success)
> >
> > 2011-01-05 12:26:07.222 [pkcs15-tool] card.c:569:sc_select_file:
> > returning with: 0 (Success)
> >
> > 2011-01-05 12:26:07.222 [pkcs15-tool] card.c:416:sc_read_binary:
> > called; 70 bytes at index 0
> >
> > 2011-01-05 12:26:07.222 [pkcs15-tool] apdu.c:527:sc_transmit_apdu:
> > called
> >
> > 2011-01-05 12:26:07.238 [pkcs15-tool] card.c:295:sc_lock: called
> >
> > 2011-01-05 12:26:07.238 [pkcs15-tool] reader-pcsc.c:242:pcsc_transmit:
> > reader 'O2 O2Micro CCID SC Reader 0'
> >
> > 2011-01-05 12:26:07.238 [pkcs15-tool] apdu.c:187:sc_apdu_log:
> >
> > Outgoing APDU data [    5 bytes] =====================================
> >
> > 00 B0 00 00 46 ....F
> >
> > ======================================================================
> >
> > 2011-01-05 12:26:07.238 [pkcs15-tool]
> > reader-pcsc.c:175:pcsc_internal_transmit:
> >
> > called
> >
> > 2011-01-05 12:26:07.285 [pkcs15-tool] apdu.c:187:sc_apdu_log:
> >
> > Incoming APDU data [   72 bytes] =====================================
> >
> > 30 44 02 01 00 04 0A 18 99 90 65 01 02 93 90 98 0D........e.....
> >
> > 85 0C 0A 41 76 65 6E 74 72 61 20 4F 79 80 13 41 ...Aventra Oy..A
> >
> > 63 74 69 76 65 50 65 72 73 6F 20 4D 61 6E 61 67 ctivePerso Manag
> >
> > 65 72 03 02 04 10 A2 0E 30 0C 02 01 00 02 01 00 er......0.......
> >
> > 05 00 03 02 00 45 90 00                         .....E..
> >
> > ======================================================================
> >
> > 2011-01-05 12:26:07.300 [pkcs15-tool] card.c:329:sc_unlock: called
> >
> > 2011-01-05 12:26:07.300 [pkcs15-tool]
> > iso7816.c:135:iso7816_read_binary: returning with: 70
> >
> > 2011-01-05 12:26:07.316 [pkcs15-tool] card.c:447:sc_read_binary:
> > returning with: 70
> >
> > 2011-01-05 12:26:07.316 [pkcs15-tool]
> > pkcs15.c:148:sc_pkcs15_parse_tokeninfo: ASN.1 parsing of EF(TokenInfo)
> > failed: Required ASN.1 object not found
> >
> > 2011-01-05 12:26:07.316 [pkcs15-tool]
> > pkcs15-syn.c:124:sc_pkcs15_bind_synthetic: called
> >
> >
> >
> >
> >
> > ASN.1 parsing log:
> >
> >
> >
> > 2011-01-05 13:47:10.744 [pkcs15-tool]
> > card-myeid.c:256:myeid_process_fci: id (5032) sec_attr (3 3F FF)
> >
> > 2011-01-05 13:47:10.744 [pkcs15-tool]
> > card-myeid.c:269:myeid_process_fci: File id (5032) status
> > SC_FILE_STATUS_ACTIVATED (0x7)
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool]
> > card-myeid.c:274:myeid_process_fci: returning with: 0 (Success)
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool]
> > card-myeid.c:208:myeid_select_file: returning with: 0 (Success)
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool] card.c:569:sc_select_file:
> > returning with: 0 (Success)
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool] card.c:416:sc_read_binary:
> > called; 70 bytes at index 0
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool] apdu.c:527:sc_transmit_apdu:
> > called
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool] card.c:295:sc_lock: called
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool] reader-pcsc.c:242:pcsc_transmit:
> > reader 'O2 O2Micro CCID SC Reader 0'
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool] apdu.c:187:sc_apdu_log:
> >
> > Outgoing APDU data [    5 bytes] =====================================
> >
> > 00 B0 00 00 46 ....F
> >
> > ======================================================================
> >
> > 2011-01-05 13:47:10.760 [pkcs15-tool]
> > reader-pcsc.c:175:pcsc_internal_transmit: called
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] apdu.c:187:sc_apdu_log:
> >
> > Incoming APDU data [   72 bytes] =====================================
> >
> > 30 44 02 01 00 04 0A 18 99 90 65 01 02 93 90 98 0D........e.....
> >
> > 85 0C 0A 41 76 65 6E 74 72 61 20 4F 79 80 13 41 ...Aventra Oy..A
> >
> > 63 74 69 76 65 50 65 72 73 6F 20 4D 61 6E 61 67 ctivePerso Manag
> >
> > 65 72 03 02 04 10 A2 0E 30 0C 02 01 00 02 01 00 er......0.......
> >
> > 05 00 03 02 00 45 90 00                         .....E..
> >
> > ======================================================================
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] card.c:329:sc_unlock: called
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool]
> > iso7816.c:135:iso7816_read_binary: returning with: 70
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] card.c:447:sc_read_binary:
> > returning with: 70
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1224:asn1_decode: called,
> > left=70, depth 0
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'TokenInfo', tag 0x1000010
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'TokenInfo'
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1224:asn1_decode:
> > called, left=68, depth 1
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'version', tag 0x2
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'version'
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1064:asn1_decode_entry:
> > decoding 'version' returned 0
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'serialNumber', tag 0x4, OPTIONAL
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'serialNumber'
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'manufacturerID', tag 0xc, OPTIONAL
> >
> > 2011-01-05 13:47:10.791 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'manufacturerID'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'label', tag 0x20000000, OPTIONAL
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'label'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'label-tw', tag 0x21000000, OPTIONAL
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1262:asn1_decode: not
> > present
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'tokenflags', tag 0x3
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'tokenflags'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'seInfo', tag 0x1000010, OPTIONAL
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1262:asn1_decode: not
> > present
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'recordInfo', tag 0x21000001, OPTIONAL
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1262:asn1_decode: not
> > present
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'supportedAlgorithms', tag 0x21000002, OPTIONAL
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'supportedAlgorithms'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1224:asn1_decode:
> > called, left=14, depth 2
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'algorithmInfo', tag 0x1000010, OPTIONAL
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'algorithmInfo'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1224:asn1_decode:
> > called, left=12, depth 3
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'reference', tag 0x2
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'reference'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1064:asn1_decode_entry:
> > decoding 'reference' returned 0
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'algorithmPKCS#11', tag 0x2
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'algorithmPKCS#11'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1064:asn1_decode_entry:
> > decoding 'algorithmPKCS#11' returned 0
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'parameters', tag 0x5
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'parameters'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'supportedOperations', tag 0x3
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1040:asn1_decode_entry:
> > decoding 'supportedOperations'
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1248:asn1_decode: Looking
> > for 'objId', tag 0x6
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1262:asn1_decode: not
> > present
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1267:asn1_decode:
> > mandatory ASN.1 object 'objId' not found
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1279:asn1_decode:
> > returning with: -1402 (Required ASN.1 object not found)
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1205:asn1_decode_entry:
> > decoding of ASN.1 object 'algorithmInfo' failed: Required ASN.1 object
> > not found
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1205:asn1_decode_entry:
> > decoding of ASN.1 object 'supportedAlgorithms' failed: Required ASN.1
> > object not found
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool] asn1.c:1205:asn1_decode_entry:
> > decoding of ASN.1 object 'TokenInfo' failed: Required ASN.1 object not
> > found
> >
> > 2011-01-05 13:47:10.807 [pkcs15-tool]
> > pkcs15.c:148:sc_pkcs15_parse_tokeninfo: ASN.1 parsing of EF(TokenInfo)
> > failed: Required ASN.1 object not found
> >
> >
> > _______________________________________________
> > opensc-devel mailing list
> > opensc-devel@lists.opensc-project.org
> > http://www.opensc-project.org/mailman/listinfo/opensc-devel

Attachment: tokenInfo.patch
Description: Binary data

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to