Secret key generation method and device and computer equipment

By randomly generating strings as key components and using a preset fusion algorithm and noise coefficients for iterative fusion processing, the target key is generated and distributed for storage. This solves the problems of key generation complexity and leakage risk, and achieves efficient and secure key generation.

CN119030713AInactive Publication Date: 2024-11-26SHENZHEN BAMBOOCLOUD TECH CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411474099.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-22
Publication Date
2024-11-26
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In existing technologies, the key replacement process is complex and cannot effectively solve the problem of key leakage, leading to an increased risk of information leakage or data corruption.

Method used

By randomly generating strings as key components, iterative fusion processing is performed using a preset fusion algorithm and noise coefficients to generate a target key, which is then distributed and stored in different areas to enhance security.

Benefits of technology

It simplifies the key generation process, improves key generation efficiency and security, enhances resistance to attacks, and reduces the risk of key leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030713A_ABST
    Figure CN119030713A_ABST
Patent Text Reader

Abstract

The invention relates to a key generation method and device and computer equipment. The method comprises the following steps: acquiring at least two key components; wherein the key component comprises a character string obtained in a random generation mode; respectively decoding the key components to obtain corresponding byte arrays; performing fusion processing on the byte array by using a preset fusion algorithm to obtain an initial key; and utilizing a preset noise coefficient and a preset algorithm to perform iteration fusion processing of preset times on the initial key to obtain a target key. By adopting the method, the generation efficiency of the secret key can be improved under the condition of ensuring the safety of the secret key.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data security technology, and in particular to a key generation method, device, computer equipment, storage medium and computer program product. Background Art

[0002] With the emergence of key technology, data encryption and decryption have become more convenient and efficient. Key technology has greatly improved data security. However, in practical applications, the same key is usually used to encrypt or decrypt all data, which may lead to key leakage, thereby increasing the risk of information leakage or data corruption. In traditional methods, keys are usually replaced regularly to enhance security. However, the current key replacement process usually requires re-negotiation and invention of new keys, which greatly increases the difficulty of generating new keys and cannot effectively solve the problem of key leakage. Summary of the invention

[0003] Based on this, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium and computer program product that can generate a key in response to the above technical problems.

[0004] In a first aspect, the present application provides a method for generating a key. The method comprises:

[0005] Obtain at least two key components; wherein the key components include character strings obtained by random generation;

[0006] Decoding the key components respectively to obtain corresponding byte arrays;

[0007] Using a preset fusion algorithm, the byte array is fused to obtain an initial key;

[0008] The initial key is iterated and fused for a preset number of times using a preset noise coefficient and a preset algorithm to obtain a target key.

[0009] In one embodiment, the key is generated in an application; the initial key is iterated and fused for a preset number of times using a preset noise coefficient and a preset algorithm to obtain a target key, including:

[0010] Using a preset fusion algorithm, iteratively fuse the preset noise coefficient and the initial key for a preset number of times to obtain a fused key;

[0011] The fused key is summed with the key coefficient preset in the application to obtain a target key; wherein the key coefficient is generated in a random manner.

[0012] In one embodiment, after the initial key is iterated and fused for a preset number of times using a preset noise coefficient and a preset algorithm to obtain a target key, the method further includes:

[0013] Obtaining an encryption coefficient and an encryption vector; wherein the encryption coefficient includes a coefficient obtained by random generation; and the encryption vector includes a vector of a preset length generated by random generation;

[0014] The target key, encryption coefficient and encryption vector are fused and encrypted using a preset fusion encryption algorithm to obtain a key encryptor; wherein the key encryptor is used to encrypt the encryption key.

[0015] In one embodiment, the use of a key encryptor includes:

[0016] generating a key encryptor in response to an encryption request and / or a decryption request for an encryption key;

[0017] Utilizing the key encryptor, encrypting and / or decrypting the encryption key;

[0018] When the encryption and / or the decryption are completed, the target key is deleted.

