SPA single-packet authentication method and system based on quantum cryptography

By adopting a method based on quantum cryptography in SPA single-package authentication, using a quantum random number generator to generate a key and incrementing the key index for replay detection, the problems of fragility and low computational efficiency in the existing technology are solved, and the Resistance to quantum computer attacks and efficient authentication.

CN118523914BActive Publication Date: 2024-10-18中电信量子信息科技集团有限公司
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202410985646.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-10-18
Estimated Expiration
2044-07-23

Smart Images

  • Figure CN118523914B_ABST
    Figure CN118523914B_ABST
Patent Text Reader

Abstract

The present invention discloses a SPA single-packet authentication method and system based on quantum cryptography. The method comprises the following steps: obtaining user-side authentication information from a storage medium based on a SPA knock request and performing summary calculation on the user-side authentication information to obtain a first SPA key, wherein the user-side authentication information comprises a user ID, a key index and a SPA key seed corresponding to the index; encrypting and authenticating the user ID, the key index and gateway information requested for access based on the first SPA key to generate a SPA data packet; after sending the SPA data packet to a controller, incrementing the key index in the storage medium so that the controller performs SPA data packet replay attack detection and authorization authentication based on the incremented key index; the present invention improves the SPA data packet replay attack protection performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network communication technology, and in particular to a SPA single-packet authentication method and system based on quantum cryptography. Background Art

[0002] Digital technologies such as big data, cloud computing, and mobile Internet have transformed the social production model and led various industries towards digital development. With the migration of business to the cloud and the development trend of mobile office, corporate data is no longer limited to the intranet. The boundaries between internal and external networks are becoming increasingly blurred. Traditional boundary-based network security protection measures are no longer able to cope with various potential security threats.

[0003] In 2013, the International Cloud Security Alliance proposed a new generation of network security technology architecture, Software Defined Perimeter (SDP), based on the concept of zero trust. The SDP architecture consists of three components: client, controller, and gateway. It adopts the "authentication before connection" model. When the client accesses business data, it uses the key seed pre-shared with the controller, and generates a SPA (Single Packet Authorization) single packet authorization authentication message through a symmetric algorithm or a one-time password (HMAC-based One-Time Password, HOTP) algorithm encrypted based on the HMAC algorithm. It is sent to the designated knocking port of the controller. Only after the controller successfully authenticates and authorizes, can it access the gateway for business communication. Clients that are not authenticated and authorized are rejected by default, which can greatly protect against various attacks and security threats.

[0004] In the SDP technical architecture, the security of the pre-shared key seed in the SPA knocking phase is very critical. Various manufacturers have different implementation methods, which can be simply summarized as follows. However, these methods all have more or less problems:

[0005] (1) Each client uses the same key seed. Once leaked, it will affect the security authentication of all clients.

[0006] (2) Each client generates a different SPA key seed based on hardware feature information such as the MAC address of the network card, which can achieve one machine and one secret. However, the protection measures for the local storage of SPA key seeds on the client are not perfect, or the algorithm for generating SPA key seeds is leaked, which is easy to be stolen. At the same time, SPA is based on timestamp anti-replay, and attackers can perform SPA message replay attacks within the time window of the timestamp;

[0007] (3) Before each knock on the door, the controller distributes the pre-shared key seed to the user through mobile phone text messages or email, and the user imports it into the client, realizing a one-time one-key system, which can prevent SPA message replay attacks. However, the key seed is easy to leak during the distribution process, and the manual operation is complicated and prone to errors, which affects the user experience.

[0008] For example, the patent application document with publication number CN112968971A proposes to use digital signatures to verify the legitimacy of SPA data packets. There is no need to transmit the private key used for digital signatures, which avoids the problem of private key theft, thereby improving the network security of SPA sessions and preventing attackers from impersonating others. Duplicate SPA data packets can be identified only by freshness numbers, simplifying the steps of protecting SPA data packet replay attacks. However, this solution uses traditional SM2 and SM9 asymmetric algorithms in the authentication process, which makes them vulnerable to attacks from future quantum computers and lacks quantum resistance. In addition, the computational efficiency of SM2 and SM9 asymmetric algorithms is low, and there is a risk of denial of service when there are large concurrent knocks. In addition, the client's private key is stored in the memory, but there is no measure to securely store the client's private key, which poses a risk of leakage.

[0009] In the patent application document with publication number CN108566273A, it is proposed to configure a quantum key card on each user terminal, and the corresponding quantum key is stored between the quantum key card and the quantum network service station. The configured quantum key card is used for identity authentication during communication between the user terminal and the quantum network service station, and between two user terminals. By using quantum true random numbers instead of the timestamp of the prior art, the possibility of replay attacks is solved; but the essence of this solution is an identity authentication product rather than a zero-trust product. The authentication of this solution is divided into three steps: user A authenticates himself with the quantum network service station, requests a ticket permission service, and uses the ticket to make an application service request to user B. The above three steps are based on the quantum key protection distributed by the quantum network service station. In terms of anti-replay attack, in this scheme, the user end is equipped with a quantum key card, and the corresponding quantum key is stored with the quantum network service station. When the user end requests authentication, it first applies for the quantum key card and the quantum network service station to update the key seed according to the predetermined rules, and then uses the key seed, the random number R1 generated by the quantum key card and the key generation algorithm to calculate the true random number N1; the quantum network service station receives the authentication request, calculates the true random number N1' according to the random number R1, the key generation algorithm ID and the key seed ID, and compares the two true random numbers to determine whether a replay attack has occurred and whether the authentication has passed. It can be seen that in this scheme, first the client quantum key card and the quantum network service station need to synchronize the key seed, and then both parties need to perform complex calculations to obtain the true random number, and determine whether a replay attack has occurred by comparing the true random number. The anti-replay implementation steps are relatively complicated. Summary of the invention

[0010] The technical problem to be solved by the present invention is how to improve the protection performance of SPA data packet replay attack.

[0011] The present invention solves the above technical problems by the following technical means:

[0012] In a first aspect, the present invention proposes a SPA single-packet authentication method based on quantum cryptography, which is applied to a client and includes:

[0013] Obtain user-side authentication information from a storage medium based on the SPA knock request, and perform digest calculation on the user-side authentication information to obtain a first SPA key, wherein the user-side authentication information includes a user ID, a key index, and an SPA key seed corresponding to the index;

[0014] Based on the first SPA key, encrypt and authenticate the user ID, the key index and the gateway information requested for access to generate a SPA data packet;

[0015] After sending the SPA data packet to the controller, the key index in the storage medium is incremented, so that the controller performs SPA data packet replay attack detection and authorization authentication based on the incremented key index.

[0016] Furthermore, before acquiring the user-side authentication information from the storage medium based on the SPA knock request, the method further includes:

[0017] Connecting the storage medium to the controller to create local account information for the user in the controller and initialize a PIN code of the storage medium;

[0018] The user ID, key index and SPA key seed are written into the storage medium, wherein the SPA key seed is a quantum random number generated by a quantum random number generator and pre-shared by the client and the controller.

[0019] Furthermore, before acquiring the user-side authentication information from the storage medium based on the SPA knock request, the method further includes:

[0020] Connecting to the storage medium in which the user-side authentication information is written, and obtaining a PIN code of the storage medium to verify the storage medium;

[0021] On authentication failure, end the SPA knock request processing.

[0022] Furthermore, when receiving the next SPA knock request, the SPA data packet is regenerated using the incremented key index and its corresponding SPA key seed.

[0023] Further, based on the first SPA key, the user ID, the key index and the gateway information requested for access are encrypted and authenticated to generate a SPA data packet, including:

[0024] Dividing the first SPA key into a first encryption key and a first authentication key by bytes;

[0025] Based on the first encryption key, encrypt the IP address and service port of the access gateway to obtain a first service request ciphertext;

[0026] Based on the first authentication key, perform a hash calculation on the user ID, the key index, and the first service request ciphertext to obtain a first authentication code;

[0027] The SPA data packet is generated based on the user ID, the key index, the first service request ciphertext, and the first authentication code.

[0028] Furthermore, after the authorization authentication is passed, the method further includes:

[0029] Initiate business access to the service port of the authorized gateway, and the authorized gateway temporarily opens a firewall policy rule that allows the client to access;

[0030] The firewall policy rules include setting a certain timeout period for the firewall policy, and the timeout period of the firewall policy is continuously updated; and after the client stops business access and the firewall policy times out, the authorized gateway automatically deletes the firewall policy rules.

[0031] In a second aspect, the present invention proposes another SPA single-packet authentication method based on quantum cryptography, which is applied to a controller and includes:

[0032] Receive a SPA data packet sent by a client, wherein the SPA data packet carries information including at least a user ID and a key index;

[0033] Compare the key index value carried in the SPA data packet with the key index value in the local storage account corresponding to the user ID to perform SPA data packet replay attack detection;

[0034] After the anti-replay detection passes, according to the key index value carried by the SPA data packet, the SPA key seed corresponding to the key index value is read from the local storage account;

[0035] Performing digest calculation according to the user ID, the SPA key seed obtained from the local storage account of the controller, and the key index carried by the SPA data packet to obtain a second SPA key;

[0036] Perform authentication and authorization processing on the SPA data packet based on the second SPA key.

[0037] Furthermore, before receiving the SPA data packet sent by the client, the method further includes:

[0038] Obtaining a batch of quantum random numbers from a quantum random number generator, and using the quantum random numbers as a SPA key seed file shared with a storage medium connected to the client;

[0039] The SPA key seed file and its corresponding key index are written into the local storage account and the storage medium respectively.

[0040] Furthermore, when the storage medium is used for the first time, the method further includes:

[0041] Creating a local storage account locally corresponding to the storage medium;

[0042] Initialize the PIN code of the storage medium, and write the user ID and key index into the storage medium.

[0043] Furthermore, the comparing the key index value carried by the SPA data packet with the key index value in the local account corresponding to the user ID to perform SPA data packet replay attack detection includes:

[0044] Determine whether the key index value carried by the SPA data packet is less than or equal to the key index value in the local account corresponding to the user ID;

[0045] If yes, it is determined to be a replayed SPA data packet and the processing ends;

[0046] If not, it is determined that the anti-replay test has passed.

[0047] Furthermore, before comparing the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID to perform SPA data packet replay attack detection, the method further includes:

[0048] Based on the user ID carried in the SPA data packet, query whether there is a local storage account corresponding to the user ID;

[0049] If not, the client is determined to be an illegal user and the process ends;

[0050] If it exists, perform SPA data packet anti-replay detection.

[0051] Furthermore, the information carried by the SPA data packet further includes a first service request ciphertext and a first authentication code, and the authentication and authorization processing of the SPA data packet based on the second SPA key includes:

[0052] Dividing the second SPA key into a second encryption key and a second authentication key by bytes;

[0053] Using the second authentication key, performing a hash calculation on the user ID, key index, and service request ciphertext carried in the SPA data packet to obtain a second authentication code;

[0054] When the second authentication code is equal to the first authentication code, it is determined that the authentication is successful and the key index in the local storage account is incremented;

[0055] The gateway information requested to be accessed by the client in the first service request ciphertext is calculated according to the second encryption key, and an authorization policy is issued to the corresponding gateway.

[0056] Furthermore, the method further comprises:

[0057] When the second authentication code is not equal to the first authentication code, it is determined that the authentication has failed and the process ends.

[0058] Further, the calculating, according to the second encryption key, the gateway information requested to be accessed by the client in the first service request ciphertext, and issuing an authorization policy to the corresponding gateway includes:

[0059] Calculate the gateway information requested by the client in the first service request ciphertext according to the second encryption key, wherein the gateway information requested includes the gateway IP and service port;

[0060] Check whether the access permissions match those in the local storage account;

[0061] If yes, then issuing an authorization policy to the corresponding gateway according to the gateway information requested for access;

[0062] If not, it is determined to be unauthorized access and the process ends.

[0063] In a third aspect, the present invention proposes a SPA single-packet authentication device based on quantum cryptography, the device comprising:

[0064] A user side authentication information acquisition module, used to acquire user side authentication information from a storage medium based on an SPA knock request, and perform a digest calculation on the user side authentication information to obtain a first SPA key, wherein the user side authentication information includes a user ID, a key index, and an SPA key seed corresponding to the index;

[0065] A data packet generating module, configured to encrypt and authenticate the user ID, the key index and the gateway information requested for access based on the first SPA key, and generate a SPA data packet;

[0066] The data packet sending module is used to increment the key index in the storage medium after sending the SPA data packet to the controller, so that the controller performs SPA data packet replay attack detection and authorization authentication based on the incremented key index.

[0067] In a fourth aspect, the present invention further proposes another SPA single-packet authentication device based on quantum cryptography, the device comprising:

[0068] A data packet receiving module, used to receive a SPA data packet sent by a client, wherein the SPA data packet carries information including at least a user ID and a key index;

[0069] An anti-replay detection module, used to compare the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID, and perform SPA data packet replay attack detection;

[0070] An index module, configured to read, after the anti-replay detection passes, the SPA key seed corresponding to the key index value from the local storage account according to the key index value carried by the SPA data packet;

[0071] A key generation module, configured to perform digest calculation according to the user ID, the SPA key seed and the key index carried by the SPA data packet to obtain a second SPA key;

[0072] An authentication and authorization module is used to perform authentication and authorization processing on the SPA data packet based on the second SPA key.

[0073] In a fifth aspect, the present invention proposes a SPA single-packet authentication system based on quantum cryptography, the system comprising a client, a controller, a gateway and a storage medium, the storage medium is inserted into the client, the storage medium is pre-written with user-side authentication information, the user-side authentication information comprises a user ID, a key index and a SPA key seed corresponding to the index;

[0074] The client is used to generate a SPA data packet based on the user-side authentication information, and increment the key index in the storage medium after sending the SPA data packet to the controller, wherein the information carried by the SPA data packet includes at least a user ID and a key index;

