CN112883364A - Security carrier control method, device, equipment and storage medium - Google Patents

Security carrier control method, device, equipment and storage medium Download PDF

Info

Publication number
CN112883364A
CN112883364A CN202110261835.2A CN202110261835A CN112883364A CN 112883364 A CN112883364 A CN 112883364A CN 202110261835 A CN202110261835 A CN 202110261835A CN 112883364 A CN112883364 A CN 112883364A
Authority
CN
China
Prior art keywords
ciphertext
authentication
random number
response message
determining
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.)
Pending
Application number
CN202110261835.2A
Other languages
Chinese (zh)
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.)
Shanghai Sodo Intelligent System Co ltd
Original Assignee
Shanghai Sodo Intelligent System Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Sodo Intelligent System Co ltd filed Critical Shanghai Sodo Intelligent System Co ltd
Priority to CN202110261835.2A priority Critical patent/CN112883364A/en
Publication of CN112883364A publication Critical patent/CN112883364A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/44Program or device authentication
    • G06F21/445Program or device authentication by mutual authentication, e.g. between devices or programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/71Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information
    • G06F21/77Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information in smart cards
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K17/00Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0869Network architectures or network communication protocols for network security for authentication of entities for achieving mutual authentication

Abstract

The embodiment of the application provides a method and a device for managing and controlling a security carrier, electronic equipment and a storage medium, and relates to the field of security of embedded equipment. The method comprises the following steps: determining a first ciphertext in response to an authentication request message sent by a first device; sending an authentication response message to the first device, wherein the authentication response message carries a first ciphertext so that the first device can perform identity authentication for the first time; receiving a third ciphertext sent by the first device after the first identity authentication is passed, wherein the third ciphertext is determined by the first device based on the authentication response message; performing second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result; based on the first result, it is determined whether to acquire encrypted data. The method realizes effective control of interaction between the security carrier and the first equipment by adopting bidirectional authentication operation between the security carrier and the first equipment, and determines whether to acquire encrypted data according to the bidirectional authentication result so as to ensure the security of important data.

Description