[0019] In one embodiment, after obtaining at least two key components, the method further includes:

[0020] Grouping the key components to obtain key component groups;

[0021] The key component groups are stored in different areas that can be called by the application program.

[0022] In one embodiment, after obtaining the encryption coefficient and the encryption vector, the method includes:

[0023] The encryption coefficient and the encryption vector are stored in a corresponding application.

[0024] In a second aspect, the present application also provides a device for generating a key. The device comprises:

[0025] A component acquisition module, used to acquire at least two key components; wherein the key components include strings obtained by randomly generating;

[0026] A component decoding module, used to decode the key components respectively to obtain corresponding byte arrays;

[0027] A key fusion module, used to perform fusion processing on the byte array using a preset fusion algorithm to obtain an initial key;

[0028] The key fusion module is further used to use a preset noise coefficient and a preset algorithm to perform a preset number of iterative fusion processes on the initial key to obtain a target key.

[0029] In one embodiment, the key fusion module includes:

[0030] The key fusion submodule is used to use a preset fusion algorithm to iteratively fuse the preset noise coefficient and the initial key for a preset number of times to obtain a fused key;

[0031] The target key determination submodule is used to sum the fused key with the key coefficient preset in the application to obtain the target key; wherein the key coefficient is generated in a random manner.

[0032] In one embodiment, the device further comprises:

[0033] A data acquisition module, used to acquire encryption coefficients and encryption vectors; wherein the encryption coefficients include coefficients obtained by random generation; and the encryption vectors include vectors of preset length generated by random generation;

[0034] The encryptor fusion module is used to utilize a preset fusion encryption algorithm to perform fusion encryption on the target key, encryption coefficient and encryption vector to obtain a key encryptor; wherein the key encryptor is used to encrypt the encryption key.

[0035] In one embodiment, the device comprises:

[0036] An encryptor generation module, for generating a key encryptor in response to an encryption request for an encryption key and / or a decryption request;

[0037] An encryptor using module, used to encrypt and / or decrypt the encryption key using the key encryptor;

[0038] The key deletion module is used to delete the target key after completing the encryption and / or the decryption.

[0039] In one embodiment, the component acquisition module includes:

[0040] A component grouping submodule, used for grouping the key components to obtain key component groups;

[0041] The component storage submodule is used to store the key component groups in different areas that can be called by the application program.

[0042] In one embodiment, the data acquisition module includes:

[0043] The data storage submodule is used to store the encryption coefficient and the encryption vector in the corresponding application program.

[0044] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method for generating a key as described in any one of the embodiments of the present disclosure is implemented.

[0045] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for generating a key as described in any one of the embodiments of the present disclosure is implemented.

[0046] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for generating a key as described in any one of the embodiments of the present disclosure is implemented.

[0047] The above-mentioned key generation method, device, computer equipment, storage medium and computer program product use randomly generated character strings as key components, decode and fuse the key components to obtain the initial key, and use the noise coefficient and preset algorithm to obtain the target key. The advantage of using character strings as key components is that it simplifies the composition of the key, improves the efficiency of key generation, and effectively solves the complexity problem of key generation, and further solves the risk of key leakage. At the same time, the randomly generated character string as a key component ensures the randomness of the key and enhances the security of key generation. Multiple key components are fused through a preset fusion algorithm, making the generated key more complex, further improving the security and anti-attack ability of the key. This key generation method not only simplifies the key generation process, but also ensures the security and randomness of the key, effectively improving the overall security of the encryption system. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] FIG1 is a schematic diagram of a flow chart of a method for generating a key in one embodiment;

[0049] FIG2 is a schematic diagram of a process for obtaining a target key in one embodiment;

[0050] FIG3 is a schematic diagram of a process flow of generating a key encryptor in one embodiment;

[0051] FIG4 is a schematic diagram of a process flow of using a key encryptor in one embodiment;

[0052] FIG5 is a schematic diagram of a process of storing a key component in one embodiment;

[0053] FIG6 is a schematic diagram of a process of encrypting and decrypting business data in one embodiment;

[0054] FIG7 is a block diagram of a key generation device in one embodiment;

[0055] FIG. 8 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] In one embodiment, as shown in FIG1 , a method for generating a key is provided. This embodiment is illustrated by applying the method to a terminal. It is understandable that the method can also be applied to a server, or to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0058] Step S100, obtaining at least two key components; wherein the key components include character strings obtained by randomly generating.

[0059] In an exemplary embodiment, the key component may include multiple key components, wherein the key component may be a string of fixed bytes, for example, the key component may include a 128-bit byte array, displayed as a base64-encoded string with a length of 24, etc.

[0060] In an exemplary embodiment, a character string may be generated using a random number algorithm, wherein the random number algorithm may include NativePRNGBlocking (a local blocking pseudo-random number generator, a random generator algorithm in Java), a Monte Carlo method, and the like.

[0061] Step S200, respectively decode the key components to obtain corresponding byte arrays.

[0062] In an exemplary embodiment, decoding the key components may include performing a transcoding operation on each key component, that is, transcoding the obtained string into a byte type to obtain a byte array.

[0063] Step S300: using a preset fusion algorithm, the byte array is fused to obtain an initial key.

[0064] In an exemplary embodiment, the fusion algorithm may include an XOR algorithm, a weighted algorithm, etc.; for example, using an XOR algorithm, in the case of two groups of key components, it can be understood that the key components are converted into byte types, wherein the key components only include '0' and '1'; wherein, when the same position of the two groups is the same (i.e., both are '0' or '1'), the same position of the fused initial key is '0', and when the two same positions are different (i.e., one key component is '1' and the other key component is '0' at the same position), the same position of the fused initial key is '1'. In addition, a weighted fusion algorithm may also be used, specifically, a weight is set for each key component, and each key component is weighted to obtain an initial key. It can be understood that the weight of each key component is stored, and in the case of missing weights, the key cannot be extracted.

[0065] Step S400: using a preset noise coefficient and a preset algorithm, perform a preset number of iterative fusion processes on the initial key to obtain a target key.

[0066] In an exemplary embodiment, the preset noise coefficient may include a randomly generated salt value. The initial key and the generated salt value are iteratively fused using a fusion algorithm to generate a target key. It can be understood that the salt value and the number of iterations generated here need to be stored. When the salt value or the number of iterations is missing, the target key cannot be extracted.

[0067] In an exemplary embodiment, the preset algorithm may include PBKDF2 (Password-Based Key Derivation Function 2). It can be understood that PBKDF2 is a function that repeatedly operates on plain text and salt values, that is, repeatedly operates on an initial key and a salt value to obtain a target key.

[0068] In the above-mentioned key generation method, a randomly generated string is used as a key component, the key component is decoded and fused to obtain an initial key, and the target key is obtained by using a noise coefficient and a preset algorithm. The advantage of using a string as a key component is that it simplifies the composition of the key, improves the efficiency of key generation, and effectively solves the complexity problem of key generation, and further solves the risk of key leakage. At the same time, the randomly generated string as a key component ensures the randomness of the key and enhances the security of key generation. By fusing multiple key components through a preset fusion algorithm, the generated key is more complex, which further improves the security and anti-attack ability of the key. This key generation method not only simplifies the key generation process, but also ensures the security and randomness of the key, effectively improving the overall security of the encryption system.

[0069] In one embodiment, as shown in FIG2 , the key is generated in an application; the initial key is iterated and fused for a preset number of times using a preset noise coefficient and a preset algorithm to obtain a target key, including:

[0070] Step S401, using a preset fusion algorithm, iteratively fuse the preset noise coefficient and the initial key for a preset number of times to obtain a fused key.

