CN100384286C - Smart card testing method - Google Patents

Smart card testing method Download PDF

Info

Publication number
CN100384286C
CN100384286C CNB2005101351805A CN200510135180A CN100384286C CN 100384286 C CN100384286 C CN 100384286C CN B2005101351805 A CNB2005101351805 A CN B2005101351805A CN 200510135180 A CN200510135180 A CN 200510135180A CN 100384286 C CN100384286 C CN 100384286C
Authority
CN
China
Prior art keywords
smart card
test
card
data
instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CNB2005101351805A
Other languages
Chinese (zh)
Other versions
CN1791258A (en
Inventor
景涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Yicheng Xintong Smart Card Co., Ltd.
Original Assignee
Beijing WatchData System Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing WatchData System Co Ltd filed Critical Beijing WatchData System Co Ltd
Priority to CNB2005101351805A priority Critical patent/CN100384286C/en
Publication of CN1791258A publication Critical patent/CN1791258A/en
Application granted granted Critical
Publication of CN100384286C publication Critical patent/CN100384286C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The present invention discloses a test method for a smart card, which provides a method aiming at that products generate fault for test in the existing test method for the smart card. The method comprises: (1), a test card is generated; (2), the existing smart card is used for communicating with an end device to obtain a command sent to smart card and return data of the smart card; (3), according to the command and the return data obtained in the step (2), a test case is generated; (4), input is sent to the test card and the return data of the test card is monitored; if the return data of the test card is the same as expected output, the test is successful, if the return data of the test card is different from the expected output, the test is failed. The test method for the smart card provided by the present invention makes the test according with use habits of end users, and meanwhile can avoid upgrade products which pass the test generating problems in use of the users for the insufficient coverage of the test.

Description

The method of testing of smart card
Technical field
The present invention relates to a kind of data processing method, relate in particular to a kind of method of testing of smart card.
Background technology
Along with development of computer, the application of software is more and more widely arrived financial circles, industry and commerce greatly, and little of household electrical appliance, SIM cards of mobile phones, the influence of software is ubiquitous.The function of software also increases day by day, causes the complexity of software more and more higher, and is also more and more by the fault that software fault causes.USAF statistics F/A-18 flight control system is in 20,000 hours experiment, and software fault is 309 times, and hardware fault is 271 times, and therefore visible test for software has become a very important job.
Existing software function method of testing much is by catching the playback mechanism generation script and carrying out test.The object of catching is the element on the GUI user interface normally.In other words be exactly tester manual operations tested software, finish certain application flow, testing tool writes down this process, generates test script, automatically playback script and checked operation situation about finishing.The tester also can develop new test case by the edit-modify script.The WinRunner of representational testing tool such as InterActive company, and the Robot of IBM Rational.
Specific to smart card industry, after going out the required smart card of user, manufacturers produce needs smart card is tested, can satisfy user's demand to guarantee smart card.Present test pattern normally tester is write test script according to testing requirement, smart card is tested, but because the coverage of test is not enough or the tester is different with developer's custom, the smart card that test is passed through still might go wrong at end user's use scene, and this all causes damage for undoubtedly manufacturer and user.When particularly smart card upgraded, owing to lack effective regression test method, the problems referred to above happened occasionally.
Summary of the invention
At above-mentioned the problems of the prior art and deficiency, the objective of the invention is to propose a kind of method of testing of smart card, can improve the coverage of test, avoid product to produce fault owing to test is not enough.
In order to address the above problem, the present invention proposes a kind of method of testing of smart card, comprising:
(1) generates test card;
When (2) using existing smart card and terminal equipment to communicate, obtain to send to the instruction of smart card and the return data of smart card;
(3) instruction and the return data that obtains according to described step (2) generates test case, and described test case sends to the input of test card and the expection output of test card when comprising test;
(4) described input is sent to test card, and the return data of monitoring test card, identical if the return data of described test card and described expection are exported, then test successfully, if inequality then test crash.
As preferably, in order to enlarge the reliability of test specification to guarantee to test, described test case is the sequence that the corresponding expection output of a plurality of inputs and input is formed.
As preferably, described step (1) is specially file structure, data structure and the association key according to the required smart card of user, sets up the card structure, generates smart card.
As preferably, described step (2) is specially: use existing smart card and terminal equipment to carry out communication, and the data flow of communicating by letter between monitoring intelligent card and the terminal equipment, and the data-signal in the data flow is reduced to the instruction that sends to smart card and the return data of smart card, can make test more meet user's use habit like this, make the reliability of test stronger.
As preferably, described step (2) is specially: use existing smart card and terminal equipment to carry out communication, and the I/O port of monitoring intelligent card obtains the data flow of communicating by letter between smart card and the terminal equipment, and the data-signal in the data flow is reduced to the instruction that sends to smart card and the return data of smart card.Because the I/O port data stream of smart card must meet the ISO7816 standard, therefore can be to send to the data that the instruction of smart card and smart card return with reduction of data.
As preferably, step (2) is specially: use existing smart card and terminal equipment to carry out communication, and the I/O port of monitoring intelligent card, carry out periodic sampling and obtain the data flow of communicating by letter between smart card and the terminal equipment, and the data-signal in the data flow is reduced to the instruction that sends to smart card and the return data of smart card.
As preferably, when the instruction described in the step (2) is when needing the output of another step to calculate could to obtain, the input described in the described step (3) comprises a variable, and this variable replacing need calculate the data that the back obtains to the output of another step; Expection described in the step (3) is exported with a variable replacing.
As preferably, replace the variable of expection output to determine expection output according to the value of the definite input variable of the execution result of last instruction in the test process.
As preferably, when the instruction described in the step (2) and the instruction before and after it all do not have when related, be input as the instruction described in the step (2) described in the step (3); Expection described in the step (3) is output as the return data described in the step (2).
The method of testing of the smart card that the present invention proposes, make test more meet end user's use habit, simultaneously can generate the substantive test use-case fast, and according to the test case sequence test card is tested, avoid in the user uses, going wrong owing to the upgrading products that the test coverage causes test to pass through inadequately.
Description of drawings
Fig. 1 is the form of the Frame of smart card I/O port transmission;
Fig. 2 is the method for testing preferred embodiment flow chart of the smart card that proposes of the present invention.
Embodiment
The present invention is described in further detail below in conjunction with accompanying drawing.
Preferred embodiment of the present invention flow process may further comprise the steps as shown in the figure:
(1) generates test card;
When (2) using existing smart card and terminal equipment to communicate, obtain to send to the instruction of smart card and the return data of smart card;
(3) instruction and the return data that obtains according to described step (2) generates test case, and described test case sends to the input of test card and the expection output of test card when comprising test;
(4) described input is sent to test card, and the return data of monitoring test card, identical if the return data of described test card and described expection are exported, then test successfully, if inequality then test crash.
As preferably, the embodiment in the described step (3) is the sequence that the corresponding expection output of a plurality of inputs and input is formed, and can guarantee that like this coverage of testing is wider, avoids breaking down in the actual use that is stuck in the user through test.
As preferably, described step (1) is specially file structure, data structure and the association key according to the required smart card of user, set up the card structure, generate smart card, the smart card architecture of Sheng Chenging more meets user's demand like this, the mode of generation test card has a variety of, in this not explanation one by one.
As preferably, described step (2) is specially uses existing smart card communicate by letter with terminal equipment (the use scene that for example can arrive the user), and the data flow of communicating by letter between monitoring intelligent card and the terminal equipment, the data-signal in the data flow is reduced to the instruction that sends to smart card and the return code or the return value of smart card.
As preferably, can be in the described step (2) by the I/O port of monitoring intelligent card, the line period of going forward side by side sampling with the data flow that obtains to communicate by letter between smart card and the terminal equipment, and is reduced to the instruction that sends to smart card and the return data of smart card with the data-signal in the data flow.Smart card all should have return code to the instruction of every input, and some also has return value.Contact intelligent card has contacts such as VCC, GND, CLK, I/O, RST usually, data are carried out two-way transmission in the asynchronous half-duplex mode by I/O (input/output end port) between terminal and smart card, the transfer of data of I/O pin meets the requirement of ISO7816 standard, therefore can carry out signals collecting to the I/O pin, and signal reduced, just can obtain instruction and corresponding data, comprise that slave unit sends to replying of the instruction of card, data and card.According to the ISO7816 standard, terminal provides a sequencing control clock signal as exchanges data to smart card, and the form of the character frame that data are transmitted on I/O is made up of 10 continuous positions a character as shown in Figure 1, comprising:
The start bit of 1 low level state;
8 data bit forming data byte;
A parity check bit.
The bit duration that uses on I/O is defined as an Elementary Time Unit, is called etu.By the I/O periodic sampling is recorded, the sampling time should be less than 0.2etu by receiving terminal for start bit.The purposes of check digit: the number that the logic in character is ' 1 ' must be an even number, and 8 data bit and parity check bit self all calculate the position as verification, but start bit is not done verification and calculated.Verification is not passed through, and then this Frame is a misdata, directly abandons this data.
As preferably, data flow that can monitoring intelligent card I/O port in the described step (2), obtain the data flow of communicating by letter between smart card and the terminal equipment by periodic sampling, the data-signal in the data flow is reduced to the instruction that sends to smart card and the return data of smart card.
By the instruction that sends to smart card of said method acquisition and the return data of smart card, be user's instruction and return data in actual use, to instruct and as test case test card be tested with return data, there is the tester to write the mode that test script carries out test card in the prior art of comparing fully, can guarantee test process more near user's use habit, the reliability of test is stronger.Need explanation at this, except that monitoring intelligent card I/O port, the method that obtains data flow between smart card and terminal equipment has a variety of, in this not explanation one by one.
Wherein, send to instruction two classes of smart card, one class is instruction all not to be had relatedly with instruction before and after it, and another kind of instruction need be calculated the return value of a last instruction or part return value, the data or the partial data that will send result of calculation as instruction specifically.
Can be for first kind instruction directly as the input in the test case, return code, return value are as desired output.Therefore, be input as the instruction described in the step (2) described in the step (3); Desired output described in the step (3) is the return data described in the step (2).
For the instruction of second class, input and desired output need be used variable replacing when being converted into test case.Therefore, the input described in the step (3) comprises a variable, and described expection is output as a variable; Only in test process, could determine the value of variable, and then judge whether the card return value is correct according to the execution result of last instruction.
We are the processing procedure that example illustrates the instruction of second class with the external authentication, may further comprise the steps:
(A) equipment sends and to get random number and instruct card, obtains 8 byte random number rnd1;
(B) equipment carries out the des cryptographic calculation with corresponding key to rnd1, produces authentication data d1;
(C) equipment sends the external authentication order to card, send d1 in card;
(D) after card is received d1, d1 is carried out the des decrypt operation, produce 8 byte authentication data d2 with corresponding secret key in the card.Card is rnd1 and d2 relatively, if then representing authentication, unanimity passes through, otherwise authentification failure.Wherein, equipment sends and gets the random number instruction: 0084000008
Card return value: de3b0cf15367c503
Card return code: 9000
After carrying out cryptographic calculation, equipment sends external authentication instruction: 00820000080f7d7fe835e6370c
Card return value: do not have
Card return code: 9000
The process that is converted into test case is:
Import as expectation 0084000008;
De3b0cf15367c503 is a random number, can not be used as desired output, replaces with variable rnd1;
9000 expressions are got random number and are run succeeded, as desired output;
0f7d7fe835e6370c among the 00820000080f7d7fe835e6370c is the result who rnd1 is carried out the des computations, replaces with variable d1, and 0082000008+d1 is imported as expectation;
9000 expression external authentications run succeeded, as desired output.
More than the specific embodiment of the present invention has been carried out detailed explanation.For the those skilled in the art in present technique field, the various conspicuous change of under the situation of spirit that does not deviate from the method for the invention and claim scope it being carried out is all within protection scope of the present invention.

Claims (9)

1. the method for testing of a smart card is characterized in that, said method comprising the steps of:
(1) generates test card;
(2) use existing smart card and terminal equipment to communicate, obtain to send to the instruction of smart card and the return data of smart card;
(3) instruction and the return data that obtains according to described step (2) generates test case, and described test case sends to the input of test card and the expection output of test card when comprising test;
(4) described input is sent to test card, and the return data of monitoring test card, identical if the return data of described test card and described expection are exported, then test successfully, if inequality then test crash.
2. the method for testing of smart card according to claim 1, described test case are the sequence that the corresponding expection output of a plurality of inputs and input is formed.
3. the method for testing of smart card according to claim 1 and 2 is characterized in that, described step (1) is specially file structure, data structure and the association key according to the required smart card of user, sets up the card structure, generates smart card.
4. the method for testing of smart card according to claim 1 and 2, it is characterized in that, described step (2) is specially: use existing smart card and terminal equipment to carry out communication, and the data flow of communicating by letter between monitoring intelligent card and the terminal equipment, and the data-signal in the data flow is reduced to the instruction that sends to smart card and the return data of smart card.
5. the method for testing of smart card according to claim 1 and 2, it is characterized in that, described step (2) is specially: use existing smart card and terminal equipment to carry out communication, and the I/O port of monitoring intelligent card obtains the data flow of communicating by letter between smart card and the terminal equipment, and the data-signal in the data flow is reduced to the instruction that sends to smart card and the return data of smart card.
6. the method for testing of smart card according to claim 1 and 2, it is characterized in that, described step (2) is specially: use existing smart card and terminal equipment to carry out communication, and the I/O port of monitoring intelligent card, carry out periodic sampling and obtain the data flow of communicating by letter between smart card and the terminal equipment, the data-signal in the data flow is reduced to the instruction that sends to smart card and the return data of smart card.
7. the method for testing of smart card according to claim 1 and 2 is characterized in that, when the instruction before and after the instruction described in the step (2) and its does not all have when related, is input as the instruction described in the step (2) described in the step (3); Desired output described in the step (3) is the return data described in the step (2).
8. the method for testing of smart card according to claim 1 and 2, it is characterized in that, when the instruction described in the step (2) is when needing the output of another step to calculate could to obtain, input described in the described step (3) comprises a variable, and this variable replacing need calculate the data that the back obtains to the output of another step; Expection described in the step (3) is exported with a variable replacing.
9. the method for testing of smart card according to claim 8 is characterized in that, the variable of described replacement expection output is determined expection output according to the value of the input variable that the execution result of last instruction in the test process is determined.
CNB2005101351805A 2005-12-29 2005-12-29 Smart card testing method Active CN100384286C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2005101351805A CN100384286C (en) 2005-12-29 2005-12-29 Smart card testing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2005101351805A CN100384286C (en) 2005-12-29 2005-12-29 Smart card testing method

Publications (2)

Publication Number Publication Date
CN1791258A CN1791258A (en) 2006-06-21
CN100384286C true CN100384286C (en) 2008-04-23

Family

ID=36788680

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2005101351805A Active CN100384286C (en) 2005-12-29 2005-12-29 Smart card testing method

Country Status (1)

Country Link
CN (1) CN100384286C (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101126793B (en) * 2007-09-18 2010-05-19 东信和平智能卡股份有限公司 Intelligent card test system and method
CN102045191B (en) * 2009-10-22 2013-03-20 华为技术有限公司 Method and equipment for testing compatibility after upgrading of system
CN102866312B (en) * 2012-08-30 2014-08-20 东信和平科技股份有限公司 Intelligent card reader-writer power failure test capturing method based on current mutation and reader-writer
CN104794036A (en) * 2014-01-17 2015-07-22 神讯电脑(昆山)有限公司 Method for testing function of computer for reading intelligent card
CN108197019A (en) * 2017-12-20 2018-06-22 大唐微电子技术有限公司 Test system, test equipment, the test method of smart card
CN110188011A (en) * 2019-05-28 2019-08-30 东信和平科技股份有限公司 A kind of smart card national secret algorithm test method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2611989Y (en) * 2003-04-04 2004-04-14 上海华园微电子技术有限公司 Intelligence card chip with self testing microprocessor
CN1503168A (en) * 2002-11-22 2004-06-09 深圳市中兴通讯股份有限公司 Automatic test method for system products
US20050034028A1 (en) * 2003-08-05 2005-02-10 Won-Woo Son Device for testing smart card and method of testing the smart card
CN1632759A (en) * 2003-12-24 2005-06-29 上海华虹集成电路有限责任公司 Method capable of smartly implementing EEPROM simulation function in chip

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1503168A (en) * 2002-11-22 2004-06-09 深圳市中兴通讯股份有限公司 Automatic test method for system products
CN2611989Y (en) * 2003-04-04 2004-04-14 上海华园微电子技术有限公司 Intelligence card chip with self testing microprocessor
US20050034028A1 (en) * 2003-08-05 2005-02-10 Won-Woo Son Device for testing smart card and method of testing the smart card
CN1632759A (en) * 2003-12-24 2005-06-29 上海华虹集成电路有限责任公司 Method capable of smartly implementing EEPROM simulation function in chip

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
智能卡操作系统开发中的测试技术. 张利华.计算机工程与设计,第25卷第6期. 2004 *
智能卡研发技术与工程实践. 李翔,16,19,26,求是科技. 2003 *

Also Published As

Publication number Publication date
CN1791258A (en) 2006-06-21

Similar Documents

Publication Publication Date Title
US6843423B2 (en) Smart card that can be configured for debugging and software development using secondary communication port
CN100384286C (en) Smart card testing method
US6769622B1 (en) System and method for simulating universal serial bus smart card device connected to USB host
EP2105892B1 (en) Apparatus and method for initializing an IC card
CN108334372A (en) firmware upgrade processing method, device and system
CN107528829A (en) BMC chip, server end and its remote monitoring and administration method
CN201015047Y (en) Split type RF CPU card meter controller
CN112269120A (en) Interface signal loop test method and device, computer equipment and storage medium
CN106502814A (en) A kind of method and device of record PCIE device error message
US6641045B1 (en) Portable electronic device with self-diagnostic function
CN105068910A (en) Testing method and apparatus for smart card
US7823133B2 (en) Smart card device and method for debug and software development
CN108647131A (en) The output system of running log
CN114338493A (en) NCSI test method, system, device and storage medium based on network protocol stack
CN103838699B (en) A kind of pluggable Multifunctional mobile financial terminal and port numbers fixing means thereof
CN102413247A (en) Method and device for recovering crash site of terminal
CN101136756B (en) Electric self-checking method, system and BMC chip on network long-range control host machine
CN101707652A (en) Mobile phone capable of realizing digital certificate application
CN102568602B (en) Flash memory development system
CN114116337A (en) Hard disk test method, system, terminal and storage medium based on PCIE link configuration
JP2023523787A (en) Techniques for storing and processing data for transaction attempts by transaction cards
KR20000076351A (en) Integrated circuit and method for testing the same
CN112445659B (en) Multi-protocol high-speed serdes test implementation method and system
CN101615124A (en) The update system of portable executive program and method thereof
CN117785050A (en) Chip and method for reading and writing chip data

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: BEIJING YICHENG XINTONG INTELLIGENT CARD SCIENCE

Free format text: FORMER OWNER: BEIJING WATCH DATA SYSTEM CO., LTD.

Effective date: 20081114

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20081114

Address after: Room 4, building 5, No. 706 Bridge Road, Beijing, Haidian District, Changchun

Patentee after: Beijing Yicheng Xintong intelligent card technology Co. Ltd.

Address before: Beijing City, Chaoyang District Dongzhimen room eight West Street No. 2 East Yan Wanhong Business Garden

Patentee before: Beijing Woqi Data System Co., Ltd.

C56 Change in the name or address of the patentee
CP01 Change in the name or title of a patent holder

Address after: Room 4, building 5, No. 706 Bridge Road, Beijing, Haidian District, Changchun

Patentee after: Beijing Yicheng Xintong Smart Card Co., Ltd.

Address before: Room 4, building 5, No. 706 Bridge Road, Beijing, Haidian District, Changchun

Patentee before: Beijing Yicheng Xintong intelligent card technology Co. Ltd.

C56 Change in the name or address of the patentee

Owner name: BEIJING YICHENGXINTONG INTELLIGENT CARD CO., LTD.

Free format text: FORMER NAME: BEIJING YICHENG XINTONG INTELLIGENT CARD SCIENCE CO., LTD.