Security carrier control method, device, equipment and storage medium
Technical Field
The present application relates to the field of security of embedded devices, and in particular, to a method and an apparatus for managing and controlling a security carrier, an electronic device, and a computer storage medium.
Background
In the production process of the smart card, the COS script data is written into the chip of the smart card, which is generally referred to as a card writing operation in the art, and is a key step in the production process. In the mass production stage, the card writing tool and the operator involved in the card writing process are both internal, and even if the card writing process is processed in a mode of presenting the COS script in a plaintext, the safety of the COS script is still within the control range.
However, during non-production phases including joint debugging testing, closed-loop demonstration scenarios, card writing operations on portions of the smart card are also involved. Because the card writing tool and the operator involved in the card writing process at this stage belong to an uncontrollable third party, if the card writing process is not controlled, and the COS script is presented in the clear text, the security of the COS script will have great problems, for example: the COS script is revealed.
Disclosure of Invention
The application provides a control method and device for a security carrier, electronic equipment and a computer storage medium, which can realize effective control on interaction between the security carrier and first equipment and guarantee the security of important data.
In a first aspect of the present application, a method for managing and controlling a security bearer is provided, where the method includes:
determining a first ciphertext in response to an authentication request message sent by a first device;
sending an authentication response message to the first device, wherein the authentication response message carries a first ciphertext so that the first device can perform identity authentication for the first time;
receiving a third ciphertext sent by the first device after the first identity authentication is passed, wherein the third ciphertext is determined by the first device based on the authentication response message;
performing second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
based on the first result, it is determined whether to acquire encrypted data.
In a second aspect of the present application, there is provided another method for managing a security bearer, including:
sending an authentication request message to a security carrier, wherein the authentication request message is used for requesting identity authentication and carrying a first random number;
responding to an authentication response message sent by the security carrier, and determining a second ciphertext, wherein the authentication response message carries the first ciphertext;
performing first identity authentication according to the first ciphertext and the second ciphertext;
and when the first identity authentication is passed, determining a third ciphertext according to the authentication response message, and sending the third ciphertext to the secure carrier so that the secure carrier can perform the second identity authentication.
In a third aspect of the present application, there is provided a security carrier comprising:
the receiving and sending module is used for receiving an authentication request message sent by first equipment;
the determining module is used for responding to an authentication request message sent by the first equipment and determining a first ciphertext;
the receiving and sending module is further configured to send an authentication response message to the first device, where the authentication response message carries a first ciphertext, so that the first device performs first identity authentication, and receives a third ciphertext sent by the first device after the first identity authentication is passed, where the third ciphertext is determined by the first device based on the authentication response message;
the authentication module is used for carrying out second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
and the determining module is also used for determining whether to acquire the encrypted data according to the first result.
In a fourth aspect of the present application, a management and control device for a security carrier is provided, where the device includes:
the receiving and sending module is used for sending an authentication request message to the security carrier, wherein the authentication request message is used for requesting identity authentication and carrying a first random number, and receiving an authentication response message sent by the security carrier, wherein the authentication response message carries a first ciphertext;
the determining module is used for responding to the authentication response message sent by the security carrier and determining a second ciphertext;
the authentication module is used for carrying out primary identity authentication according to the first ciphertext and the second ciphertext;
the determining module is further configured to determine a third ciphertext according to the authentication response message when the first identity authentication is passed, and the transceiver module is further configured to send the third ciphertext to the secure bearer so that the secure bearer performs the second identity authentication.
In a fifth aspect of the present application, there is provided an electronic device, including: a memory, a transceiver, a processor, wherein,
a memory for storing a computer program;
a processor for reading the computer program in the memory and performing the following operations:
determining a first ciphertext in response to an authentication request message sent by a first device;
the transceiver is used for sending an authentication response message to the first device under the control of the processor, wherein the authentication response message carries a first ciphertext so that the first device can perform first identity authentication, and receiving a third ciphertext sent by the first device after the first identity authentication is passed, and the third ciphertext is determined by the first device based on the authentication response message;
a processor further operable to read the computer program in the memory and perform the following:
performing second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
based on the first result, it is determined whether to acquire encrypted data.
In a sixth aspect of the present application, there is provided another electronic device including: a memory, a transceiver, a processor, wherein,
a memory for storing a computer program;
the transceiver is used for sending an authentication request message to the security carrier under the control of the processor, wherein the authentication request message is used for requesting identity authentication and carrying a first random number;
a processor for reading the computer program in the memory and performing the following operations:
responding to an authentication response message sent by the security carrier, and determining a second ciphertext, wherein the authentication response message carries the first ciphertext;
performing first identity authentication according to the first ciphertext and the second ciphertext;
when the first identity authentication is passed, determining a third ciphertext according to the authentication response message;
and the transceiver is further used for sending a third ciphertext to the secure carrier under the control of the processor so that the secure carrier performs second identity authentication.
In a seventh aspect of the present application, a computer storage medium is provided, where at least one instruction, at least one program, a code set, or a set of instructions is stored on the computer storage medium, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by a processor to implement the method for managing a security carrier according to the first aspect of the present application.
In an eighth aspect of the present application, another computer storage medium is provided, where at least one instruction, at least one program, code set, or instruction set is stored on the computer storage medium, and the at least one instruction, the at least one program, code set, or instruction set is loaded and executed by a processor to implement the method for managing a security carrier according to the second aspect of the present application.
The beneficial effect that technical scheme that this application provided brought is:
the method comprises the steps of performing first identity authentication on a first device side after an identity authentication request is received so that the first device can confirm the identity of the security carrier, and performing second identity authentication on the security carrier side after the first identity authentication is passed so that the security carrier can confirm the identity of the first device. And the first equipment and the security carrier finish mutual identity authentication, namely bidirectional authentication through the first identity authentication and the second identity authentication. After the mutual authentication is completed, it may be determined whether to acquire encrypted data. Therefore, according to the technical scheme provided by the application, the interaction between the security carrier and the first device is effectively controlled by adopting the bidirectional authentication operation between the security carrier and the first device, and whether the encrypted data is acquired or not is determined according to the bidirectional authentication result so as to guarantee the security of the important data.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1a is a schematic diagram of a process of writing Bootloader to a smart card by a manufacturer in the related art;
FIG. 1b is a schematic diagram illustrating a preprocessing process of a smart card according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for managing and controlling a security carrier according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of another method for managing and controlling a security carrier according to an embodiment of the present disclosure;
fig. 4a is a schematic view illustrating an interaction flow between a smart card and an off-card entity according to an embodiment of the present application;
FIG. 4b is a schematic diagram illustrating an interaction flow between a smart card and an off-card entity according to an embodiment of the present application;
FIG. 5a is a schematic diagram of an algorithm process for calculating a first ciphertext according to an embodiment of the present application;
FIG. 5b is a schematic diagram of an algorithm process for calculating a second ciphertext according to an embodiment of the present application;
FIG. 5c is a schematic diagram illustrating a process of decrypting a ciphertext version of a COS script according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a security carrier according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a management and control device of a security carrier according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The terms referred to in this application will first be introduced and explained:
(1)3DES-CBC
the 3DES algorithm is derived from the DES (data Encryption standard) algorithm, is one of symmetric algorithms, and uses the same set of keys in Encryption and decryption processes. In the encryption process, 3 keys are used for carrying out 3 operations on a plaintext, namely: input plaintext- > DES encryption (key 1) - > DES decryption (key 2) - > DES encryption (key 3) - > output ciphertext. Correspondingly, the decryption process is that 3 operations are performed on the ciphertext: input ciphertext- > DES encryption (using key 3) - > DES decryption (using key 2) - > DES encryption (using key 1) - > output plaintext.
In addition, the 3DES algorithm has two modes, EBC and CBC. In the CBC mode, although the calculation process is complex, the security is better than that of the EBC, and the CBC mode is more applied to the scenarios such as identity authentication. In the embodiment of the application, the CBC mode of 3DES is adopted for identity authentication.
In addition, key 1, key 2, and key 3 are not exactly equal.
(2) Smart card
The smart card, as a Security Entity (SE), is mainly composed of two parts, namely hardware and software. Wherein, the software part mainly comprises a COS (chip operating system) which can be constructed by downloading and installing a COS script; the hardware part is mainly an integrated circuit, the external form of which is a chip, and the internal form of which is an integrated component of various functions including a ROM. In the production process of the chip, a chip manufacturer designs and stores a Bootloader (a boot loader before system startup, referred to as a boot program for short) provided by the chip manufacturer in a ROM, and then the Bootloader loads a COS script.
At present, in a mass production stage, a card writing process specifically includes writing a COS script into an intelligent card by a boot loader provided by a chip manufacturer in a way of a Put Memory (a general write instruction in which a plaintext displays a written address and content). Because the write content is directly displayed in plain text by the Put Memory instruction, and no processing is performed on the COS script by the COS script provider, the COS script is directly presented in the plain text in the whole stage, and the security of the COS script is greatly threatened. If in the mass production stage, because the card writing tool and the operator involved in the card writing operation are internal, the security of the COS script is still within the control range.
However, in the non-mass production stage (such as joint debugging test and closed-loop demonstration scenario), since the COS script is provided to the third party for card writing operation, if a Put memory mode is adopted, the security of the COS script is greatly threatened, that is: the COS script is revealed. In addition, in the non-mass production stage, it is not clear whether the third party is authorized and which smart cards need to be written. If the aforementioned problems are solved and the card writing operation can be performed, there are some problems in the card writing operation, such as: how the number of loads of COS scripts will be controlled, and which smart cards may be allowed to be reloaded, etc.
(3) Safety carrier
The universal terminals such as digital wallets, bank cards, POS machines, SIM cards and the like also relate to card writing operation. Therefore, in the embodiment of the present application, the secure carrier may be a smart card or the foregoing smart terminal.
If the COS script installed on the safety carrier is leaked in the non-production stage, the business logic on the COS script is also leaked. If the leaked COS script is continuously applied to the mass production stage, a large economic loss will be caused.
It should be understood that, in the embodiment of the present application, the smart card corresponding to the security carrier is only used as an example, and is not used to limit the embodiment of the present application, and a person skilled in the art may adjust the method according to practical situations.
(4) Replacement boot loader (Bootloader)
A chip manufacturer of a smart card has designed to write a boot loader into a chip on the smart card before the smart card leaves a factory, as shown in fig. 1 a. The boot loader may act as the main entry for the program, performing a series of operations including writing COS scripts.
However, the following method in the embodiment of the present application cannot be executed based on Bootloader written by a vendor. Therefore, before implementing the method described below in the embodiment of the present application, the upper computer needs to perform a preprocessing operation on the smart card, which is to replace the boot loader written by the manufacturer design. The specific process of the pretreatment is shown in fig. 1b, and comprises the following steps:
and connecting the smart card to one end of the card reader and enabling the smart card to be in a power-on state, so as to start the Bootloader, and using the Bootloader as a main entrance of the program. Wherein, the other end of the card reader is connected with an upper computer. Downloading a testOS script from an upper computer to the smart card through a Bootloader; after downloading is successful, verifying the validity of the smart card through the TestOS; after the verification is passed, switching a main entrance of the program to a TestOS through a Bootloader; after the TestOS is successfully used as a new main entrance, deleting the Bootloader through the TestOS, and downloading a new version boot loader Shambootloader; switching a main entrance of a program to ShamBootlloader through the TestOS; after ShamBootloader succeeds as the new master, the TestOS is deleted.
(5) Card writing tool and authorization file (license. data)
And other tools capable of executing card writing operations outside the secure carrier can be used as card writing tools. In the embodiments of the present application, the card writing tool is referred to as a first device. Among them, the key of the first device is the authorization file (license.data) it calls.
For example, for a card writing tool in a smart card, it is referred to as an off-card entity. The card outer entity has two realization modes: the first one consists of an upper computer and an Ukey, wherein the Ukey contains license.data files and can be called as an Ukey mode; the second type is composed of programs in an upper computer, such as: the program can call license.data files stored in an upper computer and can be called as a website mode.
Since different scenes, different third parties, and even different batches of smart cards may be involved in the non-production phase. And setting different license.data files according to the requirements under different conditions, and being capable of coping with the card writing operation under various conditions.
It should be understood that, in the embodiment of the present application, the off-card entity corresponding to the first device is only used as an example, and is not used to limit the embodiment of the present application, and a person skilled in the art may adjust the first device according to actual situations.
The embodiment of the application provides a control method and device for a security carrier, electronic equipment and a computer storage medium, and aims to solve the security problem of a COS script in a card writing operation process, especially the problem that the COS script is leaked.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the present application provides a method for managing and controlling a security carrier, as shown in fig. 2, which may be applied to a security carrier side, and the method includes:
s101, responding to an authentication request message sent by first equipment, and determining a first ciphertext;
specifically, after receiving the authentication request message, the security bearer performs a series of operations including determining the first ciphertext based on the authentication request message.
S102, sending an authentication response message to the first equipment, wherein the authentication response message carries a first ciphertext so that the first equipment can perform identity authentication for the first time;
and the authentication response message also carries a second random number and the unique identifier of the security carrier. The unique identifier is a unique identity of the secure carrier.
For example, the serial number CardId of the smart card chip is a unique identifier.
S103, receiving a third ciphertext sent by the first device after the first identity authentication is passed, wherein the third ciphertext is determined by the first device based on the authentication response message;
s104, performing second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
s105, determining whether to acquire encrypted data according to the first result.
The technical scheme provided by the embodiment of the application comprises the steps that after an identity authentication request is received, first identity authentication is carried out on a first equipment side so that the first equipment can confirm the identity of the security carrier, and after the first identity authentication is passed, second identity authentication is carried out on the security carrier side so that the security carrier can confirm the identity of the first equipment. And the first equipment and the security carrier finish mutual identity authentication, namely bidirectional authentication through the first identity authentication and the second identity authentication. After the mutual authentication is completed, it may be determined whether to acquire encrypted data. According to the technical scheme provided by the embodiment of the application, the interaction between the security carrier and the first equipment is effectively controlled by adopting the bidirectional authentication operation between the security carrier and the first equipment, and whether the encrypted data is acquired or not is determined according to the bidirectional authentication result so as to ensure the security of important data.
In this embodiment, another possible implementation manner is provided, where in response to an authentication request message sent by a first device, a first ciphertext is determined, where the first ciphertext includes S1011 (not shown in the figure), specifically:
and S1011, determining a first ciphertext according to the first random number carried in the authentication request message, the acquired first key sequence, the acquired second random number and the unique identifier of the secure carrier.
Wherein the first key sequence is built in the secure carrier; the second random number is generated on the side of the security carrier.
For example, the serial number CardId of the smart card may be a unique identifier; the random number carried in the authentication request message is host challenge and is generated at the entity side outside the card; the random number generated on the secure carrier side is card challenge. And determining the first key sequence in the secure bearer and the random numbers host challenge, CardId and card challenge carried in the authentication request message to obtain the ciphertext C1.
In this embodiment, S1011 includes S1011a (not shown) and S1011b (not shown), specifically:
s1011a, processing the first random number, the second random number and the unique identifier according to a first combination sequence to obtain a first data parameter;
specifically, MD5 operations are performed on the unique identification, i.e., MD5 (unique identification);
the first random number, the second random number, and MD5 (unique identifier) are combined in a first combination order to obtain a first data parameter.
S1011b, based on the first key sequence, processes the first data parameter to obtain a first ciphertext.
Specifically, the first key sequence and the first data parameter are used as entry parameters of a preset algorithm, encryption operation is executed to obtain a first ciphertext, and the first ciphertext is processed according to a preset rule to obtain the first ciphertext.
For example, host challenge, card challenge, and MD5(CardId) are spliced in the order of appearance to obtain para 1; then, the para1 and the first key sequence are used as the entry parameters of the 3DES-CBC algorithm, encryption operation is carried out, a ciphertext C1 is obtained, and the last 8 bytes of C1 are intercepted to be used as C1.
Another possible implementation manner is provided in the embodiment of the present application, and the method further includes S1041 (not shown in the figure):
s1041, according to the first random number carried in the authentication request message, the obtained first key sequence, the obtained second random number and the unique identifier of the secure carrier, determining a fourth ciphertext.
For example, the first key sequence in the secure bearer, the random number card challenge, and the unique identifier CardId of the secure bearer, and the random number host challenge are obtained, and the ciphertext C4 is determined.
In this embodiment, S1041 includes S1041a (not shown) and S1041b (not shown), specifically:
s1041a, processing the first random number, the second random number and the unique identifier according to a second combination sequence to obtain a second data parameter;
specifically, MD5 operations are performed on the unique identification, i.e., MD5 (unique identification);
and combining the first random number, the second random number and the MD5 (unique identifier) according to a second combination sequence to obtain a second data parameter.
S1041b, processing the second data parameter according to the first key sequence, and obtaining a fourth ciphertext.
Specifically, the first key sequence and the second data parameter are used as entry parameters of a preset algorithm, an encryption operation is executed to obtain a fourth ciphertext, and the fourth ciphertext is processed according to a preset rule to obtain the fourth ciphertext.
For example, card challenge, host challenge, and MD5(CardId) are concatenated according to the order of appearance to obtain para2, the para2 and the first key sequence are used as the entry parameters of the 3DES-CBC algorithm, and encryption operation is performed to obtain a ciphertext C4, and the last 8 bytes of C4 are intercepted to obtain C4.
In the embodiment of the present application, another possible implementation manner is provided, and according to the third ciphertext and the determined fourth ciphertext, the second identity authentication is performed to obtain a first result, which specifically includes:
and judging whether the third ciphertext is equal to the determined fourth ciphertext, and determining a first result according to the judgment result.
Wherein, determining the first result according to the judgment result comprises:
and when the third ciphertext is determined to be the same as the fourth ciphertext, obtaining a first result as the second identity authentication passing.
In this embodiment, determining whether to acquire encrypted data based on the first result includes:
when the first result is that the second identity authentication is passed, determining to acquire encrypted data;
and executing decryption operation on the encrypted data to obtain plaintext data, and executing corresponding processing based on the plaintext data.
For example, after the identity authentication passes, a script downloading switch is turned on so as to conveniently download the ciphertext version of the script and simultaneously acquire a third key sequence; according to the third key sequence, carrying out decryption processing on the ciphertext version by adopting a 3DES-CBC algorithm, and obtaining a decryption operation result, wherein the result is the plaintext version of the script; a clear text version of the script is installed.
The embodiment of the application further provides another method for managing and controlling the security carrier, which can be applied to the first device. As shown in fig. 3, the method includes:
s201, sending an authentication request message to a security carrier, wherein the authentication request message is used for requesting identity authentication and carrying a first random number;
s202, responding to an authentication response message sent by the security carrier, and determining a second ciphertext, wherein the authentication response message carries the first ciphertext;
s203, performing first identity authentication according to the first ciphertext and the second ciphertext;
and S204, when the first identity authentication is passed, determining a third ciphertext according to the authentication response message, and sending the third ciphertext to the secure carrier so that the secure carrier can perform the second identity authentication.
In the scheme of the embodiment of the application, after an identity authentication request is sent to a security carrier and a return message based on the authentication request is received, identity authentication is carried out for the first time based on the return message, so that the identity of the security carrier is confirmed; and after the first identity authentication is passed, sending a third ciphertext to the secure carrier, and performing second identity authentication on the secure carrier side based on the third ciphertext so that the secure carrier confirms the identity of the first device. Therefore, the technical scheme provided by the embodiment of the application realizes effective control on interaction between the security carrier and the first device by adopting the operation of bidirectional authentication between the security carrier and the first device, and determines whether to acquire the encrypted data according to the result of the bidirectional authentication so as to guarantee the security of the important data.
In this embodiment, another possible implementation manner is provided, where the authentication response message further carries a second random number and a unique identifier of the secure bearer, and the second ciphertext is determined in response to the authentication response message sent by the secure bearer, where the second ciphertext includes S2021 (not shown in the figure), and specifically:
s2021, determining a second ciphertext according to the obtained second key sequence, the first random number, the second random number and the unique identifier.
For example, the second key sequence (key 1, key 2, and key 3) and host challenge, and the random numbers Card challenge and CardId carried in the authentication response message are obtained, and the ciphertext C2 is determined.
Wherein the second key sequence is stored in the authorization file.
In this embodiment, S2021 includes S2021a (not shown) and S2021b (not shown), specifically:
s2021a, processing the first random number, the second random number and the unique identifier according to a first combination sequence to obtain a first data parameter;
specifically, MD5 operations are performed on the unique identification, i.e., MD5 (unique identification);
the first random number, the second random number, and MD5 (unique identifier) are combined in a first combination order to obtain a first data parameter.
S2021b, processing the first data parameter according to the second key sequence, and obtaining a second ciphertext.
Specifically, the second key sequence and the first data parameter are used as entry parameters of a preset algorithm, encryption operation is executed to obtain a second ciphertext, and the second ciphertext is processed according to a preset rule to obtain the second ciphertext.
For example, host challenge, card challenge, and MD5(CardId) are spliced in the order of appearance to obtain para 1; then, the para1 and the second key sequence are used as the entry parameters of the 3DES-CBC algorithm, encryption operation is carried out, a ciphertext C2 is obtained, and the last 8 bytes of C2 are intercepted to be used as C2.
In this embodiment, another possible implementation manner is provided, where the authentication response message further carries a second random number and a unique identifier of the secure bearer, and a third ciphertext is determined according to the authentication response message, where the third ciphertext includes S2041 (not shown in the figure), and specifically:
s2041, determining a third ciphertext according to the obtained second key sequence, the first random number, the second random number and the unique identifier.
For example, the second key sequence and the random number host challenge are obtained, and the random number card challenge and the unique identifier of the secure bearer carried in the corresponding authentication message are authenticated, so as to determine the third ciphertext.
In this embodiment, S2041 includes S2041a (not shown) and S2041b (not shown), specifically:
s2041a, processing the first random number, the second random number and the unique identifier according to a second combination sequence to obtain a second data parameter;
specifically, MD5 operation is performed on the unique identifier, resulting in MD5 (unique identifier);
and combining the first random number, the second random number and the MD5 (unique identifier) according to a second combination sequence to obtain a second data parameter.
And S2041b, processing the second data parameter according to the second key sequence to obtain a third ciphertext.
Specifically, the second key sequence and the second data parameter are used as entry parameters of a preset algorithm, an encryption operation is executed to obtain a third ciphertext, and the third ciphertext is processed according to a preset rule to obtain the third ciphertext.
For example, card challenge, host challenge, and MD5(CardId) are spliced in the order of appearance to obtain para 2; then, the para2 and the second key sequence are used as the entry parameters of the 3DES-CBC algorithm, encryption operation is carried out, a ciphertext C3 is obtained, and the last 8 bytes of C3 are intercepted to be used as C3.
In addition, card writing operations performed in different scenes in non-mass production stages have different requirements, and how to meet the requirements is also a problem to be solved by the application. For example: how the number of card writes by the COS script will be controlled, and which smart cards may be allowed to be repeatedly written, etc.
In the embodiment of the present application, another possible implementation manner is provided, before the third ciphertext is sent to the secure carrier, whether a preset condition is satisfied is determined according to a rule in the authorization file.
And when the preset condition is met, sending a third ciphertext to the secure carrier.
Wherein, the preset conditions include:
the unique identifier is in the identifier range, the residual times of obtaining the encrypted data are larger than zero, and the repeated writing operation switch of the security carrier is in an on state.
And acquiring the authorization file in the first equipment before judging whether the preset conditions are met. The authorization file comprises a unique identification set of the security carrier needing to write the encrypted data, the number of the remaining write data and the setting state of a repeated write operation switch of the security carrier.
Whether the safety carrier is in the write operation range can be known through the unique identification set;
the remaining number of times, in particular the number of times the secure carrier can write encrypted data. The operation of writing the encrypted data once is executed, and the remaining times are correspondingly reduced once;
and acquiring whether the secure carrier has a history record of acquiring the encrypted data according to the authentication response message sent by the secure carrier, and if so, continuously judging whether to continuously write data on the secure carrier according to the state of the repeated writing operation switch of the secure carrier recorded in the authorization file. If the state is the closed state, the encrypted data is not written for the safety carrier.
It should be understood that the specific operations involved in the preset conditions are only for example and are not used to limit the embodiments of the present application. The adjustment can be carried out by the person skilled in the art according to the actual situation.
The scheme of the embodiment of the application specifically includes that whether a preset condition is met is judged according to a rule in an authorization file, so that whether a third ciphertext is sent to a security carrier is indirectly determined. And when the preset condition is met, sending a third ciphertext to the secure carrier. Since the third ciphertext is one of the conditions for performing the second authentication, the verification operation indirectly affects the result of the second authentication, thereby affecting whether the secure carrier acquires the encrypted data. The scheme can further protect the safety of the ciphertext data and adapt to the requirements on the ciphertext data in different scenes.
Based on the foregoing method for managing and controlling a security carrier applied to a security carrier and a first device in this embodiment of the present application, another possible implementation manner is provided in this embodiment of the present application, and specifically, an application of the method for managing and controlling a security carrier in this embodiment of the present application in an interaction scenario between a smart card and an entity outside the card is described with the smart card corresponding to the security carrier and the entity outside the card corresponding to the first device. The specific interaction process can refer to fig. 4a and fig. 4 b.
The interaction flow diagram of the smart card and the off-card entity is shown in fig. 4 a. The process specifically comprises the following steps:
s1001, the off-card entity generates a first random number.
In this embodiment, after acquiring a card writing operation triggered by a third party, an entity outside the card generates a first random number, that is, a host challenge.
S1002, the entity outside the card sends an authentication request message to the intelligent card, wherein the authentication request message carries the first random number.
S1003, the smart card responds to the authentication request message sent by the entity outside the card to determine a first ciphertext.
In this embodiment, after the smart card receives the authentication request message sent by the entity outside the card, the smart card performs a series of obtaining operations, such as: and acquiring the serial number CardID, the second random number card challenge of the smart card, a first key sequence built in the smart card and a first random number carried in the authentication request message. Further, corresponding calculation is performed according to the first key sequence, the first random number, the second random number and the unique identifier, so as to obtain a first ciphertext C1.
The specific process of calculating C1 may be:
performing MD5 operation on CardID to obtain MD5 (CardID); splicing host challenge, card challenge and MD5(Cardid) according to a first combination sequence to obtain a first data parameter data 1; a first key sequence (key 11, key 12, key 13) built into the smart card is obtained.
For example, when host change is "32 BC076FA369 DEAA", card change is "7 FFA2349BD8C 665E", and card id is "0102030405060708090 a", then MD5(card id) is "70903E 79B7575E3F4E7FFA15C2608AC 7", and data1 obtained by splicing host change, card change, MD5(card id) in the first combination order is:
“32BC076FA369DEAA7FFA2349BD8C665E70903E79B7575E3F4E7FFA15C2608AC7”。
taking the data1 and the first key sequence as entry parameters of a 3DES-CBC algorithm, and performing encryption operation to obtain a ciphertext c 1; the last 8 bytes of C1 are truncated and taken as C1.
The C1 is the first ciphertext.
And S1004, the smart card sends an authentication response message to the entity outside the card, wherein the authentication response message carries the first ciphertext, the second random number and the unique identifier of the smart card.
S1005, the entity outside the card responds to the authentication response message sent by the intelligent card and determines a second ciphertext.
In this embodiment, after receiving the authentication response message sent by the smart card, the off-card entity performs a series of obtaining operations, such as: and acquiring the second key sequence, the first random number, and the second random number and the unique identifier of the smart card carried in the authentication response message. Further, corresponding calculation is performed according to the second key sequence, the first random number, the second random number and the unique identifier, so as to obtain a second ciphertext C2.
The specific process of calculating C2 may be:
performing MD5 operation on CardID to obtain MD5 (CardID); splicing host challenge, card challenge and MD5(Cardid) according to the first combination sequence to obtain data 2; a second key sequence (key 21, key 22, key 23) in the off-card entity is obtained.
For example, when host change is "32 BC076FA369 DEAA", card change is "7 FFA2349BD8C 665E", and card id is "0102030405060708090 a", then MD5(card id) is "70903E 79B7575E3F4E7FFA15C2608AC 7", and data2 obtained by splicing host change, card change, MD5(card id) in the first combination order is:
“32BC076FA369DEAA7FFA2349BD8C665E70903E79B7575E3F4E7FFA15C2608AC7”。
taking the data2 and the second key sequence as entry parameters of a 3DES-CBC algorithm, and performing encryption operation to obtain a ciphertext c 2; the last 8 bytes of C2 are truncated and taken as C2.
The C2 is the second ciphertext.
Wherein the second key sequence is obtainable from a license. In the Website mode, license.data is stored on an upper computer, and a third party can update authorization information by downloading new license.data from a specified Website, so that a second key sequence is updated. In the Ukey mode, license.data loaded in the Ukey is replaced to update the authorization information, so that the second key sequence is updated.
And S1006, the entity outside the card performs the first identity authentication according to the first ciphertext carried in the authentication response message and the second ciphertext obtained by calculation.
Specifically, in this embodiment, the entity outside the card performs identity authentication on the smart card by comparing the first ciphertext carried in the authentication response message with the second ciphertext obtained by calculation. For example: and judging whether the first ciphertext and the second ciphertext are equal. If the first ciphertext is equal to the second ciphertext, the first identity authentication is passed, and the next operation can be executed; and if not, the first identity authentication is not passed. And when the first identity authentication is determined not to pass, sending an interrupt message to instruct an entity outside the card to interrupt the card writing operation.
According to the above calculation process, the following further analyzes the process of the first identity authentication in combination with the 3DES-CBC algorithm:
it should be understood that both data1 and data2 are the result of performing a stitching process on host challenge, card challenge, and MD5(CardId) in a first composition order, and it can be determined that data1 and data2 are equal.
As shown in fig. 5a, the schematic diagram of the algorithm process for calculating the first ciphertext and the schematic diagram of the algorithm process for calculating the second ciphertext shown in fig. 5b, the process for calculating C1 and C2 specifically includes:
with reference to fig. 5a, the acquisition process of C1 is: and 3DES-CBC is adopted to carry out 3 times of operation and corresponding processing on the data1, and finally C1 is obtained. The method specifically comprises the following steps:
step1, input data 1;
step2, DES encryption is carried out on the data1 by using the secret key 11, and result11 is obtained;
step3, DES decryption is carried out on the result11 by using the secret key 12, and result12 is obtained;
step4, DES encryption is carried out on the result12 by using the secret key 13 to obtain result 13;
step5, truncates the last 8 bytes of result13 as C1.
With reference to fig. 5b, the acquisition process of C2 is: and 3DES-CBC is adopted to carry out 3 times of operation and corresponding processing on the data2, and finally C2 is obtained. The method specifically comprises the following steps:
step1, input data 2;
step2, DES encryption is carried out on the data2 by using the secret key 21, and a result21 is obtained;
step3, DES decryption is carried out on the result21 by using the secret key 22, and a result22 is obtained;
step4, DES encryption is carried out on the result22 by using the secret key 23, and the result23 is obtained;
step5, truncates the last 8 bytes of result23 as C2.
It should be understood that when key 11 equals key 21, key 12 equals key 22, and key 13 equals key 23, it can be determined that the first key sequence and the second key sequence are the same; if one group of keys are not equal, it can be determined that the two groups of key sequences are not the same.
When the data1 and data2 are encrypted by using 3DES-CBC based on the same key sequence, the obtained C1 and C2 are the same, and the first identity authentication can be determined to pass.
When the data1 and the data2 are encrypted by using 3DES-CBC based on different key sequences, the obtained C1 and C2 are different, and the first identity authentication can be determined not to pass.
It may be further determined whether the first key sequence and the second key sequence are the same by determining whether C1 and C2 are the same. I.e. the off-card entity knows whether the smart card has the same key sequence as it by comparing C1 and C2.
It should be appreciated that when C1 equals C2, the off-card entity may know that the smart card has the same key sequence with it.
And S1007, when the first identity authentication is passed, the entity outside the card determines a third ciphertext C3 according to the authentication response message.
In this embodiment, when the result of the authentication of the smart card is pass, the off-card entity performs a series of acquisition operations, such as: and acquiring the second key sequence, the first random number, and the second random number and the serial number of the smart card carried in the authentication response message. Further, corresponding calculation may be performed according to the second key sequence, the first random number, the second random number, and the unique identifier, so as to obtain a third ciphertext C3.
The specific process of calculating C3 may be:
performing MD5 operation on CardID to obtain MD5 (CardID); splicing the card challenge, the host challenge and the MD5(Cardid) according to a second combination sequence to obtain a second data parameter data 3; a second key sequence in the off-card entity is obtained.
For example, when card challenge is "7 FFA2349BD8C 665E", host challenge is "32 BC076FA369 DEAA", and card challenge is "0102030405060708090 a", then MD5(card challenge) is "70903E 79B7575E3F4E7FFA15C2608AC 7", and data3 obtained by concatenating card challenge, host challenge, and MD5(card challenge) in the first combination order is:
“7FFA2349BD8C665E32BC076FA369DEAA70903E79B7575E3F4E7FFA15C2608AC7”。
taking the data3 and the second key sequence as entry parameters of a 3DES-CBC algorithm, and performing encryption operation to obtain a ciphertext c 3; the last 8 bytes of C3 are truncated and taken as C3.
In addition, the entity outside the card needs to perform further verification on the current card writing operation based on the authorization file. The verification includes:
1) and CardID is in the sequence number range. The authorization file comprises a serial number range of the card writing at this time, and whether the smart card is in the card writing range at this time is judged according to the serial number range.
2) And the residual card writing number is larger than zero. The authorization file has the total times of card writing at this time, namely the number of remaining card writing. If the total times are more than zero, the card writing operation can be executed.
3) And if the card writing operation of the safety carrier is known to be executed according to the authentication response message, the card rewritable switch of the safety carrier is in an open state. The authorization file records the setting state of the rewritable card switch of the smart card, and the setting state comprises opening and closing. When the intelligent card is started, card writing operation can be repeatedly executed on the intelligent card.
If the above checks are passed, it is determined that the preset condition is satisfied, and S1008 is continuously performed. And if at least one check fails, determining that the preset condition is not met. And when the preset condition is determined not to be met, sending an interrupt message to instruct an entity outside the card to interrupt the card writing operation.
It should be understood that the information included in the authorization document required for the above-mentioned authentication process is only for example and is not used to limit the embodiments of the present application. The person skilled in the art can adjust the method according to the specific implementation.
And S1008, the entity outside the card sends a third ciphertext C3 to the smart card.
S1009, the smart card receives the third ciphertext sent by the entity outside the card, and calculates to obtain a fourth ciphertext according to the first random number, the second random number and the unique identifier carried in the authentication request message.
In this embodiment, after receiving the third cryptogram C3 sent by the smart card, the smart card performs a series of acquisition operations, such as: and acquiring the first key sequence, the second random number, the serial number of the smart card and the first random number carried in the authentication request message. Further, corresponding calculation is performed according to the first key sequence, the first random number, the second random number and the unique identifier, so as to obtain a fourth ciphertext C4.
The specific process of calculating C4 may be:
performing MD5 operation on CardID to obtain MD5 (CardID); splicing the card challenge, the host challenge and the MD5(Cardid) according to a second combination sequence to obtain data 4; a first key sequence built in the smart card is obtained.
For example, when card challenge is "7 FFA2349BD8C 665E", host challenge is "32 BC076FA369 DEAA", and card challenge is "0102030405060708090 a", then MD5(card challenge) is "70903E 79B7575E3F4E7FFA15C2608AC 7", and data4 obtained by splicing card challenge, host challenge, and MD5(card challenge) in the second order of combination is:
“7FFA2349BD8C665E32BC076FA369DEAA70903E79B7575E3F4E7FFA15C2608AC7”。
it should be understood that the above processing of card challenge, host challenge, and MD5(CardId) in the first combination order or the second combination order is only for example and not intended to limit the embodiments of the present application. The adjustment can be carried out by the person skilled in the art according to the actual situation.
Taking the data4 and the first key sequence as entry parameters of a 3DES-CBC algorithm, and performing encryption operation to obtain a ciphertext c 4; the last 8 bytes of C4 are truncated and taken as C4.
And S1010, the intelligent card performs second identity authentication according to the third ciphertext and the fourth ciphertext to obtain a first result.
In this embodiment, the smart card performs identity authentication on the off-card entity by comparing the third ciphertext sent by the off-card entity with the fourth ciphertext obtained by calculation. For example: and judging whether the third ciphertext and the fourth ciphertext are equal. If the third ciphertext is equal to the fourth ciphertext, the second identity authentication is passed, and the next operation can be executed; if not, the identity authentication fails for the second time, and the intelligent card returns a message of authentication failure to the entity outside the card. And after receiving the message, the entity outside the card stops the card writing operation of the intelligent card.
According to the above calculation process, the following further analyzes the second authentication process in combination with the 3DES-CBC algorithm:
it should be understood that data3 and data4 are both obtained by performing a splicing process on card challenge, host challenge, and MD5(CardId) in a second combination order, and it can be determined that data3 and data4 are equal.
The calculation processes of C3 and C4 are similar to those of C1 and C2, and are not repeated here for simplicity of description.
When the data3 and data4 are encrypted by using 3DES-CBC based on the same key sequence, the obtained C3 and C4 are the same, and the second authentication pass can be determined.
When the data3 and the data4 are encrypted by using 3DES-CBC based on different key sequences, the obtained C3 and C4 are different, and the identity authentication can be determined not to pass for the second time. And when the identity authentication for the second time is determined not to pass, sending an interrupt message to the entity outside the card to indicate the entity outside the card to interrupt the card writing operation.
It may be further determined whether the first key sequence and the second key sequence are the same by determining whether C3 and C4 are the same. I.e. the smart card knows whether the off-card entity has the same key sequence as it by comparing C3 and C4.
It should be appreciated that when C3 equals C4, the smart card may know that the off-card entity has the same key sequence with it.
It should be understood that the first authentication and the second authentication are processes in which the smart card and the off-card entity confirm whether both have the same key sequence. If the same key sequence is confirmed, the stage of acquiring the script can be entered.
And S1011, the smart card sends an authentication success message to the entity outside the card.
After the second identity authentication is passed, the smart card sends a message that the authentication is successful to the entity outside the card.
S1001 to S1011 above are the process flows included in the bidirectional authentication phase, and S1012 to S1017 are the process flows included in the COS script downloading phase.
And S1012, the smart card opens a downloading switch of the COS script.
And after the first result is that the second identity authentication is passed, the intelligent card opens a download switch of the COS script.
The smart card is connected with the card reader and then is in a power-on state. In this state, the download switch of the COS script is in a closed state by default, and after the mutual authentication is passed, may be turned on and in an open state.
And S1013, the off-card entity acquires the ciphertext version information of the COS script.
For example, the off-card entity obtains the download link for the ciphertext version, or directly the ciphertext version.
And S1014, the entity outside the card sends a script downloading instruction to the smart card.
Wherein, the instruction carries the cipher text version information of the COS script.
S1015, the smart card responds to the script downloading instruction, downloads the ciphertext version of the COS script, and executes decryption operation on the ciphertext version to obtain the plaintext version of the script.
Wherein, to COS script execution decryption operation, specifically be:
acquiring a third key sequence (a key 31, a key 32 and a key 33) built in the smart card;
and taking the ciphertext version and the third key sequence as the entry parameters of the 3DES-CBC algorithm, and carrying out decryption calculation to obtain a calculation result, wherein the calculation result is the plaintext version of the COS script.
Fig. 5c shows a specific process of obtaining a plaintext version by using the 3DES-CBC algorithm for the ciphertext version, which includes:
step1, inputting a ciphertext version;
step2, DES decryption is carried out on the ciphertext version by using the secret key 33, and a result33 is obtained;
step3, DES encryption is carried out on the result33 by using the secret key 32, and the result32 is obtained;
step4, DES decryption is performed on result32 by using key 31, and result31 is obtained.
This result31 is the clear text version of the COS script.
It should be understood that the ciphertext version is derived from the plaintext version by the following encryption process: input plaintext version- > DES encryption (using key 31) - > DES decryption (using key 32) - > DES encryption (using key 33) - > output ciphertext version.
And S1016, installing the plaintext version by the smart card.
S1017, the smart card sends information of successful installation to an entity outside the card.
After successful installation, the smart card sends information of successful installation to the off-card entity.
In addition, as can be seen from the above embodiments of the present application, the card external entity includes two implementation manners: website mode and Ukey mode. The entity outside the card in the Website mode may refer to fig. 4a, and the entity outside the card in the Ukey mode may refer to fig. 4 b.
As shown in fig. 4b, S2001-2015 is a method flow included in the mutual authentication phase, and S2016-2020 is a method flow included in the downloading COS script phase. The specific method flow is shown in fig. 4b, and is not described herein again for simplicity and convenience of description.
In fig. 4b, the specific setting of the Ukey mode can refer to the following 3 points:
1) data transmission of the upper computer, the Ukey and the smart card is realized by using an APDU protocol to transmit data;
2) the upper computer, the Ukey and the smart card interact by using a PCSC protocol;
3) and the built-in Ukey is a PSAM card. Wherein, license.data file is built in the PSAM.
It should be understood that the specific references set forth in fig. 4b are for illustration purposes only and are not intended to limit embodiments of the present application. The adjustment can be carried out by the person skilled in the art according to the actual situation.
Fig. 4a and 4b illustrate in detail the application of the method for managing and controlling a security bearer in an interaction scenario between a smart card and an off-card entity in the embodiment of the present application. Therefore, according to the technical scheme provided by the embodiment of the application, the operation of bidirectional authentication is adopted between the smart card and the off-card entity, so that the card writing process is effectively controlled in a non-mass production stage, and whether the cryptograph version of the COS script is acquired or not is determined according to the result of the bidirectional authentication so as to ensure the safety of the COS script, for example: preventing the COS script from being revealed.
In an embodiment of the present application, there is also provided a security carrier 40, as shown in fig. 6, where the security carrier 40 includes: a transceiving module 401, a determination module 402, and an authentication module 403, wherein,
a transceiver module 401, configured to receive an authentication request message sent by a first device;
a determining module 402, configured to determine a first ciphertext in response to an authentication request message sent by a first device;
the transceiver module 401 is further configured to send an authentication response message to the first device, where the authentication response message carries a first ciphertext, so that the first device performs first identity authentication, and receives a third ciphertext sent by the first device after the first identity authentication is passed, where the third ciphertext is determined by the first device based on the authentication response message;
the authentication module 403 is configured to perform second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
the determining module 402 is further configured to determine whether to acquire the encrypted data according to the first result.
In this embodiment, the authentication response message also carries the second random number and the unique identifier of the secure bearer.
In another possible implementation manner provided in this embodiment of the present application, the determining module 402 is configured to, in response to an authentication request message sent by a first device, determine a first ciphertext, and specifically:
and determining a first ciphertext according to the first random number carried in the authentication request message, the acquired first key sequence, the acquired second random number and the unique identifier of the secure carrier.
In this embodiment of the present application, the determining module 402 is configured to determine, according to the first random number carried in the authentication request message, the obtained first key sequence, the obtained second random number, and the unique identifier of the secure carrier, the first secret number, and specifically configured to:
processing the first random number, the second random number and the unique identifier according to a first combination sequence to obtain a first data parameter;
and processing the first data parameter based on the first key sequence to obtain a first ciphertext.
In another possible implementation manner provided in this embodiment of the present application, the determining module 402 is further configured to:
and determining a fourth ciphertext according to the first random number carried in the authentication request message, the acquired first key sequence, the acquired second random number and the unique identifier of the secure carrier.
In this embodiment of the present application, the determining module 402 is configured to determine, according to the first random number carried in the authentication request message, the obtained first key sequence, the obtained second random number, and the unique identifier of the secure carrier, a fourth secret key specifically configured to:
processing the first random number, the second random number and the unique identifier according to a second combination sequence to obtain a second data parameter;
and processing the second data parameter according to the first key sequence to obtain a fourth ciphertext.
In another possible implementation manner provided in this embodiment of the present application, the authentication module 403 performs identity authentication for the second time according to the third ciphertext and the determined fourth ciphertext, to obtain a first result, which is specifically used to:
when the third ciphertext is determined to be the same as the fourth ciphertext, obtaining a first result as the identity authentication is passed;
determining whether to acquire encrypted data according to the first result, comprising:
and when the first result is that the identity authentication is passed, determining to acquire the encrypted data.
In an embodiment of the present application, there is further provided a management and control device 50 for a security carrier, as shown in fig. 7, the device 50 may include: a transceiver module 501, a determination module 502, and an authentication module 503, wherein,
the transceiver module 501 is configured to send an authentication request message to the secure carrier, where the authentication request message is used to request identity authentication and carries a first random number, and receive an authentication response message sent by the secure carrier, where the authentication response message carries a first ciphertext;
a determining module 502, configured to determine a second ciphertext in response to an authentication response message sent by the security bearer;
the authentication module 503 is configured to perform a first identity authentication according to the first ciphertext and the second ciphertext;
the determining module 502 is further configured to determine a third ciphertext according to the authentication response message when the first identity authentication is passed, and the transceiver module 501 is further configured to send the third ciphertext to the secure bearer, so that the secure bearer performs the second identity authentication.
In this embodiment, another possible implementation manner is provided, where the authentication response message further carries a second random number and a unique identifier of the security bearer, and the determining module 502 determines, in response to the authentication response message sent by the security bearer, a second ciphertext, which is specifically used to:
and determining a second ciphertext according to the obtained second key sequence, the first random number, the second random number and the unique identifier.
In this embodiment of the application, the determining module 502 is configured to determine, according to the obtained second key sequence and the first random number, and the second random number and the unique identifier, the second cipher text, specifically to:
processing the first random number, the second random number and the unique identifier according to a first combination sequence to obtain a first data parameter;
and processing the first data parameter according to the second key sequence to obtain a second ciphertext.
In this embodiment, another possible implementation manner is provided, where the authentication response message further carries a second random number and a unique identifier of a security bearer, and the determining module 502 determines, when the first identity authentication passes, a third ciphertext according to the authentication response message, where the third ciphertext is specifically configured to:
and determining a third ciphertext according to the obtained second key sequence, the first random number, the second random number and the unique identifier.
In this embodiment of the application, the determining module 502 is specifically configured to determine, in accordance with the obtained second key sequence and first random number, and the second random number and unique identifier, a third secret context:
processing the first random number, the second random number and the unique identifier according to a second combination sequence to obtain a second data parameter;
and processing the second data parameter according to the second key sequence to obtain a third ciphertext.
In the embodiment of the present application, another possible implementation manner is provided, before the third ciphertext is sent to the secure carrier, whether a preset condition is satisfied is determined according to a rule in the authorization file.
And when the preset condition is met, sending a third ciphertext to the secure carrier.
Wherein, the preset conditions include:
the unique identifier is in the identifier range, the residual times of obtaining the encrypted data are larger than zero, and a repeated writing operation switch of the security carrier is in an open state.
It should be understood that the specific operations involved in the preset conditions are only for illustrative purposes and are not intended to limit the embodiments of the present application. The adjustment can be carried out by the person skilled in the art according to the actual situation.
According to one or more method embodiments applied to a secure carrier, there is provided an electronic device including: the memory, the transceiver, the processor,
a memory for storing a computer program;
a processor for reading the computer program in the memory and performing the following operations:
determining a first ciphertext in response to an authentication request message sent by a first device;
the transceiver is used for sending an authentication response message to the first device under the control of the processor, wherein the authentication response message carries a first ciphertext so that the first device can perform first identity authentication, and receiving a third ciphertext sent by the first device, and the third ciphertext is determined by the first device based on the authentication response message;
a processor further operable to read the computer program in the memory and perform the following:
performing second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
based on the first result, it is determined whether to acquire encrypted data.
According to one or more method embodiments applied to the first device, another electronic device is provided, which includes: the memory, the transceiver, the processor,
a memory for storing a computer program;
the transceiver is used for sending an authentication request message to the security carrier under the control of the processor, wherein the authentication request message is used for requesting identity authentication and carrying a first random number;
a processor for reading the computer program in the memory and performing the following operations:
responding to an authentication response message sent by the security carrier, and determining a second ciphertext, wherein the authentication response message carries the first ciphertext;
performing first identity authentication according to the first ciphertext and the second ciphertext;
when the first identity authentication is passed, determining a third ciphertext according to the authentication response message;
and the transceiver is further used for sending a third ciphertext to the secure carrier under the control of the processor so that the secure carrier performs second identity authentication.
According to one or more method embodiments of the present application as applied to a secure carrier, there is provided a computer storage medium having stored thereon at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement one or more method embodiments of the present application as applied to a secure carrier.
According to one or more method embodiments of the present application as applied to a first device, there is provided a computer storage medium having stored thereon at least one instruction, at least one program, set of codes, or set of instructions, which is loaded and executed by a processor to implement one or more method embodiments of the present application as applied to a first device.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (19)