[0071] Step S402, summing the fused key and the key coefficient preset in the application to obtain a target key; wherein the key coefficient is generated in a random manner.

[0072] In an exemplary embodiment, the key coefficient can be stored in the application. It is understandable that after obtaining the merged key, if there is no key coefficient, the target key cannot be obtained. Therefore, the target key is only generated in the application to enhance the security of the key.

[0073] In an exemplary embodiment, the key components may also be stored in different areas of the application for generating keys, wherein if one or more key components are cracked, the target key will not be leaked if there is one key component that has not been cracked.

[0074] In this embodiment, the initial key and the noise coefficient are fused by using a fusion algorithm, and the fused key and the preset key coefficient are summed to obtain the target key. The generated fused key can be combined with the key coefficient of the application, further improving the complexity of the target key, avoiding the leakage of the target key, and further ensuring the security of the target key.

[0075] In one embodiment, as shown in FIG3 , the method further includes: performing a preset number of iterative fusion processes on the initial key using a preset noise coefficient and a preset algorithm to obtain a target key;

[0076] Step S501, obtaining an encryption coefficient and an encryption vector; wherein the encryption coefficient includes a coefficient obtained by random generation; and the encryption vector includes a vector of a preset length generated by random generation.

[0077] Step S502, using a preset fusion encryption algorithm, fusion encryption is performed on the target key, encryption coefficient and encryption vector to obtain a key encryptor; wherein the key encryptor is used to encrypt the encryption key.

[0078] In an exemplary embodiment, the preset length of the encryption vector may be determined according to the fusion encryption algorithm. It is understandable that different fusion encryption algorithms have different encryption vector length requirements.

[0079] In an exemplary embodiment, the fused encryption algorithm may be PBEWITHHMACSHA512ANDAES_256 (a 512-bit message authentication code of a secure hash function based on password encryption and a 256-bit message authentication code of an advanced encryption standard); the encryption vector is an initialization vector, and the encryption coefficient is a salt value. PBEWITHHMACSHA512ANDAES_256 is used to perform fusion encryption on the target key, the salt value, and the initialization vector to obtain a key encryptor.

[0080] In an exemplary embodiment, an encryption key and / or data are encrypted using a preset first encryption algorithm to obtain an encrypted encryption key and / or data, wherein the first encryption algorithm may include substitution, obfuscation, symmetric encryption, asymmetric encryption, hybrid encryption, etc.; the encrypted encryption key and / or data are encrypted again using a root key encryptor, so that the encryption key and / or data encrypted by the first encryption algorithm are encrypted again to obtain a secondary encryption key; that is, the actual result; it can be understood that after decryption using the root key encryptor, the encryption key and / or data encrypted by the first encryption algorithm will still be obtained.

[0081] In this embodiment, the randomly generated encryption coefficient and encryption vector are fused and encrypted with the target algorithm through a preset fusion encryption algorithm to obtain a key encryptor. The key encryptor can be used to simplify the encryption process, improve encryption efficiency, and make encryption more efficient and convenient while ensuring encryption security.

[0082] In one embodiment, as shown in FIG4 , the use of the key encryptor includes:

[0083] Step S601, generating a key encryptor in response to an encryption request and / or a decryption request for an encryption key.

[0084] In an exemplary embodiment, when an encryption or decryption request for an encryption key or data is received, various data of the combined key encryptor can be extracted in real time, including key components, encryption coefficients, noise coefficients, etc., and combined to obtain the key encryptor.

[0085] Step S602: encrypt and / or decrypt the encryption key using the key encryptor.

[0086] In an exemplary embodiment, the key encryptor may be used to input data that needs to be encrypted or decrypted into the key encryptor, and output the encrypted or decrypted data.

[0087] In an exemplary embodiment, data may be encrypted before encryption, for example, by substitution or obfuscation, and the data obtained after decryption is the substituted or obfuscated data, which needs to be decrypted using a corresponding key to obtain the target data.