[0075] The controller receives the SPA data packet sent by the client, and compares the key index value carried in the SPA data packet with the key index value in the local storage account corresponding to the user ID, performs SPA data packet replay attack detection, and after the anti-replay detection passes, reads the SPA key seed corresponding to the key index value from the local storage account according to the key index value carried by the SPA data packet; performs summary calculation according to the user ID, the SPA key seed and the key index carried by the SPA data packet to obtain a second SPA key; performs authentication and authorization processing on the SPA data packet based on the second SPA key, and sends the authorization policy of the authenticated client to the gateway requested by the client for access;

[0076] The corresponding gateway loads the authorization policy and temporarily opens a firewall policy rule that allows the client to access, so as to allow the client to access the service when the client initiates a service access to the gateway requesting access.

[0077] Furthermore, the controller is equipped with a quantum random number generator, and the quantum random number generator is used to generate a quantum random number pre-shared by the client and the controller as a SPA key seed.

[0078] Furthermore, the storage medium adopts a quantum key card, which is used as a storage medium for the client SPA key seed. When the storage medium is used for the first time, the storage medium is connected to the controller to create local storage account information for the user in the controller and perform storage medium distribution operations.

[0079] Furthermore, the gateway is used to adopt the firewall IP black and white list principle, and according to the authorization policy issued by the controller to the authenticated client, allow the authenticated client to perform business communication, and block the unauthenticated illegal client by default.

[0080] Furthermore, the storage medium has a built-in security chip and an operating system, and is protected by hardware and a PIN code.

[0081] In a sixth aspect, the present invention proposes an electronic device, comprising a memory and a processor; wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the SPA single-packet authentication method based on quantum cryptography as described above.

[0082] In a seventh aspect, the present invention further proposes a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the SPA single-packet authentication method based on quantum cryptography as described above is implemented.

[0083] The advantages of the present invention are:

[0084] (1) The present invention calculates the SPA key by using authentication information such as the user ID, key index, and the SPA key seed corresponding to the key index, and generates a SPA data packet by encrypting and authenticating the key index and the gateway information requested for access based on the generated SPA key. Each time the generated SPA data packet is sent to the controller for authorization authentication, the key index is incremented so that after the controller receives the SPA data packet, the SPA data packet anti-replay detection is performed based on the incremented key index. The anti-replay attack is also improved, and the attacker cannot perform a replay attack, thereby avoiding the situation where the SPA uses a timestamp for anti-replay detection and the attacker can perform a SPA message replay attack within the time window of the timestamp.

[0085] (2) The present invention has the advantages of quantum cryptography, such as security, high performance, and fast generation rate. The controller writes the SPA key seed generated by the quantum random number generator and pre-shared between the client and the controller into a storage medium, and then the administrator delivers the storage medium to the user for use on the client in an offline manner. In this way, by using the controller to recharge the pre-shared SPA key seed for the client offline, the problem of easy leakage of the pre-shared SPA key seed during distribution, storage and use is solved.

[0086] (3) SPA knock authentication adopts a one-time one-password method and uses a quantum cryptographic true random number generated by a quantum random number generator as a pre-shared SPA key seed. Theoretically, it is unpredictable and cannot be cracked. Compared with the traditional one-machine-one-password method, security has been greatly improved.

[0087] (4) In terms of usability, the storage medium can store a large number of SPA key seeds, which can be distributed once and used continuously. Compared with the method of distributing pre-shared SPA key seeds via SMS or email before each SPA knocks on the door, the operation is simpler and the user experience is better.

[0088] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0089] Figure 1 It is a flowchart of a SPA single-packet authentication method based on quantum cryptography proposed in the first embodiment of the present invention;

[0090] Figure 2 1 is a flow chart of a SPA single-packet authentication method based on quantum cryptography proposed in the second embodiment of the present invention;

[0091] Figure 31 is a schematic diagram of the structure of a SPA single-packet authentication device based on quantum cryptography proposed in the third embodiment of the present invention;

[0092] Figure 4 1 is a schematic diagram of the structure of a SPA single-packet authentication device based on quantum cryptography proposed in the fourth embodiment of the present invention;

[0093] Figure 5 It is a structural diagram of a SPA single-packet authentication system based on quantum cryptography proposed in the fifth embodiment of the present invention. DETAILED DESCRIPTION

[0094] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with 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.

[0095] Embodiment 1

[0096] like Figure 1 As shown, the first embodiment of the present invention proposes a SPA single-packet authentication method based on quantum cryptography, which is applied to a client and includes the following steps:

[0097] S101, obtaining user-side authentication information from a storage medium based on an SPA knock request, and performing a digest calculation on the user-side authentication information to obtain a first SPA key, wherein the user-side authentication information includes a user ID, a key index, and an SPA key seed corresponding to the index;

[0098] Specifically, the user ID in this embodiment refers to the client ID. In this embodiment, a quantum key card can be used as a storage medium for the client SPA key seed. In actual application, the quantum key card distributed by the controller can be inserted into the client for use.

[0099] Specifically, this embodiment performs a national secret SM3 digest operation on the read user ID, key index, and SPA key seed corresponding to the index to obtain a first SPA key.

[0100] S102: Based on the first SPA key, encrypt and authenticate the user ID, the key index and the gateway information requested for access to generate a SPA data packet;

[0101] Specifically, the gateway information that the client requests to access includes information such as the gateway IP and service port.

[0102] S103: After sending the SPA data packet to the controller, increment the key index in the storage medium, so that the controller performs SPA data packet replay attack detection and authorization authentication based on the incremented key index.

[0103] It should be noted that when the controller distributes quantum key cards to the client, both parties have the same initial key index (value is 0). When the client initiates an authentication request, the client key index is incremented by 1. When the controller receives the request, it compares the key index of the request message and finds that it is less than or equal to the local key index of the controller. If it is a replayed message, further authentication processing is performed. When the authentication is passed, the controller updates the local key index to the key index of the request message.

[0104] This embodiment generates a SPA data packet by performing encryption authentication based on the user ID, the key index, the SPA key seed corresponding to the key index, the gateway information requested for access, etc., and increments the key index each time the generated SPA data packet is sent to the controller for authorization authentication, so that after the controller receives the SPA data packet, it performs anti-replay detection on the SPA data packet based on the incremented key index, and the anti-replay attack is also improved. The attacker cannot perform a replay attack, which avoids the situation where the SPA uses a timestamp for anti-replay detection, and the attacker can perform a SPA message replay attack within the time window of the timestamp.

[0105] It should be understood that since the timestamp has a time window, when the timestamp of the forged message by the attacker is within the window, the message is considered fresh and may be subject to replay attacks. In this embodiment, the controller and the client share the same quantum key. The client authentication is based on the quantum key one-time knock authentication. The key index increases each time the authentication is performed. When the controller receives a request, it compares the key index of the request message and compares it to be less than or equal to the local key index of the controller, and determines it as a replayed message. Therefore, the replay attack problem within the timestamp window can be effectively solved.

[0106] Furthermore, in the step S101: before obtaining the user-side authentication information from the storage medium based on the SPA knock request, the method further includes the following steps:

[0107] Connecting the storage medium to the controller to create local account information for the user in the controller and initialize a PIN code of the storage medium;

[0108] The user ID, key index and SPA key seed are written into the storage medium, wherein the SPA key seed is a quantum random number generated by a quantum random number generator and pre-shared by the client and the controller.