1. A control method of a security carrier is characterized by comprising
Determining a first ciphertext in response to an authentication request message sent by a first device;
sending an authentication response message to the first device, wherein the authentication response message carries the first ciphertext so that the first device performs identity authentication for the first time;
receiving a third ciphertext sent by the first device after the first identity authentication is passed, wherein the third ciphertext is determined by the first device based on the authentication response message;
performing second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
and determining whether to acquire the encrypted data according to the first result.
2. The method of claim 1, wherein determining the first ciphertext in response to the authentication request message sent by the first device comprises:
and determining the first ciphertext according to the first random number carried in the authentication request message, the acquired first key sequence, the acquired second random number and the unique identifier of the secure carrier.
3. The method according to claim 2, wherein the determining the first ciphertext according to the first random number carried in the authentication request message, the obtained first key sequence, the obtained second random number, and the unique identifier of the secure bearer comprises:
processing the first random number, the second random number and the unique identifier according to a first combination sequence to obtain a first data parameter;
and processing the first data parameter based on the first key sequence to obtain the first ciphertext.
4. The method of claim 1, further comprising:
and determining the fourth ciphertext according to the first random number carried in the authentication request message, the acquired first key sequence, the acquired second random number and the unique identifier of the secure carrier.
5. The method according to claim 4, wherein the determining the fourth ciphertext according to the first random number carried in the authentication request message, the obtained first key sequence, the obtained second random number, and the unique identifier of the secure bearer includes:
processing the first random number, the second random number and the unique identifier according to a second combination sequence to obtain a second data parameter;
and processing the second data parameter according to the first key sequence to obtain the fourth ciphertext.
6. The method according to any one of claims 1 to 5, wherein the performing the second authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result includes:
when the third ciphertext is determined to be the same as the fourth ciphertext, obtaining the first result as passing the identity authentication;
the determining whether to acquire encrypted data according to the first result includes:
and when the first result is that the identity authentication is passed, determining to acquire the encrypted data.
7. The method according to any of claims 2-5, wherein the authentication response message further carries the second random number and the unique identifier of the secure bearer.
8. A method for managing and controlling a security carrier is characterized by comprising the following steps:
sending an authentication request message to the security carrier, wherein the authentication request message is used for requesting identity authentication and carrying a first random number;
responding to an authentication response message sent by the security carrier, and determining a second ciphertext, wherein the authentication response message carries the first ciphertext;
performing first identity authentication according to the first ciphertext and the second ciphertext;
and when the first identity authentication is passed, determining a third ciphertext according to the authentication response message, and sending the third ciphertext to the secure carrier so as to facilitate the secure carrier to perform second identity authentication.
9. The method according to claim 8, wherein the authentication response message further carries a second random number and a unique identifier of the secure bearer, and the determining a second ciphertext in response to the authentication response message sent by the secure bearer comprises:
and determining the second ciphertext according to the acquired second key sequence, the acquired first random number, the acquired second random number and the acquired unique identifier.
10. The method according to claim 9, wherein the determining the second ciphertext according to the obtained second key sequence and the first random number, and the second random number and the unique identifier comprises:
processing the first random number, the second random number and the unique identifier according to a first combination sequence to obtain a first data parameter;
and processing the first data parameter according to the second key sequence to obtain the second ciphertext.
11. The method according to claim 8, wherein the authentication response message further carries a second random number and a unique identifier of the secure bearer, and the determining a third ciphertext according to the authentication response message comprises:
and determining the third ciphertext according to the acquired second key sequence, the acquired first random number, the acquired second random number and the acquired unique identifier.
12. The method according to claim 11, wherein the determining the third ciphertext according to the obtained second key sequence and the first random number, and the second random number and the unique identifier comprises:
processing the first random number, the second random number and the unique identifier according to a second combination sequence to obtain a second data parameter;
and processing the second data parameter according to the second key sequence to obtain the third ciphertext.
13. The method according to any of claims 9-12, wherein said sending the third ciphertext to the secure bearer comprises:
when a preset condition is met, the third ciphertext is sent to the secure carrier;
wherein the preset conditions include:
the unique identification is in the identification range, the residual times of obtaining the encrypted data are larger than zero, and the repeated writing operation switch of the safety carrier is in an open state.
14. A security vector, comprising:
the receiving and sending module is used for receiving an authentication request message sent by first equipment;
the determining module is used for responding to an authentication request message sent by the first equipment and determining a first ciphertext;
the transceiver module is further configured to send an authentication response message to the first device, where the authentication response message carries the first ciphertext, so that the first device performs first identity authentication, and receive a third ciphertext sent by the first device after the first identity authentication passes, where the third ciphertext is determined by the first device based on the authentication response message;
the authentication module is used for carrying out second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
the determining module is further configured to determine whether to acquire encrypted data according to the first result.
15. A management and control device of a security carrier, comprising:
a transceiver module, configured to send an authentication request message to the secure bearer, where the authentication request message is used to request identity authentication and carries a first random number, and receive an authentication response message sent by the secure bearer, where the authentication response message carries a first ciphertext;
the determining module is used for responding to the authentication response message sent by the security carrier and determining a second ciphertext;
the authentication module is used for carrying out first identity authentication according to the first ciphertext and the second ciphertext;
the determining module is further configured to determine a third ciphertext according to the authentication response message when the first identity authentication is passed, and the transceiver module is further configured to send the third ciphertext to the secure bearer, so that the secure bearer performs a second identity authentication.
16. An electronic device, comprising: a memory, a transceiver, a processor, wherein,
the memory for storing a computer program;
the processor is used for reading the computer program in the memory and executing the following operations:
determining a first ciphertext in response to an authentication request message sent by a first device;
the transceiver is configured to send an authentication response message to the first device under the control of the processor, where the authentication response message carries the first ciphertext, so that the first device performs first identity authentication, and receives a third ciphertext sent by the first device after the first identity authentication passes, where the third ciphertext is determined by the first device based on the authentication response message;
the processor is further configured to read the computer program in the memory and perform the following operations:
performing second identity authentication according to the third ciphertext and the determined fourth ciphertext to obtain a first result;
and determining whether to acquire the encrypted data according to the first result.
17. An electronic device, comprising: a memory, a transceiver, a processor, wherein,
the memory for storing a computer program;
the transceiver is used for sending an authentication request message to a security carrier under the control of the processor, wherein the authentication request message is used for requesting identity authentication and carrying a first random number;
the processor is used for reading the computer program in the memory and executing the following operations:
responding to an authentication response message sent by the security carrier, and determining a second ciphertext, wherein the authentication response message carries the first ciphertext;
performing first identity authentication according to the first ciphertext and the second ciphertext;
when the first identity authentication is passed, determining a third ciphertext according to the authentication response message;
the transceiver is further configured to send the third ciphertext to the secure bearer under the control of the processor, so that the secure bearer performs second identity authentication.
18. A computer storage medium, characterized in that the storage medium stores at least one instruction, at least one program, a set of codes, or a set of instructions that is loaded and executed by a processor to implement a method of policing a security carrier according to any one of claims 1-7.
19. A computer storage medium, characterized in that the storage medium stores at least one instruction, at least one program, a set of codes, or a set of instructions that is loaded and executed by a processor to implement a method of policing a security carrier according to any one of claims 8-13.
CN202110261835.2A 2021-03-10 2021-03-10 Security carrier control method, device, equipment and storage medium Pending CN112883364A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110261835.2A CN112883364A (en) 2021-03-10 2021-03-10 Security carrier control method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110261835.2A CN112883364A (en) 2021-03-10 2021-03-10 Security carrier control method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112883364A true CN112883364A (en) 2021-06-01