[0088] Step S603: After the encryption and / or decryption is completed, the target key is deleted.

[0089] In an exemplary embodiment, after decryption is completed, the target key is deleted. It can be understood that after the target key is deleted, the key encryptor cannot be used anymore, that is, after the target key is deleted, the key encryptor cannot be used to encrypt or decrypt data or encryption keys.

[0090] In this embodiment, a key encryptor is generated in response to an encryption request and / or a decryption request, and the target key is deleted after encryption and / or decryption. This avoids the leakage or abuse of the target key due to long-term storage, effectively prevents potential security loopholes, and improves the security and confidentiality of data.

[0091] In one embodiment, as shown in FIG5 , after obtaining at least two key components, the method further includes:

[0092] Step S101, grouping the key components to obtain key component groups.

[0093] In an exemplary embodiment, each key component may be grouped to obtain each key component subgroup; wherein each key component subgroup may include one key component as a subgroup.

[0094] Step S102: storing the key component groups in different areas that can be called by the application.

[0095] In an exemplary embodiment, each key component is stored in a different area of ​​the system and / or application, wherein the storage method may include embedding or calling through an interface; the system may include environment variables and a system security module.

[0096] In an exemplary embodiment, the key component groups can be stored in different areas of the application or in different areas of the operating environment. For example, the key group is embedded in the application, the key group is stored in the environment variable summary, and the key group is stored in the security module of the server. It is understood that multiple key groups can be stored in one area at the same time, or each key component group can be stored in a different area. In another exemplary embodiment, the key components can be encrypted and stored in different areas. It is understood that if one or more key components are cracked, the target key is not cracked as long as there is a key component that has not been cracked.

[0097] In an exemplary embodiment, the encryption tool can be embedded in the application, and the key components can be stored in the system. When the target key is needed, the encryption tool embedded in the application is used to convert and merge the key components, wherein the encryption tool stores the algorithms for each target encryption, that is, the algorithms for converting and merging the target components are stored in the application. In another exemplary embodiment, the encryption tool can also be stored in the system, and the application obtains the encryption tool by calling the interface of the key tool.

[0098] In this embodiment, by grouping key components, key components of different groups are stored in different areas. This can ensure that if one key component is not leaked, the target key is still not leaked even if all the remaining components are leaked, thereby avoiding the security of the target key and further improving the security of the target key.

[0099] In one embodiment, after obtaining the encryption coefficient and the encryption vector, the following steps are performed:

[0100] The encryption coefficient and the encryption vector are stored in a corresponding application.

[0101] In an exemplary embodiment, the encryption coefficient and encryption vector are stored in different areas of the application and / or the system, wherein the storage method may include embedded or through an interface call; the system may include environment variables and a system security module. It is understandable that in the absence of the encryption coefficient and encryption vector, the key encryptor cannot be obtained.

[0102] In this embodiment, by storing the encryption coefficients and encryption vectors in the corresponding application, when the application receives an encryption request and / or a decryption request, the encryption coefficients and encryption vectors can be quickly obtained through the application, and a key encryptor can be generated, thereby improving the efficiency of key encryptor generation and further improving the efficiency of encryption and / or decryption.

[0103] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0104] In one embodiment, the key generation method can be used for the generation and use of root keys. After the root key has been generated, it is assumed that three groups of root key components are generated, wherein one group of root key components is stored in a root key tool, and the root key components are embedded in an application or stored in an interface that can be called by the application through a system command; the second group of root key components and the third group of root key components are stored in a system environment variable and a system security module, respectively, wherein, in response to encrypting or decrypting a working key, a process as shown in the flowchart of FIG6 is performed:

[0105] Step S901, obtain the root key tool.

[0106] In an exemplary embodiment, when the root key tool is embedded in an application, the root key tool is directly extracted, and when the root key tool is in an interface, a system command can be used to call a corresponding interface.

