Method and system for securely transmitting data between DH and NFCC

By establishing an encrypted secure channel between NFCC and DH, and encrypting data using asymmetric key pairs and session keys, the problem of security risks of data interaction between DH and NFCC is solved, and the security and integrity of data transmission are achieved.

CN119893515APending Publication Date: 2025-04-25WUXI RONGKA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411852600.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The data interaction between DH and NFCC poses security risks, especially because the Android system is open and plain text data transmission, it is vulnerable to malware attacks and threatens the system's security.

Method used

Asymmetric key pairs are generated during NFCC initialization, and an encrypted secure channel is established between DH and NFCC, and the interactive data is encrypted through the session key to ensure the security and integrity of data transmission.

Benefits of technology

Through the encryption mechanism, the security and integrity of interactive data such as keys during transmission are ensured, the data is prevented from being illegally acquired, and the system security is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119893515A_ABST
    Figure CN119893515A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a method and system for securely transmitting data between a DH and an NFCC, and the method comprises the steps: generating an asymmetric key pair when the NFCC is initialized before the data transmission between the DH and the NFCC; when the NFC card enters, the NFCC sends a first message to the DH; the DH generates a verification instruction according to the first message and sends the verification instruction to the NFCC; and the NFCC decrypts the verification instruction by using the private key to obtain the interaction data. According to the embodiment of the invention, the security and integrity of interactive data such as a key in a transmission process can be ensured. In addition, the session key can be deleted after NFC card interaction is completed, and it is ensured that the session key cannot be maliciously acquired or recovered. That is, the embodiment of the invention further provides a key destruction mechanism, and the key can be effectively prevented from being exposed or abused for a long time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data interaction, and in particular to a method and system for securely transmitting data between a DH and an NFCC. Background Art

[0002] At present, more and more smartphones on the market are equipped with NFC chips, which can read and write NFC tags. They are often used in access control, payment and other scenarios. NFC cards are widely used in various scenarios that require identity recognition and access control due to their convenience, efficiency, reliability and versatility. Therefore, it is very common to use mobile phones to read and write NFC cards.

[0003] The data exchange process between DH and NFCC is as follows: Figure 1 As shown in the figure. Since DH uses the Android system, which is an open environment, it is vulnerable to malware attacks, and the data is transmitted in plain text. If the data is illegally obtained, it will threaten the security of the system. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a method and system for securely transmitting data between DH and NFCC, by adopting an encryption security mechanism to ensure the security and integrity of interactive data such as keys during transmission.

[0005] To achieve the above objectives, in a first aspect, an embodiment of the present invention provides a method for securely transmitting data between a DH and an NFCC, including:

[0006] Before data is transmitted between DH and NFCC, an asymmetric key pair is generated when NFCC is initialized; the asymmetric key pair includes a public key and a private key;

[0007] When the NFC card enters the venue, the NFCC sends a first message to the DH; the DH uses the Android system;

[0008] The DH generates a verification instruction according to the first message, and sends the verification instruction to the NFCC; the verification instruction includes the encrypted interaction data;

[0009] The NFCC uses a private key to decrypt the verification instruction to obtain the interaction data.

[0010] As a specific implementation of the present application, DH has eSE;

[0011] When NFCC is initialized, NFCC specifies eSE to generate an asymmetric key pair and returns the public key of the asymmetric key pair.

[0012] As a specific implementation of the present application, the first message includes a notification message, a public key and a random number Rand1; DH generates a verification instruction according to the first message, specifically:

[0013] DH receives the notification message and generates a random number Session according to the notification message;

[0014] DH uses the public key to encrypt the random number Session;

[0015] DH uses a symmetric encryption algorithm and the random number Session to encrypt the random number Rand1 and the MIFARE card key;

[0016] A verification instruction is generated according to the encrypted random number Session, random number Rand1 and interaction data.

[0017] As a specific implementation of the present application, the NFCC uses a private key to decrypt the verification instruction to obtain the interaction data, specifically:

[0018] The NFCC directly uses or designates the eSE to use the private key to decrypt the verification instruction to obtain a random number Session;

[0019] Decrypt the verification instruction using the random number Session to obtain a random number Rand2;

[0020] Determine whether the random number Rand2 is the same as the random number Rand1;

[0021] If they are the same, the verification instruction is decrypted using the random number Session to obtain the interaction data;

[0022] If different, an error is returned.

[0023] As a preferred implementation of the present application, after obtaining the interaction data, the method further includes:

[0024] When the NFC card interaction process is completed or interrupted, DH and NFCC destroy the random number Session.

[0025] In a second aspect, an embodiment of the present application further provides a system for securely transmitting data, including DH and NFCC; wherein NFCC is used to:

[0026] Before data is transmitted between DH and NFCC, an asymmetric key pair is generated when NFCC is initialized; the asymmetric key pair includes a public key and a private key;

[0027] When the NFC card enters the venue, the NFCC sends the first message to the DH;

[0028] The DH uses the Android system and is used for:

[0029] generating a verification instruction according to the first message, and sending the verification instruction to the NFCC; the verification instruction includes the encrypted interaction data;

[0030] The NFCC is also used to:

[0031] The verification instruction is decrypted using a private key to obtain interactive data.

[0032] As a specific implementation of the present application, the first message includes a notification message, a public key and a random number Rand1; the DH is specifically used for:

[0033] Upon receiving the notification message, a random number Session is generated according to the notification message;

[0034] Encrypt the random number Session using the public key;

[0035] The random number Rand1 and the interaction data are encrypted using the SM4 algorithm and the random number Session;

[0036] A verification instruction is generated according to the encrypted random number Session, random number Rand1 and interaction data.

[0037] As a specific implementation of the present application, the NFCC is specifically used for:

[0038] Use or designate eSE to use the private key to decrypt the verification instruction to obtain a random number Session;

[0039] Decrypt the verification instruction using the random number Session to obtain a random number Rand2;

[0040] Determine whether the random number Rand2 is the same as the random number Rand1;

[0041] If they are the same, the verification instruction is decrypted using the random number Session to obtain the interaction data;

[0042] If different, an error is returned.

[0043] In the implementation of the embodiment of the present invention, a pair of asymmetric keys is generated when the NFCC is initialized, a secure channel is established between the DH and the NFCC, and a session key is generated. When transmitting interactive data, the information is encrypted using the session key. In this way, even if it is intercepted, the original data cannot be directly parsed, which can ensure the security and integrity of interactive data such as keys during transmission.

[0044] In addition, the session key will be deleted after the NFC card interaction is completed to ensure that it will not be maliciously acquired or restored. That is, the embodiment of the present invention also provides a key destruction mechanism, which can effectively prevent the key from being exposed or abused for a long time. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the specific implementation of the present invention or the technical solution in the prior art, the drawings required for use in the specific implementation or the description of the prior art are briefly introduced below.

[0046] Figure 1 It is a flow chart of data interaction between DH and NFCC in the prior art;

[0047] Figure 2 It is a main flow chart of a method for securely transmitting data between DH and NFCC provided by an embodiment of the present invention;

[0048] Figure 3 yes Figure 2 The first sub-flowchart of the main flow chart shown;

[0049] Figure 4 yes Figure 2 The second sub-flowchart of the main flow chart shown. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0052] The professional terms involved in the embodiments of this application are described as follows:

[0053] NFC (Near Field Communication), short-range wireless communication technology

[0054] NFCC (Near Field Communication Controller), short-range wireless communication controller, such as

[0055] NFC chip

[0056] DH (Device host), host, such as mobile terminal

[0057] eSE (embedded Secure Element), embedded security element

[0058] Please refer to Figure 1 , is a main flow chart of a method for securely transmitting data between DH and NFCC provided by an embodiment of the present invention, which mainly includes the following steps:

[0059] S1, before data transmission between DH and NFCC, an asymmetric key pair is generated when NFCC is initialized.

[0060] S2: When the NFC card enters the scene, the NFCC sends a first message to the DH.

[0061] S3. The DH generates a verification instruction according to the first message, and sends the verification instruction to the NFCC.

[0062] The verification instruction includes encrypted interaction data, and the first message includes a notification message, a public key, and a random number Rand1; DH generates a verification instruction according to the first message, specifically:

[0063] DH receives the notification message and generates a random number Session according to the notification message;

[0064] DH uses the public key to encrypt the random number Session;

[0065] DH uses the SM4 algorithm and the random number Session to encrypt the random number Rand1 and the interaction data;

[0066] A verification instruction is generated according to the encrypted random number Session, random number Rand1 and interaction data.

[0067] S4, NFCC uses a private key to decrypt the verification instruction to obtain interaction data.

[0068] In specific implementation, step S4 includes:

[0069] The NFCC uses or designates the eSE to use the private key to decrypt the verification instruction to obtain a random number Session;

[0070] Decrypt the verification instruction using the random number Session to obtain a random number Rand2;

[0071] Determine whether the random number Rand2 is the same as the random number Rand1;

[0072] If they are the same, the verification instruction is decrypted using the random number Session to obtain the interaction data;

[0073] If different, an error is returned.

[0074] S5, NFCC and NFC card interact.

[0075] S6: When the NFC card interaction process is completed or interrupted, DH and NFCC destroy the random number Session.

[0076] The main flow chart includes two specific implementation methods, the first one is for ordinary DH, and the second one is for DH with eSE. They are introduced below.

[0077] The first implementation method is as follows Figure 3 As shown, the following steps are included:

[0078] (1) When the NFCC is initialized, an asymmetric key pair is generated, which includes a public key and a private key.

[0079] (2) When the NFC card enters the venue, NFCC sends the notification information with the public key of KEY and a random number Rand to DH.

[0080] (3) DH receives the notification, generates a random number Session, and encrypts the Session using the public key and asymmetric encryption algorithm. It uses a symmetric encryption algorithm (such as SM4 algorithm) to encrypt the MIFARE key and Rand with the Session. The verification instruction of the encrypted Session, Rand and interactive data key combination is sent to the NFCC.

[0081] It should be noted that, since the encryption and decryption efficiency of symmetric algorithms is much higher than that of asymmetric algorithms, people are usually accustomed to giving priority to symmetric algorithms such as DES, AES, SM4, SM7, etc. for encryption / decryption algorithms, and asymmetric algorithms such as RSA, ECC, SM2, SM9, etc. for signature / verification algorithms, but in some special practical application scenarios, they may also be flexibly selected as needed. In this embodiment, considering that the DH end is an open and insecure environment, an asymmetric algorithm is selected when encrypting the Session, and the NFCC needs to generate an asymmetric key first.

[0082] (4) NFCC uses the private key of KEY to decrypt the Session, and then uses the Session to decrypt the Rand. It determines whether the decrypted Rand is the same as the one sent to DH. If they are the same, it uses the Session to decrypt the exchange data. If the decrypted Rand is different from the Rand value sent to DH, an error is returned.

[0083] (5) When the NFC card interaction process is completed or interrupted, DH and NFCC destroy the Session.

[0084] The second implementation method is Figure 4 As shown, the following steps are included:

[0085] (1) When NFCC is initialized, eSE is specified to generate an asymmetric key pair KEY, and eSE returns the public key.

[0086] (2) When the NFC card enters the venue, NFCC sends the notification information with the public key of KEY and a random number Rand to DH.

[0087] (3) DH receives the notification, generates a random number Session, and encrypts the Session using the public key and asymmetric encryption algorithm. It uses a symmetric encryption algorithm (such as SM4 algorithm) to encrypt the interaction data and Rand with the Session. The verification instruction composed of the encrypted Session, Rand and interaction data is sent to the NFCC.

[0088] (4) NFCC specifies that eSE uses the private key of KEY to decrypt the Session, and then uses the Session to decrypt the Rand. It determines whether the decrypted Rand is the same as the one sent to DH. Otherwise, it returns an error. Finally, it uses the Session to decrypt the exchange data.

[0089] (5) When the NFC card interaction process is completed or interrupted, DH and NFCC destroy the Session.

[0090] It should be noted that in the second implementation, using eSE to perform asymmetric key pair operations can further improve security.

[0091] In the implementation of the embodiment of the present invention, a pair of asymmetric keys is generated when the NFCC is initialized, a secure channel is established between the DH and the NFCC, and a session key is generated. When transmitting interactive data, the information is encrypted using the session key. In this way, even if it is intercepted, the original data cannot be directly parsed, which can ensure the security and integrity of interactive data such as keys during transmission.

[0092] In addition, the session key will be deleted after the NFC card interaction is completed to ensure that it will not be maliciously acquired or restored. That is, the embodiment of the present invention also provides a key destruction mechanism, which can effectively prevent the key from being exposed or abused for a long time.

[0093] Based on the same inventive concept, an embodiment of the present invention also provides a system for securely transmitting data, including DH and NFCC; wherein the NFCC is used to:

[0094] Before data is transmitted between DH and NFCC, an asymmetric key pair is generated when NFCC is initialized; the asymmetric key pair includes a public key and a private key;

[0095] When the NFC card enters the venue, the NFCC sends the first message to the DH;

[0096] The DH uses the Android system and is used for:

[0097] generating a verification instruction according to the first message, and sending the verification instruction to the NFCC; the verification instruction includes the encrypted interaction data;

[0098] The NFCC is also used to:

[0099] The verification instruction is decrypted using a private key to obtain interactive data.

[0100] Furthermore, the first message includes a notification message, a public key and a random number Rand1; the DH is specifically used for:

[0101] Upon receiving the notification message, a random number Session is generated according to the notification message;

[0102] Encrypt the random number Session using the public key;

[0103] The random number Rand1 and the interaction data are encrypted using the SM4 algorithm and the random number Session;

