Secret method, device and system of secret key, electronic equipment and storage medium
Generate a one-time key by receiving random strings sent by the server, and generate a new key through a new random string after the key is used, which solves the problem of high risk of key leakage and realizes efficient data transmission security sex.
Patent Information
- Application Number
- CN202411542354.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, the length of the key is longer and easily recognized, resulting in a greater risk of leakage of the key.
By receiving the random string sent by the server, a one-time key is generated based on the pre-established mapping relationship between characters and passwords, and after the key is used, a new key is generated through the new random string.
Reduces the risk of key leakage, improves the security of data transmission, and ensures that the key is used only in one session.
Smart Images

Figure CN119449295A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to a method and device for keeping a key confidential, an electronic device, and a storage medium. Background Art
[0002] Data can be easily intercepted during transmission, leading to data leakage. In order to prevent data leakage, it is necessary to encrypt the data with a key before data transmission.
[0003] In the related technology of key confidentiality, the key is usually stored in a variable value in plain text. Due to the long length of the key, the key in the variable value is easy to be identified, resulting in a high risk of key leakage. Summary of the invention
[0004] The present invention provides a method and device, system, electronic device and storage medium for keeping a key confidential, the main purpose of which is to solve the problem of high risk of key leakage.
[0005] According to a first aspect of the present disclosure, a method for keeping a key confidential is provided, wherein the method is applied to a client and comprises:
[0006] Receiving a first random string sent by the server; the first random string consists of at least one character;
[0007] Determine the password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords;
[0008] Generate a target key of the first random string according to the password of each character; the target key is a one-time key;
[0009] When it is determined that the target key is used, a second random character string sent by the server is received, so as to generate a key corresponding to the second random character string based on the mapping relationship.
[0010] Optionally, generating a target key of the first random character string according to the password of each character includes:
[0011] Obtaining the arrangement order of each character;
[0012] The passwords corresponding to each character are sequentially concatenated according to the arrangement order to obtain the target key of the first random character string.
[0013] Optionally, before receiving the first random character string sent by the server, the method further includes:
[0014] In response to an instruction for generating request information, generating the request information;
[0015] In response to a sending instruction to send the request information to the server, the request information is sent to the server so that the server responds to the request information, generates the first random string, and sends the first random string to the client.
[0016] Optionally, the determining that the target key is used includes:
[0017] In response to an instruction for generating next request information of the request information, generating the next request information;
[0018] Using the target key, encrypting the next request information to obtain encrypted request information of the next request information;
[0019] In response to a sending instruction to send the encryption request information to the server, the encryption request information is sent to the server, so that the server responds to the encryption request information and generates the second random string.
[0020] Optionally, the sending the encryption request information to the server includes:
[0021] The encrypted request information is sent to the server, and the first random string is sent to the server, so as to decrypt the encrypted request information based on the first random string.
[0022] According to a second aspect of the present disclosure, a method for keeping a key confidential is provided, wherein the method is applied to a server and includes:
[0023] When it is determined that the request information sent by the client is received, a first random string is generated; the first random string consists of at least one character;
[0024] Sending the first random string to the client so that the client generates a target key based on the first random string; the target key is a one-time key;
[0025] If it is determined that the target key is used, generating a second random character string;
[0026] The second random string is sent to the client, so that the client generates a key corresponding to the second random string based on the second random string.
[0027] Optionally, the determining that the target key is used includes:
[0028] If the encrypted request information and the first random character string sent by the client are received, it is determined that the target key is used; the encrypted request information is information obtained by encrypting the next request information of the request information using the target key.
[0029] Optionally, after receiving the encryption request information and the first random character string sent by the client, the method further includes:
[0030] Determine the password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords;
[0031] Generate a target key of the first random string according to the password of each character;
[0032] The encrypted request information is decrypted using the target key to obtain the next request information so as to process the next request information.
[0033] According to a third aspect of the present disclosure, a key confidentiality device is provided, wherein the device is applied to a client and includes:
[0034] A receiving unit, configured to receive a first random string sent by a server; the first random string consists of at least one character;
[0035] a determination unit, configured to determine a password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords;
[0036] A first generating unit, configured to generate a target key of the first random string according to the password of each character; the target key is a one-time key;
[0037] The receiving unit is further configured to, when it is determined that the target key is used, receive a second random string sent by the server, so as to generate a key corresponding to the second random string based on the mapping relationship.
[0038] Optionally, the determining unit includes:
[0039] An acquisition module, used for acquiring the arrangement order of each character;
[0040] The splicing module is used to sequentially splice the passwords corresponding to each character according to the arrangement order to obtain the target key of the first random character string.
[0041] Optionally, the device further comprises:
[0042] A second generating unit is used to generate the request information in response to a generating instruction of the request information before receiving the first random character string sent by the server;
[0043] A sending unit is used to send the request information to the server in response to a sending instruction to send the request information to the server, so that the server responds to the request information, generates the first random string, and sends the first random string to the client.
[0044] Optionally, the device further comprises:
[0045] The second generating unit is further configured to generate the next request information in response to a generating instruction of the next request information of the request information;
[0046] A processing unit, configured to encrypt the next request information using the target key to obtain encrypted request information of the next request information;
[0047] The sending unit is further configured to send the encryption request information to the server in response to a sending instruction for sending the encryption request information to the server, so that the server responds to the encryption request information and generates the second random character string.
[0048] Optionally, the sending unit includes:
[0049] The sending module is used to send the encrypted request information to the server, and send the first random string to the server, so as to decrypt the encrypted request information based on the first random string.
[0050] According to a fourth aspect of the present disclosure, a key confidentiality device is provided, wherein the device is applied to a server, comprising:
[0051] A first generating unit, configured to generate a first random string when it is determined that the request information sent by the client is received; the first random string consists of at least one character;
[0052] A sending unit, configured to send the first random string to the client, so that the client generates a target key based on the first random string; the target key is a one-time key;
[0053] The first generating unit is further configured to, when it is determined that the target key is used, generate a second random string;
[0054] The sending unit is configured to send the second random string to the client, so that the client generates a key corresponding to the second random string based on the second random string.
[0055] Optionally, the device further comprises:
[0056] The first determination unit is used to determine that the target key is used when receiving the encryption request information sent by the client and the first random character string; the encryption request information is the information obtained by encrypting the next request information of the request information using the target key.
[0057] Optionally, the device further comprises:
[0058] A second determination unit is used to determine the password of each character in the first random character string according to a pre-established mapping relationship between characters and passwords after receiving the encryption request information sent by the client and the first random character string;
[0059] A second generating unit, configured to generate a target key of the first random string according to the password of each character;
[0060] The processing unit is used to use the target key to decrypt the encrypted request information to obtain the next request information so as to process the next request information.
[0061] According to a fifth aspect of the present disclosure, a key confidentiality system is provided, the system comprising a client and a server, including:
[0062] The server includes a key security device as described in the third aspect of the present disclosure;
[0063] The client comprises a key security device as described in the fourth aspect of the present disclosure.
[0064] According to a sixth aspect of the present disclosure, there is provided an electronic device, including:
[0065] at least one processor; and
[0066] a memory communicatively connected to the at least one processor; wherein,
[0067] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the first aspect or the method described in the second aspect.
[0068] According to a seventh aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect or the method described in the second aspect.
[0069] According to an eighth aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method described in the first aspect or the method described in the second aspect.
[0070] The key confidentiality method and device, system, electronic device and storage medium provided by the present disclosure receive a first random string sent by a server; the first random string consists of at least one character; according to a pre-established mapping relationship between characters and passwords, the password of each character in the first random string is determined; according to the password of each character, a target key of the first random string is generated; the target key is a one-time key; when it is determined that the target key is used, a second random string sent by the server is received, so as to generate a key corresponding to the second random string based on the mapping relationship. Compared with the related art, the embodiment of the present disclosure generates a target key through a first random string, and the target key is a one-time key. When the target key is used, the corresponding key is generated using the second random string, thereby reducing the risk of key leakage.
[0071] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0073] Figure 1 A flowchart of a method for keeping a key confidential provided by an embodiment of the present disclosure;
[0074] Figure 2 A schematic diagram of a flow chart of a method for generating a target key provided by an embodiment of the present disclosure;
[0075] Figure 3 A flowchart of another method for keeping a secret key provided by an embodiment of the present disclosure;
[0076] Figure 4 A flowchart of a method for decrypting encrypted request information provided by an embodiment of the present disclosure;
[0077] Figure 5 A schematic diagram of the structure of a key security device provided in an embodiment of the present disclosure;
[0078] Figure 6 A schematic diagram of the structure of another key security device provided in an embodiment of the present disclosure;
[0079] Figure 7A schematic diagram of the structure of another key security device provided in an embodiment of the present disclosure;
[0080] Figure 8 A schematic diagram of the structure of another key security device provided in an embodiment of the present disclosure;
[0081] Fig. 9 A schematic diagram of a key confidentiality system provided by an embodiment of the present disclosure;
[0082] Fig.10 A schematic block diagram of an exemplary electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0083] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0084] The following describes a method and apparatus for keeping secret a key in an embodiment of the present disclosure, a system, an electronic device, and a storage medium with reference to the accompanying drawings.
[0085] Figure 1 A flowchart of a key confidentiality method provided in an embodiment of the present disclosure.
[0086] like Figure 1 As shown, the method is applied to the client, and the method includes the following steps:
[0087] Step 101: Receive a first random string sent by a server; the first random string consists of at least one character.
[0088] The first random string refers to a random sequence generated by the server, which is composed of at least one character and is used to generate a key. A character is the smallest unit that constitutes the first random string. A character can be a letter, a number, or other symbol. The embodiment of the present disclosure does not limit the form of the character. The server refers to the software deployed in the server to process the request information sent by the client. The client refers to an electronic device that sends request information to the server. The client includes but is not limited to desktop computers, laptops, tablets, smart phones, and smart watches.
[0089] Since the random string is randomly generated by the server, the string obtained each time is different. This ensures that the key generated each time is also unique, increasing the security of communication. At the same time, randomness makes the key difficult to predict, thereby improving the ability to resist attacks.
[0090] Step 102: Determine the password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords.
[0091] A password is a set of characters, which contains at least two characters. A mapping relationship refers to a predefined rule or a corresponding table, which specifies that each character corresponds to a unique specific password.
[0092] To facilitate understanding, an example is provided. Suppose there are two characters, a and b, and two passwords, 123ABC and 345DEF, where a corresponds to 123ABC and b corresponds to 345DEF. Then a corresponds to 123ABC and b corresponds to 345DEF, which is a mapping relationship.
[0093] There is no need to exchange keys directly, only random strings. Through the mapping relationship, the client and the server can generate their own target keys, which simplifies the distribution process of the target key and reduces the risk of the target key being intercepted during transmission.
[0094] Step 103, generating a target key of the first random string according to the password of each character; the target key is a one-time key.
[0095] The password values converted from each character are combined according to the preset rules to obtain the target key. The preset rules can be splicing or more complex operations, such as XOR operations, hash functions or encryption algorithms. However, it should be clear that this statement is not intended to limit the generation method of the target key to splicing, XOR operations, hash functions or encryption algorithms. The target key can also be generated by other methods. The target key can only be used for encryption and decryption once.
[0096] The use of one-time keys can significantly improve the security of data transmission. Because the key is only used in one session, even if the key is cracked, the attacker cannot use it to decrypt data in other sessions.
[0097] Step 104: When it is determined that the target key is used, a second random string sent by the server is received, so as to generate a key corresponding to the second random string based on the mapping relationship.
[0098] The second random string is a random string different from the first random string. By using a new random string to generate a new key, the key can be replaced after each key is used. This helps prevent the risk of leakage caused by long-term use of the key.
[0099] The key confidentiality method provided by the present disclosure receives a first random string sent by a server; the first random string consists of at least one character; according to a pre-established mapping relationship between characters and passwords, the password of each character in the first random string is determined; according to the password of each character, a target key of the first random string is generated; the target key is a one-time key; when it is determined that the target key is used, a second random string sent by the server is received, so as to generate a key corresponding to the second random string based on the mapping relationship. Compared with the related art, the embodiment of the present disclosure generates a target key through a first random string, and the target key is a one-time key. When the target key is used, the corresponding key is generated using the second random string, thereby reducing the risk of key leakage.
[0100] As a refinement of step 103, when executing the generation of the target key of the first random string according to the password of each character, it can be implemented in the following manner but not limited to: Figure 2 As shown, Figure 2 A schematic diagram of a process for generating a target key provided by an embodiment of the present disclosure includes:
[0101] Step 201, obtaining the arrangement order of each character.
[0102] The arrangement order refers to the specific order or position of each character in the first random string.
[0103] For ease of understanding, an example is provided. Assuming that the first random character string is abcd, the arrangement order of a is 1, the arrangement order of b is 2, the arrangement order of c is 3, and the arrangement order of d is 4.
[0104] By concatenating the passwords in a fixed order, we can ensure that the keys generated on the server and client are consistent. This is crucial for the encryption and decryption process.
[0105] Step 202: sequentially concatenate the passwords corresponding to each character in the arrangement order to obtain a target key of the first random character string.
[0106] To facilitate understanding, an example is provided. Suppose the first random string is abcd, where the arrangement order of a is 1, the arrangement order of b is 2, the arrangement order of c is 3, and the arrangement order of d is 4. The password corresponding to a is 123ABC, the password corresponding to B is 456DEF, the password corresponding to c is 789GHI, and the password corresponding to d is 012JKL. The target key is 123ABC456DEF789GHI012JKL.
[0107] In order to ensure that the key generation process is consistent with the character sequence of the original string, a key that is closely related to and uniquely corresponds to the original string is generated, while increasing the complexity and security of the key.
[0108] In actual applications, before receiving the first random string sent by the server, the client needs to interact with the server so that the server sends the first random string to the client, which can be implemented in but not limited to the following ways: in response to an instruction to generate request information, generate the request information; in response to an instruction to send the request information to the server, send the request information to the server so that the server responds to the request information, generates the first random string, and sends the first random string to the client.
[0109] Exemplarily, request information refers to information used to inform the server of the operation to be performed or the content to be obtained, for example, user input, configuration parameters or other related information.
[0110] For example, if the client sends a request message to the server for the first time, only the request message is sent to the server. If the client does not send a request message to the server for the first time, a key is generated using a random string returned by the server after the last request message was sent, and the request message is encrypted using the key to obtain the encrypted request message, and the encrypted request message and the random string returned by the server after the last request message was sent are sent to the server.
[0111] Through the interaction between the client and the server, a secure, unique random string is dynamically generated and returned, thus supporting the security, user experience, and functional implementation of the application.
[0112] As a refinement of step 104, when executing the determination that the target key is used, it can be implemented in the following manner but not limited to: in response to the instruction for generating the next request information of the request information, generate the next request information; use the target key to encrypt the next request information to obtain the encrypted request information of the next request information; in response to the instruction for sending the encrypted request information to the server, send the encrypted request information to the server so that the server responds to the encrypted request information and generates the second random string. By encrypting the next request information, it can be ensured that the data transmitted between the client and the server is secure, that is, the data will not be intercepted or tampered with by unauthorized third parties during the transmission process. Encryption processing increases the difficulty of data theft and tampering, thereby protecting the confidentiality and integrity of communications.
[0113] As a refinement of the above embodiment, when executing the sending of the encryption request information to the server, it can be implemented in the following manner but not limited to: sending the encryption request information to the server, and sending the first random string to the server, so as to decrypt the encryption request information based on the first random string. In some cases, the first random string may be used in a key exchange process, that is, the client and the server generate a common session key by exchanging random strings. This session key is then used to encrypt and decrypt subsequent communication content. By sending the encryption request information and the first random string, the client and the server can securely negotiate a common session key, thereby ensuring the security of subsequent communications.
[0114] The above embodiment describes the method for keeping the key confidential applied to the client, and the subsequent embodiments describe the method for keeping the key confidential applied to the server. Figure 3 A flowchart of another key confidentiality method provided by an embodiment of the present disclosure.
[0115] like Figure 3 As shown, the method is applied to the server, and the method includes the following steps:
[0116] Step 301: upon determining that request information sent by a client is received, generate a first random string; the first random string consists of at least one character.
[0117] The first random string is generated by using a random string generation algorithm. The embodiment of the present disclosure does not limit the preset number and the random string generation algorithm. However, it should be clear that this statement is not intended to limit the first random string to only be generated by the random string generation algorithm. The first random string can also be generated by other methods.
[0118] Using random strings to generate target keys can simplify the key management process, reduce the need for static key storage, and reduce the risk of key leakage.
[0119] Step 302: Send the first random string to the client so that the client generates a target key based on the first random string; the target key is a one-time key.
[0120] The first random string is the basis for the client to generate the target key. The client calculates with this random string and generates the corresponding one-time key, thereby improving the unpredictability and security of the key.
[0121] Step 303: When it is determined that the target key is used, generate a second random character string.
[0122] The one-time key principle requires that each key be used only once. Generating a second random string and generating a new key based on it can ensure that the key will not be reused, thereby reducing the risk of being attacked.
[0123] Step 304: Send the second random string to the client, so that the client generates a key corresponding to the second random string based on the second random string.
[0124] By generating a new random string for each request, it is possible to ensure that a different key is used for each communication. This ensures that even if a key is leaked, subsequent communications will not be affected because subsequent keys are generated based on the new random string.
[0125] The key confidentiality method provided by the present disclosure receives a first random string sent by a server; the first random string consists of at least one character; according to a pre-established mapping relationship between characters and passwords, the password of each character in the first random string is determined; according to the password of each character, a target key of the first random string is generated; the target key is a one-time key; when it is determined that the target key is used, a second random string sent by the server is received, so as to generate a key corresponding to the second random string based on the mapping relationship. Compared with the related art, the embodiment of the present disclosure generates a target key through a first random string, and the target key is a one-time key. When the target key is used, the corresponding key is generated using the second random string, thereby reducing the risk of key leakage.
[0126] As a refinement of step 303, when executing the determination that the target key is used, it can be implemented in the following manner but not limited to: if the encrypted request information sent by the client and the first random string are received, it is determined that the target key is used; the encrypted request information is information obtained by encrypting the next request information of the request information using the target key. By matching the received encrypted request information with the first random string, it can be verified whether the target key is correctly used under the expected circumstances, thereby confirming the validity of the communication.
[0127] In actual applications, after receiving the encrypted request information and the first random character string sent by the client, the encrypted request information needs to be decrypted, which can be achieved by but not limited to the following methods: Figure 4 As shown, Figure 4 A flowchart of a method for decrypting encrypted request information provided by an embodiment of the present disclosure includes:
[0128] Step 401: determine the password of each character in the first random character string according to a pre-established mapping relationship between characters and passwords.
[0129] By pre-establishing the mapping relationship between characters and passwords, it is ensured that each character can accurately find the corresponding password during the decryption process, thus avoiding data inconsistency caused by character parsing errors.
[0130] Step 402: Generate a target key of the first random string according to the password of each character.
[0131] The method for generating the target key on the server side is consistent with the method for generating the target key on the client side, and will not be further described in the embodiment of the present disclosure.
[0132] Through the first random string, the server and the client can independently generate the same target key based on the same first random string and mapping relationship, thereby establishing a key shared by both parties without the need to directly exchange the key, thereby improving the confidentiality of the key.
[0133] Step 403: Decrypt the encrypted request information using the target key to obtain the next request information so as to process the next request information.
[0134] The encrypted request information is used as the input of the decryption algorithm, and the target key is applied to perform the decryption operation. The decryption algorithm will perform a series of transformations and calculations on the encrypted data according to the key to restore the original, unencrypted next request information. However, it should be clear that this statement is not intended to limit the decryption processing method to only the above method, and decryption processing can also be performed by other methods.
[0135] During the encrypted communication process, the transmission of encrypted request information is safe because even if it is intercepted by a third party, it cannot be easily decrypted to obtain the original content, thus ensuring the confidentiality of the information.
[0136] In summary, the embodiments of the present disclosure can achieve the following effects:
[0137] The disclosed embodiment generates a target key through a first random character string, and the target key is a one-time key. When the target key is used, a corresponding key is generated using a second random character string, thereby reducing the risk of key leakage.
[0138] Corresponding to the above-mentioned key confidentiality method, the present invention also provides a key confidentiality device. Since the device embodiment of the present invention corresponds to the above-mentioned method embodiment, the details not disclosed in the device embodiment can be referred to the above-mentioned method embodiment, and will not be repeated in the present invention.
[0139] Figure 5 A schematic diagram of a key security device provided in an embodiment of the present disclosure, wherein the device is applied to a client, such as Figure 5 As shown, including:
[0140] A receiving unit 51 is configured to receive a first random string sent by a server; the first random string consists of at least one character;
[0141] A determination unit 52, configured to determine a password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords;
[0142] A first generating unit 53 is used to generate a target key of the first random string according to the password of each character; the target key is a one-time key;
[0143] The receiving unit 51 is further configured to, when it is determined that the target key is used, receive a second random string sent by the server, so as to generate a key corresponding to the second random string based on the mapping relationship.
[0144] The key confidentiality device provided by the present disclosure receives a first random string sent by a server; the first random string consists of at least one character; according to a pre-established mapping relationship between characters and passwords, the password of each character in the first random string is determined; according to the password of each character, a target key of the first random string is generated; the target key is a one-time key; when it is determined that the target key is used, a second random string sent by the server is received, so as to generate a key corresponding to the second random string based on the mapping relationship. Compared with the related art, the embodiment of the present disclosure generates a target key through a first random string, and the target key is a one-time key. When the target key is used, the corresponding key is generated using the second random string, thereby reducing the risk of key leakage.
[0145] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 6 As shown, the determining unit 52 includes:
[0146] An acquisition module 521 is used to acquire the arrangement order of each character;
[0147] The concatenation module 522 is used to sequentially concatenate the passwords corresponding to each character according to the arrangement order to obtain the target key of the first random character string.
[0148] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 6 As shown, the device also includes:
[0149] The second generating unit 54 is used to generate the request information in response to the instruction for generating the request information before receiving the first random character string sent by the server;
[0150] The sending unit 55 is used to send the request information to the server in response to a sending instruction to send the request information to the server, so that the server responds to the request information, generates the first random string, and sends the first random string to the client.
[0151] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 6 As shown, the device also includes:
[0152] The second generating unit 54 is further configured to generate the next request information in response to a generating instruction of the next request information of the request information;
[0153] A processing unit 56 is used to encrypt the next request information using the target key to obtain encrypted request information of the next request information;
[0154] The sending unit 55 is further configured to, in response to a sending instruction for sending the encryption request information to the server, send the encryption request information to the server, so that the server responds to the encryption request information and generates the second random character string.
[0155] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 6 As shown, the sending unit 55 includes:
[0156] The sending module 551 is used to send the encrypted request information to the server, and send the first random string to the server, so as to decrypt the encrypted request information based on the first random string.
[0157] Figure 7 A schematic diagram of the structure of another key security device provided in an embodiment of the present disclosure, wherein the device is applied to a server, such as Figure 7 As shown, including:
[0158] The first generating unit 61 is used to generate a first random string when it is determined that the request information sent by the client is received; the first random string consists of at least one character;
[0159] The sending unit 62 is used to send the first random string to the client, so that the client generates a target key based on the first random string; the target key is a one-time key;
[0160] The first generating unit 61 is further configured to generate a second random string when it is determined that the target key is used;
[0161] The sending unit 62 is configured to send the second random string to the client, so that the client generates a key corresponding to the second random string based on the second random string.
[0162] The key confidentiality device provided by the present disclosure receives a first random string sent by a server; the first random string consists of at least one character; according to a pre-established mapping relationship between characters and passwords, the password of each character in the first random string is determined; according to the password of each character, a target key of the first random string is generated; the target key is a one-time key; when it is determined that the target key is used, a second random string sent by the server is received, so as to generate a key corresponding to the second random string based on the mapping relationship. Compared with the related art, the embodiment of the present disclosure generates a target key through a first random string, and the target key is a one-time key. When the target key is used, the corresponding key is generated using the second random string, thereby reducing the risk of key leakage.
[0163] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 8 As shown, the device also includes:
[0164] The first determination unit 63 is used to determine that the target key is used when receiving the encryption request information sent by the client and the first random character string; the encryption request information is the information obtained by encrypting the next request information of the request information using the target key.
[0165] Furthermore, in a possible implementation of the embodiment of the present disclosure, as Figure 8 As shown, the device also includes:
[0166] A second determination unit 64 is used to determine the password of each character in the first random string according to a pre-established mapping relationship between characters and passwords after receiving the encryption request information sent by the client and the first random string;
[0167] A second generating unit 65 is used to generate a target key of the first random string according to the password of each character;
[0168] The processing unit 66 is used to use the target key to decrypt the encrypted request information to obtain the next request information so as to process the next request information.
[0169] It should be noted that the above explanation of the method embodiment is also applicable to the device of the embodiment of the present disclosure, and the principle is the same, which is no longer limited in the embodiment of the present disclosure.
[0170] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0171] Fig. 9 A schematic diagram of a key confidentiality system provided by an embodiment of the present disclosure, such as Fig. 9 As shown, including:
[0172] Client 71, server 72. The client 71 is a device configured at the client, and the server 72 is a device configured at the server.
[0173] Fig.10 A schematic block diagram of an example electronic device 700 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0174] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 1002 or a computer program loaded from a storage unit 1008 to a RAM (Random Access Memory) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An I / O (Input / Output) interface 1005 is also connected to the bus 1004.
[0175] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0176] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Units), various dedicated AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 1001 performs the various methods and processes described above, such as a method for keeping a key confidential. For example, in some embodiments, the method for keeping a key confidential may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the method described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the aforementioned key confidentiality method in any other appropriate manner (eg, by means of firmware).
[0177] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application Specific Standard Products), SOCs (System On Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor that may be a special purpose or general purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0178] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0179] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or a flash memory, an optical fiber, a CD-ROM (Compact Dis sc Read-Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0180] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball), through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0181] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: LAN (Local Area Network), WAN (Wide Area Network), the Internet, and blockchain networks.
[0182] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0183] It should be noted that artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include computer vision technology, speech recognition technology, natural language processing technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.
[0184] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0185] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for keeping a key confidential, characterized in that: The method is applied to a client and includes: Receiving a first random string sent by the server; the first random string consists of at least one character; Determine the password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords; Generate a target key of the first random string according to the password of each character; the target key is a one-time key; When it is determined that the target key is used, a second random character string sent by the server is received, so as to generate a key corresponding to the second random character string based on the mapping relationship.
2. The method according to claim 1, characterized in that: Generating the target key of the first random string according to the password of each character comprises: Obtaining the arrangement order of each character; The passwords corresponding to each character are sequentially concatenated according to the arrangement order to obtain the target key of the first random character string.
3. The method according to claim 1, characterized in that Before receiving the first random character string sent by the server, the method further includes: In response to an instruction for generating request information, generating the request information; In response to a sending instruction to send the request information to the server, the request information is sent to the server so that the server responds to the request information, generates the first random string, and sends the first random string to the client.
4. The method according to claim 3, characterized in that The determining that the target key is used comprises: In response to an instruction for generating next request information of the request information, generating the next request information; Using the target key, encrypting the next request information to obtain encrypted request information of the next request information; In response to a sending instruction for sending the encryption request information to the server, the encryption request information is sent to the server, so that the server responds to the encryption request information and generates the second random character string.
5. The method according to claim 3, characterized in that: The sending the encryption request information to the server includes: The encrypted request information is sent to the server, and the first random string is sent to the server, so as to decrypt the encrypted request information based on the first random string.
6. A method for keeping a key confidential, characterized in that: The method is applied to the server, and includes: When it is determined that the request information sent by the client is received, a first random string is generated; the first random string consists of at least one character; Sending the first random string to the client so that the client generates a target key based on the first random string; the target key is a one-time key; If it is determined that the target key is used, generating a second random character string; The second random string is sent to the client, so that the client generates a key corresponding to the second random string based on the second random string.
7. The method according to claim 6, characterized in that The determining that the target key is used comprises: If the encrypted request information and the first random character string sent by the client are received, it is determined that the target key is used; the encrypted request information is information obtained by encrypting the next request information of the request information using the target key.
8. The method according to claim 7, characterized in that After receiving the encryption request information and the first random character string sent by the client, the method further includes: Determine the password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords; Generate a target key of the first random string according to the password of each character; The encrypted request information is decrypted using the target key to obtain the next request information so as to process the next request information.
9. A key security device, characterized in that: The device is applied to a client and includes: A receiving unit, configured to receive a first random string sent by a server; the first random string consists of at least one character; a determination unit, configured to determine a password for each character in the first random character string according to a pre-established mapping relationship between characters and passwords; A first generating unit, configured to generate a target key of the first random string according to the password of each character; the target key is a one-time key; The receiving unit is further configured to, when it is determined that the target key is used, receive a second random string sent by the server, so as to generate a key corresponding to the second random string based on the mapping relationship.
10. A key security device, characterized in that: The device is applied to a server, and includes: A first generating unit, configured to generate a first random string when it is determined that the request information sent by the client is received; the first random string consists of at least one character; A sending unit, configured to send the first random string to the client, so that the client generates a target key based on the first random string; the target key is a one-time key; The first generating unit is further configured to, when it is determined that the target key is used, generate a second random string; The sending unit is configured to send the second random string to the client, so that the client generates a key corresponding to the second random string based on the second random string.
11. A key confidentiality system, characterized in that: The system includes a client and a server, including: The client comprises a key security device as claimed in claim 9; The server comprises a key security device as claimed in claim 10.
12. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in any one of claims 1 to 5 or the method described in claims 6 to 8.
13. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-5 or the method according to claims 6-8.
14. A computer program product, characterized in that The method comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 5 or the method according to claims 6 to 8.