[0107] Step S902, read the second and third groups of root key components and transcode them into byte arrays.

[0108] In an exemplary embodiment, the second and third groups of root key components are extracted from system environment variables and a system security module, and the three groups of root key components are converted into byte arrays.

[0109] Step S903: mathematically operate multiple root key arrays to generate a final root key byte array.

[0110] In an exemplary embodiment, three groups of root key byte data are merged using an XOR algorithm to obtain a final root key byte array.

[0111] In an exemplary embodiment, after generating the final root key byte array, a preset 128-bit salt value can be used, the number of iterations is 10000, and the key generator of the PBKDF2 algorithm is PBDKF2WithHmacSHA256, and the number of iterations of the final root key byte array is merged to obtain a 128-bit hash value with a length of 32 characters, and the obtained array is determined as the target key. In another exemplary embodiment, after obtaining the target key, the target key and the salt value preset in the application can be merged to obtain the final key byte array.

[0112] Step S904, generating a root key encryptor according to the final key byte array.

[0113] In an exemplary embodiment, a preset encryptor salt value (Salt) and initialization vector (IV) may be used, the number of iterations may be 10,000, and the key suite PBEWITHHMACSHA512ANDAES_256 may be used to perform fusion encryption on the final key byte data to obtain a root key encryptor.

[0114] Step S905: Use the root key encryptor to encrypt or decrypt the working key.

[0115] In an exemplary embodiment, the working key is an encrypted working key processed using a root key encryptor; when the working key needs to be used to encrypt or decrypt data, the encrypted working key needs to be decrypted using the root key encryptor to obtain the working key; or when the working key needs to be encrypted, the working key is encrypted using the root key encryptor.

[0116] Step S906: Use the working key to encrypt or decrypt the business data.

[0117] In an exemplary embodiment, a root key encryptor can be used to encrypt a working key or data, but the specific steps include using a preset first encryption algorithm to encrypt the encryption key and / or data to obtain an encrypted encryption key and / or data, wherein the first encryption algorithm may include substitution, obfuscation, symmetric encryption, asymmetric encryption, hybrid encryption, etc.; using the root key encryptor, the encrypted encryption key and / or data is re-encrypted so that the encryption key and / or data encrypted by the first encryption algorithm are re-encrypted; it can be understood that after decryption using the root key encryptor, the encryption key and / or data encrypted by the first encryption algorithm will still be obtained.

[0118] Based on the same inventive concept, the embodiment of the present application also provides a key generation device for implementing the key generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more key generation devices provided below can refer to the limitations of the key generation method above, and will not be repeated here.

[0119] In one embodiment, as shown in FIG. 7 , a key generation device 100 is provided, comprising: a component acquisition module 101, a component decoding module 102 and a key acquisition module 103, wherein:

[0120] A component acquisition module, used to acquire at least two key components; wherein the key components include strings obtained by randomly generating;

[0121] A component decoding module, used to decode the key components respectively to obtain corresponding byte arrays;

[0122] A key fusion module, used to perform fusion processing on the byte array using a preset fusion algorithm to obtain an initial key;

[0123] The key fusion module is further used to use a preset noise coefficient and a preset algorithm to perform a preset number of iterative fusion processes on the initial key to obtain a target key.

[0124] In one embodiment, the key fusion module includes:

[0125] The key fusion submodule is used to use a preset fusion algorithm to iteratively fuse the preset noise coefficient and the initial key for a preset number of times to obtain a fused key;

[0126] The target key determination submodule is used to sum the fused key with the key coefficient preset in the application to obtain the target key; wherein the key coefficient is generated in a random manner.

[0127] In one embodiment, the device further comprises:

[0128] A data acquisition module, used to acquire encryption coefficients and encryption vectors; wherein the encryption coefficients include coefficients obtained by random generation; and the encryption vectors include vectors of preset length generated by random generation;