[0104] A verification instruction is generated according to the encrypted random number Session, random number Rand1 and interaction data.

[0105] Furthermore, the NFCC is specifically used for:

[0106] Use or designate eSE to use the private key to decrypt the verification instruction to obtain a random number Session;

[0107] Decrypt the verification instruction using the random number Session to obtain a random number Rand2;

[0108] Determine whether the random number Rand2 is the same as the random number Rand1;

[0109] If they are the same, the verification instruction is decrypted using the random number Session to obtain the interaction data;

[0110] If different, an error is returned.

[0111] It should be noted that the specific working process of this embodiment can be found in the aforementioned method embodiment part, which will not be described in detail here.

[0112] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for securely transmitting data between DH and NFCC, characterized in that: include: Before data is transmitted between DH and NFCC, an asymmetric key pair is generated when NFCC is initialized; the asymmetric key pair includes a public key and a private key; When the NFC card enters the venue, the NFCC sends a first message to the DH; the DH uses the Android system; The DH generates a verification instruction according to the first message, and sends the verification instruction to the NFCC; the verification instruction includes the encrypted interaction data; The NFCC uses a private key to decrypt the verification instruction to obtain the interaction data.

2. The method for securely transmitting data according to claim 1, characterized in that: DH has eSE; When the NFCC is initialized, the NFCC specifies the eSE to generate an asymmetric key pair and returns the public key of the asymmetric key pair.

3. The method for securely transmitting data according to claim 1 or 2, characterized in that: The first message includes a notification message, a public key and a random number Rand1; DH generates a verification instruction according to the first message, specifically: DH receives the notification message and generates a random number Session according to the notification message; DH uses the public key to encrypt the random number Session; DH uses a symmetric encryption algorithm and the random number Session to encrypt the random number Rand1 and the interaction data; A verification instruction is generated according to the encrypted random number Session, random number Rand1 and interaction data.

4. The method for securely transmitting data according to claim 3, characterized in that: NFCC uses the private key to decrypt the verification instruction to obtain the interaction data, specifically: The NFCC uses the private key to decrypt the verification instruction to obtain a random number Session; Decrypt the verification instruction using the random number Session to obtain a random number Rand2; Determine whether the random number Rand2 is the same as the random number Rand1; If they are the same, the verification instruction is decrypted using the random number Session to obtain the interaction data; If different, an error is returned.

5. The method for securely transmitting data according to claim 3, characterized in that: NFCC uses the private key to decrypt the verification instruction to obtain the interaction data, specifically: The NFCC specifies the eSE to use the private key to decrypt the verification instruction to obtain a random number Session; Decrypt the verification instruction using the random number Session to obtain a random number Rand2; Determine whether the random number Rand2 is the same as the random number Rand1; If they are the same, the verification instruction is decrypted using the random number Session to obtain the interaction data; If different, an error is returned.

6. The method for securely transmitting data according to claim 3, characterized in that: After obtaining the interaction data, the method further includes: When the NFC card interaction process is completed or interrupted, DH and NFCC destroy the random number Session.

7. A system for securely transmitting data, comprising DH and NFCC, characterized in that: NFCC is used to: Before data is transmitted between DH and NFCC, an asymmetric key pair is generated when NFCC is initialized; the asymmetric key pair includes a public key and a private key; When the NFC card enters the venue, the NFCC sends the first message to the DH; The DH uses the Android system and is used for: generating a verification instruction according to the first message, and sending the verification instruction to the NFCC; the verification instruction includes the encrypted interaction data; The NFCC is also used to: The verification instruction is decrypted using a private key to obtain interactive data.

8. The system for securely transmitting data according to claim 7, characterized in that: The first message includes a notification message, a public key and a random number Rand1; the DH is specifically used for: Upon receiving the notification message, a random number Session is generated according to the notification message; Encrypt the random number Session using the public key; The random number Rand1 and the interaction data are encrypted using a symmetric encryption algorithm and the random number Session; A verification instruction is generated according to the encrypted random number Session, random number Rand1 and interaction data.

9. The system for securely transmitting data according to claim 7 or 8, characterized in that: The NFCC is specifically used for: Use or designate eSE to use the private key to decrypt the verification instruction to obtain a random number Session; Decrypt the verification instruction using the random number Session to obtain a random number Rand2; Determine whether the random number Rand2 is the same as the random number Rand1; If they are the same, the verification instruction is decrypted using the random number Session to obtain the interaction data; If different, an error is returned.

10. The system for securely transmitting data according to claim 7, characterized in that: When the process is completed or interrupted, DH and NFCC destroy the random number Session.