Can initialize PKCS15 card, but not store a pin?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Can initialize PKCS15 card, but not store a pin?

Geoffrey Elgey-2
G'day,

It's been a while since I used a PKCS#15 card, but I'm getting a problem
and I'm probably forgetting something fundamental.

I'm using opensc-20050524 and a Cryptoflex 32K card, on SuSE 9.2.

I can use pkcs15-init to erase the card and initialize it, and
opensc-explorer to list the contents of the card, but when I try to
store a pin on the card, I get an error message indicating "wrong card".

Debug log shows that APDU can be sent to the card and a response received:

card.c:734:sc_select_file: called; type=2, path=3f0050155031
card-flex.c:580:flex_select_file: called, cached path=3f005015
card-flex.c:525:select_file_id: called, p1=0, path=5031
card.c:247:sc_transmit_apdu: called
card.c:214:sc_transceive: Sending 8 bytes (resp. 258 bytes):
C0 A4 00 00 02 50 31 FC .....P1.
card.c:267:sc_transmit_apdu: Received 0 bytes (SW1=61 SW2=0F)
card.c:247:sc_transmit_apdu: called
card.c:214:sc_transceive: Sending 5 bytes (resp. 258 bytes):
C0 C0 00 00 0F .....
card.c:267:sc_transmit_apdu: Received 15 bytes (SW1=90 SW2=00)
00 00 01 00 50 31 01 FC 00 00 00 01 01 00 00 ....P1.........
iso7816.c:591:iso7816_get_response: returning with: 15
card-flex.c:621:flex_select_file: returning with: 0
card.c:756:sc_select_file: returning with: 0

except for the following time:

card.c:606:sc_read_binary: called; 256 bytes at index 0
card.c:606:sc_read_binary: called; 252 bytes at index 0
card.c:247:sc_transmit_apdu: called
card.c:214:sc_transceive: Sending 5 bytes (resp. 258 bytes):
C0 B0 00 00 FC .....
card.c:221:sc_transceive: Unable to transmit: Transmit failed
card.c:256:sc_transmit_apdu: transceive() failed: Transmit failed
iso7816.c:121:iso7816_read_binary: APDU transmit failed: Transmit failed
card.c:637:sc_read_binary: returning with: Transmit failed
card.c:622:sc_read_binary: sc_read_binary() failed: Transmit failed

Can anyone explain to me what is going wrong, and how I fix it?

-- Geoff
_______________________________________________
opensc-user mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-user
Reply | Threaded
Open this post in threaded view
|

Re: Can initialize PKCS15 card, but not store a pin?

Stef Hoeben
Hi,

could you try setting SC_APDU_CHOP_SIZE in src/libopensc/opensc.h
to a value of 240, then rebuild, and see if that solves the problem?

Cheers,
Stef

Geoffrey Elgey wrote:

> G'day,
>
> It's been a while since I used a PKCS#15 card, but I'm getting a problem
> and I'm probably forgetting something fundamental.
>
> I'm using opensc-20050524 and a Cryptoflex 32K card, on SuSE 9.2.
>
> I can use pkcs15-init to erase the card and initialize it, and
> opensc-explorer to list the contents of the card, but when I try to
> store a pin on the card, I get an error message indicating "wrong card".
>
> Debug log shows that APDU can be sent to the card and a response
> received:
>
> card.c:734:sc_select_file: called; type=2, path=3f0050155031
> card-flex.c:580:flex_select_file: called, cached path=3f005015
> card-flex.c:525:select_file_id: called, p1=0, path=5031
> card.c:247:sc_transmit_apdu: called
> card.c:214:sc_transceive: Sending 8 bytes (resp. 258 bytes):
> C0 A4 00 00 02 50 31 FC .....P1.
> card.c:267:sc_transmit_apdu: Received 0 bytes (SW1=61 SW2=0F)
> card.c:247:sc_transmit_apdu: called
> card.c:214:sc_transceive: Sending 5 bytes (resp. 258 bytes):
> C0 C0 00 00 0F .....
> card.c:267:sc_transmit_apdu: Received 15 bytes (SW1=90 SW2=00)
> 00 00 01 00 50 31 01 FC 00 00 00 01 01 00 00 ....P1.........
> iso7816.c:591:iso7816_get_response: returning with: 15
> card-flex.c:621:flex_select_file: returning with: 0
> card.c:756:sc_select_file: returning with: 0
>
> except for the following time:
>
> card.c:606:sc_read_binary: called; 256 bytes at index 0
> card.c:606:sc_read_binary: called; 252 bytes at index 0
> card.c:247:sc_transmit_apdu: called
> card.c:214:sc_transceive: Sending 5 bytes (resp. 258 bytes):
> C0 B0 00 00 FC .....
> card.c:221:sc_transceive: Unable to transmit: Transmit failed
> card.c:256:sc_transmit_apdu: transceive() failed: Transmit failed
> iso7816.c:121:iso7816_read_binary: APDU transmit failed: Transmit failed
> card.c:637:sc_read_binary: returning with: Transmit failed
> card.c:622:sc_read_binary: sc_read_binary() failed: Transmit failed
>
> Can anyone explain to me what is going wrong, and how I fix it?
>
> -- Geoff
> _______________________________________________
> opensc-user mailing list
> [hidden email]
> http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-user
>

_______________________________________________
opensc-user mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-user