CN115834163A - Method, device, equipment and storage medium for generating secret key of encrypted data - Google Patents

Method, device, equipment and storage medium for generating secret key of encrypted data Download PDF

Info

Publication number
CN115834163A
CN115834163A CN202211401235.2A CN202211401235A CN115834163A CN 115834163 A CN115834163 A CN 115834163A CN 202211401235 A CN202211401235 A CN 202211401235A CN 115834163 A CN115834163 A CN 115834163A
Authority
CN
China
Prior art keywords
data
encrypted
public key
characteristic
key
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211401235.2A
Other languages
Chinese (zh)
Other versions
CN115834163B (en
Inventor
宋昆鸿
李能
唐盛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Livefan Information Technology Co ltd
Original Assignee
Livefan Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Livefan Information Technology Co ltd filed Critical Livefan Information Technology Co ltd
Priority to CN202211401235.2A priority Critical patent/CN115834163B/en
Publication of CN115834163A publication Critical patent/CN115834163A/en
Application granted granted Critical
Publication of CN115834163B publication Critical patent/CN115834163B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y04INFORMATION OR COMMUNICATION TECHNOLOGIES HAVING AN IMPACT ON OTHER TECHNOLOGY AREAS
    • Y04SSYSTEMS INTEGRATING TECHNOLOGIES RELATED TO POWER NETWORK OPERATION, COMMUNICATION OR INFORMATION TECHNOLOGIES FOR IMPROVING THE ELECTRICAL POWER GENERATION, TRANSMISSION, DISTRIBUTION, MANAGEMENT OR USAGE, i.e. SMART GRIDS
    • Y04S40/00Systems for electrical power generation, transmission, distribution or end-user application management characterised by the use of communication or information technologies, or communication or information technology specific aspects supporting them
    • Y04S40/20Information technology specific aspects, e.g. CAD, simulation, modelling, system security

Landscapes

  • Storage Device Security (AREA)

Abstract

The invention relates to the field of data encryption, and discloses a method, a device, equipment and a storage medium for generating a secret key of encrypted data. The method comprises the following steps: receiving a data encryption instruction, and randomly generating N arrays based on the data encryption instruction, wherein N is a positive integer, and the number of elements of the arrays is an odd number; extracting the leading digit, the median and the tail digit of the array, adding the leading digit and the median to obtain a first characteristic number, and adding the tail digit and the median to obtain a second characteristic number; converting the first characteristic number into binary data to obtain a first characteristic binary number, and converting the second characteristic number into binary data to obtain a second characteristic binary number; based on preset base64 coding, carrying out transcoding splicing processing on the first characteristic binary number and the second characteristic binary number to obtain a public key element; splicing the public key elements corresponding to the N arrays to obtain an encrypted public key; and performing character insertion processing on the public key according to a preset character interpolation algorithm to obtain an encrypted private key.

Description

Method, device, equipment and storage medium for generating secret key of encrypted data
Technical Field
The present invention relates to the field of data encryption, and in particular, to a method, an apparatus, a device, and a storage medium for generating a key for encrypting data.
Background
Since data exists, an encryption mode already appears, at present, the most similar to asymmetric encryption is symmetric encryption, symmetric encryption means that data A is encrypted into a ciphertext C by using a password B, then the data is transmitted to other people, the other people decrypt and restore the data by using the same password B, the symmetric encryption is called as symmetric encryption because the encryption and decryption both use the password B, and the asymmetric encryption is more optimized and safer in the symmetric encryption mode, two keys are simultaneously used for encryption and decryption, then the two keys have certain unknown relation, and then the data is operated through the unknown relation of the four keys, and the asymmetric encryption is called as the keys for encryption and decryption are different.
In the information age developing at a high speed, people mostly use information to transmit messages, and the information contains many important data at the same time, so that the problem of data security is solved. Firstly, data is encrypted, a plurality of encryption modes are provided on the world at present, however, asymmetric encryption is favored in the aspect of data security from the security perspective, the asymmetric encryption mainly comprises the steps of encrypting the data, and then decrypting the data in a complicated and variable mode and a key, so that the security is high, the application is wide, and the method is mainly applied to the aspects of transmission and storage of various program data and communication information related to security and confidentiality, and is particularly applied to individuals or companies with strict requirements on the data.
There are many asymmetric encryption methods, such as RSA, elgamal, knapsack algorithm, rabin, D-H, ECC (elliptic curve encryption algorithm), etc., but these are commonly used, and many of the internal algorithms are known or familiar, so that the security may be greatly reduced. Therefore, the current encryption algorithm has high possibility of being predicted, the encryption processing is over-existing, and the safety is insufficient.
Disclosure of Invention
The invention mainly aims to solve the technical problems that the current encryption algorithm is high in possibility of being predicted, the encryption processing is over-existing, and the safety is insufficient.
A first aspect of the present invention provides a method for generating a key for encrypting data, where the method for generating a key for encrypting data includes:
receiving a data encryption instruction, and randomly generating N arrays based on the data encryption instruction, wherein N is a positive integer, and the number of elements of the arrays is an odd number;
extracting the leading digit, the median and the tail digit of the array, adding the leading digit and the median to obtain a first characteristic number, and adding the tail digit and the median to obtain a second characteristic number;
converting the first characteristic number into binary data to obtain a first characteristic binary number, and converting the second characteristic number into binary data to obtain a second characteristic binary number;
based on preset base64 coding, carrying out transcoding splicing processing on the first characteristic binary number and the second characteristic binary number to obtain a public key element;
splicing the public key elements corresponding to the N arrays to obtain an encrypted public key;
and performing character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key.
Optionally, in a first implementation manner of the first aspect of the present invention, after performing character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key, the method further includes:
and based on the encryption public key, carrying out encryption processing on the data needing to be encrypted to obtain encrypted data.
Optionally, in a second implementation manner of the first aspect of the present invention, the encrypting the data to be encrypted based on the encryption public key to obtain the encrypted data includes:
based on preset base64 coding, carrying out coding conversion processing on data needing to be encrypted to obtain coded data;
and inserting the coded data interval into the encrypted public key to generate encrypted data.
Optionally, in a third implementation manner of the first aspect of the present invention, the inserting the encoded data into the encrypted public key at intervals, and generating encrypted data includes:
calculating the character interval number of the encrypted public key, and reading the character number of the encoded data;
judging whether the character interval number is larger than the character number;
if the number of the characters is larger than the number of the characters, performing cyclic extension processing on the encrypted public key to obtain a new encrypted public key;
and if the number of the characters is not larger than the number of the characters, inserting the coded data into the encrypted public key at intervals to generate encrypted data.
Optionally, in a fourth implementation manner of the first aspect of the present invention, after the encrypting data that needs to be encrypted based on the encryption public key to obtain encrypted data, the method further includes:
according to a preset cyclic interval comparison algorithm, performing interval comparison processing on the encrypted data and the encrypted private key to obtain a comparison result;
and when the comparison result is consistent, decrypting the encrypted data based on the encrypted private key to obtain decrypted data.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the performing transcoding and splicing processing on the first feature binary and the second feature binary based on preset base64 coding to obtain a public key element includes:
based on preset base64 coding, carrying out coding conversion processing on the first characteristic binary number to obtain a first character string;
based on preset base64 coding, carrying out coding conversion processing on the second characteristic binary number to obtain a second character string;
and splicing the first character string and the second character string to generate a public key element.
Optionally, in a sixth implementation manner of the first aspect of the present invention, the splicing the public key elements corresponding to the N arrays to obtain the encrypted public key includes:
and performing first splicing on public key elements corresponding to the N arrays based on the sequencing of the N arrays to generate an encrypted public key.
A second aspect of the present invention provides a key generation apparatus for encrypting data, including:
the array generating module is used for receiving a data encryption instruction and randomly generating N arrays based on the data encryption instruction, wherein N is a positive integer, and the number of elements of the arrays is an odd number;
the extraction and addition module is used for extracting the first digit number, the median number and the tail digit number of the array, adding the first digit number and the median number to obtain a first characteristic number, and adding the tail digit number and the median number to obtain a second characteristic number;
the binary conversion module is used for converting the first characteristic number into binary data to obtain a first characteristic binary number and converting the second characteristic number into binary data to obtain a second characteristic binary number;
the transcoding splicing module is used for performing transcoding splicing processing on the first characteristic binary number and the second characteristic binary number based on preset base64 coding to obtain a public key element;
the public key generating module is used for splicing the public key elements corresponding to the N arrays to obtain an encrypted public key;
and the private key generation module is used for performing character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key.
A third aspect of the present invention provides a key generation apparatus that encrypts data, including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; the at least one processor invokes the instructions in the memory to cause the key generation device of the encrypted data to perform the key generation method of the encrypted data described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-described key generation method of encrypting data.
In the embodiment of the invention, by adopting a public key and private key generation rule and a data encryption and decryption mode through the principle of asymmetric encryption, an algorithm different from the commercial asymmetric encryption is achieved. The problem that the existing mainstream asymmetric encryption mode is too much used and is familiar to people and easy to crack is solved, and the method can be widely applied to various data transmission, so that the data is safer.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a key generation method for encrypting data according to an embodiment of the present invention;
fig. 2 is a schematic diagram of an embodiment of a key generation apparatus for encrypting data according to an embodiment of the present invention;
fig. 3 is a schematic diagram of another embodiment of a key generation apparatus for encrypting data according to an embodiment of the present invention;
fig. 4 is a schematic diagram of an embodiment of a key generation apparatus for encrypting data according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for generating a secret key of encrypted data.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be implemented in other sequences than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of an embodiment of the present invention is described below, and referring to fig. 1, an embodiment of a key generation method for encrypting data in an embodiment of the present invention includes:
101. receiving a data encryption instruction, and randomly generating N arrays based on the data encryption instruction, wherein N is a positive integer, and the number of elements of the arrays is an odd number;
in this embodiment, a public key needs to be generated first, the public key is encrypted with external data, the public key can be generated by a random number conversion method, and after the public key is generated, the private key is generated according to the rule of the public key. When an encryption party encrypts data in an encryption mode to form a ciphertext, the ciphertext is sent to a receiving party, and whether the ciphertext is encrypted by a public key or not is judged according to a rule of the private key. And after judgment, removing the characters corresponding to the ciphertext by using a private key rule, and finally obtaining the decrypted data.
Since the public key is disclosed to the outside and only used for data encryption, we directly use a random generation method to generate the public key, and firstly, n groups of numbers (n is increased along with the complexity of the private key of the public key) need to be generated randomly, for example, 1 group of numbers, 2, 5 and 6, are generated randomly.
102. Extracting the leading digit, the median and the tail digit of the array, adding the leading digit and the median to obtain a first characteristic number, and adding the tail digit and the median to obtain a second characteristic number;
103. converting the first characteristic number into binary data to obtain a first characteristic binary number, and converting the second characteristic number into binary data to obtain a second characteristic binary number;
104. based on preset base64 coding, carrying out transcoding splicing processing on the first characteristic binary number and the second characteristic binary number to obtain a public key element;
in steps 102-104, adding the randomly generated 2, 5, 6 array head and tail to the middle digit respectively, we can get 2 digits, 7, 11 respectively, and binarize 7, 11 digits respectively to get 0111, 1011. Then base64 coding is carried out on the '0111 and 1011', and then splicing is carried out to obtain a public key element of 'MDExMeOAgTEwMTE ='.
Further, at 104, the following steps may be performed:
1041. based on preset base64 coding, carrying out coding conversion processing on the first characteristic binary number to obtain a first character string;
1042. based on preset base64 coding, carrying out coding conversion processing on the second characteristic binary number to obtain a second character string;
1043. and splicing the first character string and the second character string to generate a public key element.
In the 1041-1043 step, first, base64 coding is performed on the first feature binary number "0111" to obtain "MDExMQ = =", then, base64 coding is performed on the second feature binary number "1011" to obtain "MTAxMQ =", and then, the two are subjected to splicing processing to obtain a public key element "MDExMQ = = MTAxMQ =", the processing is different from the starting overall coding, and a user can perform different selections according to requirements.
105. Splicing the public key elements corresponding to the N arrays to obtain an encrypted public key;
106. and performing character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key.
In steps 105-106, the public key elements of the multiple arrays may be stitched, e.g., "MDExMeOAgTEwMTE =" is the public key element of the first array, "MDExMQ = = MTAxMQ =" is the public key element of the second array, and the two stitched cryptographic public keys are "MDExMeOAgTEwMTE = MDExMQ = = MTAxMQ = = = =.
Respectively inserting characters and digits of the public key into the characters, wherein the digits are odd numbers 1, 3, 5 and 7 …, and the digits are M0001D0003E0005x0007M0009E00011000013A00015g00017T0019E0021w0023M0025T0027E0029=0031, extracting the extracted characters to serve as a private key, and finally, the private key is as follows: M0001D0003E0005x0007M0009E00011000013a00015g00017T0019E0021w0023M0025T0027E0029=0031.
Further, the following steps may be performed after the step 106:
107. and based on the encryption public key, carrying out encryption processing on the data needing to be encrypted to obtain encrypted data.
In this embodiment, the data "12345" to be encrypted is base64 encoded to "12345" to obtain "MTIzNDU =", and single and double superposition may be performed: the first digit M of public key is the first digit, and first digit M of data is the second bit, and second bit D of public key is the third bit, and second bit T of data is the fourth bit, and when data length was not enough, then the character of cycle data, the last encryption character was: "mmdteixzzmnedoua = gmteiwzmntdeu = =0008".
Specifically, the following steps may be performed at 107:
1071. based on preset base64 coding, carrying out coding conversion processing on data needing to be encrypted to obtain coded data;
1072. and inserting the coded data interval into the encrypted public key to generate encrypted data.
In this embodiment, the data to be encrypted is "12345", and "12345" is subjected to base64 encoding to obtain "MTIzNDU =", and "MTIzNDU =" is inserted into the encryption public key "MDExMeOAgTEwMTE =" every other character, that is, "mmdteixzmnodou = gmtetawzntdeu = =0008".
Specifically, the following steps may be performed at interval 1072:
10721. calculating the character interval number of the encrypted public key, and reading the character number of the encoded data;
10722. judging whether the character interval number is larger than the character number;
10723. if the number of the characters is larger than the number of the characters, performing cyclic extension processing on the encrypted public key to obtain a new encrypted public key;
10724. and if the number of the characters is not larger than the number of the characters, inserting the coded data into the encrypted public key at intervals to generate encrypted data.
In the 10721-10724 steps, "mdexi oagtewmte =" has 15 character intervals and "MTIzNDU =" has 8 characters, then the direct insertion results in "mmdteixzmetdoua = gmteiwzmnttdeu = =0008", and if the encryption public key is "MDExMe", then "MDExMe" has 5 character intervals and "MTIzNDU =" has 8 characters, the encryption public key is cyclically extended to "MDExMe = exme", and then "mdizndu =" is inserted "MDExMe = MDExMe" to obtain the encrypted data of "MMDTEIxzMNe = MDDUE = xMe =0008".
Further, the decryption process after 107 may perform the following scheme:
1071. according to a preset cyclic interval comparison algorithm, performing interval comparison processing on the encrypted data and the encrypted private key to obtain a comparison result;
1072. and when the comparison result is consistent, carrying out decryption processing on the encrypted data based on the encrypted private key to obtain decrypted data.
In steps 1071-1072, after taking the ciphertext, first checking whether the ciphertext is encrypted by the corresponding public key, comparing the characters of no four bits of the private key with the characters of every other bit of the ciphertext, if the characters are consistent, indicating that the ciphertext is encrypted by the corresponding public key, then removing the ciphertext according to the way of every other bit, and the rest is the base64 of the data.
Example (c):
ciphertext: mmdteixzmnedua = gmtetiwzmntdeu = =0008
The private key is:
M0001D0003E0005x0007M0009e00011000013A00015g00017T0019E0021w0023M0025T0027E0029=0031
five bits of the private key form a group, M0001D 0003.
The ciphertext character is compared with each group of first characters of the private key,
M(M)D(T)E(I)x......
M0001 D0003 E0005 x0007.....
after the verification is consistent, the ciphertext is removed from the digit characters corresponding to each group of characters of the private key, the rest characters are data, the characters with corresponding digits are intercepted according to the final number of characters of the ciphertext to obtain a base code of the data, and finally the data is obtained by decoding the base code 64.
In the embodiment of the invention, by adopting a public key and private key generation rule and a data encryption and decryption mode through the principle of asymmetric encryption, an algorithm different from the commercial asymmetric encryption is achieved. The problem that the existing mainstream asymmetric encryption mode is too much used and is familiar to people and easy to crack is solved, and the method can be widely applied to various data transmission, so that the data is safer.
With reference to fig. 2, the method for generating a key for encrypting data in the embodiment of the present invention is described above, and a key generating device for encrypting data in the embodiment of the present invention is described below, where in an embodiment of the device for generating a key for encrypting data in the embodiment of the present invention, the key generating device for encrypting data includes:
the array generating module 201 is configured to receive a data encryption instruction, and randomly generate N arrays based on the data encryption instruction, where N is a positive integer, and the number of elements in the array is an odd number;
an extracting and adding module 202, configured to extract a leading digit, a median, and a trailing digit of the array, add the leading digit and the median to obtain a first feature number, and add the trailing digit and the median to obtain a second feature number;
a binary conversion module 203, configured to convert the first feature number into binary data to obtain a first feature binary, and convert the second feature number into binary data to obtain a second feature binary;
a transcoding and splicing module 204, configured to perform transcoding and splicing processing on the first characteristic binary number and the second characteristic binary number based on preset base64 coding to obtain a public key element;
a public key generating module 205, configured to splice public key elements corresponding to the N arrays to obtain an encrypted public key;
the private key generating module 206 is configured to perform character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key.
In the embodiment of the invention, by adopting a public key and private key generation rule and a data encryption and decryption mode through the principle of asymmetric encryption, an algorithm different from the commercial asymmetric encryption is achieved. The problem that the existing mainstream asymmetric encryption mode is too much used and is familiar to people and easy to crack is solved, and the method can be widely applied to various data transmission, so that the data is safer.
Referring to fig. 3, another embodiment of a key generation apparatus for encrypting data according to an embodiment of the present invention includes:
an array generation module 201, configured to receive a data encryption instruction, and randomly generate N arrays based on the data encryption instruction, where N is a positive integer, and the number of elements in the array is an odd number;
an extracting and adding module 202, configured to extract a leading digit, a median, and a trailing digit of the array, add the leading digit and the median to obtain a first feature number, and add the trailing digit and the median to obtain a second feature number;
a binary conversion module 203, configured to convert the first feature number into binary data to obtain a first feature binary, and convert the second feature number into binary data to obtain a second feature binary;
a transcoding and splicing module 204, configured to perform transcoding and splicing processing on the first characteristic binary number and the second characteristic binary number based on preset base64 coding to obtain a public key element;
a public key generating module 205, configured to splice public key elements corresponding to the N arrays to obtain an encrypted public key;
the private key generating module 206 is configured to perform character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key.
The apparatus for generating a key of encrypted data further includes an encryption module 207, where the encryption module 207 is specifically configured to:
and based on the encryption public key, carrying out encryption processing on the data needing to be encrypted to obtain encrypted data.
Wherein, the encryption module 207 is further specifically configured to:
based on preset base64 coding, carrying out coding conversion processing on data needing to be encrypted to obtain coded data;
and inserting the coded data interval into the encrypted public key to generate encrypted data.
Wherein the encryption module 207 is further specifically configured to:
calculating the character interval number of the encrypted public key, and reading the character number of the encoded data;
judging whether the character interval number is larger than the character number;
if the number of the characters is larger than the number of the characters, performing cyclic extension processing on the encrypted public key to obtain a new encrypted public key;
and if the number of the characters is not larger than the number of the characters, inserting the coded data into the encrypted public key at intervals to generate encrypted data.
The apparatus for generating a key of encrypted data further includes a decryption module 208, where the decryption module 208 is specifically configured to:
according to a preset cyclic interval comparison algorithm, performing interval comparison processing on the encrypted data and the encrypted private key to obtain a comparison result;
and when the comparison result is consistent, carrying out decryption processing on the encrypted data based on the encrypted private key to obtain decrypted data.
The transcoding and splicing module 204 is specifically configured to:
based on preset base64 coding, carrying out coding conversion processing on the first characteristic binary number to obtain a first character string;
based on preset base64 coding, carrying out coding conversion processing on the second characteristic binary number to obtain a second character string;
and splicing the first character string and the second character string to generate a public key element.
The public key generating module 205 is specifically configured to:
and performing first splicing on public key elements corresponding to the N arrays based on the sequencing of the N arrays to generate an encrypted public key.
In the embodiment of the invention, by adopting a public key and private key generation rule and a data encryption and decryption mode through the principle of asymmetric encryption, an algorithm different from the commercial asymmetric encryption is achieved. The problem that the existing mainstream asymmetric encryption mode is too much used and is familiar to people and easy to crack is solved, and the method can be widely applied to various data transmission, so that the data is safer.
Fig. 2 and fig. 3 describe the key generation device for encrypting data in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the key generation device for encrypting data in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 4 is a schematic structural diagram of a key generating apparatus for encrypting data according to an embodiment of the present invention, where the key generating apparatus 400 for encrypting data may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 410 (e.g., one or more processors) and a memory 420, and one or more storage media 430 (e.g., one or more mass storage devices) for storing applications 433 or data 432. Memory 420 and storage medium 430 may be, among other things, transient or persistent storage. The program stored in the storage medium 430 may include one or more modules (not shown), each of which may include a series of instruction operations in the key generation apparatus 400 for encrypting data. Further, the processor 410 may be configured to communicate with the storage medium 430 to execute a series of instruction operations in the storage medium 430 on the key generation apparatus 400 that encrypts data.
The encrypted data-based key generation apparatus 400 may also include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input-output interfaces 460, and/or one or more operating systems 431, such as Windows server, mac OS X, unix, linux, freeBSD, and so forth. Those skilled in the art will appreciate that the configuration of the key generation apparatus for encrypting data shown in fig. 4 does not constitute a limitation of the key generation apparatus based on encrypted data, and may include more or less components than those shown, or some components may be combined, or a different arrangement of components.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the key generation method for encrypting data.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses, and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a portable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for generating a key for encrypting data, comprising the steps of:
receiving a data encryption instruction, and randomly generating N arrays based on the data encryption instruction, wherein N is a positive integer, and the number of elements of the arrays is an odd number;
extracting the leading digit, the median and the tail digit of the array, adding the leading digit and the median to obtain a first characteristic number, and adding the tail digit and the median to obtain a second characteristic number;
converting the first characteristic number into binary data to obtain a first characteristic binary number, and converting the second characteristic number into binary data to obtain a second characteristic binary number;
based on preset base64 coding, carrying out transcoding splicing processing on the first characteristic binary number and the second characteristic binary number to obtain a public key element;
splicing the public key elements corresponding to the N arrays to obtain an encrypted public key;
and performing character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key.
2. The method for generating a key for encrypting data according to claim 1, wherein after performing character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key, the method further comprises:
and based on the encryption public key, carrying out encryption processing on the data needing to be encrypted to obtain encrypted data.
3. The method according to claim 2, wherein the encrypting data based on the encryption public key to encrypt the data to be encrypted to obtain the encrypted data includes:
based on preset base64 coding, carrying out coding conversion processing on data needing to be encrypted to obtain coded data;
and inserting the coded data interval into the encrypted public key to generate encrypted data.
4. The method according to claim 3, wherein the inserting the encoded data interval into the encrypted public key to generate the encrypted data includes:
calculating the character interval number of the encrypted public key, and reading the character number of the encoded data;
judging whether the character interval number is larger than the character number;
if the number of the characters is larger than the number of the characters, performing cyclic extension processing on the encrypted public key to obtain a new encrypted public key;
and if the number of the characters is not larger than the number of the characters, inserting the coded data into the encrypted public key at intervals to generate encrypted data.
5. The method for generating a key for encrypting data according to claim 2, wherein, after the data to be encrypted is encrypted based on the encryption public key to obtain encrypted data, the method further comprises:
according to a preset cyclic interval comparison algorithm, performing interval comparison processing on the encrypted data and the encrypted private key to obtain a comparison result;
and when the comparison result is consistent, carrying out decryption processing on the encrypted data based on the encrypted private key to obtain decrypted data.
6. The method for generating a key for encrypting data according to claim 1, wherein the transcoding and splicing the first feature binary number and the second feature binary number based on preset base64 encoding to obtain a public key element comprises:
based on preset base64 coding, carrying out coding conversion processing on the first characteristic binary number to obtain a first character string;
based on preset base64 coding, carrying out coding conversion processing on the second characteristic binary number to obtain a second character string;
and splicing the first character string and the second character string to generate a public key element.
7. The method for generating a key for encrypting data according to claim 1, wherein the splicing the public key elements corresponding to the N arrays to obtain the encrypted public key comprises:
and performing first splicing on public key elements corresponding to the N arrays based on the sequencing of the N arrays to generate an encrypted public key.
8. A key generation apparatus for encrypting data, the key generation apparatus for encrypting data comprising:
the array generating module is used for receiving a data encryption instruction and randomly generating N arrays based on the data encryption instruction, wherein N is a positive integer, and the number of elements of the arrays is an odd number;
the extraction and addition module is used for extracting the first digit number, the median number and the tail digit number of the array, adding the first digit number and the median number to obtain a first characteristic number, and adding the tail digit number and the median number to obtain a second characteristic number;
the binary conversion module is used for converting the first characteristic number into binary data to obtain a first characteristic binary number and converting the second characteristic number into binary data to obtain a second characteristic binary number;
the transcoding and splicing module is used for transcoding and splicing the first characteristic binary number and the second characteristic binary number based on preset base64 coding to obtain a public key element;
the public key generating module is used for splicing the public key elements corresponding to the N arrays to obtain an encrypted public key;
and the private key generation module is used for performing character insertion processing on the encrypted public key according to a preset character interpolation algorithm to obtain an encrypted private key.
9. A key generation apparatus that encrypts data, characterized by comprising: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invokes the instructions in the memory to cause the key generation apparatus to encrypt data to perform the key generation method to encrypt data as claimed in any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, carries out a method of key generation of encrypted data according to any one of claims 1 to 7.
CN202211401235.2A 2022-11-09 2022-11-09 Method, device, equipment and storage medium for generating secret key of encrypted data Active CN115834163B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211401235.2A CN115834163B (en) 2022-11-09 2022-11-09 Method, device, equipment and storage medium for generating secret key of encrypted data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211401235.2A CN115834163B (en) 2022-11-09 2022-11-09 Method, device, equipment and storage medium for generating secret key of encrypted data

Publications (2)

Publication Number Publication Date
CN115834163A true CN115834163A (en) 2023-03-21
CN115834163B CN115834163B (en) 2023-07-18

Family

ID=85527484

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211401235.2A Active CN115834163B (en) 2022-11-09 2022-11-09 Method, device, equipment and storage medium for generating secret key of encrypted data

Country Status (1)

Country Link
CN (1) CN115834163B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090046853A1 (en) * 2007-07-25 2009-02-19 Sai Chuen Hui Method and system for generating a pair of public key and secret key
CN110708167A (en) * 2019-10-14 2020-01-17 杭州云萃流图网络科技有限公司 Method, device, equipment and medium for generating public key and private key
CN111865616A (en) * 2020-07-31 2020-10-30 海尔优家智能科技(北京)有限公司 Method and device for generating key pair based on ECDSA algorithm
CN112564907A (en) * 2021-03-01 2021-03-26 北京信安世纪科技股份有限公司 Key generation method and device, encryption method and device, and decryption method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090046853A1 (en) * 2007-07-25 2009-02-19 Sai Chuen Hui Method and system for generating a pair of public key and secret key
CN110708167A (en) * 2019-10-14 2020-01-17 杭州云萃流图网络科技有限公司 Method, device, equipment and medium for generating public key and private key
CN111865616A (en) * 2020-07-31 2020-10-30 海尔优家智能科技(北京)有限公司 Method and device for generating key pair based on ECDSA algorithm
CN112564907A (en) * 2021-03-01 2021-03-26 北京信安世纪科技股份有限公司 Key generation method and device, encryption method and device, and decryption method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李倩;: "RSA加密体制的密钥生成技术的研究", 现代计算机, no. 10 *

Also Published As

Publication number Publication date
CN115834163B (en) 2023-07-18

Similar Documents

Publication Publication Date Title
US8300828B2 (en) System and method for a derivation function for key per page
US8892881B2 (en) Split key secure access system
CN105871550B (en) A kind of system for realizing digital signal encryption transmission
CN108173640B (en) High-security symmetric encryption and decryption method for character strings
Thangavel et al. Enhanced DNA and ElGamal cryptosystem for secure data storage and retrieval in cloud
CN111404953A (en) Message encryption method, message decryption method, related devices and related systems
CN1551559A (en) Method and device for organising public key based on user_defined identification code cryptographic system
CN115065555A (en) Information security processing method and system
Biswas et al. A DNA cryptographic technique based on dynamic DNA encoding and asymmetric cryptosystem
Ahmad et al. A secure network communication protocol based on text to barcode encryption algorithm
Vinodhini et al. A survey on DNA and image steganography
CN111475690B (en) Character string matching method and device, data detection method and server
CN117375836A (en) Encryption and decryption method and system for long text segment based on RSA encryption algorithm
US20020136400A1 (en) R-conversion encryption method and system
Vinay et al. Implementation of DNA cryptography based on dynamic DNA sequence table using cloud computing
Kar et al. An improved data security using DNA sequencing
CN115834163B (en) Method, device, equipment and storage medium for generating secret key of encrypted data
CN115423474A (en) Transaction processing method and device based on chaotic mapping
CN115935299A (en) Authorization control method, device, computer equipment and storage medium
Thangavel et al. A comparative study on DNA-based cryptosystem
Al-Mahdi et al. Design and analysis of DNA binary cryptography algorithm for plaintext
CA3167530A1 (en) A method for symmetric asynchronous generative encryption
CN116866029B (en) Random number encryption data transmission method, device, computer equipment and storage medium
Abdul-Jabbar Secure QR-code generation in healthcare
JP2015082077A (en) Encryption device, control method, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant