CN109885351B - Multi-application smart card and method for establishing master-slave application relationship thereof - Google Patents

Multi-application smart card and method for establishing master-slave application relationship thereof Download PDF

Info

Publication number
CN109885351B
CN109885351B CN201910056375.2A CN201910056375A CN109885351B CN 109885351 B CN109885351 B CN 109885351B CN 201910056375 A CN201910056375 A CN 201910056375A CN 109885351 B CN109885351 B CN 109885351B
Authority
CN
China
Prior art keywords
application
slave
master
unit
identifier
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
CN201910056375.2A
Other languages
Chinese (zh)
Other versions
CN109885351A (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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies 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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201910056375.2A priority Critical patent/CN109885351B/en
Publication of CN109885351A publication Critical patent/CN109885351A/en
Application granted granted Critical
Publication of CN109885351B publication Critical patent/CN109885351B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Telephone Function (AREA)

Abstract

The invention discloses a multi-application smart card and a method for establishing a master-slave application relationship thereof, relating to the field of smart cards. The method comprises the following steps: when a first instruction sent by a card reader is received, the multi-application smart card acquires the identity type of a target application according to a target application identifier in the first instruction, judges the master-slave application relationship updating type according to the master-slave application relationship data updated in the first instruction, executes application addition master application operation according to the identity type of the target application when the master application is added to the application, and returns an application addition master application operation response to the card reader; when the slave application is added to the master application, executing the operation of adding the slave application to the master application according to the identity type of the target application, and returning the operation response of adding the slave application to the card reader; and when the slave application is deleted for the master application, executing the operation of deleting the slave application by the master application according to the identity type of the target application, and returning the operation response of deleting the slave application by the master application to the card reader.

Description

Multi-application smart card and method for establishing master-slave application relationship thereof
Technical Field
The invention relates to the field of smart cards, in particular to a multi-application smart card and a method for establishing a master-slave application relationship.
Background
Smart card (SmartCard): the plastic card embedded with microchip (usually a credit card) is a general term, wherein the smart one-card uses IC card technology as core, and computer and communication technology as means to connect all the facilities in the smart building into an organic whole, and the user can complete the usual key, fund settlement, attendance and some control operations through one IC card, such as opening doors, IC card dining, shopping, entertainment, meeting, parking, night watching, office work, charging service and other activities.
In the society at present, more and more users use multi-application smart cards with a plurality of applications installed, but when the users process the applications on the multi-application smart cards, the applications need to be processed one by one, so that the efficiency is low, and the user experience is poor.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a multi-application smart card and a method for establishing a master-slave application relationship.
The invention provides a method for establishing a master-slave application relationship by a multi-application intelligent card, which comprises the following steps:
step S1: when a multi-application intelligent card receives a first instruction sent by a card reader, the multi-application intelligent card analyzes the first instruction to obtain a target application identifier; judging the updating type of the master-slave application relationship according to the master-slave application relationship data updated in the first instruction, and executing the step S2 when the master application is added to the application; when the slave application is added for the master application, step S3 is performed; when the slave application is deleted for the master application, step S4 is performed;
step S2: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute application addition main application operation or not, if so, executes the application addition main application operation according to the identity type of the target application, returns an application addition main application operation response to the card reader, and ends; otherwise, returning a warning message response to the card reader, and ending;
step S3: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute the operation of adding the master application and the slave application, if so, executes the operation of adding the master application and the slave application according to the identity type of the target application, returns a response of adding the slave application to the master application and the operation of adding the slave application to the card reader, and ends; otherwise, returning a warning message response to the card reader, and ending;
step S4: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute the operation of deleting the master application and the slave application, if so, executes the operation of deleting the master application and the slave application according to the identity type of the target application, returns a response of deleting the slave application of the master application to the card reader, and ends; otherwise, returning warning information response to the card reader, and ending.
The invention also provides a multi-application smart card, which comprises a receiving module, a first analysis module, a first judgment module, a first acquisition module, a second judgment module, a first execution module, a first return module, a second acquisition module, a third judgment module, a second execution module, a second return module, a third acquisition module, a fourth judgment module, a third execution module, a third return module and a fourth return module;
the receiving module is used for receiving a first instruction sent by the card reader;
the first analysis module is used for analyzing the first instruction received by the receiving module to obtain a target application identifier;
the first judging module is used for judging the updating type of the master-slave application relationship according to the master-slave application relationship data updated in the first instruction received by the receiving module;
the first obtaining module is configured to obtain an identity type of a target application according to the target application identifier obtained through analysis by the first analyzing module when the first judging module judges that the master-slave application relationship update type is an application addition master application;
the second judging module is used for judging whether the identity type acquired by the first acquiring module can execute application addition main application operation or not;
the first executing module is configured to, when the second determining module determines that an application addition primary application operation can be executed, execute the application addition primary application operation according to the identity type of the target application acquired by the first acquiring module;
the first returning module is used for returning an application adding main application operation response to the card reader and ending;
the fourth returning module is configured to, when the second determining module determines that the application addition main application operation cannot be executed, return a warning information response to the card reader, and end;
the second obtaining module is configured to obtain an identity type of the target application according to the target application identifier obtained through analysis by the first analyzing module when the first judging module judges that the master-slave application relationship update type is that the master application adds the slave application;
the third judging module is configured to judge whether the identity type acquired by the second acquiring module can execute a master application adding slave application operation;
the second execution module is configured to, when the third determination module determines that a master application addition slave application operation can be executed, execute a master application addition slave application operation according to the identity type of the target application acquired by the second acquisition module;
the second returning module is used for returning the operation response of the master application and the slave application to the card reader and ending;
the fourth returning module is further configured to return a warning message response to the card reader when the third determining module determines that the operation of adding the slave application to the master application cannot be executed, and then the operation is ended;
the third obtaining module is configured to, when the first determining module determines that the master-slave application relationship update type is that the master application deletes the slave application, obtain the identity type of the target application according to the target application identifier obtained through analysis by the first analyzing module;
the fourth judging module is configured to judge whether the identity type acquired by the third acquiring module can execute a master application deleting slave application operation;
the third executing module is configured to, when the fourth determining module determines that a master application deleting slave application operation can be executed, execute a master application deleting slave application operation according to the identity type of the target application acquired by the third acquiring module;
the third returning module is used for returning the operation response of the master application deleting slave application to the card reader and ending;
and the fourth returning module is further configured to return a warning message response to the card reader when the fourth determining module determines that the master application deleting slave application operation cannot be executed, and then the operation is ended.
Compared with the prior art, the invention has the following advantages: according to the multi-application smart card and the method for establishing the master-slave application relationship thereof, the master application is added and the slave applications are increased or decreased through the application to group the applications on the multi-application smart card, namely, the multi-application smart card establishes the master-slave application relationship, so that the unified processing or convenient processing of the multiple applications on the multi-application smart card is realized later, and the user experience is improved.
Drawings
Fig. 1 is a flowchart of a method for establishing a master-slave application relationship by a multi-application smart card according to an embodiment of the present invention;
2-1, 2-2 and 2-3 are flowcharts of a method for establishing a master-slave application relationship by a multi-application smart card according to a second embodiment of the present invention;
fig. 3 is a structural diagram of a multi-application smart card according to a third embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
An embodiment of the present invention provides a method for establishing a master-slave application relationship by a multi-application smart card, where the master-slave application relationship includes a master application and a slave application, and as shown in fig. 1, the method includes the following steps:
step 101: when the multi-application intelligent card receives a first instruction sent by the card reader, the multi-application intelligent card analyzes the first instruction to obtain a target application identifier; judging the updating type of the master-slave application relationship according to the master-slave application relationship data updated in the first instruction, and executing the step 102 when the master application is added to the application; when a slave application is added for the master application, step 103 is performed; when the slave application is deleted for the master application, step 104 is performed;
optionally, in step 101, after the multi-application smart card obtains the target application identifier according to the first instruction, the method further includes: the multi-application smart card analyzes the first instruction to obtain event type data; judging whether the event type data comprises updated master-slave application relationship data, if so, judging the master-slave application relationship update type according to the updated master-slave application relationship data in the first instruction; otherwise, updating the identity type of the target application into an independent application according to the target application identifier, returning a response of successful update of the master-slave application relationship to the card reader, and ending;
further, the identity type of the target application is updated to be an independent application according to the target application identifier, specifically: and the multi-application smart card updates the identity type of the target application in the application information table into an independent application according to the target application identifier.
Step 102: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute application addition main application operation or not, if so, executes the application addition main application operation according to the identity type of the target application, returns an application addition main application operation response to the card reader, and ends; otherwise, returning a warning message response to the card reader, and ending;
optionally, in step 102, it is determined whether the identity type can execute an application addition main application operation, specifically: the multi-application intelligent card judges whether the identity type of the target application is the main application, if so, the multi-application intelligent card returns a warning message response to the card reader, and the process is finished; otherwise, executing the operation of adding the main application according to the identity type of the target application;
further, executing application addition main application operation according to the identity type of the target application, returning an application addition main application operation response to the card reader, and ending, specifically: when the identity type is the independent application, the multi-application smart card updates the identity type of the target application to the slave application; acquiring a new master application identifier from the updated master-slave application relationship data; updating the original main application identifier of the target application into a new main application identifier according to the target application identifier; returning a response of successful update of the master-slave application relationship to the card reader, and ending;
further, executing an application addition main application operation according to the identity type of the target application, specifically:
when the identity type is the slave application, the multi-application smart card acquires a new master application identifier from the updated master-slave application relation data; acquiring an original main application identifier according to the target application identifier, judging whether the original main application identifier is the same as the new main application identifier, if so, returning a response of successful updating of the main-slave application relationship to the card reader, and ending; otherwise, returning the warning information to the card reader, and ending.
Step 103: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute the operation of adding the master application and the slave application, if so, executes the operation of adding the master application and the slave application according to the identity type of the target application, returns a response of adding the slave application to the master application and the operation of adding the slave application to the card reader, and ends; otherwise, returning a warning message response to the card reader, and ending;
optionally, in step 103, it is determined whether the identity type can execute a master application adding slave application operation, specifically: the multi-application intelligent card judges whether the identity type of the target application is the slave application, if so, the multi-application intelligent card returns a warning information response to the card reader, and the operation is finished; otherwise, the operation of adding the slave application by the master application is executed according to the identity type of the target application.
Further, the operation of adding the slave application to the master application is executed according to the identity type of the target application, specifically:
step A1: the multi-application smart card acquires a slave application identifier to be added from the updated master-slave application relation data, and acquires a slave application list corresponding to the target application according to the target application identifier;
step A2: the multi-application intelligent card judges whether the slave application identifier exists in the slave application list, if so, the multi-application intelligent card returns a response of successful update of the master-slave application relationship to the card reader, and the process is finished; otherwise, executing step A3;
step A3: the multi-application smart card judges whether the slave application corresponding to the slave application identifier is installed or not according to the slave application identifier, if so, the step A4 is executed, otherwise, the step A6 is executed;
step A4: the multi-application smart card acquires the identity type of the slave application according to the slave application identifier, and when the identity type is the master application, the multi-application smart card returns a warning information response to the card reader, and the operation is finished; when the identity type is the slave application, performing step a 5; when the identity type is the independent application, performing step a 6;
step A5: the multi-application smart card acquires the master application identifier of the slave application according to the slave application identifier, judges whether the target application identifier is the same as the master application identifier, and executes the step A6 if the target application identifier is the same as the master application identifier; otherwise, returning a warning message response to the card reader, and ending;
step A6: the multi-application smart card updates the identity type of the target application into a master application, and adds the slave application identification to a slave application list corresponding to the target application; returning a response of successful update of the master-slave application relationship to the card reader, and ending;
further, the operation of adding the slave application to the master application is executed according to the identity type of the target application, specifically:
step B1: the multi-application smart card acquires an added slave application identifier list from updated master-slave application relationship data, and selects one slave application identifier from the added slave application identifier list as a current slave application identifier; acquiring a slave application list corresponding to the target application according to the target application identifier;
step B2: the multi-application smart card judges whether the current slave application identifier exists in the slave application list, if so, the current slave application identifier is deleted from the added slave application identifier list, and the step B4 is executed, otherwise, the step B3 is executed;
step B3: the multi-application smart card judges whether a current slave application corresponding to the current slave application identifier is installed or not according to the current slave application identifier, if so, the step B5 is executed, otherwise, the step B4 is executed;
step B4: the multi-application smart card judges whether a slave application identifier which is not taken as the current slave application identifier exists in the added slave application identifier list, if so, the multi-application smart card acquires the next slave application identifier from the added slave application identifier list as the current slave application identifier, and returns to the step B2; otherwise, executing step B7;
step B5: the multi-application smart card acquires the identity type of the current slave application according to the current slave application identifier, and when the identity type is the master application, the multi-application smart card returns a warning information response to the card reader, and the operation is finished; when the identity type is the independent application, returning to the step B4; when the identity type is the slave application, performing step B6;
step B6: the multi-application smart card acquires the master application identifier of the current slave application according to the current slave application identifier, judges whether the target application identifier is the same as the master application identifier or not, and returns to the step B4 if the target application identifier is the same as the master application identifier; otherwise, returning a warning message response to the card reader, and ending;
step B7: the multi-application smart card updates the identity type of the target application to be a master application, and adds the slave application identification added in the slave application identification list to the slave application list; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
Step 104: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute the operation of deleting the master application and the slave application, if so, executes the operation of deleting the master application and the slave application according to the identity type of the target application, returns a response of deleting the slave application by the master application to the card reader, and ends; otherwise, returning warning information response to the card reader, and ending.
Optionally, in step 104, it is determined whether the identity type can execute a master application deleting slave application operation, specifically: the multi-application intelligent card judges whether the identity type of the target application is an independent application or a slave application, if so, the multi-application intelligent card returns a warning information response to the card reader, and the operation is finished; otherwise, executing the operation of deleting the slave application by the master application according to the identity type of the target application;
further, the operation of deleting the slave application from the master application is executed according to the identity type of the target application, specifically:
step C1: the multi-application smart card obtains the slave application identifier to be deleted from the updated master-slave application relationship data, judges whether the slave application identifier exists in the slave application list corresponding to the target application, if so, executes the step C2, otherwise, returns a master-slave application relationship updating success response to the card reader, and ends;
step C2: the multi-application smart card judges whether the slave application is installed or not according to the slave application identifier, if so, the step C3 is executed, otherwise, the step C6 is executed;
step C3: the multi-application smart card acquires the identity type of the slave application according to the slave application identifier, and when the identity type of the slave application is the independent application or the master application, the step C6 is executed; when the identity type of the slave application is the slave application, performing step C4;
step C4: the multi-application smart card acquires the master application identifier of the slave application according to the slave application identifier, judges whether the target application identifier is the same as the master application identifier, if so, executes the step C5, otherwise, executes the step C6;
further, in step C4, when the target application identifier is determined not to be the same as the primary application identifier, step C6 is replaced with: and the multi-application smart card returns a warning message response to the card reader, and the operation is finished.
Step C5: the multi-application smart card updates the identity type of the slave application into the independent application according to the slave application identifier, and deletes the master application identifier of the slave application according to the slave application identifier;
step C6: the multi-application smart card deletes the slave application identifier from the slave application list corresponding to the target application, returns a master-slave application relationship updating success response to the card reader, and ends;
further, in step C6, after the multi-application smart card deletes the slave application identifier, the method further includes:
step C7: the multi-application smart card judges whether the slave application list is empty, if yes, step C8 is executed; otherwise, returning a response of successful update of the master-slave application relationship to the card reader, and ending;
step C8: and the multi-application intelligent card updates the identity type of the target application into an independent application, returns a response of successful update of the master-slave application relationship to the card reader, and ends.
Further, the operation of deleting the slave application from the master application is executed according to the identity type of the target application, specifically:
step D1: the multi-application smart card acquires a deleted slave application identifier list from the updated master-slave application relationship data, and selects one slave application identifier from the deleted slave application identifier list as a current slave application identifier; acquiring a slave application list of the target application according to the target application identifier;
step D2: the multi-application smart card judges whether a current slave application identifier exists in a slave application list corresponding to the target application, if so, the step D3 is executed, otherwise, the step D8 is executed;
step D3: the multi-application smart card judges whether the current slave application is installed or not according to the current slave application identifier, if so, the step D4 is executed, otherwise, the step D7 is executed;
step D4: the multi-application smart card acquires the identity type of the current slave application according to the current slave application identifier, and if the identity type of the current slave application is the independent application or the master application, the multi-application smart card executes the step D7; if the identity type of the current slave application is the slave application, executing step D5;
step D5: the multi-application smart card acquires a master application identifier of the current slave application according to the current slave application identifier, judges whether the target application identifier is the same as the master application identifier or not, and executes the step D6 if the target application identifier is the same as the master application identifier; otherwise, executing step D7;
step D6: the multi-application smart card updates the identity type of the current slave application into an independent application according to the current slave application identifier, and deletes the master application identifier of the current slave application according to the current slave application identifier;
step D7: the multi-application smart card deletes the current slave application identification from the slave application list;
step D8: the multi-application smart card judges whether a slave application identifier which is not used as the current slave application identifier exists in the deleted slave application identifier list, if so, the multi-application smart card acquires the next slave application identifier from the deleted slave application identifier list as the current slave application identifier, and returns to the step D2; otherwise, returning a response of successful update of the master-slave application relationship to the card reader, and ending.
Further, in step D8, when it is determined that there is no slave application id in the slave application id list that is not identified as the current slave application, the method further includes:
step D9: the multi-application intelligent card judges whether the slave application identifier exists in the slave application list, if so, the multi-application intelligent card returns a response of successful update of the master-slave application relationship to the card reader, and the process is finished; otherwise, executing step D10;
step D10: and the multi-application intelligent card updates the identity type of the target application into an independent application, returns a response of successful update of the master-slave application relationship to the card reader, and ends.
Example two
An embodiment of the present invention provides a method for establishing a master-slave application relationship by a multi-application smart card, where the group includes a master application and a slave application, and as shown in fig. 2-1, fig. 2-2, and fig. 2-3, the method includes the following steps:
step 200: when the multi-application intelligent card receives a first instruction sent by the card reader, the multi-application intelligent card analyzes the first instruction to obtain event type data and a target application identifier; judging whether the target application is installed or not according to the target application identifier, if so, executing step 201; otherwise, returning warning information to the card reader, and ending;
optionally, the step specifically includes: when the multi-application smart card receives a first instruction sent by the card reader, the multi-application smart card analyzes the first instruction to obtain a third data length and a fifth data length, third data are obtained from the first instruction according to the third data length and serve as target application identification, and fifth data are obtained from the first instruction according to the fifth data length and serve as event type data; judging whether the target application is installed or not according to the target application identifier, if so, executing step 201; otherwise, returning warning information to the card reader, and ending;
more specifically, the steps are as follows: when the multi-application smart card receives a first instruction sent by the card reader, the multi-application smart card analyzes the first instruction to obtain a third data length (L3) and a fifth data length (L5), third data (V3) are obtained from the first instruction according to the third data length (L3) and are used as target application identifiers, and fifth data (V5) are obtained from the first instruction according to the fifth data length (L5) and are used as event type data; judging whether the target application is installed or not according to the target application identifier, if so, executing step 201; otherwise, returning warning information to the card reader, and ending;
optionally, this step comprises the steps of:
step E1: when the multi-application smart card receives a first command sent by the card reader, the multi-application smart card checks whether the first byte data of the received first command is 0x80 or 0x84, if so, the step E2 is executed, otherwise, warning information is returned to the card reader, and the operation is finished;
for example, the first instruction is 0x80E60C005D0CA000000151434C41420000010CA000000151434C41420001010CA000000151434C41420101010300000030EF2EA12CA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C 414204010100;
step E2: the multi-application smart card checks the second byte data of the received first instruction, if the second byte data is 0xE6, the step E3 is executed, otherwise, warning information is returned to the card reader, and the operation is finished;
step E3: the multi-application smart card checks the third byte data to the fourth byte data of the received first command, and if the third byte data and the fourth byte data are 0x0C and 0x00, respectively, the step E4 is executed; otherwise, returning warning information to the card reader, and ending;
step E4: recording the received fifth byte data of the first instruction as the data field length by the multi-application smart card; recording all byte data after the fifth byte of the received first instruction as a data field according to the length of the data field; optionally, in this embodiment, the length of the data field may be 1 byte or 3 bytes, and the following examples all use 1 byte as an example;
for example, the multi-application smart card records the fifth byte of data 0x5D of the received first instruction as the data field length; recording all byte data 0x0CA000000151434C41420000010CA000000151434C41420001010CA000000151434C41420101010300000030EF2EA12CA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C414204010100 after the fifth byte of the received first instruction as a data field according to the data field length of 0x 5D;
step E5: recording first byte data of a data domain as a first data length by the multi-application smart card; reading data with a first data length after the first data length byte and recording the data as first data; wherein the first data length (L) and the first data (V) can be considered as a first data block as a whole, i.e. the first data block is in LV format;
for example, the multi-application smart card records the first byte data 0x0C of the data field 0x0CA000000151434C41420000010CA000000151434C41420001010CA000000151434C41420101010300000030EF2EA12 A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C414204010100 as a first data length; reading data of a first data length after the first data length byte as first data 0xA000000151434C 4142000001;
step E6: recording first byte data after first data of a data domain as second data length by the multi-application smart card; reading data of a second data length after the second data length byte and recording the data as second data; wherein the second data length (L) and the second data (V) can be considered as a second data block as a whole, i.e. the second data block is in LV format;
for example, the multi-application smart card records the first byte data 0x0C after the first data 0xA000000151434C4142000001 of the data field as the second data length; reading the data of the second data length after the second data length byte and recording the data of the second data length as second data 0xA000000151434C 4142000101;
step E7: recording first byte data after second data of the data domain as third data length by the multi-application smart card; reading data with a third data length after the third data length byte, recording the data as third data, and taking the third data as a target application identifier; wherein the third data length (L) and the third data (V) can be considered as a third data block as a whole, i.e. the third data block is in LV format;
for example, the multi-application smart card records the first byte data 0x0C after the second data 0xA000000151434C4142000101 of the data field as the third data length; reading data of a third data length after the third data length byte, recording the data as third data 0xA000000151434C4142000101, and taking the third data as a target application identification 0xA000000151434C 4142000101;
step E8: recording first byte data after third data of a data domain as a fourth data length by the multi-application smart card; reading data with a fourth data length after the fourth data length byte and recording the data as fourth data; wherein the fourth data length (L) and the fourth data (V) can be considered as a fourth data block as a whole, i.e. the fourth data block is in LV format;
for example, the multi-application smart card records the first byte data 0x03 after the third data 0xA000000151434C4142000101 of the data field as the fourth data length; reading data of a fourth data length after the fourth data length byte and recording the data as fourth data 0x 000000;
step E9: recording first byte data after fourth data of a data domain as a fifth data length by the multi-application smart card; reading data of a fifth data length after the byte of the fifth data length and recording the data as fifth data; wherein the fifth data length (L) and the fifth data (V) can be considered as a fifth data block as a whole, i.e. the fifth data block is in LV format; in this embodiment, the fifth data length includes 1 to 3 bytes, and 1 byte is taken as an example in this embodiment;
for example, the multi-application smart card records the first byte data 0x30 after the fourth data 0x000000 of the data field as the fifth data length; the data of the fifth data length after the fifth data length byte is read is recorded as the fifth data 0xEF2EA12CA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C 4142040101;
specifically, the operation of the multi-application smart card for analyzing the fifth data comprises the following steps:
step F1, the multi-application smart card marks the first byte data in the fifth data of the data field as a first label; judging whether the first label is a first preset value or not, if so, recording first byte data after reading the first label byte as a first label length, and recording the data of the first label length after reading the first label length byte as a first label effective value; otherwise, returning warning information to the card reader, and ending; the first tag (T), the first tag length (L) and the first tag effective value (V) can be regarded as a fifth data block as a whole, that is, the fifth data block is in TLV format;
for example, the multi-application smart card records first byte data in fifth data of the data field as a first tag, and judges whether the first tag is a first preset value 0 xEF; if yes, the first byte data 0x2E after reading the first tag byte is recorded as a first tag length 0x2E, and the data 0xA12CA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C4142040101 after reading the first tag length byte is recorded as a first tag valid value 0xA12CA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F 000000151434C 4142040101; otherwise, returning warning information to the card reader, and ending;
specifically, the operation of the multi-application smart card for resolving the first tag valid value (V) comprises the following steps:
step F2, the multi-application smart card marks the first byte data in the first label effective value (V) of the data field as a second label, judges whether the second label is a second preset value, if yes, the first byte data after reading the second label byte is marked as a second label length, the data after reading the second label length byte is marked as a second label effective value, otherwise, the multi-application smart card returns warning information to the card reader, and the operation is finished; the second tag (T), the second tag length (L) and the second tag effective value (V) can be regarded as a fifth data block as a whole, that is, the fifth data block is in TLV format;
for example, the multi-application smart card records the first byte data in the first tag effective value (V)0xA12CA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C4142040101 of the data field as a second tag, determines whether the second tag is the second preset value 0xA1, if so, records the first byte data 0x2C after reading the second tag byte as the second tag length 0x2C, reads the data 0xA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C 4140101 of the second tag length byte as the second tag effective value 0xA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA 41 000000151434C 4140101, otherwise, returns the warning information to the card reader, and ends;
specifically, the operation of the multi-application smart card for resolving the second tag valid value (V) comprises the following steps:
step F3, the multi-application smart card records the first byte data in the second label effective value (V) of the data field as a third label, judges whether the third label is a fourth preset value, a fifth preset value or a sixth preset value, if so, the first byte data after reading the third label byte is recorded as a third label length, the data after reading the third label length byte is recorded as a third label effective value, otherwise, the multi-application smart card returns warning information to the card reader, and the operation is finished; the third tag (T), the third tag length (L) and the third tag effective value (V) can be regarded as a fifth one-by-one data block as a whole, that is, the fifth one-by-one data block is in TLV format;
for example, the multi-application smart card records the first byte data 0xA1 in the second tag valid value (V)0xA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C4142040101 in the data field as a third tag, determines whether the third tag is a fourth preset value 0xA0, a fifth preset value 0xA1 or a sixth preset value 0xA2, if so, reads the first byte data 0x2A after the third tag byte is recorded as the third tag length, reads the data 0x4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C4142040101 of the third tag length after the third tag length byte is recorded as the third tag valid value 0x4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C 4142001, otherwise, returns an alert message to the card reader, and ends up;
step E10: recording first byte data after fifth data of a data domain as sixth data length by the multi-application smart card; reading data with a sixth data length after the byte with the sixth length and recording the data as sixth data; wherein, the sixth data length (L) and the sixth data (V) can be regarded as the sixth data block as a whole, i.e. the sixth data block is in LV format;
for example, the multi-application smart card records the first byte count 0x00 data after the fifth data 0xEF2EA12CA12A4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C4142040101 in the data field as the sixth data length; reading data of a sixth data length after the sixth length byte and recording the data as sixth data (in this embodiment, the sixth data is null);
in this embodiment, the data length L may be 0x00, and when the data length L is 0x00, the data V corresponding to the data length L is null;
optionally, judging whether the target application is already installed according to the target application identifier, specifically: the multi-application smart card judges whether a target application identifier exists in an installation information column of the application information table, if so, step 201 is executed; otherwise, returning warning information to the card reader, and ending;
in this embodiment, the first instruction conforms to an APDU format; the first instruction is in a format of an instruction header and Data;
specifically, the first instruction is CLAINSP1P2LCData, in this embodiment, CLA represents the application type of the instruction, INS represents the execution type of the instruction, P1 and P2 represent the parameters of the instruction, and LC represents the length of the Data field (Data) of the instruction;
wherein, Data is in a multi-group LV Data format, and the effective value (V value) of the 5 th LV Data (L5V5) comprises a plurality of groups of TLV members; each group of TLV members comprises a member length value (L value) and a member effective value (V value) corresponding to the member T value, wherein the L value is the length of the V value; the member valid value (V value) may also include multiple sets of TLV sub-members;
the format of Data in the first instruction is shown in table 1:
Figure GDA0001991784260000171
TABLE 1
Wherein, Data is in multi-group LV Data format, and the 5 th effective value (V value) of LV Data comprises a plurality of TLV Data; each TLV data comprises a length value (L value) and an effective value (V value) corresponding to the T value; the L value is the length of the V value; the member valid value (V-value) may further include a plurality of sets of TLV sub-members, and the sub-member valid values (V-values) among the TLV sub-members may further include a plurality of sets of TLV sub-members.
Step 201: the multi-application smart card judges whether the event type data comprises updated master-slave application relation data, if so, step 203 is executed, otherwise, step 202 is executed;
optionally, the step specifically includes: the multi-application smart card judges whether the first label is a first preset value, whether the second label is a second preset value and whether the third label is a fourth preset value, a fifth preset value or a sixth preset value, if the first label is the first preset value, the second label is the second preset value and the third label is the fourth preset value or the fifth preset value, the event type data comprises updating master-slave application relation data, step 203 is executed, otherwise step 202 is executed;
for example, the multi-application smart card determines whether the first tag is 0xEF, the second tag is 0xA1, and the third tag is 0xA0, 0xA1, or 0xA2, if the first tag is 0xEF, the second tag is 0xA1, and the third tag is 0xA0, 0xA1, or 0xA2, the event type data includes updating the master-slave application relationship data, perform step 203, otherwise perform step 202;
step 202: the multi-application intelligent card updates the identity type of the target application into an independent application according to the target application identifier, returns a response of successful update of the master-slave application relationship to the card reader, and ends;
optionally, the step specifically includes: the multi-application intelligent card updates the identity type of the target application in the application information table into an independent application according to the target application identifier, returns a response of successful update of the master-slave application relationship to the card reader, and ends;
step 203: the multi-application smart card judges the master-slave application relationship updating type according to the updated master-slave application relationship data, and executes step 204-01 when the master-slave application relationship updating type is that the master application is added to the application; when the master-slave application relationship update type is that the master application adds the slave application, executing step 205-01; when the master-slave application relationship update type is that the master application deletes the slave application, executing step 206-01;
optionally, the step specifically includes: the multi-application smart card judges the master-slave application relationship updating type according to a third label in the updated master-slave application relationship data, when the third label is a third preset value, the master-slave application relationship updating type adds the master application for the application, and step 204-01 is executed; when the third label is a fourth preset value, adding a slave application for the master application according to the master-slave application relationship updating type, and executing the step 205-01; when the third label is a fifth preset value, the master-slave application relationship updating type is that the master application deletes the slave application, and the step 206-01 is executed;
for example, the multi-application smart card determines the master-slave application relationship update type according to the third tag in the updated master-slave application relationship data, and when the third tag is 0xA0, the master-slave application relationship update type adds the master application for the application, and step 204-01 is executed; when the third label is 0xA1, adding a slave application for the master application according to the master-slave application relationship update type, and executing step 205-01; when the third label is 0xA2, the master-slave application relationship update type is that the master application deletes the slave application, and step 206-01 is executed;
optionally, this step further includes: when the master-slave application relationship update type is master application addition or subtraction slave application, step 207-01 is executed:
step 207-01 may first perform a master application add-slave application operation, and then perform a master application delete-slave application operation; firstly executing the step 205-01-the step 205-08, and directly executing the operation of deleting the slave application by the master application after all the responses of returning the successful update of the master-slave application relationship to the card reader in the step 205-01-the step 205-08 are returned, without ending, like the step 206-01-the step 206-10; or the operation of deleting the slave application by the master application can be executed firstly, and then the operation of adding the slave application by the master application can be executed; firstly executing the step 206-01-the step 206-10, and directly executing the operation of deleting the slave application by the master application if the operation is not finished after all the responses of returning the successful update of the master-slave application relationship to the card reader in the step 206-01-the step 206-10 are returned, such as the step 205-01-the step 205-08;
step 204-01: the multi-application smart card acquires the identity type of the target application according to the target application identifier, and executes step 204-02 when the identity type is an independent application; when the identity type is the slave application, executing step 204-03; when the identity type is the main application, returning a warning message response to the card reader, and ending;
optionally, the step specifically includes: the multi-application smart card acquires the identity type of the target application from the application information table according to the target application identifier, and executes step 204-02 when the identity type is an independent application; when the identity type is the slave application, executing step 204-03; when the identity type is the main application, returning a warning message response to the card reader, and ending;
step 204-02: the multi-application smart card updates the identity type of the target application into a slave application according to the target application identifier; acquiring a new master application identifier from the updated master-slave application relationship data; adding a new main application identifier to the target application according to the target application identifier; returning a response of successful update of the master-slave application relationship to the card reader, and ending;
optionally, the step specifically includes: the multi-application intelligent card updates the identity type of the target application in the application information table into a slave application; acquiring a new master application identifier from the updated master-slave application relationship data; updating the main application information of the target application in the application information table into a new main application identifier according to the target application identifier; returning a response of successful update of the master-slave application relationship to the card reader, and ending;
optionally, the updating, according to the target application identifier, the primary application information of the target application in the application information table to be a new primary application identifier specifically includes: the multi-application smart card acquires the main application information of the target application from the application information table according to the target application identifier, and updates the main application information into a new main application identifier;
step 204-03: the multi-application smart card acquires an original main application identifier of the target application according to the target application identifier; acquiring a new master application identifier from the updated master-slave application relationship data; judging whether the new main application identifier is the same as the original main application identifier, if so, returning a response of successful update of the main-slave application relationship to the card reader, and ending; otherwise, returning a warning message response to the card reader, and ending;
optionally, the step specifically includes: the multi-application smart card acquires an original main application identifier of the target application from the main application information of the application information table according to the target application identifier; acquiring a new master application identifier from the updated master-slave application relationship data; judging whether the new main application identifier is the same as the original main application identifier, if so, returning a response of successful update of the main-slave application relationship to the card reader, and ending; otherwise, returning a warning message response to the card reader, and ending;
step 205-01: the multi-application smart card acquires the identity type of the target application according to the target application identifier, and executes step 205-02 when the identity type is an independent application or a main application; when the identity type is the slave application, returning a warning information response to the card reader, and ending;
optionally, the step specifically includes: the multi-application smart card acquires the identity type of the target application from the application information table according to the target application identifier, and executes the step 205-02 when the identity type is an independent application or a main application; when the identity type is the slave application, returning a warning information response to the card reader, and ending;
step 205-02: the multi-application smart card acquires an added slave application identifier list from updated master-slave application relationship data, and selects one slave application identifier from the added slave application identifier list as a current slave application identifier; acquiring a slave application list corresponding to the target application according to the target application identifier;
optionally, the step specifically includes: the multi-application smart card acquires an effective value corresponding to a third label from the updated master-slave application relation data according to the third label to serve as an added slave application identifier list, and selects one slave application identifier from the added slave application identifier list to serve as a current slave application identifier; acquiring a slave application list corresponding to the target application according to the target application identifier;
in this embodiment, the effective value (V5211 value) corresponding to the third tag is an added slave application identifier list, the added slave application identifier list includes multiple sets of TLV format data, each set represents a slave application and includes a fourth tag, and the 1 st byte after the fourth tag is the length of the effective value corresponding to the fourth tag; and the effective value corresponding to the fourth label (V5211k value, k ≧ 1); the specific format is shown in table 2:
Figure GDA0001991784260000211
TABLE 2
For example, the effective value (V5211 value) corresponding to the third tag is 0x4F0CA000000151434C41420201014F0CA000000151434C41420301014F0CA000000151434C 4142040101; then, table 2 is specifically table 3, i.e. table 3 includes 3 slave applications, as shown in the following table:
Figure GDA0001991784260000221
TABLE 3
Optionally, the step is more specifically: the multi-application smart card acquires an effective value corresponding to a third label from the updated master-slave application relation data according to the third label to serve as an added slave application identifier list, acquires a fourth label from the added slave application identifier list, acquires the length and the effective value of the effective value corresponding to the fourth label, and takes the acquired effective value as a current slave application identifier; acquiring a slave application list corresponding to the target application according to the target application identifier;
for example, the multi-application smart card acquires a valid value corresponding to the third tag from the updated master-slave application relationship data according to the third tag as an added slave application identifier list, acquires a fourth tag (0x4F, namely T52112) from the added slave application identifier list, acquires the length (0x0C) and the valid value (0xA000000151434C4142030101) of the valid value corresponding to the fourth tag (0x4F), and takes the acquired valid value as a current slave application identifier (0xA000000151434C 4142030101); wherein the selected fourth label (0x4F) is T52112;
step 205-03: the multi-application smart card judges whether the current slave application identifier exists in the slave application list, if so, the current slave application identifier is deleted from the added slave application identifier list, and step 205-05 is executed, otherwise, step 205-04 is executed;
step 205-04: the multi-application smart card judges whether a current slave application corresponding to the current slave application identifier is installed or not according to the current slave application identifier, if so, the step 205-06 is executed, otherwise, the step 205-05 is executed;
optionally, the step specifically includes: the multi-application smart card judges whether a current slave application identifier corresponding to the current slave application identifier exists in an installation information column of the application information table according to the current slave application identifier, if so, the step 205-06 is executed, otherwise, the step 205-05 is executed;
for example, in this embodiment, as shown in table 4, the application information table includes: if the operation is aimed at realizing that the identifier 3 is added with the slave application identifier 8, the slave application identifier 9 and the slave application identifier 10, the target application identifier is the identifier 3; the specific implementation flow is as follows: the multi-application smart card judges whether all the identifiers in the installation information column comprise the current slave application identifier (0xA000000151434C4142030101), if so, step 205-06 is executed, otherwise, step 205-05 is executed; assume that identification 9 ═ 0xA000000151434C 4142030101;
application information table
Figure GDA0001991784260000231
TABLE 4
Step 205-05: the multi-application smart card judges whether a slave application identifier which is not used as the current slave application identifier exists in the added slave application identifier list, if so, the multi-application smart card acquires the next slave application identifier from the added slave application identifier list as the current slave application identifier, and the step is returned to the step 205-03; otherwise, executing step 205-08;
for example, the multi-application smart card determines whether a slave application identifier which is not identified as the current slave application exists in the slave application identifier list, if so, the multi-application smart card acquires the next slave application identifier (0xA000000151434C4142020101) from the slave application identifier list as the current slave application identifier, and returns to step 205-03; otherwise, executing step 205-08; in this embodiment, the added slave application identification list includes 3 slave applications, and the identification numbers are 0xA000000151434C4142020101, 0xA000000151434C4142030101, and 0xA000000151434C4142040101, respectively; suppose 8-0 xA000000151434C4142020101, 9-0 xA000000151434C4142030101, 10-0 xA000000151434C 4142040101;
step 205-06: the multi-application smart card acquires the identity type of the current slave application according to the current slave application identifier, and when the identity type is the master application, the multi-application smart card returns a warning information response to the card reader, and the operation is finished; when the identity type is the independent application, returning to the step 205-05; when the identity type is the slave application, performing step 205-07;
optionally, the step specifically includes: the multi-application smart card acquires the identity type of the current slave application from the application information table according to the current slave application identifier, and when the identity type is the master application, the multi-application smart card returns a warning information response to the card reader, and the operation is finished; when the identity type is the independent application, returning to the step 205-05; when the identity type is the slave application, performing step 205-07;
for example, the multi-application smart card obtains the identity type of the current slave application from the application information table according to the current slave application identifier 0xA000000151434C4142030101, and when the identity type is the master application 02, returns a warning information response to the card reader, and ends; when the identity type is the independent application 00, returning to the step 205-05; when the identity type is slave application 01, step 205-07 is performed; wherein, it is assumed that 8 ═ 0xA000000151434C4142020101, 9 ═ 0xA000000151434C4142030101, and 10 ═ 0xA000000151434C 4142040101;
step 205-07: the multi-application smart card acquires a master application identifier of the current slave application according to the current slave application identifier, judges whether the target application identifier is the same as the master application identifier or not, and returns to the step 205-05 if the target application identifier is the same as the master application identifier; otherwise, returning a warning message response to the card reader, and ending;
optionally, the step specifically includes: the multi-application smart card acquires the master application identifier of the current slave application from the application information table according to the current slave application identifier 0xA000000151434C4142030101, judges whether the target application identifier is the same as the master application identifier, and returns to the step 205-05 if the target application identifier is the same as the master application identifier; otherwise, returning a warning message response to the card reader, and ending;
step 205-08: the multi-application smart card updates the identity type of the target application to be a master application, and adds the slave application identification added in the slave application identification list to the slave application list; returning a response of successful update of the master-slave application relationship to the card reader, and ending;
optionally, the step specifically includes: the multi-application smart card updates the identity type of the target application in the application information table to be a master application, and adds the slave application identifier added in the slave application identifier list to the slave application list; returning a response of successful update of the master-slave application relationship to the card reader, and ending;
for example, the multi-application smart card updates the identity type of the target application in the application information table from the independent application 00 to the master application 02, and adds the slave application identifiers (identifier 8, identifier 9, and identifier 10) in the slave application identifier list to the slave application list; returning a response of successful update of the master-slave application relationship to the card reader, and ending; that is, the application information table after successful addition is shown in table 5:
Figure GDA0001991784260000251
TABLE 5
Step 206-01: the multi-application smart card acquires the identity type of the target application according to the target application identifier, and when the identity type is independent application or slave application, the multi-application smart card returns warning information response to the card reader, and the operation is finished; when the identity type is the main application, executing the step 206-02;
optionally, the step specifically includes: the multi-application smart card acquires the identity type of the target application from the application information table according to the target application identifier, and when the identity type is independent application or slave application, the multi-application smart card returns a warning information response to the card reader, and the operation is finished; when the identity type is the main application, executing the step 206-02;
step 206-02: the multi-application smart card acquires a deleted slave application identifier list from the updated master-slave application relationship data, and selects one slave application identifier from the deleted slave application identifier list as a current slave application identifier; acquiring a slave application list of the target application from the application information table according to the target application identifier;
optionally, the step specifically includes: the multi-application smart card acquires a deleted slave application identifier list from the updated master-slave application relationship data, and selects one slave application identifier from the deleted slave application identifier list as a current slave application identifier; acquiring a slave application list of the target application according to the target application identifier;
step 206-03: the multi-application smart card judges whether the current slave application identifier exists in the slave application list, if so, step 206-04 is executed, otherwise, step 206-09 is executed;
step 206-04: the multi-application smart card judges whether the current slave application is installed or not according to the current slave application identifier, if so, the step 206-05 is executed, and if not, the step 206-08 is executed;
optionally, the step specifically includes: the multi-application smart card judges whether the installation information column of the application information table has a current slave application identifier, if so, the step 206-05 is executed, otherwise, the step 206-08 is executed;
step 206-05: the multi-application smart card acquires the identity type of the current slave application from the application information table according to the current slave application identifier, and if the identity type of the current slave application is the slave application, the multi-application smart card executes the step 206-06; if the identity type of the current slave application is the independent application or the master application, executing step 206-08;
optionally, the step specifically includes: the multi-application smart card acquires the identity type of the current slave application according to the current slave application identifier, and if the identity type of the current slave application is the slave application, the multi-application smart card executes the step 206-06; if the identity type of the current slave application is the independent application or the master application, executing step 206-08;
step 206-06: the multi-application smart card acquires a master application identifier of the current slave application according to the current slave application identifier, judges whether the target application identifier is the same as the master application identifier or not, and executes the step 206-07 if the target application identifier is the same as the master application identifier; otherwise, executing step 206-08;
optionally, the step specifically includes: the multi-application smart card acquires a master application identifier of the current slave application from the application information table according to the current slave application identifier, judges whether the target application identifier is the same as the master application identifier, and if so, executes the step 206-07; otherwise, executing step 206-08;
step 206-07: the multi-application smart card updates the identity type of the current slave application into an independent application according to the current slave application identifier, and deletes the master application identifier of the current slave application according to the current slave application identifier;
optionally, the step specifically includes: the multi-application smart card updates the identity type of the current slave application in the application information table into an independent application according to the current slave application identifier, and deletes the master application identifier of the current slave application from the application information table according to the current slave application identifier;
step 206-08: the multi-application smart card deletes the current slave application identification from the slave application list;
step 206-09: the multi-application smart card judges whether a slave application identifier which is not used as the current slave application identifier exists in the deleted slave application identifier list, if so, the multi-application smart card acquires the next slave application identifier from the deleted slave application identifier list as the current slave application identifier, and returns to the step 206-03; otherwise, go to step 206-10;
step 206-10: the multi-application intelligent card judges whether the slave application identifier exists in the slave application list, if so, the multi-application intelligent card returns a response of successful update of the master-slave application relationship to the card reader, and the process is finished; otherwise, go to step 206-11;
step 206-11: the multi-application intelligent card updates the identity type of the target application into an independent application, returns a response of successful update of the master-slave application relationship to the card reader, and ends;
optionally, the step specifically includes: the multi-application intelligent card updates the identity type of the target application in the application information table into an independent application, returns a response of successful update of the master-slave application relationship to the card reader, and ends;
optionally, the warning information may specifically be error reporting information or warning information.
EXAMPLE III
A third embodiment of the present invention provides a multi-application smart card, as shown in fig. 3, including a receiving module 301, a first parsing module 302, a first determining module 303, a first obtaining module 304, a second determining module 305, a first executing module 306, a first returning module 307, a second obtaining module 308, a third determining module 309, a second executing module 310, a second returning module 311, a third obtaining module 312, a fourth determining module 313, a third executing module 314, a third returning module 315, and a fourth returning module 316;
the receiving module 301 is configured to receive a first instruction sent by a card reader;
a first parsing module 302, configured to parse the first instruction received by the receiving module 301 to obtain a target application identifier;
a first judging module 303, configured to judge, according to the updated master-slave application relationship data in the first instruction received by the receiving module 301, a master-slave application relationship update type;
a first obtaining module 304, configured to, when the first determining module 303 determines that the master-slave application relationship update type is an application-added master application, obtain an identity type of the target application according to the target application identifier obtained through analysis by the first analyzing module 302;
a second determining module 305, configured to determine whether the identity type acquired by the first acquiring module 304 is capable of performing an application add primary application operation;
a first executing module 306, configured to, when the second determining module 305 determines that the application addition primary application operation can be executed, execute the application addition primary application operation according to the identity type of the target application acquired by the first acquiring module 304;
optionally, the fourth return module 316 includes a first return unit;
correspondingly, the second determining module 305 is specifically configured to determine whether the identity type of the target application acquired by the first acquiring module 304 is a master application, if so, trigger the first returning unit, otherwise, trigger the first executing module 306;
correspondingly, the first returning unit is used for returning the warning information response to the card reader and ending.
Further, the first executing module 306 is specifically configured to update the identity type of the target application acquired by the first acquiring module 304 to be a slave application when the identity type acquired by the first acquiring module 304 is an independent application; acquiring a new master application identifier from the updated master-slave application relationship data; updating the original main application identifier of the target application to a new main application identifier according to the target application identifier obtained by the analysis of the first analysis module 302;
correspondingly, the first returning module 307 is specifically configured to return a response of successful update of the master-slave application relationship to the card reader, and then end.
Further, the first executing module 306 is specifically configured to, when the identity type acquired by the first acquiring module 304 is a slave application, acquire a new master application identifier from updated master-slave application relationship data; acquiring an original main application identifier according to the target application identifier, judging whether the original main application identifier is the same as the new main application identifier, if so, triggering a second returning module 311, otherwise, triggering a second returning unit;
correspondingly, the second returning module 311 is specifically configured to return a response of successful update of the master-slave application relationship to the card reader, and then end.
A first returning module 307, configured to return an application addition main application operation response to the card reader, and end;
a fourth returning module 316, configured to, when the second determining module 305 determines that the application addition host application operation cannot be executed, return a warning information response to the card reader, and end;
the second obtaining module 308 is configured to, when the first determining module 303 determines that the master-slave application relationship update type is that a master application adds a slave application, obtain an identity type of the target application according to the target application identifier obtained through analysis by the first analyzing module 302;
a third determining module 309, configured to determine whether the identity type obtained by the second obtaining module 308 can perform a master application adding slave application operation;
optionally, the fourth return module 316 includes a second return unit;
correspondingly, the third determining module 309 is specifically configured to determine whether the identity type of the target application acquired by the second acquiring module 308 is a slave application, and if so, trigger the second returning unit; otherwise, the second execution module 310 is triggered;
correspondingly, the second returning unit is used for returning the warning information response to the card reader and ending.
Further, the second executing module 310 includes a first obtaining unit, a second obtaining unit, a first judging unit, a second judging unit, a third obtaining unit, a fourth obtaining unit, a third judging unit, and a first update addition returning unit;
correspondingly, the first obtaining unit is used for obtaining the slave application identifier to be added from the updated master-slave application relationship data;
correspondingly, the second obtaining unit is configured to obtain a slave application list corresponding to the target application according to the target application identifier obtained through analysis by the first analysis module 302;
correspondingly, the first judging unit is configured to judge whether the slave application identifier exists in the slave application list acquired by the second acquiring unit, if yes, the first returning module 307 is triggered, and otherwise, the second judging unit is triggered;
correspondingly, the first returning module 307 is specifically configured to return a response that the master-slave application relationship is updated successfully to the card reader, and then end;
correspondingly, the second judging unit is used for judging whether a slave application corresponding to the slave application identifier acquired by the first acquiring unit is installed or not according to the slave application identifier acquired by the first acquiring unit, if so, the third acquiring unit is triggered, and otherwise, the first update addition returning unit is triggered;
correspondingly, the third obtaining unit is used for obtaining the identity type of the slave application according to the slave application identifier obtained by the first obtaining unit, and when the identity type is the master application, the second returning unit is triggered; when the identity type is the slave application, triggering a fourth acquisition unit; when the identity type is the independent application, triggering a first updating addition returning unit;
correspondingly, the fourth obtaining unit is used for obtaining the master application identifier of the slave application according to the slave application identifier obtained by the first obtaining unit;
correspondingly, the third determining unit is configured to determine whether the target application identifier obtained by the analysis of the first analyzing module 302 is the same as the main application identifier obtained by the fourth obtaining unit, and if so, trigger the first update addition returning unit; otherwise, triggering a second return unit;
correspondingly, the first update addition returning unit is configured to update the identity type of the target application acquired by the second acquiring module 308 to be the master application, and add the slave application identifier acquired by the first acquiring unit to the slave application list acquired by the second acquiring unit and corresponding to the target application; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
Further, the second executing module 310 includes an eleventh acquiring unit, an eleventh selecting unit, a twelfth acquiring unit, an eleventh judging unit, an eleventh deleting unit, a twelfth judging unit, a thirteenth acquiring unit, a fourteenth acquiring unit, a fifteenth acquiring unit, a fourteenth judging unit, and an eleventh update addition returning unit;
correspondingly, an eleventh obtaining unit, configured to obtain an add slave application identifier list from the updated master-slave application relationship data;
correspondingly, the eleventh selecting unit is configured to select one slave application identifier from the list of added slave application identifiers acquired by the eleventh acquiring unit as the current slave application identifier;
correspondingly, the twelfth obtaining unit is configured to obtain a slave application list corresponding to the target application according to the target application identifier obtained through analysis by the first analysis module 302;
correspondingly, the eleventh judging unit is configured to judge whether the slave application list acquired by the eleventh acquiring unit has a current slave application identifier, if so, trigger the eleventh deleting unit, otherwise, trigger the twelfth judging unit;
correspondingly, an eleventh deleting unit, configured to delete the current slave application identifier from the list of added slave application identifiers, and trigger the thirteenth judging unit;
correspondingly, the twelfth judging unit is configured to judge whether the current slave application corresponding to the current slave application identifier selected by the eleventh selecting unit has been installed according to the current slave application identifier selected by the eleventh selecting unit, if so, the fourteenth obtaining unit is performed, and if not, the thirteenth judging unit is triggered;
correspondingly, the thirteenth judging unit is used for judging whether the added slave application identifier list obtained by deleting the current slave application identifier by the eleventh deleting unit has a slave application identifier which is not used as the current slave application identifier, if so, the thirteenth obtaining unit is triggered, otherwise, the eleventh updating and adding returning unit is triggered;
correspondingly, a thirteenth acquiring unit, configured to acquire a next slave application identifier from the added slave application identifier list after the current slave application identifier is deleted, as the current slave application identifier, and trigger the eleventh judging unit;
correspondingly, the fourteenth obtaining unit is configured to obtain the identity type of the current slave application according to the current slave application identifier selected by the eleventh selecting unit, and trigger the second returning unit when the identity type is the master application; when the identity type is independent application, triggering a thirteenth judging unit; when the identity type is the slave application, triggering a fifteenth acquisition unit;
correspondingly, the fifteenth obtaining unit is configured to obtain the master application identifier of the current slave application according to the current slave application identifier selected by the eleventh selecting unit;
correspondingly, the fourteenth determining unit is configured to determine whether the target application identifier obtained through analysis by the first analyzing module 302 is the same as the main application identifier obtained by the fifteenth obtaining unit, and if so, trigger the thirteenth determining unit; otherwise, triggering a second return unit;
still further, the fourth return module 316 includes a third return unit;
correspondingly, the fourth determining module 313 is specifically configured to determine whether the identity type of the target application acquired by the third acquiring module 312 is an independent application or a slave application, and if so, trigger the third returning unit; otherwise, the third execution module 314 is triggered;
correspondingly, the third returning unit is used for returning the warning information response to the card reader and ending.
Correspondingly, the eleventh update addition returning unit is configured to update the identity type of the target application acquired by the second acquiring module 308 to be the master application, and add the slave application identifier in the added slave application identifier list divided by the current slave application identifier to the slave application list acquired by the twelfth acquiring unit; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
A second executing module 310, configured to, when the third determining module 309 determines that the master application adding slave application operation can be executed, execute the master application adding slave application operation according to the identity type of the target application acquired by the second acquiring module 308;
a second returning module 311, configured to return the operation response of the master application and the slave application to the card reader, and end;
the fourth returning module 316 is further configured to, when the third determining module 309 determines that the operation of adding the slave application to the master application cannot be executed, return a warning information response to the card reader, and then end;
a third obtaining module 312, configured to, when the first determining module 303 determines that the master-slave application relationship update type is that the master application deletes the slave application, obtain an identity type of the target application according to the target application identifier obtained through analysis by the first analyzing module 302;
a fourth determining module 313, configured to determine whether the identity type obtained by the third obtaining module 312 can perform a master application deleting slave application operation;
a third executing module 314, configured to, when the fourth determining module 313 determines that the master application deletion slave application operation can be executed, execute the master application deletion slave application operation according to the identity type of the target application acquired by the third acquiring module 312;
a third returning module 315, configured to return a response of the master application to delete the slave application to the card reader, and end;
the fourth returning module 316 is further configured to, when the fourth determining module 313 determines that the master application deleting slave application operation cannot be performed, return an alert information response to the card reader, and end.
Optionally, the multi-application smart card in this embodiment further includes a fifth determining module, an updating module, and a fifth returning module;
correspondingly, the first parsing module 302 is further configured to parse the first instruction received by the receiving module 301 to obtain event type data;
correspondingly, the fifth judging module is configured to judge whether the event type data analyzed by the first analyzing module 302 includes updated master-slave application relationship data, if yes, the first judging module 303, and if not, the updating module is triggered;
correspondingly, the updating module is configured to update the identity type of the target application to an independent application according to the target application identifier obtained through the analysis by the first analyzing module 302;
further, the updating module is specifically configured to update the identity type of the target application in the application information table to be an independent application according to the target application identifier obtained through the analysis by the first analyzing module 302.
Correspondingly, the fifth returning module is used for returning a response of successful update of the master-slave application relationship to the card reader, and ending.
Further, the third executing module 314 includes a twenty-first acquiring unit, a twenty-first judging unit, a twenty-second acquiring unit, a twenty-third judging unit, a twenty-first updating and deleting unit, and a twenty-first deleting and returning unit;
correspondingly, a twenty-first obtaining unit, configured to obtain a slave application identifier to be deleted from the updated master-slave application relationship data;
correspondingly, the twenty-first judging unit is configured to judge whether the slave application identifier acquired by the twenty-first acquiring unit exists in the slave application list corresponding to the target application, if yes, trigger the twenty-second judging unit, and otherwise trigger the third returning module 315;
correspondingly, the third returning module 315 is specifically configured to return a response that the master-slave application relationship is updated successfully to the card reader, and then end;
correspondingly, the twenty-second judging unit is used for judging whether the slave application is installed or not according to the slave application identifier acquired by the twenty-first acquiring unit, if so, the twenty-second acquiring unit is triggered, otherwise, the twenty-first deleting returning unit is triggered;
correspondingly, the twenty-second obtaining unit is configured to obtain the identity type of the slave application according to the slave application identifier obtained by the twenty-first obtaining unit, and trigger the twenty-first deletion returning unit when the identity type of the slave application is the independent application or the master application; when the identity type of the slave application is the slave application, triggering a twenty-third acquisition unit;
correspondingly, the twenty-third obtaining unit is used for obtaining the master application identifier of the slave application according to the slave application identifier obtained by the twenty-first obtaining unit;
correspondingly, the twenty-third determining unit is configured to determine whether the target application identifier obtained through analysis by the first analyzing module 302 is the same as the main application identifier obtained by the twenty-third obtaining unit, if so, trigger the twentieth updating and deleting unit, otherwise, trigger the twenty-first deleting and returning unit;
more recently, the twenty-third determining unit is further configured to determine whether the target application identifier obtained by the analysis of the first analyzing module 302 is the same as the main application identifier obtained by the twenty-third obtaining unit, if so, trigger the twentieth updating and deleting unit, otherwise, trigger the third returning unit.
Correspondingly, the twenty-first updating and deleting unit is used for updating the identity type of the slave application acquired by the twenty-second acquiring unit into the independent application according to the slave application identifier acquired by the twenty-first acquiring unit, and deleting the master application identifier of the slave application acquired by the twenty-third acquiring unit according to the slave application identifier acquired by the twenty-first acquiring unit;
correspondingly, the twenty-first deletion returning unit is configured to delete the slave application identifier acquired by the twenty-first acquiring unit from the slave application list corresponding to the target application, return a response of successful master-slave application relationship update to the card reader, and end.
Further comprises a twenty-fourth judging unit, a twenty-second updating and returning unit,
Correspondingly, the twenty-fourth judging unit is used for judging whether the slave application list is empty or not, and if so, the twenty-second updating returning unit is triggered; otherwise, the third return module 315 is triggered;
correspondingly, the twenty-second update returning unit is configured to update the identity type of the target application acquired by the third acquiring module 312 into an independent application, return a response of successful update of the master-slave application relationship to the card reader, and end.
Further, the third executing module 314 includes a thirty-first obtaining unit, a thirty-first selecting unit, a thirty-second obtaining unit, a thirty-first judging unit, a thirty-second obtaining unit, a thirty-third judging unit, a thirty-first updating and deleting unit, a thirty-second deleting unit, a thirty-fourth judging unit, and a thirty-fourth obtaining unit;
correspondingly, a thirty-first obtaining unit, configured to obtain a deleted slave application identifier list from the updated master-slave application relationship data;
correspondingly, a thirty-first selecting unit, configured to select one slave application identifier from the list of deleted slave application identifiers obtained by the thirty-first obtaining unit as the current slave application identifier;
correspondingly, the thirty-second obtaining unit is configured to obtain a slave application list of the target application according to the target application identifier obtained through analysis by the first analysis module 302;
correspondingly, the thirty-first judging unit is used for judging whether the current slave application identifier selected by the thirty-first selecting unit exists in the slave application list acquired by the thirty-second acquiring unit corresponding to the target application, if so, the thirty-second judging unit is triggered, otherwise, the thirty-fourth judging unit is triggered;
correspondingly, the thirty-second judging unit is used for judging whether the current slave application is installed or not according to the current slave application identifier selected by the thirty-first selecting unit, if so, the thirty-second acquiring unit is triggered, and if not, the thirty-second deleting unit is triggered;
correspondingly, the thirty-second obtaining unit is configured to obtain the identity type of the current slave application according to the current slave application identifier selected by the thirty-first selecting unit, and if the identity type of the current slave application is an independent application or a master application, trigger the thirty-second deleting unit; if the identity type of the current slave application is the slave application, triggering a thirty-third acquisition unit;
correspondingly, the thirty-third obtaining unit is configured to obtain the master application identifier of the current slave application according to the current slave application identifier selected by the thirty-first selecting unit;
correspondingly, the thirty-third determining unit is configured to determine whether the target application identifier obtained through analysis by the first analyzing module 302 is the same as the main application identifier obtained by the thirty-third obtaining unit, and if so, trigger the thirty-first updating and deleting unit; otherwise, triggering a thirty-second deleting unit;
correspondingly, the thirty-first updating and deleting unit is used for updating the identity type of the current slave application into the independent application according to the current slave application identifier and deleting the master application identifier of the current slave application according to the current slave application identifier;
correspondingly, the thirty-second deleting unit is configured to delete the current slave application identifier selected by the thirty-first selecting unit from the slave application list acquired by the thirty-second acquiring unit;
correspondingly, the thirty-fourth judging unit is configured to judge whether there is a slave application identifier that is not used as the current slave application identifier in the deleted slave application identifier list, if so, trigger the thirty-fourth acquiring unit, otherwise, trigger the first returning module 307;
correspondingly, the thirty-fourth obtaining unit is used for obtaining the next slave application identifier from the deleted slave application identifier list as the current slave application identifier and triggering the thirty-first judging unit;
correspondingly, the first returning module 307 is specifically configured to return a response of successful update of the master-slave application relationship to the card reader, and then end.
Furthermore, the third executing module 314 further includes a thirty-fifth determining unit and a thirty-second obtaining unit;
correspondingly, the thirty-five judging unit is used for judging whether the slave application identifier exists in the slave application list, if so, the third returning module 315 is triggered, otherwise, the thirty-one updating returning unit is triggered;
correspondingly, the thirty-first update returning unit is configured to update the identity type of the target application acquired by the thirty-second acquiring unit to an independent application, return a response of successful update of the master-slave application relationship to the card reader, and end.
Optionally, the warning information may specifically be error reporting information or warning information.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (30)

1. A method for establishing a master-slave application relationship by a multi-application smart card is characterized by comprising the following steps:
step S1: when a multi-application intelligent card receives a first instruction sent by a card reader, the multi-application intelligent card analyzes the first instruction to obtain a target application identifier; judging the updating type of the master-slave application relationship according to the updated master-slave application relationship data in the first instruction, and executing the step S2 when the master application is added to the application; when the slave application is added for the master application, step S3 is performed; when the slave application is deleted for the master application, step S4 is performed;
step S2: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute application addition main application operation or not, if so, executes the application addition main application operation according to the identity type of the target application, returns an application addition main application operation response to the card reader, and ends; otherwise, returning a warning message response to the card reader, and ending;
step S3: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute the operation of adding the master application and the slave application, if so, executes the operation of adding the master application and the slave application according to the identity type of the target application, returns a response of adding the slave application to the master application and the operation of adding the slave application to the card reader, and ends; otherwise, returning a warning message response to the card reader, and ending;
step S4: the multi-application smart card acquires the identity type of the target application according to the target application identifier, judges whether the identity type can execute the operation of deleting the master application and the slave application, if so, executes the operation of deleting the master application and the slave application according to the identity type of the target application, returns a response of deleting the slave application of the master application to the card reader, and ends; otherwise, returning warning information response to the card reader, and ending.
2. The method according to claim 1, wherein in step S1, after the multi-application smart card parses the first command to obtain the target application identifier, the method further comprises:
the multi-application smart card analyzes the first instruction to obtain event type data; judging whether the event type data comprises updated master-slave application relationship data, if so, judging the master-slave application relationship update type according to the updated master-slave application relationship data in the first instruction; otherwise, the identity type of the target application is updated to be independent application according to the target application identification, a response of successful update of the master-slave application relation is returned to the card reader, and the process is finished.
3. The method according to claim 2, wherein the updating the identity type of the target application to an independent application according to the target application identifier specifically comprises: and the multi-application smart card updates the identity type of the target application in the application information table into an independent application according to the target application identifier.
4. The method according to claim 1, wherein in step S2, the determining whether the identity type can perform the application add primary application operation includes:
the multi-application intelligent card judges whether the identity type of the target application is a main application, if so, the multi-application intelligent card returns a warning message response to the card reader, and the operation is finished; otherwise, executing the operation of adding the main application according to the identity type of the target application.
5. The method according to claim 4, wherein the executing of the application addition host application operation according to the identity type of the target application returns an application addition host application operation response to the card reader, and the ending is specifically:
when the identity type is the independent application, the multi-application smart card updates the identity type of the target application to be the slave application; acquiring a new master application identifier from the updated master-slave application relationship data; updating the original main application identifier of the target application into a new main application identifier according to the target application identifier; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
6. The method according to claim 4, wherein the executing of the application add master application operation according to the identity type of the target application specifically comprises:
when the identity type is the slave application, the multi-application smart card acquires a new master application identifier from the updated master-slave application relation data; acquiring an original main application identifier according to the target application identifier, judging whether the original main application identifier is the same as the new main application identifier, if so, returning a response of successful updating of the main-slave application relationship to the card reader, and ending; otherwise, returning the warning information to the card reader, and ending.
7. The method according to claim 1, wherein in step S3, the determining whether the identity type can perform the operation of adding the slave application by the master application is specifically:
the multi-application intelligent card judges whether the identity type of the target application is a slave application, if so, a warning information response is returned to the card reader, and the process is finished; otherwise, the operation of adding the slave application by the master application is executed according to the identity type of the target application.
8. The method according to claim 7, wherein the performing a master application add slave application operation according to the identity type of the target application specifically comprises:
step A1: the multi-application smart card acquires a slave application identifier to be added from the updated master-slave application relation data, and acquires a slave application list corresponding to the target application according to the target application identifier;
step A2: the multi-application smart card judges whether the slave application identifier exists in the slave application list, if so, the multi-application smart card returns a response of successful update of the master-slave application relationship to the card reader, and the process is finished; otherwise, executing step A3;
step A3: the multi-application smart card judges whether a slave application corresponding to the slave application identifier is installed or not according to the slave application identifier, if so, the step A4 is executed, otherwise, the step A6 is executed;
step A4: the multi-application smart card acquires the identity type of the slave application according to the slave application identifier, and when the identity type is the master application, the multi-application smart card returns a warning information response to the card reader, and the operation is finished; when the identity type is the slave application, performing step a 5; when the identity type is the independent application, performing step a 6;
step A5: the multi-application smart card acquires a master application identifier of the slave application according to the slave application identifier, judges whether the target application identifier is the same as the master application identifier, and executes the step A6 if the target application identifier is the same as the master application identifier; otherwise, returning a warning message response to the card reader, and ending;
step A6: the multi-application smart card updates the identity type of the target application into a master application, and adds the slave application identification to a slave application list corresponding to the target application; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
9. The method according to claim 7, wherein the performing a master application add slave application operation according to the identity type of the target application specifically comprises:
step B1: the multi-application smart card acquires an added slave application identifier list from updated master-slave application relationship data, and selects one slave application identifier from the added slave application identifier list as a current slave application identifier; acquiring a slave application list corresponding to the target application according to the target application identifier;
step B2: the multi-application smart card judges whether the current slave application identifier exists in the slave application list, if so, the current slave application identifier is deleted from the added slave application identifier list, and the step B4 is executed, otherwise, the step B3 is executed;
step B3: the multi-application smart card judges whether a current slave application corresponding to the current slave application identifier is installed or not according to the current slave application identifier, if so, the step B5 is executed, otherwise, the step B4 is executed;
step B4: the multi-application smart card judges whether a slave application identifier which is not used as the current slave application identifier exists in the added slave application identifier list, if so, the multi-application smart card acquires the next slave application identifier from the added slave application identifier list as the current slave application identifier, and returns to the step B2; otherwise, executing step B7;
step B5: the multi-application smart card acquires the identity type of the current slave application according to the current slave application identifier, and when the identity type is the master application, the multi-application smart card returns a warning information response to the card reader, and the operation is finished; when the identity type is the independent application, returning to the step B4; when the identity type is the slave application, performing step B6;
step B6: the multi-application smart card acquires the master application identifier of the current slave application according to the current slave application identifier, judges whether the target application identifier is the same as the master application identifier or not, and returns to the step B4 if the target application identifier is the same as the master application identifier; otherwise, returning a warning message response to the card reader, and ending;
step B7: the multi-application smart card updates the identity type of the target application to be a master application, and adds the slave application identification added in the slave application identification list to the slave application list; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
10. The method according to claim 1, wherein in step S4, the determining whether the identity type can perform the master application deletion slave application operation includes:
the multi-application smart card judges whether the identity type of the target application is an independent application or a slave application, if so, a warning message response is returned to the card reader, and the process is finished; otherwise, executing the operation of deleting the slave application by the master application according to the identity type of the target application.
11. The method according to claim 10, wherein the executing of the master application deleting slave application operation according to the identity type of the target application specifically comprises:
step C1: the multi-application smart card obtains the slave application identifier to be deleted from the updated master-slave application relationship data, judges whether the slave application identifier exists in the slave application list corresponding to the target application, if so, executes the step C2, otherwise, returns a response of successful master-slave application relationship update to the card reader, and ends;
step C2: the multi-application smart card judges whether the slave application is installed or not according to the slave application identification, if so, the step C3 is executed, otherwise, the step C6 is executed;
step C3: the multi-application smart card acquires the identity type of the slave application according to the slave application identifier, and when the identity type of the slave application is the independent application or the master application, the step C6 is executed; when the identity type of the slave application is the slave application, performing step C4;
step C4: the multi-application smart card acquires a master application identifier of the slave application according to the slave application identifier, judges whether the target application identifier is the same as the master application identifier, if so, executes the step C5, otherwise, executes the step C6;
step C5: the multi-application smart card updates the identity type of the slave application into the independent application according to the slave application identifier, and deletes the master application identifier of the slave application according to the slave application identifier;
step C6: and the multi-application smart card deletes the slave application identifier from the slave application list corresponding to the target application, returns a master-slave application relationship updating success response to the card reader, and ends.
12. The method as claimed in claim 11, wherein in the step C4, when the target application id is determined not to be the same as the master application id, the step C6 is replaced with: and the multi-application intelligent card returns a warning information response to the card reader, and the operation is finished.
13. The method according to claim 11, wherein in step C6, after the multi-application smart card deletes the slave application identifier, the method further comprises:
step C7: the multi-application smart card judges whether the slave application list is empty, if so, the step C8 is executed; otherwise, returning a response of successful update of the master-slave application relationship to the card reader, and ending;
step C8: and the multi-application intelligent card updates the identity type of the target application into an independent application, returns a response of successful update of the master-slave application relationship to the card reader, and ends.
14. The method according to claim 10, wherein the master application deletion slave application operation is performed according to the identity type of the target application, specifically:
step D1: the multi-application smart card acquires a deleted slave application identifier list from the updated master-slave application relationship data, and selects one slave application identifier from the deleted slave application identifier list as a current slave application identifier; acquiring a slave application list of the target application according to the target application identifier;
step D2: the multi-application smart card judges whether a current slave application identifier exists in a slave application list corresponding to the target application, if so, the step D3 is executed, otherwise, the step D8 is executed;
step D3: the multi-application smart card judges whether the current slave application is installed or not according to the current slave application identifier, if so, the step D4 is executed, otherwise, the step D7 is executed;
step D4: the multi-application smart card acquires the identity type of the current slave application according to the current slave application identifier, and if the identity type of the current slave application is the independent application or the master application, the step D7 is executed; if the identity type of the current slave application is the slave application, executing step D5;
step D5: the multi-application smart card acquires a master application identifier of the current slave application according to the current slave application identifier, judges whether the target application identifier is the same as the master application identifier, and executes the step D6 if the target application identifier is the same as the master application identifier; otherwise, executing step D7;
step D6: the multi-application smart card updates the identity type of the current slave application into an independent application according to the current slave application identifier, and deletes the master application identifier of the current slave application according to the current slave application identifier;
step D7: the multi-application smart card deletes the current slave application identification from the slave application list;
step D8: the multi-application smart card judges whether a slave application identifier which is not used as the current slave application identifier exists in the deleted slave application identifier list, if so, the multi-application smart card acquires the next slave application identifier from the deleted slave application identifier list as the current slave application identifier, and returns to the step D2; otherwise, returning a response of successful update of the master-slave application relationship to the card reader, and ending.
15. The method according to claim 14, wherein in step D8, when it is determined that there is no slave application id in the slave application id list that is not identified as the current slave application, the method further comprises:
step D9: the multi-application intelligent card judges whether a slave application identifier exists in the slave application list, if so, a response of successful updating of the master-slave application relationship is returned to the card reader, and the process is finished; otherwise, executing step D10;
step D10: and the multi-application intelligent card updates the identity type of the target application into an independent application, returns a response of successful update of the master-slave application relationship to the card reader, and ends.
16. A multi-application smart card is characterized by comprising a receiving module, a first analysis module, a first judgment module, a first obtaining module, a second judgment module, a first execution module, a first return module, a second obtaining module, a third judgment module, a second execution module, a second return module, a third obtaining module, a fourth judgment module, a third execution module, a third return module and a fourth return module;
the receiving module is used for receiving a first instruction sent by the card reader;
the first analysis module is used for analyzing the first instruction received by the receiving module to obtain a target application identifier;
the first judging module is used for judging the updating type of the master-slave application relationship according to the updated master-slave application relationship data in the first instruction received by the receiving module;
the first obtaining module is configured to obtain an identity type of a target application according to the target application identifier obtained through analysis by the first analyzing module when the first judging module judges that the master-slave application relationship update type is an application addition master application;
the second judging module is used for judging whether the identity type acquired by the first acquiring module can execute application addition main application operation or not;
the first executing module is configured to, when the second determining module determines that an application addition primary application operation can be executed, execute the application addition primary application operation according to the identity type of the target application acquired by the first acquiring module;
the first returning module is used for returning an application adding main application operation response to the card reader and ending;
the fourth returning module is configured to, when the second determining module determines that the application addition main application operation cannot be executed, return a warning information response to the card reader, and end;
the second obtaining module is configured to obtain an identity type of the target application according to the target application identifier obtained through analysis by the first analyzing module when the first judging module judges that the master-slave application relationship update type is that the master application adds the slave application;
the third judging module is configured to judge whether the identity type acquired by the second acquiring module can execute a master application adding slave application operation;
the second execution module is configured to, when the third determination module determines that a master application addition slave application operation can be executed, execute a master application addition slave application operation according to the identity type of the target application acquired by the second acquisition module;
the second returning module is used for returning the operation response of the master application and the slave application to the card reader and ending;
the fourth returning module is further configured to return a warning message response to the card reader when the third determining module determines that the operation of adding the slave application to the master application cannot be executed, and then the operation is ended;
the third obtaining module is configured to, when the first determining module determines that the master-slave application relationship update type is that the master application deletes the slave application, obtain the identity type of the target application according to the target application identifier obtained through analysis by the first analyzing module;
the fourth judging module is configured to judge whether the identity type acquired by the third acquiring module can execute a master application deleting slave application operation;
the third executing module is configured to, when the fourth determining module determines that a master application deleting slave application operation can be executed, execute a master application deleting slave application operation according to the identity type of the target application acquired by the third acquiring module;
the third returning module is used for returning the operation response of the master application deleting slave application to the card reader and ending;
and the fourth returning module is further configured to return a warning message response to the card reader when the fourth determining module determines that the master application deleting slave application operation cannot be executed, and then the operation is ended.
17. The multi-application smart card of claim 16, further comprising a fifth judging module, an updating module, and a fifth returning module;
the first analysis module is further configured to analyze the first instruction received by the receiving module to obtain event type data;
the fifth judging module is configured to judge whether the event type data analyzed by the first analyzing module includes updated master-slave application relationship data, if yes, the first judging module, and if not, the updating module is triggered;
the updating module is used for updating the identity type of the target application into an independent application according to the target application identifier obtained by the analysis of the first analyzing module;
and the fifth returning module is used for returning a response of successful update of the master-slave application relationship to the card reader and ending.
18. The multi-application smart card of claim 17, wherein the updating module is specifically configured to update the identity type of the target application in the application information table to an independent application according to the target application identifier obtained by the analysis of the first analyzing module.
19. The multi-application smart card of claim 16, wherein the fourth return module comprises a first return unit;
the second judging module is specifically configured to judge whether the identity type of the target application acquired by the first acquiring module is a master application, if so, trigger the first returning unit, otherwise, trigger the first executing module;
and the first return unit is used for returning the warning information response to the card reader and ending.
20. The multi-application smart card of claim 19, wherein the first executing module is specifically configured to update the identity type of the target application acquired by the first acquiring module to a slave application when the identity type acquired by the first acquiring module is an independent application; acquiring a new master application identifier from the updated master-slave application relationship data; updating the original main application identifier of the target application to be a new main application identifier according to the target application identifier obtained by the analysis of the first analysis module;
and the first returning module is specifically used for returning a response of successful update of the master-slave application relationship to the card reader, and ending.
21. The multi-application smart card of claim 19, wherein the first executing module is specifically configured to, when the identity type obtained by the first obtaining module is a slave application, obtain a new master application identifier from updated master-slave application relationship data; acquiring an original main application identifier according to the target application identifier, judging whether the original main application identifier is the same as the new main application identifier, if so, triggering a second return module, otherwise, triggering the first return unit;
and the second returning module is specifically used for returning a response of successful update of the master-slave application relationship to the card reader, and ending.
22. The multi-application smart card of claim 16, wherein the fourth return module comprises a second return unit;
the third determining module is specifically configured to determine whether the identity type of the target application acquired by the second acquiring module is a slave application, and if so, trigger the second returning unit; otherwise, triggering the second execution module;
and the second return unit is used for returning the warning information response to the card reader and ending.
23. The multi-application smart card of claim 22, wherein the second execution module comprises a first obtaining unit, a second obtaining unit, a first judging unit, a second judging unit, a third obtaining unit, a fourth obtaining unit, a third judging unit, and a first update addition returning unit;
the first obtaining unit is used for obtaining a slave application identifier to be added from the updated master-slave application relationship data;
the second obtaining unit is used for obtaining a slave application list corresponding to the target application according to the target application identifier obtained by the analysis of the first analyzing module;
the first judging unit is configured to judge whether the slave application identifier exists in the slave application list acquired by the second acquiring unit, if yes, the first returning module is triggered, and if not, the second judging unit is triggered;
the first returning module is specifically configured to return a response that the master-slave application relationship is updated successfully to the card reader, and then end;
the second judging unit is configured to judge, according to the slave application identifier acquired by the first acquiring unit, whether a slave application corresponding to the slave application identifier acquired by the first acquiring unit has been installed, if so, trigger the third acquiring unit, otherwise, trigger the first update addition returning unit;
the third obtaining unit is configured to obtain an identity type of the slave application according to the slave application identifier obtained by the first obtaining unit, and trigger the second returning unit when the identity type is the master application; when the identity type is the slave application, triggering the fourth acquisition unit; when the identity type is the independent application, triggering the first updating and adding return unit;
the fourth obtaining unit is configured to obtain the master application identifier of the slave application according to the slave application identifier obtained by the first obtaining unit;
the third judging unit is configured to judge whether the target application identifier obtained through analysis by the first analyzing module is the same as the main application identifier obtained by the fourth obtaining unit, and if so, trigger the first update addition returning unit; otherwise, triggering the second returning unit;
the first update addition returning unit is configured to update the identity type of the target application acquired by the second acquiring module to be a master application, and add the slave application identifier acquired by the first acquiring unit to the slave application list acquired by the second acquiring unit and corresponding to the target application; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
24. The multi-application smart card of claim 22, wherein the second execution module includes an eleventh acquisition unit, an eleventh selection unit, a twelfth acquisition unit, an eleventh judgment unit, an eleventh deletion unit, a twelfth judgment unit, a thirteenth acquisition unit, a fourteenth acquisition unit, a fifteenth acquisition unit, a fourteenth judgment unit, and an eleventh update addition return unit;
the eleventh acquiring unit is configured to acquire an add slave application identifier list from the updated master-slave application relationship data;
the eleventh selecting unit is configured to select one slave application identifier from the added slave application identifier list acquired by the eleventh acquiring unit as the current slave application identifier;
the twelfth obtaining unit is configured to obtain a slave application list corresponding to the target application according to the target application identifier obtained through analysis by the first analyzing module;
the eleventh judging unit is configured to judge whether the slave application list acquired by the eleventh acquiring unit has a current slave application identifier, if yes, trigger the eleventh deleting unit, and otherwise trigger the twelfth judging unit;
the eleventh deleting unit is configured to delete the current slave application identifier from the added slave application identifier list, and trigger the thirteenth judging unit;
the twelfth judging unit is configured to judge, according to the current slave application identifier selected by the eleventh selecting unit, whether a current slave application corresponding to the current slave application identifier selected by the eleventh selecting unit has been installed, if so, the fourteenth obtaining unit, and if not, the thirteenth judging unit is triggered;
the thirteenth judging unit is configured to judge whether the added slave application identifier list obtained by deleting the current slave application identifier by the eleventh deleting unit has a slave application identifier that is not used as the current slave application identifier, if yes, the thirteenth obtaining unit is triggered, and if not, the eleventh update addition returning unit is triggered;
the thirteenth acquiring unit is configured to acquire a next slave application identifier from the added slave application identifier list after the current slave application identifier is deleted, as a current slave application identifier, and trigger the eleventh judging unit;
the fourteenth obtaining unit is configured to obtain the identity type of the current slave application according to the current slave application identifier selected by the eleventh selecting unit, and trigger the second returning unit when the identity type is the master application; when the identity type is an independent application, triggering the thirteenth judging unit; triggering the fifteenth acquisition unit when the identity type is a slave application;
the fifteenth obtaining unit is configured to obtain a master application identifier of the current slave application according to the current slave application identifier selected by the eleventh selecting unit;
the fourteenth judging unit is configured to judge whether the target application identifier obtained through analysis by the first analyzing module is the same as the main application identifier obtained by the fifteenth obtaining unit, and if so, trigger the thirteenth judging unit; otherwise, triggering the second returning unit;
the eleventh update addition returning unit is configured to update the identity type of the target application acquired by the second acquiring module to be a master application, and add a slave application identifier in the added slave application identifier list, which is obtained by dividing the current slave application identifier, to the slave application list acquired by the twelfth acquiring unit; and returning a response of successful update of the master-slave application relationship to the card reader, and ending.
25. The multi-application smart card of claim 16, wherein the fourth return module comprises a third return unit;
the fourth determining module is specifically configured to determine whether the identity type of the target application acquired by the third acquiring module is an independent application or a slave application, and if so, trigger the third returning unit; otherwise, triggering the third execution module;
and the third returning unit is used for returning the warning information response to the card reader and ending.
26. The multi-application smart card of claim 25, wherein the third execution module comprises a twenty-first obtaining unit, a twenty-first judging unit, a twenty-second obtaining unit, a twenty-third judging unit, a twenty-first updating deleting unit, and a twenty-first deleting returning unit;
the twenty-first obtaining unit is configured to obtain a slave application identifier to be deleted from updated master-slave application relationship data;
the twenty-first judging unit is configured to judge whether the slave application identifier acquired by the twenty-first acquiring unit exists in a slave application list corresponding to a target application, if yes, trigger the twenty-second judging unit, and otherwise trigger the third returning module;
the third returning module is specifically configured to return a response that the master-slave application relationship is updated successfully to the card reader, and then end;
the twenty-second judging unit is configured to judge whether the slave application is already installed according to the slave application identifier acquired by the twenty-first acquiring unit, if so, trigger the twenty-second acquiring unit, and otherwise, trigger the twenty-first deletion returning unit;
the twenty-second obtaining unit is configured to obtain an identity type of the slave application according to the slave application identifier obtained by the twenty-first obtaining unit, and trigger the twenty-first deletion returning unit when the identity type of the slave application is the independent application or the master application; when the identity type of the slave application is the slave application, triggering the twenty-third acquisition unit;
the twenty-third obtaining unit is configured to obtain a master application identifier of a slave application according to the slave application identifier obtained by the twenty-first obtaining unit;
the twenty-third judging unit is configured to judge whether the target application identifier obtained through analysis by the first analyzing module is the same as the main application identifier obtained by the twenty-third obtaining unit, if so, trigger the twenty-first updating and deleting unit, otherwise, trigger the twenty-first deleting and returning unit;
the twenty-first updating and deleting unit is configured to update the identity type of the slave application acquired by the twenty-second acquiring unit into an independent application according to the slave application identifier acquired by the twenty-first acquiring unit, and delete the master application identifier of the slave application acquired by the twenty-third acquiring unit according to the slave application identifier acquired by the twenty-first acquiring unit;
and the twenty-first deletion returning unit is used for deleting the slave application identifier acquired by the twenty-first acquiring unit from the slave application list corresponding to the target application, returning a response of successful update of the master-slave application relationship to the card reader, and ending.
27. The multi-application smart card of claim 26, wherein the twenty-third determining unit is further configured to determine whether the target application identifier obtained by the analysis of the first analyzing module is the same as the master application identifier obtained by the twenty-third obtaining unit, if so, trigger the twenty-first updating and deleting unit, otherwise, trigger the third returning unit.
28. The multi-application smart card of claim 26, further comprising a twenty-fourth judging unit, a twenty-second update returning unit, a,
The twenty-fourth judging unit is used for judging whether the slave application list is empty or not, and if so, triggering a twenty-second updating and returning unit; otherwise, triggering the third returning module;
and the twenty-second updating and returning unit is used for updating the identity type of the target application acquired by the third acquisition module into an independent application, returning a response of successful updating of the master-slave application relationship to the card reader, and ending.
29. The multi-application smart card of claim 25, wherein the third execution module comprises a thirty-first obtaining unit, a thirty-first selecting unit, a thirty-second obtaining unit, a thirty-first judging unit, a thirty-second obtaining unit, a thirty-third judging unit, a thirty-first updating and deleting unit, a thirty-second deleting unit, a thirty-fourth judging unit, and a thirty-fourth obtaining unit;
the thirty-first obtaining unit is used for obtaining a deleted slave application identifier list from the updated master-slave application relationship data;
the thirty-first selecting unit is configured to select one slave application identifier from the deleted slave application identifier list acquired by the thirty-first acquiring unit as the current slave application identifier;
the thirty-second obtaining unit is configured to obtain a slave application list of the target application according to the target application identifier obtained through analysis by the first analyzing module;
the thirty-first judging unit is configured to judge whether the current slave application identifier selected by the thirty-first selecting unit exists in the slave application list acquired by the thirty-second acquiring unit corresponding to the target application, if yes, the thirty-second judging unit is triggered, and if not, the thirty-fourth judging unit is triggered;
the thirty-second judging unit is configured to judge whether the current slave application is already installed according to the current slave application identifier selected by the thirty-first selecting unit, if so, trigger the thirty-second acquiring unit, and otherwise, trigger the thirty-second deleting unit;
the thirty-second obtaining unit is configured to obtain the identity type of the current slave application according to the current slave application identifier selected by the thirty-first selecting unit, and if the identity type of the current slave application is an independent application or a master application, trigger the thirty-second deleting unit; if the identity type of the current slave application is the slave application, triggering the thirty-third acquisition unit;
the thirty-third obtaining unit is configured to obtain a master application identifier of the current slave application according to the current slave application identifier selected by the thirty-first selecting unit;
the thirty-third judging unit is configured to judge whether the target application identifier obtained through analysis by the first analyzing module is the same as the main application identifier obtained by the thirty-third obtaining unit, and if so, trigger the thirty-first updating and deleting unit; otherwise, triggering the thirty-second deleting unit;
the thirty-first updating and deleting unit is used for updating the identity type of the current slave application into an independent application according to the current slave application identifier and deleting the master application identifier of the current slave application according to the current slave application identifier;
the thirty-second deleting unit is configured to delete the current slave application identifier selected by the thirty-first selecting unit from the slave application list acquired by the thirty-second acquiring unit;
the thirty-fourth judging unit is configured to judge whether there is a slave application identifier that is not used as the current slave application identifier in the deleted slave application identifier list, if yes, trigger the thirty-fourth acquiring unit, and otherwise trigger the first returning module;
the thirty-fourth obtaining unit is configured to obtain a next slave application identifier from the deleted slave application identifier list as a current slave application identifier, and trigger the thirty-first judging unit;
and the first returning module is specifically used for returning a response of successful update of the master-slave application relationship to the card reader, and ending.
30. The multi-application smart card of claim 29, wherein the third execution module further comprises a thirty-five determination unit and a thirty-second acquisition unit;
the thirty-five judging unit is used for judging whether the slave application identifier exists in the slave application list, if so, the third returning module is triggered, otherwise, the thirty-one updating returning unit is triggered;
and the thirty-first updating and returning unit is used for updating the identity type of the target application acquired by the thirty-second acquiring unit into an independent application, returning a response of successful updating of the master-slave application relationship to the card reader, and ending.
CN201910056375.2A 2019-01-22 2019-01-22 Multi-application smart card and method for establishing master-slave application relationship thereof Active CN109885351B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910056375.2A CN109885351B (en) 2019-01-22 2019-01-22 Multi-application smart card and method for establishing master-slave application relationship thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910056375.2A CN109885351B (en) 2019-01-22 2019-01-22 Multi-application smart card and method for establishing master-slave application relationship thereof

Publications (2)

Publication Number Publication Date
CN109885351A CN109885351A (en) 2019-06-14
CN109885351B true CN109885351B (en) 2021-09-28

Family

ID=66926425

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910056375.2A Active CN109885351B (en) 2019-01-22 2019-01-22 Multi-application smart card and method for establishing master-slave application relationship thereof

Country Status (1)

Country Link
CN (1) CN109885351B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024092565A1 (en) * 2022-11-02 2024-05-10 京东方科技集团股份有限公司 Identifier acquisition method, apparatus, device and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101042736A (en) * 2006-03-24 2007-09-26 ***股份有限公司 Smart card and method for accessing objects in smart card
CN103365701A (en) * 2013-07-10 2013-10-23 飞天诚信科技股份有限公司 Work method of analog card reader and analog communication system
CN104301284A (en) * 2013-07-15 2015-01-21 ***股份有限公司 Multi-application smart card and multi-application management method for smart card
CN107229489A (en) * 2016-12-02 2017-10-03 天地融科技股份有限公司 A kind of multi-application smart card and its selective method for application and device
JP2018132818A (en) * 2017-02-13 2018-08-23 大日本印刷株式会社 Electronic information storage medium, IC card and application selection method
CN108897584A (en) * 2018-07-02 2018-11-27 珠海格力电器股份有限公司 Using starting method, apparatus and intelligent terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7573301B2 (en) * 2002-12-02 2009-08-11 Silverbrook Research Pty Ltd Temperature based filter for an on-chip system clock

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101042736A (en) * 2006-03-24 2007-09-26 ***股份有限公司 Smart card and method for accessing objects in smart card
CN103365701A (en) * 2013-07-10 2013-10-23 飞天诚信科技股份有限公司 Work method of analog card reader and analog communication system
CN104301284A (en) * 2013-07-15 2015-01-21 ***股份有限公司 Multi-application smart card and multi-application management method for smart card
CN107229489A (en) * 2016-12-02 2017-10-03 天地融科技股份有限公司 A kind of multi-application smart card and its selective method for application and device
JP2018132818A (en) * 2017-02-13 2018-08-23 大日本印刷株式会社 Electronic information storage medium, IC card and application selection method
CN108897584A (en) * 2018-07-02 2018-11-27 珠海格力电器股份有限公司 Using starting method, apparatus and intelligent terminal

Also Published As

Publication number Publication date
CN109885351A (en) 2019-06-14

Similar Documents

Publication Publication Date Title
CN101496000B (en) Two-way and multi-master synchronization over web syndications
US7487920B2 (en) Integrated circuit card system and application loading method
CN102073634B (en) Smart card file system and file selection method thereof
CA2395241A1 (en) Data linking system and method using tokens
CN109284549A (en) A kind of buildings model parameter management method, computer installation and readable storage medium storing program for executing
CN111666346A (en) Information merging method, transaction query method, device, computer and storage medium
KR20200140813A (en) Data processing method, device and storage medium
CN109885351B (en) Multi-application smart card and method for establishing master-slave application relationship thereof
KR101455155B1 (en) Method for Mobile Payment Card Priority Auto-Setting in Multi-SE and Mobile Device using the same
CN101706860B (en) Card reader and intelligent card
EP2793201A1 (en) Safety information transfer system, device and method based on extended parameter set
CN111008865A (en) Coupon synchronous display method and device, server and storage medium
CN102170650B (en) Display system of signalling or event and filtering and recovering method thereof
CN107169005B (en) POI recommendation method, device, equipment and computer readable storage medium
CN104700122A (en) Information interaction system and information interaction method
CN103309905A (en) Method for transcoding, combining and reading web pages
CN102567771A (en) Method and system for operating smart card, smart card and terminal
CN115660001A (en) Near field communication card confirmation method and device, storage medium and electronic equipment
CN111768537A (en) Intelligent door card data input method and device, intelligent door lock and storage medium
CN103581879A (en) Method and system for performing data transmission between terminal and user identification card
CN111352917A (en) Information input method and device, electronic equipment and storage medium
CN110334550B (en) Smart card and method for protecting privacy data thereof
CN205139988U (en) POS machine card swiping system and POS machine thereof
CN109799981A (en) A kind of integrated system and method based on execution chain
CN116170794B (en) Online idle issuing system and method for smart card

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant