>As far as I can tell the only way for this to happen is either a really screwed up 
>driver/API, or a problem with the card.  

It is not a problem with the card. If you want to confirm, use the passthru card 
service and talk to the card using APDUs. 

I think I rectified this problem with the help of one of the developers. Unfortunately 
he has left Gemplus. If I find the rectified version of the card services, I will 
forward it to the list.
----------
When one find's oneself in a hole of one's own making, it is a good time to examine 
the quality of the workmanship.
- John Renmerde



-----Original Message-----
From: Sean Graham [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 14, 2001 12:53 AM
To: [EMAIL PROTECTED]
Subject: Re: [OCF] crazy problem writing files and verifying



  Well I solved it.  Short answer : the cards are physically bad.

  I have come up with an easier way to show this too.  Here's what the sample program 
does:

  - provides credentials
  - erases card
  - creates a DF and an EF of 1979 bytes (a prime number)
  - initializes a 1979 byte array in memory, writing 0x80 through 0xFF to the first 
128 bytes, and leaving the rest of them zeros.
  - writes this array to the card
  - reads from the card and compares to what it told the card to write.

  [drumroll]

  And the result is below (you'll have to disable word wrap to see it properly, or 
copy it to notepad)

  the short : bytes are being duplicated throughout the card, but only after a write 
operation has occurred.  For example, if I write the first 128 bytes of the array and 
read the entire 1979 bytes from the file, I will get exactly what you'd expect:  0x80 
though 0xFF and the rest zeros.  But if I write zeros to the range offset 296 through 
383 and then read that data in again I will not get zeros in return, but 0xA8 through 
0xFF as shown below.

  As far as I can tell the only way for this to happen is either a really screwed up 
driver/API, or a problem with the card.  Unfortunately I do not have any other types 
of cards to try (I have 4 of these GPK8000 which all give the same results).

  Does anyone know why this happens, or have had something similar happen too?

  As far as I can tell these are sample cards...

  -- Sean










  Erase Card

  Creating DF :3F00:D000
  Creating 1979 byte EF :3F00:D000:D001
  Reading Certificate from disk...
  Writing 1979 bytes of data to :3F00:D000:D001....
  Reading data.
  Verifying data:
        ------Read Data--------------------------------       ------Original 
Data----------------------------
  0000: 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F  ---  80 81 82 83 84 85 86 87 
88 89 8A 8B 8C 8D 8E 8F
  0016: 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F  ---  90 91 92 93 94 95 96 97 
98 99 9A 9B 9C 9D 9E 9F
  0032: A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF  ---  A0 A1 A2 A3 A4 A5 A6 A7 
A8 A9 AA AB AC AD AE AF
  0048: B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF  ---  B0 B1 B2 B3 B4 B5 B6 B7 
B8 B9 BA BB BC BD BE BF
  0064: C0 C1 C2 C3 C4 C5 C6 C7 C8 C9 CA CB CC CD CE CF  ---  C0 C1 C2 C3 C4 C5 C6 C7 
C8 C9 CA CB CC CD CE CF
  0080: D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB DC DD DE DF  ---  D0 D1 D2 D3 D4 D5 D6 D7 
D8 D9 DA DB DC DD DE DF
  0096: E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF  ---  E0 E1 E2 E3 E4 E5 E6 E7 
E8 E9 EA EB EC ED EE EF
  0112: F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF  ---  F0 F1 F2 F3 F4 F5 F6 F7 
F8 F9 FA FB FC FD FE FF
  0128: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0144: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0176: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0192: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0208: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0224: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0256: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0272: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0288: 00 00 00 00 00 00 00 00 A8*A9*AA*AB*AC*AD*AE*AF* ---  00 00 00 00 00 00 00 00 
00*00*00*00*00*00*00*00*
  0304: B0*B1*B2*B3*B4*B5*B6*B7*B8*B9*BA*BB*BC*BD*BE*BF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0320: C0*C1*C2*C3*C4*C5*C6*C7*C8*C9*CA*CB*CC*CD*CE*CF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0336: D0*D1*D2*D3*D4*D5*D6*D7*D8*D9*DA*DB*DC*DD*DE*DF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0352: E0*E1*E2*E3*E4*E5*E6*E7*E8*E9*EA*EB*EC*ED*EE*EF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0368: F0*F1*F2*F3*F4*F5*F6*F7*F8*F9*FA*FB*FC*FD*FE*FF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0384: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0416: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0432: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0448: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0464: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0496: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0512: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0528: 00 00 00 00 00 00 00 00 98*99*9A*9B*9C*9D*9E*9F* ---  00 00 00 00 00 00 00 00 
00*00*00*00*00*00*00*00*
  0544: A0*A1*A2*A3*A4*A5*A6*A7*A8*A9*AA*AB*AC*AD*AE*AF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0560: B0*B1*B2*B3*B4*B5*B6*B7*B8*B9*BA*BB*BC*BD*BE*BF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0576: C0*C1*C2*C3*C4*C5*C6*C7*C8*C9*CA*CB*CC*CD*CE*CF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0592: D0*D1*D2*D3*D4*D5*D6*D7*D8*D9*DA*DB*DC*DD*DE*DF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0608: E0*E1*E2*E3*E4*E5*E6*E7*E8*E9*EA*EB*EC*ED*EE*EF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0624: F0*F1*F2*F3*F4*F5*F6*F7*F8*F9*FA*FB*FC*FD*FE*FF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0640: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0656: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0672: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0688: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0704: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0720: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0736: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0752: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0768: 00 00 00 00 00 00 00 00 88*89*8A*8B*8C*8D*8E*8F* ---  00 00 00 00 00 00 00 00 
00*00*00*00*00*00*00*00*
  0784: 90*91*92*93*94*95*96*97*98*99*9A*9B*9C*9D*9E*9F* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0800: A0*A1*A2*A3*A4*A5*A6*A7*A8*A9*AA*AB*AC*AD*AE*AF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0816: B0*B1*B2*B3*B4*B5*B6*B7*B8*B9*BA*BB*BC*BD*BE*BF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0832: C0*C1*C2*C3*C4*C5*C6*C7*C8*C9*CA*CB*CC*CD*CE*CF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0848: D0*D1*D2*D3*D4*D5*D6*D7*D8*D9*DA*DB*DC*DD*DE*DF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0864: E0*E1*E2*E3*E4*E5*E6*E7*E8*E9*EA*EB*EC*ED*EE*EF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0880: F0*F1*F2*F3*F4*F5*F6*F7*F8*F9*FA*FB*FC*FD*FE*FF* ---  
00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*00*
  0896: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0912: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0928: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0944: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0960: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0976: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  0992: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  1008: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  1024: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  1040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00
  1056: 00 00 00 00 00 00 00 00 00 00 00 00 AC*AD*AE*AF* ---  00 00 00 00 00 00 00 00 
00 00 00 00 00*00*00*00*
  1072: B0*B1*B2*B3*B4*B5*B6*B7*00 00 00 00 00 00 00 00  ---  
00*00*00*00*00*00*00*00*00 00 00 00 00 00 00 00
  1088: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ---  00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00

  <------------snip--------------->
  Bytes 1104 through 1979 are zeros. --- > Visit the OpenCard web site at 
http://www.opencard.org/ for more > information on OpenCard---binaries, source code, 
documents. > This list is being archived at http://www.opencard.org/archive/opencard/ 
! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email ! to ! 
[EMAIL PROTECTED] ! containing the word ! unsubscribe ! in the body. 




---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
!                           [EMAIL PROTECTED]
! containing the word
!                           unsubscribe 
! in the body.

Reply via email to