[0109] It should be noted that this embodiment uses the quantum key card as the storage medium of the client SPA key seed. Before the first use, the administrator completes the distribution in the controller. The distribution process is as follows:

[0110] The administrator connects the quantum key card to the controller, creates a local storage account information for the user in the controller, and performs the quantum key card distribution operation; the controller initializes the quantum key card PIN code, and writes the user ID and key index (initial value is 0) into the quantum key card; the controller obtains a batch of quantum random numbers from the quantum random number generator as the SPA key seed pre-shared by the controller and the user, generates an SPA key seed file and writes it into the local storage account and the quantum key card respectively; during authentication, the administrator delivers the quantum key card to the user offline and inserts it into the client for use.

[0111] This embodiment uses a quantum key card as the storage medium for the client SPA key seed, has an embedded security chip and operating system, and is protected by hardware and PIN code.

[0112] Furthermore, in the step S101: before obtaining the user-side authentication information from the storage medium based on the SPA knock request, the method further includes the following steps:

[0113] Connecting to the storage medium in which the user-side authentication information is written, and obtaining a PIN code of the storage medium to verify the storage medium;

[0114] On authentication failure, end the SPA knock request processing.

[0115] It should be noted that when the user inserts the quantum key card distributed by the controller on the client, he enters the PIN code, the client obtains the PIN code and verifies the quantum key card. If the verification fails, the SPA knock request processing ends.

[0116] It should be noted that the embedded chip and chip operating system of the quantum key card can provide functions such as secure storage of private keys and cryptographic algorithms. Due to its independent data processing capabilities and good security, the quantum key card becomes a secure carrier of quantum true random number private keys. Each quantum key card is protected by a hardware PIN code. The PIN code and hardware constitute two necessary factors for users to use the quantum key card. Users can only log in to the system if they obtain the quantum key card that stores relevant authentication information and the user PIN code at the same time.

[0117] Furthermore, when receiving the next SPA knock request, this embodiment uses the incremented key index and its corresponding SPA key seed to regenerate the SPA data packet for replay attack detection.

[0118] Further, the step S102: encrypting and authenticating the user ID, the key index and the gateway information requested for access based on the first SPA key to generate a SPA data packet includes the following steps:

[0119] S121. Divide the first SPA key into a first encryption key and a first authentication key by bytes;

[0120] Specifically, this embodiment divides the first 16 bytes of the first SPA key into bytes, and uses the first encryption key and the last 16 bytes as the second authentication key.

[0121] S122. Based on the first encryption key, perform a symmetric encryption operation on the IP address and service port of the access gateway to obtain a first service request ciphertext;

[0122] Specifically, this embodiment uses the first encryption key to perform the national secret SM4 symmetric encryption operation on the IP address and service port of the access gateway to obtain the first service request ciphertext.

[0123] This embodiment uses symmetric encryption operations such as SM4 for symmetric encryption protection based on quantum cryptography one-time knock authentication, which has anti-quantum capabilities.

[0124] S123. Based on the first authentication key, perform a hash calculation on the user ID, the key index, and the first service request ciphertext to obtain a first authentication code;

[0125] Specifically, this embodiment uses the first authentication key to perform national secret SM3 HMAC calculation on fields such as user ID, key index, and first service request ciphertext to obtain a first authentication code.

[0126] S124. Generate the SPA data packet based on the user ID, the key index, the first service request ciphertext and the first authentication code.

[0127] In this embodiment, the IP address and service port of the access gateway are encrypted by using the first encryption key to prevent unauthorized users from snooping on service information, thereby achieving the purpose of service hiding; by using the first authentication key, summary operations are performed on fields such as user ID, key index, and first service request ciphertext to effectively prevent illegal tampering of authentication information.

[0128] Furthermore, after the authorization authentication is passed, the method further comprises the following steps:

[0129] Initiate business access to the service port of the authorized gateway, and the authorized gateway temporarily opens a firewall policy rule that allows the client to access;

[0130] The firewall policy rules include setting a certain timeout period for the firewall policy, and the timeout period of the firewall policy is continuously updated; and after the client stops business access and the firewall policy times out, the authorized gateway automatically deletes the firewall policy rules.

[0131] Embodiment 2

[0132] like Figure 2 As shown, the second embodiment of the present invention proposes a SPA single packet authentication method based on quantum cryptography, which is applied to a controller and includes the following steps:

[0133] S201, receiving a SPA data packet sent by a client, wherein the SPA data packet carries information including at least a user ID and a key index;

[0134] S202, comparing the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID, and performing SPA data packet replay attack detection;

[0135] S203: after the anti-replay detection passes, according to the key index value carried by the SPA data packet, read the SPA key seed corresponding to the key index value from the local storage account;

[0136] S204, performing digest calculation according to the user ID, the SPA key seed obtained from the local storage account of the controller, and the key index carried by the SPA data packet to obtain a second SPA key;

[0137] Specifically, this embodiment reads the SPA key seed from the SPA key seed file in the user's local storage account according to the key index value of the SPA data packet, and performs SM3 digest operation according to the user ID, key index, and SPA key seed to obtain the second SPA key.

[0138] S205: Perform authentication and authorization processing on the SPA data packet based on the second SPA key.

[0139] It should be noted that, in this embodiment, after receiving the SPA data packet sent by the client, the controller performs SPA data packet replay attack detection by comparing the key index value carried in the SPA data packet with the key index value in the local storage account corresponding to the user ID. When it is determined that the current SPA data packet is not a replayed SPA data packet, the controller reads the SPA key seed corresponding to the key index value from the local storage account based on the key index value carried by the SPA data packet, and performs subsequent authentication and authorization processing, thereby protecting from various attack behaviors and security threats to a great extent.

[0140] Furthermore, before the step S201: receiving the SPA data packet sent by the client, the method further includes the following steps:

[0141] Obtaining a batch of quantum random numbers from a quantum random number generator, and using the quantum random numbers as a SPA key seed file shared with a storage medium connected to the client;

[0142] The SPA key seed file and its corresponding key index are written into the local storage account and the storage medium respectively.

[0143] It should be noted that the controller is equipped with a quantum random number generator, which is used to generate quantum random numbers as the SPA key seeds pre-shared by the client and the controller. The quantum key card is used as the storage medium for the client SPA key seeds. Before the first use, the administrator completes the distribution in the controller. The distribution process is as follows:

[0144] The administrator connects the quantum key card to the controller, creates local account information for the user in the controller, and performs quantum key card distribution operations; the controller initializes the quantum key card PIN code, and writes the user ID and key index (initial value is 0) into the quantum key card; the controller obtains a batch of quantum random numbers from the quantum random number generator as the SPA key seed file shared by the user, and writes them into the local storage and quantum key card respectively; the administrator delivers the quantum key card to the user for use on the client in an offline manner.

[0145] Furthermore, the step S202: comparing the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID to perform SPA data packet replay attack detection includes the following steps:

[0146] S221, determining whether the key index value carried by the SPA data packet is less than or equal to the key index value in the local account corresponding to the user ID, if so, executing step S222, if not, executing step S223;

[0147] S222, determine that it is a replayed SPA data packet and end the processing;

[0148] S223: Determine whether the anti-replay detection has passed.

[0149] Furthermore, before the step S202: comparing the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID to perform SPA data packet replay attack detection, the method further includes the following steps:

[0150] Based on the user ID carried in the SPA data packet, query whether there is a local storage account corresponding to the user ID;

[0151] If not, the client is determined to be an illegal user and the process ends;

[0152] If it exists, perform SPA data packet anti-replay detection.

[0153] It should be noted that this embodiment immediately stops processing if the user ID query fails, effectively rejecting unauthorized users; for users who successfully query, local account information is read, including local key index and other information, for anti-replay detection and subsequent authentication processing.

[0154] Furthermore, the information carried by the SPA data packet further includes a first service request ciphertext and a first authentication code. The step S205: performing authentication and authorization processing based on the first SPA key and the second SPA key includes the following steps:

[0155] S251, dividing the second SPA key into a second encryption key and a second authentication key by bytes;

[0156] Similarly, in this embodiment, the first 16 bytes of the second SPA key are used as the second encryption key, and the last 16 bytes are used as the second authentication key, and the second authentication key is an HMAC authentication key.

[0157] S252, using the second authentication key to perform a hash calculation on the user ID, key index and service request ciphertext carried in the SPA data packet to obtain a second authentication code;

[0158] Specifically, this embodiment uses the second authentication key to perform SM3 HMAC calculation on fields such as the user ID, the key index, and the first service request ciphertext in the SPA data packet to obtain the second authentication code.

[0159] S253: When the second authentication code is equal to the first authentication code, it is determined that the authentication is successful and the key index in the local storage account is incremented;

[0160] It should be understood that when the second authentication code is not equal to the first authentication code, it is determined that the authentication has failed and the process is terminated; after the authentication is successful, the SPA key index of the user in the local storage account information is updated to prevent replay attacks.

[0161] S254. Calculate the gateway information that the client requests to access in the first service request ciphertext according to the second encryption key, and issue an authorization policy to the corresponding gateway.

[0162] Further, the step S254: calculating the gateway information requested to be accessed by the client in the first service request ciphertext according to the second encryption key, and issuing an authorization policy to the corresponding gateway, specifically includes the following steps:

[0163] Using the second encryption key to perform SM4 decryption operation on the first service request ciphertext, to obtain the gateway information requested to be accessed by the client, wherein the gateway information requested to be accessed includes the gateway IP and service port;

[0164] Check whether the access permissions match those in the local storage account;

[0165] If yes, then issuing an authorization policy to the corresponding gateway according to the gateway information requested for access;

[0166] If not, it is determined to be unauthorized access and the process ends.

[0167] Embodiment 3

[0168] like Figure 3 As shown, the third embodiment of the present invention proposes a SPA single-packet authentication device based on quantum cryptography, and the device includes:

[0169] A user side authentication information acquisition module 11 is used to acquire user side authentication information from a storage medium based on an SPA knock request, and perform a digest calculation on the user side authentication information to obtain a first SPA key, wherein the user side authentication information includes a user ID, a key index, and an SPA key seed corresponding to the index;

[0170] The data packet generating module 12 is used to encrypt and authenticate the user ID, the key index and the gateway information requested for access based on the first SPA key to generate a SPA data packet;

[0171] The data packet sending module 13 is used to increment the key index in the storage medium after sending the SPA data packet to the controller, so that the controller performs SPA data packet replay attack detection and authorization authentication based on the incremented key index.

[0172] Furthermore, before the user-side authentication information acquisition module 11 acquires the user-side authentication information from the storage medium based on the SPA knock request, the storage medium is connected to the controller to create local account information for the user in the controller and initialize the PIN code of the storage medium; the user ID, key index and SPA key seed are written into the storage medium, wherein the SPA key seed is a quantum random number generated by a quantum random number generator and pre-shared by the client and the controller.

[0173] Furthermore, the device also includes a verification module, which is used to connect to the storage medium written with the user-side authentication information and obtain a PIN code of the storage medium to verify the storage medium; when the verification fails, the SPA knock request processing is terminated.

[0174] Furthermore, the data packet generating module 12 is further configured to regenerate the SPA data packet using the incremented key index and its corresponding SPA key seed when the user-side authentication information acquiring module 11 receives the next SPA knock request.

[0175] Furthermore, the data packet generation module 12 specifically includes:

[0176] A first key division unit, configured to divide the first SPA key into a first encryption key and a first authentication key by bytes;

[0177] An encryption unit, configured to perform a symmetric encryption operation on the IP address and the service port of the access gateway based on the first encryption key to obtain a first service request ciphertext;

[0178] A first authentication code calculation unit, configured to perform a hash calculation on the user ID, the key index, and the first service request ciphertext based on the first authentication key to obtain a first authentication code;

[0179] The SPA data packet generating unit is configured to generate the SPA data packet based on the user ID, the key index, the first service request ciphertext and the first authentication code.

[0180] Furthermore, the device also includes an access module, which is used to initiate business access to the service port of an authorized gateway after the client authorization authentication is passed, and the authorized gateway temporarily opens a firewall policy rule that allows the client to access; wherein the firewall policy rule includes setting a certain timeout time for the firewall policy, and the timeout time of the firewall policy is continuously updated; and after the client stops business access and the firewall policy times out, the authorized gateway automatically deletes the firewall policy rule.

[0181] It should be noted that other embodiments of the SPA single-packet authentication device based on quantum cryptography described in the present invention or implementation methods can refer to the above-mentioned method embodiment 1, which will not be repeated here.

[0182] Embodiment 4

[0183] like Figure 4 As shown, the fourth embodiment of the present invention further discloses a SPA single-packet authentication device based on quantum cryptography, the device comprising:

[0184] The data packet receiving module 21 is used to receive a SPA data packet sent by a client, wherein the SPA data packet carries information including at least a user ID and a key index;

[0185] An anti-replay detection module 22, used to compare the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID, and perform SPA data packet replay attack detection;

[0186] The index module 23 is used to read the SPA key seed corresponding to the key index value from the local storage account according to the key index value carried by the SPA data packet after the anti-replay detection passes;

[0187] The key generation module 24 is used to perform a digest calculation based on the user ID, the SPA key seed obtained from the local storage account of the controller, and the key index carried by the SPA data packet to obtain a second SPA key;

[0188] The authentication and authorization module 25 is configured to perform authentication and authorization processing on the SPA data packet based on the second SPA key.

[0189] Furthermore, the device also includes an SPA key seed pre-sharing module, which is used to obtain batches of quantum random numbers from a quantum random number generator, and use the quantum random numbers as an SPA key seed file shared with a storage medium connected to the client; and write the SPA key seed file and its corresponding key index into a local storage account and the storage medium respectively.

[0190] Furthermore, the device also includes a local account creation module, which is used to locally create a local storage account corresponding to the storage medium when the storage medium is used for the first time; initialize the PIN code of the storage medium, and write the user ID and key index into the storage medium.

[0191] Furthermore, the anti-replay detection module 22 specifically includes:

[0192] A determination unit, configured to determine whether the key index value carried by the SPA data packet is less than or equal to the key index value in the local storage account corresponding to the user ID;

[0193] The replay determination unit is used to determine that the packet is a replayed SPA packet and end the processing when the judgment unit outputs a yes result; and to determine that the anti-replay detection is passed when the judgment unit outputs a no result.

[0194] Furthermore, the device also includes an ID query module, which is used to query whether there is a local storage account corresponding to the user ID carried by the SPA data packet; if not, the client is determined to be an illegal user and the processing is terminated; if it exists, SPA data packet anti-replay detection is performed.

[0195] Furthermore, the authentication and authorization module 25 specifically includes:

[0196] A second key division unit, used for dividing the second SPA key into a second encryption key and a second authentication key by bytes;

[0197] A second authentication code calculation unit, configured to perform a hash calculation on the user ID, key index and service request ciphertext carried by the SPA data packet using the second authentication key to obtain a second authentication code;

[0198] an authentication unit, configured to determine that the authentication is successful and increment the key index in the local storage account when the second authentication code is equal to the first authentication code; and to determine that the authentication fails and terminate the process when the second authentication code is not equal to the first authentication code;

[0199] The authorization unit is used to calculate the gateway information that the client requests to access in the first service request ciphertext according to the second encryption key, and issue an authorization policy to the corresponding gateway.

[0200] Further, the authorization unit is specifically used to: calculate the gateway information requested to be accessed by the client in the first service request ciphertext according to the second encryption key, wherein the gateway information requested to be accessed includes the gateway IP and service port;

[0201] Check whether the access permissions match those in the local storage account;

[0202] If yes, then issuing an authorization policy to the corresponding gateway according to the gateway information requested for access;

[0203] If not, it is determined to be unauthorized access and the process ends.

[0204] It should be noted that other embodiments of the SPA single-packet authentication device based on quantum cryptography described in the present invention or implementation methods can refer to the above-mentioned method embodiment 2, which will not be repeated here.

[0205] Embodiment 5

[0206] like Figure 5 As shown, the fifth embodiment of the present invention proposes a SPA single-packet authentication system based on quantum cryptography, the system includes a client, a controller, a gateway and a storage medium, the storage medium is inserted into the client, the storage medium is pre-written with user-side authentication information, the user-side authentication information includes a user ID, a key index and a SPA key seed corresponding to the index;

[0207] The client is used to generate a SPA data packet based on the user-side authentication information, and increment the key index in the storage medium after sending the SPA data packet to the controller, wherein the information carried by the SPA data packet includes at least a user ID and a key index;

[0208] The controller receives the SPA data packet sent by the client, and compares the key index value carried in the SPA data packet with the key index value in the local storage account corresponding to the user ID, performs SPA data packet replay attack detection, and after the anti-replay detection passes, reads the SPA key seed corresponding to the key index value from the local storage account according to the key index value carried by the SPA data packet; performs summary calculation according to the user ID, the SPA key seed and the key index carried by the SPA data packet to obtain a second SPA key; performs authentication and authorization processing on the SPA data packet based on the second SPA key, and sends the authorization policy of the authenticated client to the gateway requested by the client for access;

[0209] The corresponding gateway loads the authorization policy and temporarily opens a firewall policy rule that allows the client to access, so as to allow the client to access the service when the client initiates a service access to the gateway requesting access.

[0210] Furthermore, the controller is equipped with a quantum random number generator, and the quantum random number generator is used to generate a quantum random number pre-shared by the client and the controller as a SPA key seed.

[0211] The quantum random number generator is an external device of the controller; or, the quantum random number generator is an internal board of the controller; or, the quantum random number generator is an embedded chip of the controller.

[0212] Furthermore, the storage medium adopts a quantum key card, which is used as a storage medium for the client SPA key seed. When the storage medium is used for the first time, the storage medium is connected to the controller to create local storage account information for the user in the controller and perform storage medium distribution operations.

[0213] It should be noted that the quantum key card is used as the storage medium for the client to store the SPA pre-shared key seed. The quantum key card has a built-in security chip and operating system, which is protected by hardware and PIN code, and provides functions such as secure storage of quantum keys and cryptographic algorithms. Optionally, a quantum USB key is used as a quantum key card on a PC, and a quantum SIM card is used as a quantum key card on a mobile phone.

[0214] Furthermore, the controller sends an authorization policy to the gateway according to the gateway IP and service port requested by the client; the gateway temporarily opens a firewall policy rule that allows the client to access according to the authorization policy sent by the controller;

[0215] Among them, the firewall policy rules include setting a certain timeout period for the firewall policy, automatically deleting the rule after the timeout, and continuously updating the timeout during the client's continuous access. For clients that are not authenticated and authorized, the gateway firewall policy blocks them by default to achieve hiding of the protected services.

[0216] In summary, the client in this embodiment is a PC or mobile terminal that has installed the quantum key card and SPA knocking client software. The quantum key card is used to store the SPA pre-shared key seed. The user sends the SPA knocking authentication data packet to the controller through the client, and accesses the service with the authorized gateway; SPA knocks one password each time, and consumes a new set of key seeds each time. The quantum key card is equipped with a large-capacity secure storage to avoid redistribution due to exhaustion of SPA key seeds.

[0217] The controller is equipped with a quantum random number generator, which distributes quantum key cards to clients and performs knock authentication on SPA data packets from clients. If the authentication fails, the processing is rejected. If the authentication succeeds, the client authorization policy is sent to the gateway.

[0218] The gateway specifically hides the protected service resources and adopts the firewall IP blacklist and whitelist principle to block unauthenticated illegal clients by default. According to the authorization policy distributed by the controller, the corresponding firewall rules are opened to allow authenticated clients to conduct business communications.

[0219] It should be noted that other embodiments of the client described in the present invention or implementation methods thereof may refer to the above-mentioned Embodiment 1 or Embodiment 3, and other embodiments of the controller described in the present invention or implementation methods thereof may refer to the above-mentioned Embodiment 2 or Embodiment 4, which will not be repeated here.

[0220] Specifically, the workflow of the SPA single-package authentication system based on quantum cryptography proposed in this embodiment includes:

[0221] Step S1: The controller distributes keys to the quantum key card used for the first time, including the following steps:

[0222] Step S1-1: The administrator connects the quantum key card to the controller, creates local account information for the user in the controller, and performs the quantum key card distribution operation;

[0223] Step S1-2: The controller initializes the quantum key card PIN code and writes the user ID and key index (initial value is 0) into the quantum key card;

[0224] Step S1-3: The controller obtains a batch of quantum random numbers from the quantum random number generator as the SPA key seed file shared by the user, and writes them into the local storage and the quantum key card respectively;

[0225] Step S1-4: The administrator delivers the quantum key card to the user for use on the client in an offline manner.

[0226] Step S2: The client sends a SPA knock packet to the controller, including the following steps:

[0227] Step S2-1: The user inserts the quantum key card distributed by the controller at the client;

[0228] Step S2-2: The user enters the PIN code. If the quantum key card verification fails, the SPA knock request process ends;

