Xcd pg

414 views
294 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
414
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Xcd pg

  1. 1. SMART-CARD Smart-!"#$% 30 2001
  2. 2. @ A ?DDKO C$>FGHD# "$CHMI!# $L!"?D!H QFD>T!O (% "#!PH @NK>? ), %U$C@V!U %C!D?G!AH">! N?EMFI?HGFW J!JP!$#H>F xcdata.dll. M!%$C!#"@ DH$JU$C!G?@ "LM?%$AD?@ !DQ$MG?T!@, "%HCHD!@ $ %$NG$IDKU $S!J>?U,%$ND!>?WV!U LM! M?J$#H QFD>T!O.DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 2 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  3. 3. EP?%PHD!H1. C@DC@EFCGF HGHIGJKFLG XCDATA.DLL.............................................................................. 42. JHOGF PFQFCGR ........................................................................................................................... 43. J G @CGF STCLUGV HGHIGJKFLG XCDATA.DLL............................................................ 6 3.1. STCLUGR CHECKACCESSCARD ..................................................................................................... 6 3.2. STCLUGR CONNECTSAMCARD ..................................................................................................... 7 3.3. STCLUGR CONNECTUSERCARD ..................................................................................................... 7 3.4. STCLUGR CLOSECARD ................................................................................................................... 8 3.5. STCLUGR GETCARDSTAT............................................................................................................... 8 3.6. STCLUGR GETCHALLENGE ............................................................................................................ 8 3.7. STCLUGR SELECTFILEINCARD ...................................................................................................... 9 3.8. STCLUGR READFILERECORD....................................................................................................... 10 3.9. STCLUGR UPDATEFILERECORD................................................................................................... 10 3.10. STCLUGR STATICAUTH ............................................................................................................ 11 3.11. STCLUGR EXTERNALAUTH ...................................................................................................... 12 3.12. STCLUGR INTERNALAUTH........................................................................................................ 12 3.13. STCLUGR DEBITTRANSACTION ................................................................................................ 13 3.14. STCLUGR CREDITTRANSACTION ............................................................................................. 15 3.15. STCLUGR GETMAXAMOUNT .................................................................................................... 164. GIJeFCGR................................................................................................................................... 17 4.1. JJHOFCGR JH JfGHL@g........................................................................................................... 17 4.2. G F PhDJP@ STCLUGV JQTIR GD Ji @ h (BORLAND C++ V.5.01) ....................... 20 4.3. PD@G J PRDn STCLUGV JQTIR XCDATA.DLL......................................................................... 29DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 3 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  4. 4. 1. C ? xcdata.dll $CFPB - C!D?G!AH">! N?EMFI?HG?@ J!JP!$#H>? xcdata.dll - LMHCD?ND?AHD CP@$ME?D!N?T!! LFD>#? L$L$PDHD!@ >$SHPB>$% >?M#K L$PBN$%?#HP@ D? $"D$%HLHM"$D?PBD$E$ >$GLBW#HM?. "L$PDHD!H G$CFP@ % %!CH "#?DC?M#D$O C!D?G!AH">! N?EMFI?HG$O J!JP!$#H>!Windows L$N%$P@H# !"L$PBN$%?#B H` !N "?GKU M?NDKU LM!P$IHD!O ! "!"#HGLM$EM?GG!M$%?D!@, D?A!D?@ $# FoxPro, Visual Basic >$DA?@ Delphi ! ++ Builder.2. J o ?J$M QFD>T!O C!D?G!AH">! N?EMFI?HG$O J!JP!$#H>! xcdata.dll %>PWA?H#: EMFLLFQFD>T!O, LMHCD?ND?AHDDKU CP@ ?F#HD#!Q!>?T!! >?M# L$PBN$%?#HPHO, EMFLLFQFD>T!O CP@ M?J$#K " jPH>#M$DDKG >$SHPB>$G ! M?NP!ADKH %"L$G$E?#HPBDKHQFD>T!!.kFD>T!!, %U$C@V!H % G$CFPB xcdata.dll, MH?P!N$%?DK D? @NK>?U LM$EM?GG!M$%?D!@ , C++. H$JU$C!G$H $J$MFC$%?D!H:• l$GLBW#HM IBM PC (486 ! %KSH), !GHWV!O "%$J$CDKH L$"PHC$%?#HPBDKH L$M#K;• Smart->?M#K: >?M#? C$"#FL?, >?M#? L$PBN$%?#HP@, SAM->?M#? (Secure Application Module);• A!#K%?#HPB smart->?M# $CD$E$ !N "PHCFWV!U #!L$%: SCR-60, Reflex 60, Reflex 72 (Schlumberger), TOWITOKO ChipDrive. H$JU$C!G$H LM$EM?GGD$H $JH"LHAHD!H:• LHM?T!$DD?@ "!"#HG? MS Windows 9x, NT;• CT API CP@ "A!#K%?#HPHO TOWITOKO ChipDrive ! Schlumberger Reflex 72;• k?OP " >PWA$G v /v l CA_ID.KEY. "#?D$%>? G$CFP@ xcdata.dll $"FVH"#%P@H#"@ LM$"#KG HE$ >$L!M$%?D!HG %"$$#%H#"#%FWV!O >?#?P$E (SYSTEM, SYSTEM32) "!"#HGK Windows. N?!G$CHO"#%!H QFD>T!O G$CFP@ xcdata.dll LM!%HCHD$ D? M!"FD>H % LM!P$IHD!!L.4.3. G ? > smart- > J ? >r C ? >r q C ? $PBN$- >r >r / C$"#FL? SAM %?#HP@ >? s A r >? s A r 1 CheckAccessCard + - - - 2 ConnectSAMCard - + - - CloseCard 3 ConnectUserCard - - + - CloseCardDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 4 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  5. 5. - + - ConnectSAMCard/ 4 GetChallenge - + ConnectUserCard - + - ConnectSAMCard/ 5 SelectFileInCard - + ConnectUserCard + CheckAccessCard, 6 StaticAuth - + - ConnectSAMCard/ - + ConnectUserCard - + + ConnectSAMCard, 7 ExternalAuth ConnectUserCard - + + ConnectSAMCard, 8 InternalAuth ConnectUserCard - + - ConnectSAMCard/ 9 ReadFileRecord - + ConnectUserCard, SelectFileInCard - + + ConnectSAMCard, ConnectUserCard, 10 UpdateFileRecord ExternalAuth, InternalAuth SelectFileInCard + CheckAccessCard, StaticAuth + ConnectSAMCard, 11 DebitTransaction + ConnectUserCard, ExternalAuth, InternalAuth, + CheckAccessCard, StaticAuth + ConnectSAMCard, 12 CreditTransaction + ConnectUserCard, ExternalAuth, InternalAuth + + ConnectSAMCard, 13 GetMaxAmount ConnectUserCard 14 CloseCard $EF# %KL$PD@#B"@ L$"PH PWJ$O !N %KSHLHMHA!"PHDDKU QFD>T!O 15 GetCardStatDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 5 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  6. 6. 3. J s A r xcdata.dll 3.1. S A CheckAccessCard !": CheckAccessCard #" !": kFD>T!@ LM$%HM@H# D?P!A!H % "A!#K%?#HPH >?M#K C$"#FL?. "P! $D? LM!"F#"#%FH#, #$ HO LMHC}@%P@H#"@ F>?N?DDKO PIN->$C ! " >?M#K C$"#FL? "A!#K%?H#"@ H` "HM!ODKO D$GHM. kFD>T!@ #?>IH $LMHCHP@H# D?P!A!H Q?OP? " $#>MK#KG >PWA$G v /v l (CA_ID.KEY) !, H"P! $D $JD?MFIHD, #$ LM$!N%$C!#"@ HE$ «L$C>PWAHD!H» > G$CFPW. $%!&"# !": HMHC N?%HMSHD!HG >$GGFD!>?T!$DDKO L$M# ("A!#K%?#HPB) $"%$J$IC?H#"@.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H >?M#K C$"#FL? ! Q?OP? " >PWA?G! THD#M? LP?#`ID$O "!"#HGK..! / 0(!(: #include "xCData.h" int CheckAccessCard(char *Port, short ReaderType, char *IccNo, char *KeyFile, char *PIN))12*3 4" 3 4": Port – F>?N?#HPB D? "#M$>F "$CHMI?VFW !G@ >$GGFD!>?T!$DD$E$ L$M#? (D?LM!GHM COM1, COM2, COM3, COM4). ReaderType – THP$H A!"P$, F>?NK%?WVHH #!L "A!#K%?#HP@. $CCHMI!%?W#"@ 4 #!L? "A!#K%?#HPHO: „ L.L. M$!N%$C!#HPB / ?N%?D!H ReaderType 1 Schlumberger / SCR 60 0 2 Schlumberger / Reflex 60 1 3 TOWITOKO / ChipDrive 2 4 Schlumberger / Reflex 72 3 KeyFile – F>?N?#HPB D? "#M$>F, "$CHMI?VFW LF#B ! !G@ Q?OP? " >PWA?G! THD#M? LP?#`ID$O "!"#HGK CA_ID.KEY, >$#$MKO !"L$PBNFH#"@ CP@ L$PFAHD!@ $#>MK#$E$ >PWA? THD#M? "!"#HGK. PIN – F>?N?#HPB D? "#M$>F, "$CHMI?VFW PIN–>$C >?M#K C$"#FL?. PIN– >$C G$IH# "$"#$@#B $# 4 C$ 8 CH"@#!ADKU T!QM.142*3 4" 3 4": IccNo – F>?N?#HPB D? JFQHM ("#M$>F), % >$#$M$G JFCH# %$N%M?V`D "HM!ODKO D$GHM >?M#K C$"#FL?. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 33 J?O#$%.1* % 5 "&*" #" !": 1 – % "PFA?H F"LHSD$E$ N?%HMSHD!@ LM$EM?GGK, !D?AH $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$> L.4.1).$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 6 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  7. 7. 3.2. S A ConnectSAMCard !": ConnectSAMCard #" !": kFD>T!@ LM$%HM@H# D?P!A!H % "A!#K%?#HPH SAM >?M#K. "P! >?M#? LM!"F#"#%FH#, #$ $D? "#?D$%!#"@ C$"#FLD$O CP@ CMFE!U QFD>T!O.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K..! / 0(!(: #include "xCData.h" HANDLE ConnectSAMCard (char *Port, short ReaderType)12*3 4" 3 4": Port – F>?N?#HPB D? "#M$>F, "$CHMI?VFW !G@ >$GGFD!>?T!$DD$E$ L$M#? ("G. L.3.1). ReaderType – THP$H A!"P$, F>?NK%?WVHH #!L "A!#K%?#HP@ ("G. L.3.1).1* % 5 "&*" #" !": HANDLE (CH">M!L#$M, P$E!AH">!O D$GHM, "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ SAM->?M#?) – LM! F"LHSD$G N?%HMSHD!! LM$EM?GGK, !D?AH $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$> % L.4.1) M!GHA?D!H. HMHC $JM?VHD!HG > QFD>T!! ConnectSAMCard DH$JU$C!G$ LMHC%?M!#HPBD$ FC$"#$%HM!#B"@, A#$ >$GGFD!>?T!$DDKO L$M# DH JKP M?DHH $#>MK# CP@ M?J$#K " CMFE$O >?M#$O ("G. L.3.4).C9% !#" !+: H$JU$C!G$ "$JPWCHD!@ "#M$E$E$ "$$#%H#"#%!@ #!L? "A!#K%?#HP@ (ReaderType) " MH?PBDKG "A!#K%?#HPHG, L$C>PWA`DDKG > C?DD$GF L$"PHC$%?#HPBD$GF L$M#F. H"$JPWCHD!H j#$E$ $EM?D!AHD!@ LM!%$C!# > DHLMHC">?NFHGKG MHNFPB#?#?G.$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.3. S A ConnectUserCard !": ConnectUserCard #" !": kFD>T!@ LM$%HM@H# D?P!A!H % "A!#K%?#HPH >?M#K L$PBN$%?#HP@. "P! >?M#? LM!"F#"#%FH#, #$ $D? "#?D$%!#"@ C$"#FLD$O CP@ CMFE!U QFD>T!O.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H >?M#K L$PBN$%?#HP@..! / 0(!(: #include "xCData.h" HANDLE ConnectUserCard (char *Port, short ReaderType)12*3 4" 3 4": Port – F>?N?#HPB D? "#M$>F, "$CHMI?VFW !G@ >$GGFD!>?T!$DD$E$ L$M#? ("G. L.3.1). ReaderType – THP$H A!"P$, F>?NK%?WVHH #!L "A!#K%?#HP@ ("G. L.3.1).1* % 5 "&*" #" !": HANDLE (CH">M!L#$M, P$E!AH">!O D$GHM, "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#? L$PBN$%?#HP@) – H"P! F"LHSD$H N?%HMSHD!H LM$EM?GGK, !D?AH $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$> % L.4.1). M!GHA?D!H. HMHC $JM?VHD!HG > QFD>T!! ConnectUserCard DH$JU$C!G$ LMHC%?M!#HPBD$ FC$"#$%HM!#B"@, A#$ >$GGFD!>?T!$DDKO L$M# DH JKP M?DHH $#>MK# CP@ M?J$#K " CMFE$O >?M#$O ("G. L.3.4).DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 7 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  8. 8. C9% !#" !+: H$JU$C!G$ "$JPWCHD!@ "#M$E$E$ "$$#%H#"#%!@ #!L? "A!#K%?#HP@ (ReaderType) " MH?PBDKG "A!#K%?#HPHG, L$C>PWA`DDKG > C?DD$GF L$"PHC$%?#HPBD$GF L$M#F. H"$JPWCHD!H j#$E$ $EM?D!AHD!@ LM!%$C!# > DHLMHC">?NFHGKG MHNFPB#?#?G.$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.4. S A CloseCard !": CloseCard #" !": kFD>T!@ N?%HMS?H# M?J$#F " >?M#$O, %"#?%PHDD$O % "A!#K%?#HPB, N?>MK%?H# ! $"%$J$IC?H# L$M#.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H PWJ$O !N %KSHLHMHA!"PHDDKU smart->?M#..! / 0(!(: #include "xCData.h" BOOL CloseCard (HANDLE hcd)12*3 4" 3 4": hcd – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#?.1* % 5 "&*" #" !": True, H"P! F"LHSD$H N?%HMSHD!H LM$EM?GGK, !D?AH – False.$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.5. S A GetCardStat !": GetCardStat #" !": "$$#%H#"#%!! "$ ND?AHD!HG >$C? $S!J>! QFD>T!@ %KC?H# M?"S!MHDD$H "$$JVHD!H $J $S!J>H. ?DD?@ QFD>T!@ G$IH# JK#B !"L$PBN$%?D? L$"PH PWJ$O QFD>T!! G$CFP@ CP@ C!?ED$"#!>! %KL$PDHD!@ $LHM?T!! % >?M#H.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H PWJ$O !N %KSHLHMHA!"PHDDKU smart->?M#..! / 0(!(: #include "xCData.h" void GetCardStat (char *msgbuf)12*3 4" 3 4": $#"F#"#%FW#.142*3 4" 3 4": msgbuf – F>?N?#HPB D? JFQHM ("#M$>F), % >$#$M$G JFCH# %$N%M?VHD$ "$$JVHD!H $J $S!J>H. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 80 J?O#.C9% !#" !+: kFD>T!@ C$PID? %KNK%?#B"@ DHL$"MHC"#%HDD$ N? QFD>T!HO, %KN%?%SHO $S!J>F % >?M#H, !D?AH %$N%M?V?HG$H "$$JVHD!H JFCH# "$CHMI?#B «GF"$M».$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.6. S A GetChallengeDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 8 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  9. 9. !": GetChallenge #" !": kFD>T!@ L$PFA?H# "PFA?OD$H A!"P$, Q$MG!MFHG$H >?M#$O, ! N?L!"K%?H# HE$ % JFQHM. ?>IH G$IH# JK#B !"L$PBN$%?D? CP@ $LMHCHPHD!@ D?P!A!@ >?M#K % "A!#K%?#HPH.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K !P! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! GetChallenge DH$JU$C!G$ LMHC%?M!#HPBD$ %KN%?#B QFD>T!W ConnectUserCard !P! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH)..! / 0(!(: #include "xCData.h" BOOL GetChallenge (HANDLE hcd, char *buf)12*3 4" 3 4": hcd – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#?.142*3 4" 3 4": buf - F>?N?#HPB D? JFQHM ("#M$>F), % >$#$M$G QFD>T!@ %$N%M?V?H# "PFA?ODFW L$"PHC$%?#HPBD$"#B % Q$MG?#H ASCII % SH"#D?CT?#HM!AD$G >$CH. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 17 J?O#.1* % 5 "&*" #" !": True, H"P! F"LHSD$H N?%HMSHD!H LM$EM?GGK, !D?AH – False. CD$O !N LM!A!D L$@%PHD!@ MHNFPB#?#? False G$IH# JK#B $#"F#"#%!H >?M#K % "A!#K%?#HPH.$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.7. S A SelectFileInCard !": SelectFileInCard #" !": kFD>T!@ LM$%HM@H# D?P!A!H % >?M#H F>?N?DD$E$ Q?OP?. "P! C?DDKO Q?OP LM!"F#"#%FH#, #$ $D CHP?H#"@ #H>FV!G.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K !P! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! SelectFileInCard DH$JU$C!G$ LMHC%?M!#HPBD$ %KN%?#B QFD>T!W ConnectUserCard !P! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH)..! / 0(!(: #include "xCData.h" BOOL SelectFileInCard (HANDLE hcd, char *FID)12*3 4" 3 4": hcd – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#?. FID – F>?N?#HPB D? "#M$>F, "$CHMI?VFW !CHD#!Q!>?#$M (!G@) Q?OP?.1* % 5 "&*" #" !": "PFA?H F"LHSD$E$ N?%HMSHD!@ LM$EM?GGK - True, !D?AH False, LM! j#$G M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat.$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 9 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  10. 10. 3.8. S A ReadFileRecord !": ReadFileRecord #" !": kFD>T!@ ReadFileRecord LM$%HM@H# D?P!A!H % >?M#H F>?N?DD$E$ Q?OP?. "P! C?DDKO Q?OP LM!"F#"#%FH#, #$ LM$!N%$C!#"@ A#HD!H !N DHE$ %KJM?DD$O N?L!"!.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K !P! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! ReadFileRecord DH$JU$C!G$ LMHC%?M!#HPBD$ %KN%?#B QFD>T!W ConnectUserCard !P! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH), ? #?>IH %KJM?#B "$$#%H#"#%FWV!O FM$%HDB % !HM?MU!! Q?OP$% " L$G$VBW QFD>T!! SelectFileInCard..! / 0(!(: #include "xCData.h" BOOL ReadFileRecord (HANDLE hcd, short rcNo, short len, char *buf)12*3 4" 3 4": hcd – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#?. rcNo – D$GHM N?L!"! CP@ A#HD!@, THP$H A!"P$. M!GHA?D!H: DFGHM?T!@ D?A!D?H#"@ " 1. len – CP!D? N?L!"! % J?O#?U, THP$H A!"P$. buf – F>?N?#HPB D? JFQHM ("#M$>?), % >$#$M$G JFCH# %$N%M?VHD? LM$A!#?DD?@ N?L!"B !N Q?OP?. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 2 * len + 1.1* % 5 "&*" #" !": True, H"P! F"LHSD$H N?%HMSHD!H LM$EM?GGK, !D?AH False. "PFA?H False, M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat.C9% !#" !+: $GHM N?L!"B (rcNo) ! CP!D? N?L!"! (len) DH G$EF# JK#B J$PBSH 255. lM$GH #$E$, j#! %HP!A!DK C$PIDK #$AD$ "$$#%H#"#%$%?#B "#MF>#FMH %KJM?DD$E$ Q?OP?.$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.9. S A UpdateFileRecord !": UpdateFileRecord #" !": kFD>T!@ UpdateFileRecord LM$%HM@H# D?P!A!H % >?M#H F>?N?DD$E$ Q?OP?. "P! C?DDKO Q?OP LM!"F#"#%FH#, #$ LM$!N%$C!#"@ N?GHD? %KJM?DD$O N?L!"!.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K !P! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! UpdateFileRecord DH$JU$C!G$ LMHC%?M!#HPBD$ %KN%?#B QFD>T!W ConnectUserCard !P! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH), ? #?>IH %KJM?#B "$$#%H#"#%FWV!O FM$%HDB % !HM?MU!! Q?OP$% " L$G$VBWDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 10 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  11. 11. QFD>T!! SelectFileInCard ! LMHC}@%!#B "$$#%H#"#%FWV!O >PWA. ?LM!GHM, CP@ N?GHDK N?L!"! % Q?OPH “8400” #MHJFH#"@ %KL$PD!#B %DHSDWW ! %DF#MHDDWW ?F#HD#!Q!>?T!W (QFD>T!! ExternalAuth ! InternalAuth)..! / 0(!(: #include "xCData.h" int UpdateFileRecord (HANDLE hcd, short rcNo, short len, char *buf)12*3 4" 3 4": hcd – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#?. rcNo – D$GHM N?L!"! CP@ A#HD!@, THP$H A!"P$. M!GHA?D!H: DFGHM?T!@ D?A!D?H#"@ " 1. len – CP!D? N?L!"! % J?O#?U, THP$H A!"P$. buf – F>?N?#HPB D? JFQHM ("#M$>?), % >$#$M$G D?U$C!#"@ N?L!"B CP@ N?GHDK (% Q$MG?#H ASCII).1* % 5 "&*" #" !": 1, H"P! F"LHSD$H N?%HMSHD!H LM$EM?GGK, !D?AH 0 ($S!J>? >?M#K) !P! $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$>). "PFA?H 0 M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat.C9% !#" !+: $GHM N?L!"B (rcNo) ! CP!D? N?L!"! (len) DH G$EF# JK#B J$PBSH 255. lM$GH #$E$, j#! %HP!A!DK C$PIDK #$AD$ "$$#%H#"#%$%?#B "#MF>#FMH %KJM?DD$E$ Q?OP?.$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.10. S A StaticAuth !": StaticAuth #" !": kFD>T!@ StaticAuth %KL$PD@H# "#?#!AH">FW ?F#HD#!Q!>?T!W >?M#K, >$#$M?@ %>PWA?H# LM$%HM>F %HMD$"#! "#?#!AH">!U C?DDKU D? >?M#H, LM!D?CPHID$"#B >?M#K C?DD$O "!"#HGH ! jG!#HD#F. ?DD?@ LM$%HM>? @%P@H#"@ «"!PBD$O», #.>., L$ "F#!, $"FVH"#%P@H#"@ LM$%HM>? T!QM$%$O L$CL!"!.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K !P! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! StaticAuth DH$JU$C!G$ LMHC%?M!#HPBD$ «L$C>PWA!#B» Q?OP " >PWA?G! v /v l (QFD>T!@ CheckAccessCard) ! %KN%?#B QFD>T!W ConnectUserCard !P! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH)..! / 0(!(: #include "xCData.h" int StaticAuth (HANDLE hcd)12*3 4" 3 4": hcd – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#?.1* % 5 "&*" #" !": 1 - F"LHSD$H N?%HMSHD!H LM$EM?GGK;DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 11 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  12. 12. 0 - $S!J>? >?M#K (M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat); $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$> % L.4.1).$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.11. S A ExternalAuth !": ExternalAuth #" !": kFD>T!@ ExternalAuth %KL$PD@H# %DHSDWW ?F#HD#!Q!>?T!W, >$#$M?@ $ND?A?H#, A#$ >?M#? L$PBN$%?#HP@ LM$%HM@H#, @%P@H#"@ P! >$MMH>#D$O SAM >?M#?. F#HD#!Q!>?T!@ LMHC"#?%P@H# "$J$O LM$%HM>F %HMD$"#! >PWAHO % SAM G$CFPH. D? @%P@H#"@ LM$%HM>$O MAC ND?AHD!@ L$PFAHDD$E$ LM! L$G$V! ?PE$M!#G? DES. ˆ#? LM$%HM>? @%P@H#"@ J$PHH "P?J$O, AHG LM$%HM>?, %KL$PD@HG?@ QFD>T!HO StaticAuth.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K ! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! ExternalAuth DH$JU$C!G$ LMHC%?M!#HPBD$ %KN%?#B QFD>T!! ConnectUserCard ! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH)..! / 0(!(: #include "xCData.h" BOOL ExternalAuth (HANDLE hcd_user, HANDLE hcd_SAM)12*3 4" 3 4": hcd_user – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#? L$PBN$%?#HP@. hcd_ SAM – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ SAM->?M#?.1* % 5 "&*" #" !": True, H"P! F"LHSD$H N?%HMSHD!H LM$EM?GGK, !D?AH False. "PFA?H False, M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat.C9% !#" !+: "P! >PWA! SAM >?M#K DH "$$#%H#"#%FW# >PWA?G >?M#K L$PBN$%?#HP@, #$ FGHDBS?H#"@ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? % >?M#H L$PBN$%?#HP@. M! !"AHML?D!! %"HU ($JKAD$ 3-U) L$LK#$> "$$#%H#"#%FWV!O >PWA JP$>!MFH#"@. "P! ?F#HD#!Q!>?T!@ LM$U$C!# F"LHSD$, #$ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? F"#?D?%P!%?H#"@ % G?>"!G?PBD$H ND?AHD!H ($JKAD$ 3).$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.12. S A InternalAuth !": InternalAuthDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 12 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  13. 13. #" !": kFD>T!@ InternalAuth %KL$PD@H# %DF#MHDDWW ?F#HD#!Q!>?T!W, >$#$M?@ $ND?A?H#, A#$ SAM >?M#? LM$%HM@H#, @%P@H#"@ P! >$MMH>#D$O >?M#? L$PBN$%?#HP@. F#HD#!Q!>?T!@ LMHC"#?%P@H# "$J$O LM$%HM>F %HMD$"#! >PWAHO >?M#K L$PBN$%?#HP@. D? @%P@H#"@ LM$%HM>$O MAC ND?AHD!@, L$PFAHDD$E$ LM! L$G$V! ?PE$M!#G? DES. ?DD?@ LM$%HM>? @%P@H#"@ J$PHH "P?J$O, AHG LM$%HM>?, %KL$PD@HG?@ QFD>T!HO StaticAuth.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K ! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! InternalAuth DH$JU$C!G$ LMHC%?M!#HPBD$ %KN%?#B QFD>T!! ConnectUserCard ! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH)..! / 0(!(: #include "xCData.h" BOOL InternalAuth (HANDLE hcd_user, HANDLE hcd_SAM)12*3 4" 3 4": hcd_user – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#? L$PBN$%?#HP@. hcd_ SAM – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ SAM->?M#?.1* % 5 "&*" #" !": True, H"P! F"LHSD$H N?%HMSHD!H LM$EM?GGK, !D?AH False. "PFA?H False, M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat.C9% !#" !+: "P! >PWA! >?M#K L$PBN$%?#HP@ DH "$$#%H#"#%FW# >PWA?G SAM >?M#K, #$ FGHDBS?H#"@ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? % SAM >?M#H. M! !"AHML?D!! %"HU ($JKAD$ 3-U) L$LK#$> "$$#%H#"#%FWV!O >PWA JP$>!MFH#"@. "P! ?F#HD#!Q!>?T!@ LM$U$C!# F"LHSD$, #$ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? F"#?D?%P!%?H#"@ % G?>"!G?PBD$H ND?AHD!H ($JKAD$ 3).$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.13. S A DebitTransaction !": DebitTransaction #" !": kFD>T!@ DebitTransaction %KL$PD@H# CHJH#$%?D!H %KJM?DD$E$ >$SHPB>? >?M#K L$PBN$%?#HP@ D? F>?N?DDFW "FGGF. LHM?T!@ %KL$PD@H#"@ % C!?P$EH " SAM->?M#$O, % LM$TH""H >$#$M$E$ LM$!"U$C!# C!D?G!AH">?@ ?F#HD#!Q!>?T!@ >?M# ! "$NC?`#"@ "HM#!Q!>?# (L$CL!"B) $LHM?T!!.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K ! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! DebitTransaction DH$JU$C!G$ LMHC%?M!#HPBD$ «L$C>PWA!#B» Q?OP " >PWA?G! v /v l (QFD>T!@ CheckAccessCard), %KN%?#B QFD>T!! ConnectUserCard ! ConnectSAMCard (H"P! j#$ DHDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 13 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  14. 14. JKP$ %KL$PDHD$ M?DHH). ?#HG %KL$PD!#B %DHSDWW ! %DF#MHDDWW ?F#HD#!Q!>?T!W (InternalAuth, ExternalAuth)..! / 0(!(: #include "xCData.h" int DebitTransaction (HANDLE hcd_user, HANDLE hcd_SAM, short purse, unsigned long amount, char *cur, char *merchantID, char *rnd, char *crt)12*3 4" 3 4": hcd_user – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#? L$PBN$%?#HP@. hcd_ SAM – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ SAM->?M#?. MercantID – F>?N?#HPB D? "#M$>F, "$CHMI?VFW !CHD#!Q!>?#$M LM$C?%T? (8 SH"#D?CT?#HM!ADKU T!QM). purse – D$GHM jPH>#M$DD$E$ >$SHPB>? (THP$H A!"P$). M!GHA?D!H: DFGHM?T!@ D?A!D?H#"@ " 1. amount – CP!DD$H THP$H, $LMHCHP@WVHH "FGGF, D? >$#$MFW LM$!"U$C!# CHJH#$%?D!H >$SHPB>?. M!GHA?D!H: "FGG? CHJH#$%?D!@ C$PID? JK#B #?>$O, A#$JK (J?P?D" >$SHPB>? L$PBN$%?#HP@- amount) > 0; cur – F>?N?#HPB D? "#M$>F, "$CHMI?VFW >$C %?PW#K L$ ISO, LMHC"#?%PHDDKO % ASCII >$CH (3 J?O#?);142*3 4" 3 4": rnd – F>?N?#HPB D? JFQHM (M?NGHM$G DH GHDHH 17 J?O#$%), % >$#$MKO QFD>T!@ %$N%M?V?H# "PFA?ODFW L$"PHC$%?#HPBD$"#B (8 – C%$!ADKU J?O#$%) % Q$MG?#H ASCII % SH"#D?CT?#HM!AD$G >$CH. crt – F>?N?#HPB D? JFQHM (M?NGHM$G DH GHDHH 13 J?O#$%), % >$#$MKO QFD>T!@ %$N%M?V?H# "HM#!Q!>?# (L$CL!"B) $LHM?T!! CHJH#$%?D!@ >$SHPB>? (6 – C%$!ADKU J?O#$%) % Q$MG?#H ASCII % SH"#D?CT?#HM!AD$G >$CH.1* % 5 "&*" #" !": 1 - F"LHSD$H N?%HMSHD!H LM$EM?GGK; 0 - $S!J>? >?M#K (M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat); $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$> % L.4.1).C9% !#" !+: "P! >PWA! >?M#K L$PBN$%?#HP@ DH "$$#%H#"#%FW# >PWA?G SAM >?M#K, #$ FGHDBS?H#"@ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? % >?M#H L$PBN$%?#HP@ !P! SAM >?M#H. M! !"AHML?D!! %"HU ($JKAD$ 3-U) L$LK#$> "$$#%H#"#%FWV!O >PWA JP$>!MFH#"@. "P! C!D?G!AH">?@ ?F#HD#!Q!>?T!@ LM$U$C!# F"LHSD$, #$ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? F"#?D?%P!%?H#"@ % G?>"!G?PBD$H ND?AHD!H ($JKAD$ 3).$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 14 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  15. 15. 3.14. S A CreditTransaction !": CreditTransaction #" !": kFD>T!@ CreditTransaction %KL$PD@H# >MHC!#$%?D!H %KJM?DD$E$ >$SHPB>? >?M#K L$PBN$%?#HP@ D? F>?N?DDFW "FGGF ! CHJH#$%?D!@ "$$#%H#"#%FWVHE$ >$SHPB>? SAM->?M#K D? #FIH "FGGF. LHM?T!@ %KL$PD@H#"@ % C!?P$EH " SAM->?M#$O, % LM$TH""H >$#$M$E$ LM$!"U$C!# C!D?G!AH">?@ ?F#HD#!Q!>?T!@ >?M# D? $"D$%H "HM#!Q!>?#$% (L$CL!"HO) $LHM?T!O.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K ! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! CreditTransaction DH$JU$C!G$ LMHC%?M!#HPBD$ «L$C>PWA!#B» Q?OP " >PWA?G! v /v l (QFD>T!@ CheckAccessCard), %KN%?#B QFD>T!! ConnectUserCard ! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH). ?#HG %KL$PD!#B %DHSDWW ! %DF#MHDDWW ?F#HD#!Q!>?T!W (InternalAuth, ExternalAuth)..! / 0(!(: #include "xCData.h" int CreditTransaction (HANDLE hcd_user, HANDLE hcd_SAM, short purse_user, short purse_SAM, unsigned long amount, char *cur, char *pointID, char *rnd, char *crt, char *rnd2, char *crt2)12*3 4" 3 4": hcd_user – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#? L$PBN$%?#HP@. hcd_ SAM – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ SAM->?M#?. pointID – F>?N?#HPB D? "#M$>F, "$CHMI?VFW !CHD#!Q!>?#$M LFD>#? L$L$PDHD!@ (8 SH"#D?CT?#HM!ADKU T!QM). cur – F>?N?#HPB D? "#M$>F, "$CHMI?VFW >$C %?PW#K L$ ISO, LMHC"#?%PHDDKO % ASCII >$CH (3 J?O#?). purse_user – D$GHM jPH>#M$DD$E$ >$SHPB>? >?M#K L$PBN$%?#HP@ (THP$H A!"P$). M!GHA?D!H: DFGHM?T!@ D?A!D?H#"@ " 1. purse_SAM – D$GHM jPH>#M$DD$E$ >$SHPB>? SAM->?M#K (THP$H A!"P$). M!GHA?D!H: DFGHM?T!@ D?A!D?H#"@ " 1. amount – CP!DD$H THP$H, $LMHCHP@WVHH "FGGF, D? >$#$MFW LM$!"U$C!# >MHC!#$%?D!H >$SHPB>? >?M#K L$PBN$%?#HP@ ! CHJH#$%?D!H >$SHPB>? SAM->?M#K. M!GHA?D!H: "FGG? >MHC!#$%?D!@ C$PID? JK#B #?>$O, A#$JK (J?P?D" >$SHPB>? >?M#K L$PBN$%?#HP@ + amount) < L$#$P$> >?M#K L$PBN$%?#HP@, (J?P?D" >$SHPB>? SAM->?M#K - amount) > 0.142*3 4" 3 4": rnd – F>?N?#HPB D? JFQHM ("#M$>F), % >$#$M$G QFD>T!@ %$N%M?V?H# "PFA?ODFW L$"PHC$%?#HPBD$"#B % Q$MG?#H ASCII % SH"#D?CT?#HM!AD$G >$CH. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 17 J?O# (k 1).DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 15 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  16. 16. "rt - F>?N?#HPB D? JFQHM ("#M$>F), % >$#$M$G QFD>T!@ %$N%M?V?H# "HM#!Q!>?# (L$CL!"B) $LHM?T!! CHJH#$%?D!@ % Q$MG?#H ASCII % SH"#D?CT?#HM!AD$G >$CH. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 13 J?O# (k 1). rnd2 – F>?N?#HPB D? JFQHM ("#M$>F), % >$#$M$G QFD>T!@ %$N%M?V?H# "PFA?ODFW L$"PHC$%?#HPBD$"#B % Q$MG?#H ASCII % SH"#D?CT?#HM!AD$G >$CH. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 17 J?O# (k 2). crt2 - F>?N?#HPB D? JFQHM ("#M$>F), % >$#$M$G QFD>T!@ %$N%M?V?H# "HM#!Q!>?# (L$CL!"B) $LHM?T!! CHJH#$%?D!@ % Q$MG?#H ASCII % SH"#D?CT?#HM!AD$G >$CH. ?NGHM JFQHM? C$PIHD JK#B DH GHDHH 13 J?O# (k 2).1* % 5 "&*" #" !": 1 - F"LHSD$H N?%HMSHD!H LM$EM?GGK; 0 - $S!J>? >?M#K (M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat); $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$> % L.4.1).C9% !#" !+: "P! >PWA! >?M#K L$PBN$%?#HP@ DH "$$#%H#"#%FW# >PWA?G SAM >?M#K, #$ FGHDBS?H#"@ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? % >?M#H L$PBN$%?#HP@ !P! SAM >?M#H. M! !"AHML?D!! %"HU ($JKAD$ 3-U) L$LK#$> "$$#%H#"#%FWV!O >PWA JP$>!MFH#"@. "P! C!D?G!AH">?@ ?F#HD#!Q!>?T!@ LM$U$C!# F"LHSD$, #$ "A`#A!> L$LK#$> "$$#%H#"#%FWVHE$ >PWA? F"#?D?%P!%?H#"@ % G?>"!G?PBD$H ND?AHD!H ($JKAD$ 3).$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.2 3.15. S A GetMaxAmount !": GetMaxAmount #" !": kFD>T!@ GetMaxAmount %KL$PD@H# A#HD!H ND?AHD!@ L$#$P>? %KJM?DD$E$ >$SHPB>? >?M#K.()* !+ ,%!&" " !+: H$JU$C!G$ D?P!A!H SAM->?M#K !P! >?M#K L$PBN$%?#HP@. HMHC $JM?VHD!HG > QFD>T!! GetMaxAmount DH$JU$C!G$ LMHC%?M!#HPBD$ %KN%?#B QFD>T!W ConnectUserCard !P! ConnectSAMCard (H"P! j#$ DH JKP$ %KL$PDHD$ M?DHH)..! / 0(!(: #include "xCData.h" int GetMaxAmount (HANDLE hcd, short purse, unsigned long &amount)12*3 4" 3 4": hcd – P$E!AH">!O D$GHM (HANDLE), "%@N?DDKO " $#>MK#KG >$GGFD!>?T!$DDKG L$M#$G, > >$#$M$GF L$C>PWA`D "A!#K%?#HPB ! % >$#$M$G D?U$C!#"@ >?M#? L$PBN$%?#HP@ !P! SAM->?M#?. purse – D$GHM jPH>#M$DD$E$ >$SHPB>? >?M#K L$PBN$%?#HP@ !P! SAM- >?M#K (THP$H A!"P$). M!GHA?D!H: DFGHM?T!@ D?A!D?H#"@ " 1.142*3 4" 3 4": amount – CP!DD$H THP$H, $LMHCHP@WVHH ND?AHD!H L$#$P>? >$SHPB>? >?M#K L$PBN$%?#HP@ !P! SAM->?M#K.DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 16 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  17. 17. 1* % 5 "&*" #" !": 1 - F"LHSD$H N?%HMSHD!H LM$EM?GGK; 0 - $S!J>? >?M#K (M?"S!MHDD$H "$$JVHD!H $J $S!J>H >?M#K G$ID$ L$PFA!#B " L$G$VBW QFD>T!! GetCardStat); $#M!T?#HPBD$H ND?AHD!H >$C? $S!J>! ("G. >$CK $S!J$> % L.4.1).$%!&"% 4 * 67 08!! ! ,%*9% &&4 (BC++ v.5.01) "G. L.4.24. 4.1. o x y L C x L r x CD5!" 0*34 * % / 0 XCDATA_NOK HD$MG?PBD$H N?%HMSHD!H LM$EM?GGK. $ND!>P? $S!J>? LM! M?J$#H " >?M#$O. H$JU$C!G$ %$"L$PBN$%?#B"@ QFD>T!HO GetCardStat. 1 XCDATA_OK $MG?PBD$H N?%HMSHD!H LM$EM?GGK. CE!D0! *D5"9* 2 % 0/"% -1 ERR_PC_TIME_OUT S!J>? %KN%?D? "J$HG % M?J$#H >$GLBW#HM? -2...-7 HNHM% F"/% ()!%7"&4" 0*34 *E!D0! ! /"%6"G( CT-API -8 ERR_CT_API_NOT_ACC CT-API DHC$"#FLHD -10 ERR_CT_API_TRANSMIS S!J>? LHMHC?A! -11 ERR_CT_API_MEM_ASIGN S!J>? N?U%?#? L?G@#! CE!D0!, * !0 M5!" ,%! % D*/" ( 67 08!+&! &*37)+ xCData -12 ERR_FILE_NOT_FOUND S!J>? %KN%?D? $#"F#"#%!HG Q?OP? " >PWA?G! "!"#HGK -13 ERR_READING_FILE S!J>? LM! A#HD!! Q?OP? " >PWA?G! "!"#HGK -14 ERR_BAD_READER $@%PHD!H C?DD$O $S!J>! G$IH# E$%$M!#B $ "PHCFWVHG: • $#"F#"#%FH# "A!#K%?#HPB, !P! • #!L "A!#K%?#HP@ F>?N?D DHLM?%!PBD$, !P!DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 17 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  18. 18. • $S!J>? LM! M?J$#H "A!#K%?#HP@, !P! • F>?N?D DH%HMDKO -L$M#. -15 ERR_NO_CARD_ON_READER S!J>? %KN%?D? $#"F#"#%!HG >?M#K % "A!#K%?#HPH -16 ERR_BAD_ACCESS_CARD S!J>? LM! M?J$#H " >?M#$O C$"#FL?, %$NG$ID$, %"#?%PHD? DH >?M#? C$"#FL?, ? !D?@. -17 ERR_INVALID_PIN_LEN HLM?%!PBD?@ CP!D? PIN->$C? -18 ERR_INVALID_PIN_CHR M! %%$CH PIN->$C? JKP! !"L$PBN$%?DK DH #$PB>$ CH"@#!ADKH T!QMK -19 ERR_BAD_PIN_VERIFY PIN->$C DH %HM!Q!T!M$%?D -20 ERR_BAD_PASSWORD H%HMDKO L?M$PB C$"#FL? > "H>MH#DKG >PWA?G "!"#HGK -21 ERR_BAD_SAM_CARD S!J>? LM! M?J$#H " SAM >?M#$O, %$NG$ID$, %"#?%PHD? DH SAM >?M#?, ? !D?@. -22 ERR_BAD_USR_CARD S!J>? LM! M?J$#H " >?M#$O L$PBN$%?#HP@, %$NG$ID$, %"#?%PHD? DH >?M#? L$PBN$%?#HP@, ? !D?@. -23 ERR_INV_REC_LEN HLM?%!PBD?@ CP!D? N?L!"! -24 ERR_DNOT_FOUND_KEY #"F#"#%FH# >PWA -25 ERR_APP_NOT_FOUND #"F#"#%FH# LM!P$IHD!H -26 ERR_READ_CARD_FILE S!J>? A#HD!@ Q?OP? D? >?M#H -27 ERR_IDENT_NOT_FOUND ? >?M#H $#"F#"#%FH# Q?OP 8000 -28 ERR_BAD_ISS_CERT H%HMDKO "HM#!Q!>?# $#>MK#$E$ >PWA? jG!#HD#? -29 ERR_BAD_ISS_IDEND H%HMDKO jG!#HD# -30 ERR_AUTH_NOT_FOUND ? >?M#H $#"F#"#%FH# Q?OP 8300 -31 ERR_UNKNOWN_AUTH_ALG H!N%H"#DKO ?PE$M!#G ?F#HD#!Q!>?T!! -32 ERR_SN_NOT_FOUND ? >?M#H $#"F#"#%FH# Q?OP 2F00 -33 ERR_SAM_NOT_FOUND #"F#"#%FH# SAM->?M#? -34 ERR_USR_NOT_FOUND #"F#"#%FH# >?M#? L$PBN$%?#HP@ -35 ERR_USR_PURS_NOTFOUND ? >?M#H L$PBN$%?#HP@ $#"F#"#%FH# Q?OP " >$SHPB>$G -36 ERR_SAM_PURS_NOTFOUND ? SAM->?M#H $#"F#"#%FH# Q?OP " >$SHPB>$G -37 ERR_USR_IS_BAD « ?L$MAHD?» >?M#? L$PBN$%?#HP@ – L$CPHI!# !N}@#!W -38 ERR_SAM_IS_BAD « ?L$MAHD?» SAM->?M#? – L$CPHI!# !N}@#!W -39 ERR_USR_CUR_NOT_MATCH M! %KN$%H QFD>T!! F>?N?D DH%HMDKO #!L %?PW#K % >$SHPB>H >?M#K L$PBN$%?#HP@DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 18 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  19. 19. -40 ERR_SAM_CUR_NOT_MATCH M! %KN$%H QFD>T!! F>?N?D DH%HMDKO #!L %?PW#K % >$SHPB>H SAM->?M#K -41 ERR_READ_USR_CARD S!J>? LM! A#HD!! >?M#K L$PBN$%?#HP@ -42 ERR_READ_SAM_CARD S!J>? LM! A#HD!! SAM->?M#K -43 ERR_USR_DEBIT_PURSE S!J>? LM! CHJH#$%?D!! >$SHPB>? >?M#K L$PBN$%?#HP@ -44 ERR_USR_CREDIT_PURSE S!J>? LM! >MHC!#$%?D!! >$SHPB>? >?M#K L$PBN$%?#HP@ -45 ERR_SAM_DEBIT_PURSE S!J>? LM! CHJH#$%?D!! >$SHPB>? SAM->?M#K -46 ERR_INV_ID_LEN H%HMD?@ CP!D? !CHD#!Q!>?#$M?-47...-50 HNHM% CE!D0!, * !0 M5!" ,%! % D*/" ( D!D)!*/"0*G mirlib (% D*/ ( D*)OE!&! #!() &!) -51 ERR_BASE_TOO_BIG "D$%?D!H A!"P? $AHDB J$PBS$H CP@ LMHC"#?%PHD!@ -52 ERR_DIV_BY_ZERO HPHD!H D? D$PB (% J!JP!$#H>H J$PBS!U A!"HP) -53 ERR_OVERFLOW HMHL$PDHD!H – A!"P$ $AHDB J$PBS$H -54 ERR_NEG_RESULT M! %KA!"PHD!! L$PFAHD$ $#M!T?#HPBD$H ND?AHD!H -55 ERR_BAD_FORMAT H%HMDKO %U$CD$O Q$MG?# A!"P? -56 ERR_BAD_BASE H%HMD$H $"D$%?D!H A!"P? -57 ERR_BAD_PARAMETERS H%HMD$H !"L$PBN$%?D!H L?M?GH#M? -58 ERR_OUT_OF_MEMORY HC$"#?#$AD$ $LHM?#!%D$O L?G@#! -59 ERR_NEG_ROOT H#DKO >$MHDB !N $#M!T?#HPBD$E$ A!"P? -60 ERR_NEG_POWER $N%HCHD!H A!"P? % $#M!T?#HPBDFW "#HLHDB -61 ERR_BAD_ROOT $LK#>? L$PFA!#B DH%HMDKO >$MHDB -62 ERR_INT_OP H%HMD?@ $LHM?T!@ D?C Flash A!"P$G -63 ERR_FLASH_OVERFLOW Flash LHMHL$PDHD!H -64 ERR_TOO_BIG !"P? $AHDB J$PBS!H -65 ERR_NEG_LOG $E?M!QG !N $#M!T?#HPBD$E$ A!"P? -66 ERR_DOUBLE_FAIL S!J>? LMH$JM?N$%?D!@ double % flash -67 ERR_IO_OVERFLOW HMHL$PDHD!H JFQHM? %%$C?/%K%$C? -68 ERR_NO_MIRSYS !JP!$#H>? J$PBS!U A!"HP DH LM$!D!T!?P!N!M$%?D? -69 ERR_BAD_MONT_MOD H%HMDKO $D#E$GHM! G$CFPBDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 19 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  20. 20. (C$PIHD JK#B DHAH#DKG) -70 ERR_NO_MONT_MOD H $LMHCHPHD $D#E$GHM! G$CFPB -71 ERR_EXP_TOO_BIG P!S>$G J$PBS?@ j>"L$DHD#? -72 ERR_NBASE_MBP_P2 "D$%?D!H C$PID$ JK#B "#HLHDBW 2-73...–124 HNHM% -125 ERR_FUNC_NOT_RELEASED -126 ERR_USR_ABORT ?J$#? LM$EM?GGK $"#?D$%PHD? L$PBN$%?#HPHG /* Rest of CT-API */ -127 ERR_CT_API_ABORT ?J$#? LM$EM?GGK $"#?D$%PHD? "HM%HM$G -128 ERR_CT_API_HTSI S!J>? D!IDHE$ FM$%D@ 4.2. >? s A r ? > (Borland C++ v.5.01)//----------------------------------------------------------------------------// Test BC++ built 32-bit DLLs (Example of xcdata.DLL call).//// Copyright (c) Dekart Ltd. All Rights Reserved//// This application tests calling into a 32-bit DLL built with Borland C++.// Code was verified with Borland C++ 5.02////----------------------------------------------------------------------------#include <mfc/afxwin.h> // For GetDlgItemText() + windows.h#include <stdio.h> // stdio.h#include "xCData.h" // functions from xcdata.dll#include <stdlib.h>#include <sys/stat.h>#include <io.h>#include <conio.h>#include <dir.h>#include <fstream.h>#include <string.h>//// Declaration of DLL - functions//int ( __stdcall *pCheckAccessCard)(char *Port, short ReaderType, char *IccNo, char *KeyFile, char *PIN);int (__stdcall *pConnectSAMCard)(char *Port, short ReaderType);int (__stdcall *pConnectUserCard)(char *Port, short ReaderType);BOOL (__stdcall *pCloseCard)(int hcd);BOOL (__stdcall *pSelectFileInCard)(int hcd, char *FID);BOOL (__stdcall *pReadFileRecord)(int hcd, short rcNo, short len, char *buf);int (__stdcall *pUpdateFileRecord)(int hcd, short rcNo, short len, char *buf);int (__stdcall *pStaticAuth)(int hcd);BOOL (__stdcall *pExternalAuth)(int hcd_user, int hcd_SAM);BOOL (__stdcall *pInternalAuth)(int hcd_user, int hcd_SAM);int (__stdcall *pDebitTransaction)(int hcd_user, int hcd_SAM, short purse, unsigned long amount, char *cur, char *mercantID, char *rnd, char *crt);int (__stdcall *pCreditTransaction)(int hcd_user, int hcd_SAM, short purse_user, short purse_SAM, unsigned long amount, char *cur, char *pointID, char *rnd, char *crt, char *rnd2, char *crt2);BOOL (__stdcall *pGetChallenge)(int hcd, char *buf);DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 20 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  21. 21. void (__stdcall *pGetCardStat)(char *msgbuf);int (__stdcall *pGetMaxAmount)(int hcd, short purse, unsigned long &amount);char xDll[] = "xcdata.dll";///////////////////////////////////////////////////////////////////////////////int main(){//// Declaration & Initial Values of variables// int status, i, user, sam; long int sum1=0; unsigned long amount_user=0, amount_sam=0; char cardnum[33]=" "; char port[20]=" ", port_sam[20]=" ",port_user[20]=" ", cardpin[32]=" "; char buf_err[80],buf_reader[2]=" ",buf_reader_sam[2]=" ",buf_reader_user[2]=" "; char buf_sum[80]=" ",buf_purse_sam[2]=" ",buf_purse_user[2]=" "; char card_file[5]=" "; char rand[17]=" ", str_buf[511]=" "; char rand1[17]=" ", rand2[17]=" "; char crt1[17]=" ", crt2[17]=" "; char cur[4]=" ",ident[9]=" "; short reader, reader_sam, reader_user, purse_sam, purse_user, purse_s, purse_u; char filename[MAXPATH]; BOOL res;//// Load the Dynamic Link LIbrary xcdata.DLL// HINSTANCE hLib = LoadLibrary(xDll); if ( (unsigned)hLib <= HINSTANCE_ERROR ) { printf("Failure loading library: %sn", xDll); return 0; }//// Get all the entry points for the functions we wish to test. Typedefs can// be used to simplify casting the retrun value from GetProcAddress.//pCheckAccessCard = (int( __stdcall*)(char *Port, short ReaderType, char *IccNo,char*KeyFile, char *PIN))GetProcAddress(hLib, "CheckAccessCard");pConnectSAMCard = (int(__stdcall*)(char *Port, short ReaderType))GetProcAddress(hLib,"ConnectSAMCard");pConnectUserCard = (int(__stdcall*)(char *Port, short ReaderType))GetProcAddress(hLib,"ConnectUserCard");pCloseCard = (BOOL(__stdcall*)(int hcd))GetProcAddress(hLib, "CloseCard");pSelectFileInCard = (BOOL(__stdcall*)(int hcd, char *FID))GetProcAddress(hLib,"SelectFileInCard");pReadFileRecord = (BOOL(__stdcall*)(int hcd, short rcNo, short len, char*buf))GetProcAddress(hLib, "ReadFileRecord");pUpdateFileRecord = (int(__stdcall*)(int hcd, short rcNo, short len, char*buf))GetProcAddress(hLib, "UpdateFileRecord");pStaticAuth = (int(__stdcall*)(int hcd))GetProcAddress(hLib, "StaticAuth");pExternalAuth = (BOOL(__stdcall*)(int hcd_user, int hcd_SAM))GetProcAddress(hLib,"ExternalAuth");pInternalAuth = (BOOL(__stdcall*)(int hcd_user, int hcd_SAM))GetProcAddress(hLib,"InternalAuth");pDebitTransaction = (int(__stdcall*)(int hcd_user, int hcd_SAM, short purse, unsigned long amount, char *cur, char *mercantID, char *rnd, char*crt))GetProcAddress(hLib, "DebitTransaction");pCreditTransaction = (int(__stdcall*)(int hcd_user, int hcd_SAM, short purse_user, short purse_SAM, unsigned long amount, char *cur, char *pointID, char *rnd, char *crt, char *rnd2, char *crt2))GetProcAddress(hLib, "CreditTransaction");pGetChallenge = (BOOL(__stdcall*)(int hcd, char *buf))GetProcAddress(hLib,"GetChallenge");pGetCardStat = (void(__stdcall*)(char *msgbuf))GetProcAddress(hLib, "GetCardStat");pGetMaxAmount = (int (__stdcall*)(int hcd, short purse, unsigned long&amount))GetProcAddress(hLib,"GetMaxAmount");DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 21 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  22. 22. //// GetProcAddress returns null on failure// if( pCheckAccessCard == NULL || pConnectSAMCard == NULL || pConnectUserCard == NULL || pCloseCard == NULL || pSelectFileInCard == NULL || pReadFileRecord == NULL || pUpdateFileRecord == NULL || pStaticAuth == NULL || pExternalAuth == NULL || pInternalAuth == NULL || pDebitTransaction == NULL || pCreditTransaction ==NULL || pGetChallenge == NULL || pGetCardStat == NULL || pGetMaxAmount == NULL) { printf("Failure locating procedures.n"); return 0; }//// Check & load INI parameters from xcdata.ini//// PORT - name of com-port connected to reader// PORT_SAM - name of com-port connected to reader with SAM-card// PORT_USER - name of com-port connected to reader with user card// READER - reader type// READER_SAM - type of reader with SAM-card// READER_USER - type of reader with user card// CA_CARD_PIN - PIN-code to access card (CA)// PURSE_SAM - number of purse on SAM-card// PURSE_USER - number of purse on user card// CUR - currency type// SUM - sum// ID - merchant identifier// CARD_FILE - name of card file// CA_KEY_FILE - name of file with keys of CA// GetPrivateProfileString("COMMON", "PORT", "COM2", port, sizeof(port), "ex_xcd.ini"); GetPrivateProfileString("COMMON", "PORT_SAM", "COM2", port_sam, sizeof(port_sam),"ex_xcd.ini"); GetPrivateProfileString("COMMON", "PORT_USER", "COM2", port_user, sizeof(port_user),"ex_xcd.ini"); GetPrivateProfileString("COMMON", "CA_CARD_PIN", "1111", cardpin, sizeof(cardpin),"ex_xcd.ini"); GetPrivateProfileString("COMMON", "READER", "2", buf_reader, sizeof(buf_reader),"ex_xcd.ini"); GetPrivateProfileString("COMMON", "READER_SAM", "2", buf_reader_sam,sizeof(buf_reader_sam), "ex_xcd.ini"); GetPrivateProfileString("COMMON", "READER_USER", "2", buf_reader_user,sizeof(buf_reader_user), "ex_xcd.ini"); GetPrivateProfileString("COMMON", "PURSE_SAM", "2", buf_purse_sam,sizeof(buf_purse_sam), "ex_xcd.ini"); GetPrivateProfileString("COMMON", "PURSE_USER", "2", buf_purse_user,sizeof(buf_purse_user), "ex_xcd.ini"); GetPrivateProfileString("COMMON", "CUR", "498", cur, sizeof(cur), "ex_xcd.ini"); GetPrivateProfileString("COMMON", "ID", "11111111", ident, sizeof(ident),"ex_xcd.ini"); GetPrivateProfileString("COMMON", "CA_KEY_FILE", ".94980000.KEY", filename,sizeof(filename), "ex_xcd.ini"); GetPrivateProfileString("COMMON", "CARD_FILE", "3F00", card_file, sizeof(card_file),"ex_xcd.ini"); GetPrivateProfileString("COMMON", "SUM", "3", buf_sum, sizeof(buf_sum), "ex_xcd.ini");//// char-to-integer conversion// reader_sam=atoi(buf_reader_sam); reader_user=atoi(buf_reader_user); purse_sam=atoi(buf_purse_sam); purse_user=atoi(buf_purse_user); sum1=atoi(buf_sum);//// Test of XCDATA////DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 22 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  23. 23. // Keys Reading from CA_KEY_FILE//// pCloseCard(1); printf("n Test of CheckAccessCard n"); printf("nn Insert Acces Card in Reader"); getch(); status = pCheckAccessCard(port_user, reader_user, cardnum, filename, cardpin); pGetCardStat(buf_err); printf("n Result of Keys Reading: %d ", status); if(status!=1) {printf("n Card status: %s", buf_err); return 0;}//// Connecting to reader with user card//// pCloseCard(1); pCloseCard(2); printf("n Test of ConnectUserCard n"); printf("n Insert User Card in Reader"); getch(); user = pConnectUserCard(port_user, reader_user); pGetCardStat(buf_err); if(user<0) { printf("n Error: %d ", user); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n User_handle: %d ", user); printf("n ....."); getch();//// GetChallenge operation for user card// printf("n Test of GetChallenge (user card)n"); res=pGetChallenge(user,rand); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n User_random: %s ", rand); // operation result printing printf("n ....."); getch();//// GetMaxAmount operation// printf("n Test of GetMaxAmount (user card)n"); purse_u=1; // purse 1 i=pGetMaxAmount(user, purse_u, amount_user); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n GetMaxAmount1: %d ", amount_user); purse_u=2; // purse 2 i=pGetMaxAmount(user, purse_u, amount_user); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n GetMaxAmount2: %d ", amount_user); purse_u=3; // purse 3 i=pGetMaxAmount(user, purse_u, amount_user); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} elseDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 23 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  24. 24. printf("n GetMaxAmount3: %d ", amount_user); printf("n ....."); getch();//// SelectFileInCard operation for user card// printf("n Test of SelectFileInCard (user card)n"); res=pSelectFileInCard(user, "3F00"); // card file select pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n 3F00 - %d ", res); res=pSelectFileInCard(user, "7F10"); // card file select pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n 7F10 - %d ", res); res=pSelectFileInCard(user, "8100"); // card file select (purse descriptors) pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n 8100 - %d ", res); printf("n ....."); getch();//// ReadFileRecord operation for user card// printf("n Reading of Purses Descriptors"); for(i=1;i<4;i++) { res=pReadFileRecord(user,i,16, str_buf); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n Purse %d description %s", i,str_buf); } printf("n ....."); getch();//// StaticAuth operation for User Card// printf("n Test of StaticAuth (user card)"); i=pStaticAuth(user); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", i); printf("n Card status: %s", buf_err); // cardstatus printing return 0;} else printf("n Result of StaticAuth: %d ", i); //card status & operation result printing printf("n ....."); getch();//// Connecting to reader with SAM-card//// pCloseCard(2);DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 24 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  25. 25. printf("n Test of ConnectSAMCard n"); printf("nn Insert SAM Card in Reader"); getch(); sam = pConnectSAMCard(port_sam, reader_sam); pGetCardStat(buf_err); if(sam<0) { printf("nError: %d ", sam); printf("nCard status: %s", buf_err); // cardstatus printing return 0;} else printf("n SAM_handle: %d ", sam); printf("n ....."); getch();//// GetChallenge operation for SAM card// printf("n Test of GetChallenge (SAM card)n"); res=pGetChallenge(sam,rand); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n SAM_random: %s ", rand); // operation result printing printf("n ....."); getch();//// GetMaxAmount operation for SAM card// printf("n Test of GetMaxAmount (SAM card)n"); purse_s=1; // purse 1 i=pGetMaxAmount(sam, purse_s, amount_sam); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", i); printf("n Card status: %s", buf_err); // cardstatus printing return 0;} else printf("n GetMaxAmount1: %d ", amount_sam); purse_s=2; // purse 2 i=pGetMaxAmount(sam, purse_s, amount_sam); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", i); printf("n Card status: %s", buf_err); // cardstatus printing return 0;} else printf("n GetMaxAmount2: %d ", amount_sam); purse_s=3; // purse 3 i=pGetMaxAmount(sam, purse_s, amount_sam); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", i); printf("n Card status: %s", buf_err); // cardstatus printing return 0;} else printf("n GetMaxAmount3: %d ", amount_sam); printf("n ....."); getch();//// SelectFileInCard operation for SAM card// printf("n Test of SelectFileInCard (SAM card)n"); res=pSelectFileInCard(sam, "3F00"); // card file select pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printingDSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 25 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  26. 26. return 0;} else printf("n 3F00 - %d ", res); res=pSelectFileInCard(sam, "7F10"); // card file select pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n 7F10 - %d ", res); res=pSelectFileInCard(sam, "8100"); // card file select (purse descriptors) pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n 8100 - %d ", res); printf("n ....."); getch();//// ReadFileRecord operation for sam card// printf("n Reading of Purses Descriptors (SAM)"); for(i=1;i<4;i++) { res=pReadFileRecord(sam,i,16, str_buf); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n Purse %d description %s", i,str_buf); } printf("n ....."); getch();//// StaticAuth operation for SAM Card// printf("n Test of StaticAuth (SAM card)"); i=pStaticAuth(sam); pGetCardStat(buf_err); if(i!=1) { printf("n Error: %d ", i); printf("n Card status: %s", buf_err); // cardstatus printing return 0;} else printf("n Result of StaticAuth: %d ", i); //card status & operation result printing printf("n ....."); getch();//// Internal Authentication// printf("n Test of InternalAuth"); res=pInternalAuth(user,sam); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n InternalAuth: %d ", res); printf("n ....."); getch();//DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 26 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .
  27. 27. // External Authentication// printf("n Test of ExternalAuth"); res=pExternalAuth(user,sam); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} else printf("n ExternalAuth: %d %s ", res,buf_err); printf("n ....."); getch();//// CreditTransaction operation// printf("n Test of CreditTransaction");// purse_user=2; purse_sam=2;i=pCreditTransaction(user,sam,purse_user,purse_sam,sum1,cur,ident,rand1,crt1,rand2,crt2); pGetCardStat(buf_err);// printf("n %s", buf_err); // card status printing if(i!=1) { printf("n Error: %d ", i); printf("n Card status: %s", buf_err); // cardstatus printing return 0;} else printf("n Result of CreditTransaction: %d %s",i, buf_err); // operation resultprinting printf("n Rand1: %s Cert.1: %s",rand1,crt1); // Phase1 (random & certificate) printf("n Rand2: %s Cert.2: %s",rand2,crt2); // Phase2 (random & certificate)//// Reading of Purses after CreditTransaction// printf("nn Reading of Purse after CreditTransaction"); res=pSelectFileInCard(user, "6F00"); // card file select (purse 1) pGetCardStat(buf_err); printf("n 6F00 - %d %s", res,buf_err); res=pReadFileRecord(user,1,6, str_buf); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} printf("n Result of Reading of Purse1 - %d %s %s", res,buf_err,str_buf); res=pSelectFileInCard(user, "6F01"); // card file select (purse 2) pGetCardStat(buf_err); printf("n 6F01 %d %s", res,buf_err); res=pReadFileRecord(user,1,6, str_buf); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} printf("n Result of Reading of Purse2 - %d %s %s", res,buf_err,str_buf); res=pSelectFileInCard(user, "6F02"); // card file select (purse 3) pGetCardStat(buf_err); printf("n 6F02 %d %s", res,buf_err); res=pReadFileRecord(user,1,6, str_buf); pGetCardStat(buf_err); if(res!=1) { printf("n Error: %d ", res); printf("n Card status: %s", buf_err); //card status printing return 0;} printf("n Result of Reading of Purse3 - %d %s %s", res,buf_err,str_buf); printf("n ....."); getch();DSSSCT File :xcd_pg.doc Ref : XCDATAPG0000 Revision:2.0 27 / 30 Copyright © Dekart S.R.L (www.dekart.com) - 2001 This document shall not be disclosed to a third party without prior written consent of Dekart S.R.L. !>?>?@ A?"#B C?DD$E$ C$>FGHD#? DH G$IH# JK#B %$"LM$!N%HCHD? % >?>$O JK #$ D! JKP$ Q$MGH ! >?>!G! JK, #$ D! JKP$ "MHC"#%?G! JHN L!"BGHDD$E$ M?NMHSHD!@ %P?CHPBT? ?%#$M">!U LM?%. > ? .

×