Family

ID=76054158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110261835.2A Pending CN112883364A (en) 2021-03-10 2021-03-10 Security carrier control method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112883364A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105516182A (en) * 2015-12-30 2016-04-20 深圳市正东源科技有限公司 Bidirectional authentication method and system used between smart card and reader-writer
CN105989386A (en) * 2015-02-28 2016-10-05 北京天威诚信电子商务服务有限公司 Method and device for reading and writing radio frequency identification card
CN106603485A (en) * 2016-10-31 2017-04-26 美的智慧家居科技有限公司 Secret key negotiation method and device
CN107682147A (en) * 2017-10-10 2018-02-09 捷德(中国)信息科技有限公司 Method for managing security and system for intelligent card chip operating system file
CN108282329A (en) * 2017-01-06 2018-07-13 中国移动通信有限公司研究院 A kind of Bidirectional identity authentication method and device
CN109522689A (en) * 2018-10-29 2019-03-26 北京九州云腾科技有限公司 Multiple-factor strong identity authentication method under mobile office environment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105989386A (en) * 2015-02-28 2016-10-05 北京天威诚信电子商务服务有限公司 Method and device for reading and writing radio frequency identification card
CN105516182A (en) * 2015-12-30 2016-04-20 深圳市正东源科技有限公司 Bidirectional authentication method and system used between smart card and reader-writer
CN106603485A (en) * 2016-10-31 2017-04-26 美的智慧家居科技有限公司 Secret key negotiation method and device
CN108282329A (en) * 2017-01-06 2018-07-13 中国移动通信有限公司研究院 A kind of Bidirectional identity authentication method and device
CN107682147A (en) * 2017-10-10 2018-02-09 捷德(中国)信息科技有限公司 Method for managing security and system for intelligent card chip operating system file
CN109522689A (en) * 2018-10-29 2019-03-26 北京九州云腾科技有限公司 Multiple-factor strong identity authentication method under mobile office environment

Similar Documents

Publication Publication Date Title
CN103577221B (en) The update of the operating system of safety element
CN104520870B (en) For the method and system for the firmware for updating security module
EP2698756B1 (en) Local Trusted Service Manager
KR101819102B1 (en) Method of performing a secure application in an nfc device
US6005942A (en) System and method for a multi-application smart card which can facilitate a post-issuance download of an application onto the smart card
JP4906168B2 (en) Key distribution unit for IC card
KR20180093038A (en) A mobile device with a trusted execution environment
CN105391840A (en) automatic purposed-application creation
CN106133739B (en) Security protection of loading of data into non-volatile memory of a secure element
CN102105883A (en) Electronic device and method of software or firmware updating of an electronic device
CN111404682B (en) Android environment key segmentation processing method and device
CN103460186A (en) Method for updating a data storage medium
CN107273150B (en) Preloading firmware downloading and writing method and device
CN107944234A (en) A kind of brush machine control method of Android device
EP2209080A1 (en) Method of loading data in an electronic device
CN105187410A (en) Application self-upgrading method and system
CN107688756A (en) Hard disk control method, equipment and readable storage medium storing program for executing
WO2007119594A1 (en) Secure device and read/write device
KR20180007459A (en) Method and apparatus for white box cryptography
US20050120226A1 (en) Initialization of a chip card
CN112883364A (en) Security carrier control method, device, equipment and storage medium
KR20230019032A (en) Pre-personalized secure element and embedded personalization
CN112422281B (en) Method and system for changing secret key in security module
KR101040577B1 (en) Method and System for issuing of Mobile Application
US11443022B2 (en) Method for controlling access to a security module

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