[0229] Step S2-3: The client reads the user ID, key index and SPA key seed corresponding to the index from the quantum key card, and calculates the SPA key based on the three data read;

[0230] Step S2-4: The client generates a SPA data packet based on the SPA key, which includes information such as user ID, key index, service request ciphertext, HMAC authentication code, etc.

[0231] Step S2-5: The client sends a SPA data packet to the controller and increments the key index in the quantum key card by 1.

[0232] Step S3: The controller performs SPA knock authentication processing, including the following steps:

[0233] Step S3-1: The controller receives the SPA data packet from the client;

[0234] Step S3-2: The controller checks whether the local account information of the user exists according to the user ID of the SPA data packet. If not, it is determined to be an illegal user and the processing ends;

[0235] Step S3-3: The controller compares the key index value of the SPA data packet and the local account information. If it is less than or equal to the key index value, it is determined to be a replayed SPA data packet and the processing ends;

[0236] Step S3-4: the controller reads the SPA key seed from the SPA key seed file of the user according to the key index value of the SPA data packet;

[0237] Step S3-5: The controller calculates the SPA key according to the user ID, the key index, and the SPA key seed;

[0238] Step S3-6: Use the SPA authentication key to calculate the HMAC authentication code for the SPA data packet and compare it with the HMAC authentication code in the SPA data packet. If they are not equal, the authentication fails and the process ends. If they are equal, the authentication succeeds and the local account information of the user's SPA key index is updated to prevent replay attacks.

[0239] Step S4: The controller distributes the client authorization policy to the gateway, including the following steps:

[0240] Step S4-1: The controller uses the SPA key to decrypt the service request ciphertext in the SPA data packet to obtain the gateway IP and service port that the client requests to access;

[0241] Step S4-2: The controller checks whether the local account information matches the access rights. If not, it determines that it is an unauthorized access and ends the process;

[0242] Step S4-3: The controller sends an authorization policy to the gateway according to the gateway IP and service port requested by the client.

[0243] Step S5: The gateway loads the client authorization policy, including the following steps:

[0244] Step S5-1: The gateway receives the authorization policy sent from the controller;

[0245] Step S5-2: The gateway temporarily opens a firewall policy rule that allows the client to access based on the client IP and the accessed service port in the authorization policy information.

[0246] Step S6: The client accesses the gateway to access the service, including the following steps:

[0247] Step S6-1: The client initiates a service access to the service port of the authorized gateway. Since the gateway firewall policy has allowed the client to access the service, the service can communicate normally;

[0248] Step S6-2: During the continuous access of the client, the gateway sets a certain timeout period for the firewall policy, and the timeout period of the policy is continuously updated;

[0249] Step S6-3: The client stops accessing the service. After the firewall policy times out, the gateway automatically deletes the rule. The client needs to perform SPA knock authentication with the controller again the next time it accesses.

[0250] The SPA single-package authentication system based on quantum cryptography proposed in this embodiment is a zero-trust product, which realizes SDP gateway single-package authentication authorization and service hiding. The system consists of a client, a controller, and an SDP gateway. The controller distributes a quantum key card to the client for the first time. The client performs SPA single-package authentication to the controller based on the quantum key. After the authentication is successful, the controller authorizes the client to access the SDP gateway. When the client uses it for the first time, the controller distributes a quantum key card to it. The controller and the client share a large number of quantum keys. The SPA knocks on the door for authentication once, and a new set of quantum keys is consumed each time. The controller performs anti-replay detection based on the incremental rule of the key index value of the quantum key. There is no need to synchronize the key seed before authentication, and no complex calculations are required during authentication. After the controller receives the authentication request, when the key index value in the comparison message is less than the local key index value, it is immediately determined as a replay attack, thereby achieving efficient anti-replay.

[0251] Furthermore, the sixth and seventh embodiments of the present invention respectively disclose an electronic device and a computer-readable storage medium, wherein the electronic device includes a memory and a processor; wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the SPA single-packet authentication method based on quantum cryptography as described in the above embodiment one or embodiment two.

[0252] The computer-readable storage medium stores a computer program thereon. When the computer program is executed by a processor, the SPA single-packet authentication method based on quantum cryptography as described in the first or second embodiment above is implemented.

[0253] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.

[0254] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0255] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0256] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0257] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A SPA single-packet authentication method based on quantum cryptography, characterized in that: The method is applied to a client and includes: Obtain user-side authentication information from a storage medium of the client based on the SPA knock request, and perform digest calculation on the user-side authentication information to obtain a first SPA key, wherein the user-side authentication information includes a user ID, a key index, and an SPA key seed corresponding to the index; Based on the first SPA key, encrypt and authenticate the user ID, the key index and the gateway information requested for access to generate a SPA data packet; After sending the SPA data packet to the controller, the key index in the storage medium is incremented, so that the controller performs SPA data packet replay attack detection and authorization authentication based on the incremented key index.

2. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 1, characterized in that: Before acquiring the user-side authentication information from the storage medium based on the SPA knock request, the method further includes: Connecting the storage medium to the controller to create local account information for the user in the controller and initialize a PIN code of the storage medium; The user ID, key index and SPA key seed are written into the storage medium, wherein the SPA key seed is a quantum random number generated by a quantum random number generator and pre-shared by the client and the controller.

3. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 1, characterized in that: Before acquiring the user-side authentication information from the storage medium based on the SPA knock request, the method further includes: Connecting to the storage medium in which the user-side authentication information is written, and obtaining a PIN code of the storage medium to verify the storage medium; On authentication failure, end the SPA knock request processing.

4. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 1, characterized in that: When receiving the next SPA knock request, the SPA data packet is regenerated using the incremented key index and its corresponding SPA key seed.

5. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 1, characterized in that: The step of encrypting and authenticating the user ID, the key index, and the gateway information requested for access based on the first SPA key to generate a SPA data packet includes: Dividing the first SPA key into a first encryption key and a first authentication key by bytes; Based on the first encryption key, perform symmetric encryption operation on the IP address and service port of the access gateway to obtain a first service request ciphertext; Based on the first authentication key, perform a hash calculation on the user ID, the key index, and the first service request ciphertext to obtain a first authentication code; The SPA data packet is generated based on the user ID, the key index, the first service request ciphertext, and the first authentication code.

6. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 1, characterized in that: After the authorization authentication is passed, the method further includes: Initiate business access to the service port of the authorized gateway, and the authorized gateway temporarily opens a firewall policy rule that allows the client to access; The firewall policy rules include setting a certain timeout period for the firewall policy, and the timeout period of the firewall policy is continuously updated; and after the client stops business access and the firewall policy times out, the authorized gateway automatically deletes the firewall policy rules.

7. A SPA single-packet authentication method based on quantum cryptography, characterized in that: The method is applied to a controller and comprises: Receive a SPA data packet sent by a client, wherein the SPA data packet carries information including at least a user ID, a key index, and gateway information; Compare the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID to perform SPA data packet replay attack detection, wherein the key index value in the local storage account is incremented; After the anti-replay detection passes, according to the key index value carried by the SPA data packet, the SPA key seed corresponding to the key index value is read from the local storage account; Performing digest calculation according to the user ID, the SPA key seed obtained from the local storage account of the controller, and the key index carried by the SPA data packet to obtain a second SPA key; Perform authentication and authorization processing on the SPA data packet based on the second SPA key.

8. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 7, characterized in that: Before receiving the SPA data packet sent by the client, the method further includes: Obtaining a batch of quantum random numbers from a quantum random number generator, and using the quantum random numbers as a SPA key seed file shared with a storage medium connected to the client; The SPA key seed file and its corresponding key index are written into the local storage account and the storage medium respectively.

9. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 8, characterized in that: When the storage medium is used for the first time, the method further includes: Creating a local storage account locally corresponding to the storage medium; Initialize the PIN code of the storage medium, and write the user ID and key index into the storage medium.

10. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 7, characterized in that: The comparing the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID to perform SPA data packet replay attack detection includes: Determine whether the key index value carried by the SPA data packet is less than or equal to the key index value in the local storage account corresponding to the user ID; If yes, it is determined to be a replayed SPA data packet and the processing ends; If not, it is determined that the anti-replay test has passed.

11. The SPA single-packet authentication method based on quantum cryptography according to claim 7, characterized in that: Before comparing the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID to perform SPA data packet replay attack detection, the method further includes: Based on the user ID carried in the SPA data packet, query whether there is a local storage account corresponding to the user ID; If not, the client is determined to be an illegal user and the process ends; If it exists, perform SPA data packet anti-replay detection.

12. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 7, characterized in that: The SPA data packet carries information further including a first service request ciphertext and a first authentication code, and the authentication and authorization processing of the SPA data packet based on the second SPA key includes: Dividing the second SPA key into a second encryption key and a second authentication key by bytes; Using the second authentication key, performing a hash calculation on the user ID, key index, and service request ciphertext carried in the SPA data packet to obtain a second authentication code; When the second authentication code is equal to the first authentication code, it is determined that the authentication is successful and the key index in the local storage account is incremented; The gateway information requested to be accessed by the client in the first service request ciphertext is calculated according to the second encryption key, and an authorization policy is issued to the corresponding gateway.

13. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 12, characterized in that: The method further comprises: When the second authentication code is not equal to the first authentication code, it is determined that the authentication has failed and the process ends.

14. The SPA single-packet authentication method based on quantum cryptography as claimed in claim 12, characterized in that: The calculating, according to the second encryption key, the gateway information requested to be accessed by the client in the first service request ciphertext, and issuing an authorization policy to the corresponding gateway includes: Calculate the gateway information requested by the client in the first service request ciphertext according to the second encryption key, wherein the gateway information requested includes the gateway IP and service port; Check whether the access permissions match those in the local storage account; If yes, then issuing an authorization policy to the corresponding gateway according to the gateway information requested for access; If not, it is determined to be unauthorized access and the process ends.

15. A SPA single-packet authentication device based on quantum cryptography, characterized in that: The device comprises: A user-side authentication information acquisition module, configured to acquire user-side authentication information from a storage medium of a client based on an SPA knock request, and perform a digest calculation on the user-side authentication information to obtain a first SPA key, wherein the user-side authentication information includes a user ID, a key index, and an SPA key seed corresponding to the index; A data packet generating module, configured to encrypt and authenticate the user ID, the key index and the gateway information requested for access based on the first SPA key, and generate a SPA data packet; The data packet sending module is used to increment the key index in the storage medium after sending the SPA data packet to the controller, so that the controller performs SPA data packet replay attack detection and authorization authentication based on the incremented key index.

16. A SPA single-packet authentication device based on quantum cryptography, characterized in that: The device comprises: A data packet receiving module, used to receive a SPA data packet sent by a client, wherein the SPA data packet carries information including at least a user ID, a key index and gateway information; An anti-replay detection module, used to compare the key index value carried by the SPA data packet with the key index value in the local storage account corresponding to the user ID, and perform SPA data packet replay attack detection, wherein the key index value in the local storage account is incremented; An index module, configured to read, after the anti-replay detection passes, the SPA key seed corresponding to the key index value from the local storage account according to the key index value carried by the SPA data packet; A key generation module, configured to perform a digest calculation based on the user ID, the SPA key seed obtained from the local storage account of the controller, and the key index carried by the SPA data packet to obtain a second SPA key; An authentication and authorization module is used to perform authentication and authorization processing on the SPA data packet based on the second SPA key.

17. A SPA single-packet authentication system based on quantum cryptography, characterized in that: The system includes a client, a controller, a gateway and a storage medium, wherein the storage medium is inserted into the client, and user-side authentication information is pre-written in the storage medium, wherein the user-side authentication information includes a user ID, a key index and a SPA key seed corresponding to the index; The client is used to generate a SPA data packet based on the user-side authentication information, and increment the key index in the storage medium after sending the SPA data packet to the controller, wherein the SPA data packet carries information including at least a user ID, a key index and gateway information; The controller receives the SPA data packet sent by the client, and compares the key index value carried in the SPA data packet with the key index value in the local storage account corresponding to the user ID, performs SPA data packet replay attack detection, and after the anti-replay detection passes, reads the SPA key seed corresponding to the key index value from the local storage account according to the key index value carried by the SPA data packet; performs summary calculation according to the user ID, the SPA key seed and the key index carried by the SPA data packet to obtain a second SPA key; performs authentication and authorization processing on the SPA data packet based on the second SPA key, and sends the authorization policy of the authenticated client to the gateway requested by the client for access; The corresponding gateway loads the authorization policy and temporarily opens a firewall policy rule that allows the client to access, so as to allow the client to access the service when the client initiates a service access to the gateway requesting access.

18. The SPA single-packet authentication system based on quantum cryptography as claimed in claim 17, characterized in that: The controller is equipped with a quantum random number generator, which is used to generate a quantum random number pre-shared between the client and the controller as a SPA key seed.

19. The SPA single-packet authentication system based on quantum cryptography as claimed in claim 17, characterized in that: The storage medium adopts a quantum key card, which is used as a storage medium for the client SPA key seed. When the storage medium is used for the first time, the storage medium is connected to the controller to create local storage account information for the user in the controller and perform storage medium distribution operations.

20. The SPA single-packet authentication system based on quantum cryptography as claimed in claim 17, characterized in that: The gateway is used to adopt the firewall IP black and white list principle, and according to the authorization policy issued by the controller to the authenticated client, allow the authenticated client to perform business communication, and block the unauthenticated illegal client by default.

21. The SPA single-packet authentication system based on quantum cryptography as claimed in claim 18, characterized in that: The storage medium has a built-in security chip and an operating system, and is protected by hardware and a PIN code.

22. An electronic device, characterized in that: The device includes a memory and a processor; wherein the processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the method as described in any one of claims 1-6 or 7-14.

23. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 or 7 to 14 is implemented.

Citation Information

Patent Citations

  • Identity authentication system based on quantum network

    CN108566273A

  • Session connection establishment method and device, electronic equipment and readable storage medium

    CN112968971A

  • Data storage method and system based on RISC-V architecture

    CN113486399A

  • Single packet authorization authentication method and device, server and storage medium

    CN116545659A

  • Single packet authentication method and related device

    CN116707955A