# # Oberthur CS PIV End Point v1.08 FIPS201 Certified # # The following may not accurate, fix later admin.name = OberthurCS admin.model = OberthurCS admin.description = OberthurCS admin.supplier = Oberthur admin.version = 1.08 admin.type = smartcard --StartWords-- ## From sample config file ## "OberthurCS" dup tokenType setprop "Trying " swap concat msg ############################# "OberthurCS." CUID_prefix setprop ### SEND INITIAL APDU TO SELECT APPLICATION ### 00A4040007A0000001510000 00 exchangeAPDU badCard jmpIfFalse # error communicating with card swap drop 9000 hexequals noID jmpIfFalse ### SEND FIRST APDU TO EXTRACT CUID ### # send APDU, expected response size is 32h, but leave as 00 80CA006600 00 exchangeAPDU badCard jmpIfFalse # error communicating with card swap drop 9000 hexequals noID jmpIfFalse drop # first, duplicate the APDU returned dup # get rid of 'P2', which is the first byte in the response # read size of data returned # and compare with actual hexlength # return INVALID if lengths are inconsistent hexlength 1 - 1 swap hexchop dup dup dup hexlength 1 - apduLength setprop 0 1 hexchop apduLength getprop hexequals badCard jmpIfFalse # get rid of data size byte dup hexlength 1 - 1 swap hexchop # get rid of 3 tag bytes dup hexlength 3 - 3 swap hexchop dup dup dup # read size of CUID string 0 1 hexchop CUID_string_size setprop # get rid of size byte hexlength 1 - 1 swap hexchop dup dup dup # skip that many bytes hexlength CUID_string_size getprop - CUID_string_size getprop swap hexchop # get rid of 3 tag bytes dup hexlength 3 - 3 swap hexchop dup dup dup # read size of CUID string 0 1 hexchop CUID_string_size setprop # get rid of size byte dup hexlength 1 - 1 swap hexchop dup dup dup # skip that many bytes hexlength CUID_string_size getprop - CUID_string_size getprop swap hexchop dup # get rid of 3 tag bytes hexlength 3 - 3 swap hexchop dup dup dup # read size of CUID string 0 1 hexchop CUID_string_size setprop # get rid of size byte hexlength 1 - 1 swap hexchop dup dup dup # store the next # bytes as CUID 0 CUID_string_size getprop hexchop CUID setprop # set a boolean to show that we are sending the second APDU and not the third one (this boolean is used later, in loop) 0 thirdAPDU setprop ### SEND SECOND APDU ### 80CA004200 00 exchangeAPDU badCard jmpIfFalse # error communicating with card swap drop 9000 hexequals noID jmpIfFalse loop:: drop dup # get rid of P2 byte hexlength 1 - 1 swap hexchop dup dup dup # store actual length of received data hexlength 1 - CUID_string_size setprop # read size byte 0 1 hexchop # check if the size is consistent CUID_string_size getprop hexequals badCard jmpIfFalse # get rid of size byte hexlength 1 - 1 swap hexchop #commented out next 3 commands to shorted id to get rid of whichServer #errors in auth logs #Frank Hess 2008-10-09 # bring the CUID extracted so far onto the top of the stack #CUID getprop # swap new and old CUID strings #swap # append the new CUID string at the end of the old one #concat # store the new combined string as the CUID CUID setprop 1 thirdAPDU getprop hexequals done jmpIfTrue # set boolean value 'thirdAPDU' as true 1 thirdAPDU setprop ### SEND THIRD (AND FINAL) APDU ### 80CA004500 00 exchangeAPDU badCard jmpIfFalse # error communicating with card swap drop 9000 hexequals noID jmpIfFalse loop jmp done:: CUID getprop ## From sample config file ## # print token info to log file dup " Token ID: " swap concat tokenType getprop " Token Type: " swap concat concat "Identified " tokenType getprop concat swap concat msg # actually return the Token ID and Token Type # tokenType getprop returnID CUID getprop tokenType getprop returnID ############################# badCard:: "Bad card" msg noID:: "No ID" msg --EndWords--