[0129] The encryptor fusion module is used to utilize a preset fusion encryption algorithm to perform fusion encryption on the target key, encryption coefficient and encryption vector to obtain a key encryptor; wherein the key encryptor is used to encrypt the encryption key.

[0130] In one embodiment, the device comprises:

[0131] An encryptor generation module, for generating a key encryptor in response to an encryption request for an encryption key and / or a decryption request;

[0132] An encryptor using module, used to encrypt and / or decrypt the encryption key using the key encryptor;

[0133] The key deletion module is used to delete the target key after completing the encryption and / or the decryption.

[0134] In one embodiment, the component acquisition module includes:

[0135] A component grouping submodule, used for grouping the key components to obtain key component groups;

[0136] The component storage submodule is used to store the key component groups in different areas that can be called by the application program.

[0137] In one embodiment, the data acquisition module includes:

[0138] The data storage submodule is used to store the encryption coefficient and the encryption vector in the corresponding application program.

[0139] Each module in the key generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0140] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG8. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store key component data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for generating a key is implemented.

[0141] Those skilled in the art will understand that the structure shown in FIG. 8 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0143] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0144] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0145] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for generating a key, characterized in that: The method comprises: Obtain at least two key components; wherein the key components include character strings obtained by random generation; Decoding the key components respectively to obtain corresponding byte arrays; Using a preset fusion algorithm, the byte array is fused to obtain an initial key; The initial key is iterated and fused for a preset number of times using a preset noise coefficient and a preset algorithm to obtain a target key.

2. The method according to claim 1, characterized in that The key is generated in an application program; the initial key is iterated and fused for a preset number of times using a preset noise coefficient and a preset algorithm to obtain a target key, including: Using a preset fusion algorithm, iteratively fuse the preset noise coefficient and the initial key for a preset number of times to obtain a fused key; The fused key is summed with the key coefficient preset in the application to obtain a target key; wherein the key coefficient is generated in a random manner.

3. The method according to claim 1, characterized in that After the preset noise coefficient and the preset algorithm are used to perform a preset number of iterative fusion processes on the initial key to obtain the target key, the method further includes: Obtaining an encryption coefficient and an encryption vector; wherein the encryption coefficient includes a coefficient obtained by random generation; and the encryption vector includes a vector of a preset length generated by random generation; The target key, encryption coefficient and encryption vector are fused and encrypted using a preset fusion encryption algorithm to obtain a key encryptor; wherein the key encryptor is used to encrypt the encryption key.

4. The method according to claim 3, characterized in that Use of key encryptors, including: generating a key encryptor in response to an encryption request and / or a decryption request for an encryption key; Utilizing the key encryptor, encrypting and / or decrypting the encryption key; When the encryption and / or the decryption are completed, the target key is deleted.

5. The method according to claim 1, characterized in that After obtaining at least two key components, the method further includes: Grouping the key components to obtain key component groups; The key component groups are stored in different areas that can be called by the application program.

6. The method according to claim 3, characterized in that After obtaining the encryption coefficient and the encryption vector, the method includes: The encryption coefficient and the encryption vector are stored in a corresponding application.

7. A key generation device, characterized in that: The device comprises: A component acquisition module, used to acquire at least two key components; wherein the key components include strings obtained by randomly generating; A component decoding module, used to decode the key components respectively to obtain corresponding byte arrays; A key fusion module, used to perform fusion processing on the byte array using a preset fusion algorithm to obtain an initial key; The key fusion module is further used to use a preset noise coefficient and a preset algorithm to perform a preset number of iterative fusion processes on the initial key to obtain a target key.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

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

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Key processing method, device and system and electronic device

    CN110166236A

  • Private key generation and use method, apparatus and device in asymmetric key

    CN110650010A

  • Key processing method and device and terminal equipment

    CN114531676A

  • Method, device and equipment for encrypting storage data and storage medium

    CN115603907A

  • Secure trusted key generation method and system, communication method and system, and device

    CN115913535A