The invention concerns an improvement to the smartcard system described in International Patent Application No WO03/049056 and, in particular, it concerns the possibility of extending the functionality of the scripts and script engine mechanism described in that application and the extension of the range of operations that can be performed.
International Patent Application No WO03/049056 describes a smartcard system in which operating software enables on-card and off-card files and/or applications to interface with one another by means of a file formatted in a web (Internet) standard language for self-describing messages, preferably XML. This file contains at least some of the file system, and commands for accessing the file system, which allow the on-card and off-card files and/or applications to interface. The card includes a script engine for running a script derived from the XML file so as to modify the structure and content of the file system, or the commands to be used for accessing the file system, or any security conditions associated therewith.
In order to extend the existing system described in International Patent Application No WO03/049056, it would be desirable to add other operations over and above the file system commands of Read, Update etc. The additional operations would preferably include arithmetic operations, such as ADD, SUBTRACT or COMPARE, or some other customised operation, on either records within files or simpler Data Objects. However, whilst such functionality is widely available in complex applications, it is necessary, in the context of the system described in WO03/049056 that this functionality be implemented in such a way as to allow the simple script engine carried by the card, in combination with the system's operating system, to carry out required operations. In particular, it is desirable that
In accordance with the invention, there is provided a programmable device for use in a system of the kind outlined above and the subject of International Patent Application No WO03/049056; the device being characterised in that the means for running the script is operable to run a plurality of script commands in succession and to use an input/output buffer of the device as an accumulator to allow arithmetic operations on values held in data files or in the accumulator itself under the control of one or more of said script commands.
As defined in International Patent Application No WO03/049056, scripts are sequences of Application Protocol Data Units (‘APDUs’) according to ISO 7816-4, pertaining in the most part to file system manipulation.
Values may, preferably, be read from, and written to, data files or the accumulator using the Read Record and Update Record commands, respectively, of the operating software
We have thus further appreciated that the machine operating codes are able to perform comparisons and arithmetic operations between registers. The standard READ and UPDATE commands could be used to perform the basic operations of getting data in and out of registers (records). One way of doing this would be having a fixed size register (record) as it makes the comparisons and arithmetic easier, requiring much less development time. Thus, by effectively treating each record as a register, and using existing machine code operations it is possible to achieve additional functionality of the kind proposed.
Preferably, the means for running the script is capable of carrying out a comparison of values and to branch to a predetermined one of the plurality of script commands in dependence on the outcome of the comparison.
Thus, if the script engine itself is enhanced to include CONDITIONAL statements (IF . . . THEN GO TO APDU X) then the functionality can be increased to allow applications such as electronic purse operations to be configured as a script which can be run by the on-card script engine proposed in International Patent Application No WO03/049056. In such an enhanced script engine, the results of a COMPARE command can be used to direct the sequence of ADPUs to be executed next. This in effect gives the script programme flow capabilities enabling the construction of scripts to perform macro-like operations such as are required to have the card make complex decisions after, for example, examining a history of transactions.
The key benefit of adding this programme flow capability up at the script level is that all the issues relating to data isolation, low level communication etc are taken care of by the lower layers of the smartcard system. The card's operating system and, so, the business logic of a particular application can be specified and captured at a very high level, with user friendly interfaces, such as flow charts, which can be built and translated “off the card”, into the script to run on the card. XML formatting would probably be used as the ‘pseudo code’ intermediate stage as an enhancement to the XML file system model already described in International Patent Application No WO03/049056 and so acts as the business logic input to the terminal framework of that system. Also the Configurator tool described in International Patent Application No WO03/049056 can be extended to include such flow-charting and ladder sequence diagrams as the requirements entry point.
In addition, the sequence of commands to be issued by the terminal or interface device would, in the improved system, include script selection and execution to make up a complete Business Application such as a payment request on a credit card.
The benefit is to enable the simultaneous development of terminal and card applications by going straight from application high level functional requirements (human generated diagrams) to running code including more complex business logic running on either or both platforms.
To summarise, the system described in International Patent Application No WO03/049056 does not automate the generation of Business Logic. The enhancement to the script mechanisms of that system outlined above and described in greater detail below enables the automated generation of business logic code running on the card, and can be extended to run on the terminal also. This leaves only the user interface and host communications aspects of terminal design to be developed by traditional methods, which are themselves already highly efficient.
An embodiment of the invention will now be described in detail, by way of example, by reference to the accompanying drawing which illustrates the high level architecture of such a system.
In a system having one or more working variables and several system variables, it is desirable to provide a set of basic control and logic functions, as follows:
These commands can be supported on a simple command processor or script engine with a single working accumulator and multiple system variables stored in RAM. The system would also require a program counter and a set of status flags: ZERO (EQUAL), CARRY (GREATER THAN) and NEGATIVE.
An overview of the high level architecture required to implement the commands listed above is shown in the drawing. All operations are performed on the accumulator and it is possible to move the content of one variable to other variables via the accumulator. The program counter steps through each of the instructions in turn; if the instruction is a branch instruction the counter will move on to the appropriate instruction as defined by the branch test.
Application logic can be implemented on the existing script processing mechanisms and data structures that supported by the system of International Patent Application No WO03/049056. Within this system, system variables can be implanted with records, and an accumulator implemented using the input/output (‘IO’) buffer. A mechanism already exists within the system for loading data from variables and storing data to variables, in the form of the system's Read Record and Update Record commands. The system's security manager allows creation of a security environment to control access to the variables offering support for secure messaging to input and output data.
As the script manager does not check that the script contains data even though the length of the expected command data in an APDU, ‘Lc’, is specified in the APDU, the system will allow, for example, an Update Record command script with a Lc value, but no data. This command will use the data in the buffer from the previous command. This mechanism can be used by the commands to allow operations on either script data (absolute value) or the existing data from the last script result.
The script manager of the system of International Patent Application No WO03/049056 already steps through single commands. The additional application logic functionality will allow branching within the list of scripts (instructions). The script manager already provides support for checking the integrity and authorisation of the script contents. It also supports downloading of encrypted application logic programs.
A smartcard application of the kind envisaged can use a one or more record file for its application data. Within the files it can have up to 254 records. By using short file identifiers (‘SFIs’) as defined in ISO 7816 File System, the command to read, update or any other record command can be contained in a single command script specifying the file, record and operation. To simplify processing all records should be a constant length. Using 4-byte records, a system which can support signed integers in the range −32768 to +32767 can be provided.
As mentioned above, the system's Read Record and Update Record commands can be used to implement Load and Store operations. Additional commands are required to support the AND, OR and XOR logical operations. These are in some degree supported already within the smartcard system of International Patent Application No WO03/049056. For example, the Write Record command will perform an AND or OR logical update, which may affect the ZERO (‘Z’) flag.
Add and Subtract would be implemented as new commands which would add or subtract the value in a record from the value held within the command data or from the value in the accumulator. These commands may update the Z or NEGATIVE (‘N’) flags.
The Compare command would have to be implemented as a new command which would simply compare the value in the command or in the accumulator with the value in the specified record. It may update the EQUAL (‘Z’) or CARRY (‘C’) flags.
The Branch command is implemented as a command which would update the script pointer based on the state of the flags. The script pointer would be modified relative to its position (relative branch) by a fixed number of scripts (positive or negative) as specified in the Branch command.
The Exit command is required to exit from the script with a result or error. The exit data would contain the error code returned in the SW1 SW2 parameters of the existing system.
A record file can under the existing system described in International Patent Application No WO03/049056 have its access conditions set to allow updating of the record data. The update may have no access conditions or, alternatively, may require previous authentication or secure messaging of the input data. As a record file could be used to return data with it access conditions set to, secure messaging (‘SM’). If the last script reads this record file, the Security Environment will sign the data, certifying the response.
The scripts will be signed and optionally encrypted by the card issuer/scheme owner before they are stored on the terminal. As the script manager will only run a verified script neither the terminal nor anyone else can download and run scripts on the card or modify existing scripts.
The following example illustrates the capabilities of the proposed logic in the context of an electronic purse scheme.
An electronic purse consists of 4 purses. The scheme requires the following operations:
A record file will be created that has for each purse
A record file will be created with the following records
The system scripts will provide for the following operations
The low level coding for putting these steps into operation could be:
A request to decrement the balance in a purse would be handled as follows:
Prior to running the script proper, the system would need to acquire the amount to be decremented from the user's purse from the merchant or supplier. The access conditions of the files are used authorise the loading and running of the script.
Then the system runs the script commands themselves, as follows:
This script would require 15 script commands and would be around 100 bytes before encrypting and signing.
Where a balance is to be transferred, the sequence of script commands is as follows. Again, the access conditions of the files are used to authorise the loading and running of the script. As a preliminary step the system would need to acquire the amount to be transferred.
Purse1=Transfer FROM purse. Purse2=Transfer TO purse.
The script commands would then be:
Thus, it will be appreciated from the description above that the improved system described above will allow application logic controlling code to be downloaded and run on a smartcard or other programmable device utilised in the system of International Patent Application No WO03/049056. It offers a simple set of logical and arithmetical processing and control functionality and is independent of the platform used.
Number | Date | Country | Kind |
---|---|---|---|
0330179.3 | Dec 2003 | GB | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/GB04/05434 | 12/23/2004 | WO | 4/3/2007 |