Hybrid encryption and decryption system and method based on hierarchical division and secret-in-secret distribution
Through the hybrid encryption method and the secret-in-key distribution technology, the balance problem between security and efficiency of existing cryptography technology is solved, and information protection with high security and low time complexity is achieved, which is suitable for the modern Internet environment.
Patent Information
- Application Number
- CN202210921081.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-02
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2042-08-02
AI Technical Summary
Existing cryptography technology is difficult to provide sufficient security and efficiency in the face of the increase in computing power of modern computers and the threat of quantum computers. In particular, it is difficult to find a balance between the time complexity of encryption and decryption and the complexity of cracking, and many traditional cryptography technologies The rule fixity and time complexity improvement of the secondary encryption method are insufficient, which affects information security.
The hybrid encryption method (H-encryption method) is used to reduce the time complexity of encryption and decryption through hierarchical layers and permutations, while improving the cracking complexity. It uses a variety of cryptography methods and network transmission methods to achieve hierarchical layering and A hybrid encryption and decryption system for secret-in-secret distribution, including hybrid encryption methods, hybrid decryption methods, variable-length header data management and signature verification, key and certificate storage management, encryption means management, and distributed secret-in-secret dual-layer distribution.
It realizes cryptography technology that provides high security under low time complexity, can independently establish standards, is suitable for massive information processing, improves information security, reduces encryption and decryption time consumption, and enhances the complexity and flexibility of information protection. .
Smart Images

Figure CN115174261B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cryptographic information encryption technology, and in particular to a system, device and method using hybrid encryption and decryption and distributed secret-in-secret double-layer distribution. Background Art
[0002] At present, Internet-based information transmission has penetrated into all aspects of society, from digital finance to information-based national defense. Many industries with high security and confidentiality requirements are increasingly relying on the Internet as a medium for information acquisition, storage and exchange. Ensuring the security of Internet information has become a key link in the Internet strategy of organizations, enterprises and even countries. However, the development of Internet information security is now constrained by many different factors. On the one hand, the rapid growth of modern computer computing power has increasingly challenged the security of traditional cryptographic protection methods; on the other hand, although quantum computers and quantum encryption technology have good prospects for protecting information security, regardless of the time required from technology development to maturity, the process of realizing quantum protection transition in the industry is often not achieved overnight.
[0003] Based on the principle of reducing "menu costs", improving existing technologies to achieve higher security protection has become an important direction of cryptographic research in recent years. Among them, the application of public key cryptography enables both parties in information transmission to encrypt and decrypt information through asymmetric keys, and private keys are not transmitted on the Internet, which has become an epoch-making progress in Internet security. Furthermore, in order to reduce the time consumption of encryption and decryption, public key cryptography is used to encrypt the session key of symmetric cryptography, and then the session key of symmetric cryptography is used to encrypt the message, achieving a balance between security and speed. In addition, in order to overcome the above-mentioned method of only protecting once, the method of multiple encryption has gradually been promoted and applied. Typical applications are 3DES and nested salted hashing. It is hoped that by using different keys for multiple encryptions, the complexity based on permutations and combinations can be improved, thereby improving the security of information.
[0004] However, the above three well-known improvement methods have been mature for many years, and the strategies have been studied thoroughly by the industry, and their defects have been increasingly exposed and demonstrated: the biggest problem of public key cryptography is the disclosure of public keys. In many cases, the necessity of public-private key pairs will lead to the problem of insufficient security of ciphertext. At the same time, in the case of having ciphertext and public key, there is theoretically the possibility of obtaining plaintext through circular operations; the method of encrypting the session key of symmetric cryptography by public key cryptography is not perfect. Under certain circumstances, the decipher of the password can skip the encryption step of public key cryptography and directly crack the message used for symmetric encryption. At this time, the security of the data directly depends on the security of the symmetric encryption method. Under brute force cracking, the improvement of security has almost nothing to do with the participation of public key cryptography; and the method of multiple encryption is desirable to exchange space complexity and time complexity for higher security due to permutations and combinations, but the traditional method of using the same algorithm and performing multiple encryptions for a fixed number of times has problems such as fixed rules, too simple permutations and combinations, easy determination of decryption results, and insufficient improvement in security due to time complexity consumption.
[0005] Since the security required by cryptography mainly depends on the complexity of the cracking operation, it is true that in general fields, the complexity of existing technologies is almost enough to cope with most information security scenarios, and the complexity can be further increased by increasing the key bit length; but in some areas involving critical information security, blindly increasing the key bit length for the purpose of security will sacrifice a huge encryption and decryption time complexity (classic experiments have proved that in public key cryptography applications, increasing the key bit length by 1 times will increase the encryption and decryption running time by 8 times), especially when used for massive information processing. The low throughput caused by low speed is obviously contrary to the future development of the Internet; in addition, the relatively lagging development of cryptography in my country has prevented my country from fully participating in the formulation of relevant international standards, which has further challenged my country's information security.
[0006] Therefore, we still need a more advanced, more complex, faster and more secure technology to protect the information security of longer time and higher standards in the future; we also need a more independent and complete solution to protect the development of my country's Internet + industry and national strategic undertakings. Developing cryptographic technology that can bring higher security with lower encryption and decryption time complexity, and being able to independently establish standards and apply them to related industries to ensure information security is an urgent problem to be solved by technical personnel in this field.
[0007] The above information is provided as background information only to assist in understanding the background of the present invention, and no determination or admission is made as to whether any of the above content may be used as prior art relative to the present invention. Summary of the invention
[0008] In order to achieve cryptographic technology with higher security at lower time complexity and establish relevant application standards, the present invention utilizes the ideas of permutation and combination and group distribution to increase the complexity of cracking, and uses a variety of cryptographic coding and network transmission methods to provide a set of solutions that can realize a hybrid encryption and decryption system and method based on hierarchical layering and secret-in-secret distribution.
[0009] The specific contents of the invention include: a hybrid encryption method, a hybrid decryption method, a method for implementing information management and signature verification for variable-length header data of hybrid encryption and decryption, a method for storing and managing hybrid encryption and decryption keys and certificates, a method for managing encryption means for hybrid encryption and decryption, a method for operating, managing and protecting hybrid encryption and decryption in conjunction with distributed secret-in-secret double-layer distribution, a system, device, storage medium for implementing the above functions, and a method for generating a standard hash and substitution table.
[0010] It should be noted that, in order to distinguish from other hybrid encryption and decryption methods, the hybrid encryption method and hybrid decryption method involved in the present invention will be referred to as H-(Hybrid Minus) encryption method and H-(Hybrid Minus) decryption method below, which means hybrid (Hybrid) and reduction (Minus) of time complexity.
[0011] Before further elaborating on the content of the invention, the key terms involved in the content of the invention are first defined and explained as follows:
[0012] Step: In multiple encryption, one encryption of a message is defined as one step of encryption. Multiple encryption means that each step needs to be encrypted step by step. After each step is completed, the entire plaintext of the message or the entire ciphertext after the previous step is encrypted is completely encrypted. In multiple decryption, the definition of step is similar.
[0013] Block: In block encryption, a part of a message is extracted and encrypted. This part is called a block. Usually, a complete encryption requires several or even many blocks to be encrypted in groups to obtain the final ciphertext. In multiple decryptions, the definition of block is similar.
[0014] Stage: In multiple encryption, if the encryption of a certain step of a message needs to be divided into blocks, a part of each block of the message that uses different encryption algorithms, different keys or different encryption methods for encryption operations is defined as a stage. The encryption of a certain step of a message is generally divided into several or many blocks, each block is composed of different stages, and different blocks are composed of the same layer division. The first-order encryption is finally realized by repeatedly dividing different layers into different blocks for encryption. In multiple decryption, the definition of stage is similar.
[0015] The encryption throughput length is the maximum amount of data that can be processed for a complete encryption operation. For example, the encryption throughput length of AES-128 is 128 bits.
[0016] The throughput length of a decryption is the maximum amount of data that can be processed for a complete decryption operation. For example, the decryption throughput length of AES-128 is 128 bits.
[0017] Encryption and decryption time complexity: used to measure the time consumed by the encryption and decryption process. Taking the usual computer measurement method as an example, the encryption and decryption time complexity can be measured by the number of basic statement executions, which is usually used to compare relative time complexity. In order to measure the absolute time complexity to reflect the time difference consumed by different encryption and decryption operations in the application, we define the time consumed by using AES-128 to encrypt and decrypt binary data of a specific length as the unit time. The absolute time complexity involved below will be measured in unit time.
[0018] Cracking complexity: The amount of computation required to use general methods to obtain all the keys used for encryption and use the ciphertext to crack the plaintext. Since the cracking complexity is usually difficult to measure accurately and has uncertainty, we will only estimate the cracking complexity in relative terms in the following text.
[0019] Body code rules: In order to accurately locate different encryption methods or hash function algorithms, a mapping scheme is defined for different encryption methods or hash function algorithms. The encryption method or hash function algorithm used can be uniquely determined by using the corresponding code.
[0020] Row: A set of information containing keys or certificates corresponding to all possible alternative encryption methods. In the case of multiple rows, multiple rows contain multiple sets of information containing keys or certificates corresponding to all possible alternative encryption methods.
[0021] Column: Contains one or more pieces of information containing the key or certificate corresponding to the encryption method corresponding to the corresponding body code rule.
[0022] Group: When a column contains one key or certificate information, the column is defined to contain a group; similarly, when a column contains k keys or certificate information, the column is defined to contain k groups.
[0023] Encapsulation: data encapsulation, which is the process of adding a shell to the data to make it easier to operate and identify. Usually, the corresponding information is written in the data header as data encapsulation. The encapsulation form has nothing to do with the internal encoding.
[0024] Unpacking: data unpacking is the process of removing the encapsulation shell from the data to obtain the original data after unpacking. It is usually in the form of reading the corresponding information in the data header and restoring the original content of the data. The unpacking form has nothing to do with the internal encoding.
[0025] Variable-length header data: a packaging format named for its scalability and indeterminate length. Hereinafter, it generally refers to the basic format used to encapsulate H-encrypted data in the present invention. A portion of data for identification and management is added before the encrypted data, namely, the variable-length header data.
[0026] Replacement table: A comparison table used to replace the replaced content. By searching the replacement table, you can find the corresponding replacement content based on the replaced content, or you can uniquely find the replaced content based on the replacement content.
[0027] Streaming transmission: sequential and real-time transmission of data over the network multiple times, and eventually transmission of all data. In the following text, it generally refers to the situation where the content to be transmitted is too long, so the content to be transmitted is divided into blocks and then transmitted sequentially multiple times. In actual application, it can also be used for real-time data transmission.
[0028] Key: refers to the secret information used to complete cryptographic operations such as encryption and decryption. In symmetric cryptography, it refers to the symmetric key, and in asymmetric public key cryptography, it includes public key and private key.
[0029] Certificate: A digital certificate that usually marks identity authentication in Internet communications. There are public key certificates and private key certificates. The following text generally refers to a digital certificate containing a public key or a private key. The difference is that in addition to being used for identity authentication, the H-encryption and decryption algorithm usually uses the public key and private key in the certificate to implement encryption and decryption operations at a certain level.
[0030] Storage and management method of hybrid encryption and decryption keys and certificates: Data structure and management method for storing hybrid encryption and decryption keys and certificates, generally referred to as the fourth aspect of the present invention below, provides a data structure adapted to H-hybrid encryption and decryption keys and certificates and related necessary data. The data structure provides relevant operations and methods for managing, updating, and storing related data, and provides an interface for H-encryption and decryption to call.
[0031] Key and certificate database: a database used to store existing keys that may be used for H-encryption and decryption and certificates for authentication or encryption. Hereinafter, it generally refers to a file that is stored locally in the form of a file and is not transmitted, and stores existing keys that may be used for H-encryption and decryption and certificates for authentication or encryption. The database can be imported into a data structure for use in encryption and decryption.
[0032] Scenario and purpose flag: A flag that distinguishes encryption and transmission scenarios and purposes. In the following text, it generally refers to a flag that distinguishes the number of entities that may have plain text and encrypt, send and receive and may be able to decrypt. It is mainly divided into three modes: P2P, P2N and N2P. Different modes have different numbers of entities that may encrypt and send, and different numbers of entities that can decrypt. In the corresponding H-encryption method, different modes have different method applicability.
[0033] P2P mode: A mode in which there is only one party as the encryption sender and the decryption receiver (Person to Person). This mode is suitable for one-to-one scenarios in which only one party has the data to be encrypted and only one party needs to receive the data. It supports all symmetric and asymmetric encryption methods. Both the sender and the receiver need to verify each other's identity and supports digital signatures.
[0034] P2N mode: A mode in which there is only one encryption sender and multiple decryption receivers (Person to Numbers). It is suitable for one-to-many scenarios in which only one party needs to send data to multiple parties. It supports all symmetric encryption methods and some asymmetric encryption methods. The receiver must verify the identity of the sender and supports digital signatures.
[0035] N2P mode: A mode in which there are multiple encryption senders and only one decryption receiver (Numbers to Person). It is suitable for many-to-one scenarios where multiple parties need to send data to one party. It only supports all symmetric encryption methods. Neither the sender nor the receiver needs to verify the identity of the other party. Digital signatures are not supported.
[0036] Machine code: A code that identifies the machine on which the executable program runs. It is generated based on the hardware and varies from machine to machine. In the following text, it generally refers to the random code generated in the key and certificate database to identify the machine that executes encryption and decryption.
[0037] The unique code issued at the time of the last modification is a code that marks the last modification of the content. It is completely randomly generated and varies depending on the modification. In the following text, it generally refers to the old version of the personal keystore, interface public key, and complete public key used in the key and certificate database. It is used to mark the random code generated to update the keystore to match its old version.
[0038] Unique code after the latest modification: A code marked by the latest content modification, which is completely randomly generated and varies according to the modification. Hereinafter, it generally refers to the random code generated in the database of keys and certificates to mark the personal key store, interface public key, and complete public key used.
[0039] Personal key store: a locally stored distributed database, especially storing all keys and all certificates generated or set by the user. It generally refers to the data structure of the database marking keys and certificates in the fourth aspect of the present invention, as well as the file content after the data structure is written to the local file.
[0040] Interface key group: a group of keys and certificates used to encrypt other keys and certificates. Hereinafter, it generally refers to the interface key group corresponding to the interface public key and interface private key used for the second distribution encryption in the secret-in-secret double-layer distribution.
[0041] Interface public key (for transmission): Hereinafter generally refers to the public key group (especially the certificate) distributed for the first time in the secret-within-secret double-layer distribution, which is also the interface public key used for the second distribution of encryption.
[0042] Complete public key (for transmission): Hereinafter generally refers to the public key group distributed for the second time in the secret-within-secret double-layer distribution, and the symmetric key (including not only asymmetric public keys, but also symmetric keys).
[0043] Compliance check: Hereinafter generally refers to an operation in a data structure to verify whether the data structure has all the necessary data to perform related operations, usually a verification function.
[0044] A management method for encryption means of hybrid encryption and decryption: a data structure and method for managing and guiding H-encryption and decryption methods, keys used, substitution tables used, etc. to implement encryption, decryption and encapsulation, hereinafter generally referred to as the fifth aspect of the present invention, providing a data structure including an H-hybrid encryption and decryption method, keys and certificates used, substitution tables used and related necessary data, the data structure providing related operations and methods for managing and guiding H-encryption and decryption and implementing encapsulation using variable-length header data, providing an output interface for reading and writing variable-length header data, identifying H-module content, and providing an interface for H-encryption and decryption, and implementing encapsulation using variable-length header data.
[0045] Time limit for decryption: The time limit for decryption operation is generally referred to as the time limit for H-decryption operation set by the H-module in the indefinite-length header data. Within the limited time, the plaintext can be decrypted using the correct decryption method and related keys and certificates. Outside the limited time, decryption is not allowed even if the correct decryption method and related keys and certificates are available.
[0046] Machine restrictions for decryption: The hardware machine restrictions for decryption operations are generally referred to as the machine codes set by the H-module in the indefinite-length header data that allow H-decryption operations. Within all allowed machine codes, the correct decryption method and related keys and certificates can be used to decrypt plain text. Outside all allowed machine codes, decryption is not allowed even with the correct decryption method and related keys and certificates.
[0047] Methods for operating, managing and protecting hybrid encryption and decryption with distributed secret-in-secret double-layer distribution: methods for executing, managing and protecting hybrid encryption and decryption and distributed secret-in-secret double-layer distribution, hereinafter generally referred to as the sixth aspect of the present invention, providing a set of methods related to H-encryption, decryption and encapsulation, including two key distributions, coordinated encryption and encapsulation, coordinated decryption and unsealing, as well as improvements and optimizations to the operations required for special scenarios, including interfaces for calling the data structures and operations of the first to fifth aspects, to fully implement all H-related operations.
[0048] Configuration file: hereinafter generally refers to the content written in the content of the variable-length header data mark purpose for the interface public key, complete public key, and update of the complete public key in the sixth aspect of the present invention. It may also refer to the file information storing information used for encryption, that is, the file after the local file is written to the personal key library, interface public key, complete public key, etc.
[0049] The interface private key of this user: hereinafter generally refers to the private key group corresponding to the interface public key of this user.
[0050] The interface public key of the recipient: hereinafter generally refers to the interface public key of the user to be received during hybrid encryption and distribution.
[0051] A symmetric key that is negotiated but not transmitted over the network: hereinafter generally refers to a string of symmetric keys that are negotiated but not transmitted over the network, which are selected when the P2N mode is used to distribute the ciphertext of the second complete public key. Since the recipient has multiple symmetric keys, the symmetric keys are used to replace the recipient's interface public key in the P2P mode to participate in the encryption of the second complete public key.
[0052] Network transmission: Use the network to transmit files, data, and messages. The sender and receiver do not need to exchange information through hardware, which may be hijacked by a third party and cause information leakage.
[0053] Physical transmission: Use non-network methods to transmit files, data, and messages. The sender and receiver need to exchange information through hardware. The process of exchanging information does not require the participation of the network, and there will be no situation where third-party hijacking may lead to information leakage.
[0054] Parent key or certificate: the basic key or certificate (the key in it) used in the encryption and decryption process, hereinafter generally refers to the key used in (any) symmetric encryption (and corresponding decryption) method, the key used in the asymmetric encryption (and corresponding decryption) method encrypted with the recipient's public key, the key used in the asymmetric encryption (and corresponding decryption) method encrypted with the sender's private key, the asymmetric key in the encryption (and corresponding decryption) method using the recipient's public key to encrypt the symmetric key, and the private key in the symmetric encryption (and corresponding decryption) method using key exchange.
[0055] Method of using the parent key or certificate: The encryption method used by the parent key or certificate for encryption and decryption operations during the encryption and decryption process, hereinafter generally refers to the symmetric encryption (and corresponding decryption) method of transmitting keys on the network, the symmetric encryption (and corresponding decryption) method that does not use the network to transmit keys, the asymmetric encryption (and corresponding decryption) method that uses the public key of the recipient to encrypt, the asymmetric encryption (and corresponding decryption) method that uses the private key of the sender to encrypt, the symmetric key encryption (and corresponding decryption) method that uses the public key of the recipient to encrypt, and the symmetric encryption (and corresponding decryption) method that uses key exchange.
[0056] Subkey or certificate: A key or certificate (the key in it) used by the basic key or certificate during the encryption and decryption process. Hereinafter, it generally refers to the public key in the encryption (and corresponding decryption) method using the recipient's public key to encrypt the symmetric key and the public key in the symmetric encryption (and corresponding decryption) method using key exchange.
[0057] Update of complete public key (non-interface public key): hereinafter generally refers to the process of updating some keys in the complete public key (non-interface public key) without changing the interface public key (once the interface public key is changed, all corresponding non-interface keys will be invalidated), using new keys (asymmetric keys and symmetric keys) to replace old keys, creating new keys, and redistributing the updated asymmetric public keys and symmetric keys and (forcibly updated) replacement tables.
[0058] In order to achieve the above object, the technical solution adopted by the present invention is:
[0059] In a first aspect, an embodiment of the present invention provides a hybrid encryption method (H-encryption method) to utilize a variety of existing cryptographic methods, and to reduce the time complexity of encryption and decryption as much as possible through hierarchical layers and permutations and combinations, while bringing about a geometrically increasing high cracking complexity, to encrypt plaintext into ciphertext, wherein the method comprises:
[0060] Select an order m, and select a number of layers n for each order i i (1≤i≤m and i∈Z), which can be recorded in the form of a vector as follows:
[0061] n1 n2 … n m-1 n m ;
[0062] Select an encryption method and key for each layer of each stage;
[0063] Enter the loop;
[0064] Starting from the first order i=1, if this order has only one layer, the block size is equal to the layer size (encryption throughput), the plaintext length is divided by the block size to get the number of block divisions, if it is not divisible, round up, for the non-tail complete block, use the encryption method selected by the layer to encrypt the entire plaintext, if it is not divisible when dividing into blocks, then when the first layer that needs to be filled is encountered, the number of layers to be filled is recorded (1 when the plaintext is recorded), the body code rule or length of the filling is recorded, and then the content of the layer is filled and the encryption method selected by the layer is used to encrypt the content of the encrypted throughput length of the layer, and then the encryption of this order is ended, and i is incremented; if this order has multiple layers, the block size is equal to the sum of the sizes (encryption throughput) of all layers of this order, the plaintext length is divided by the block size to get the number of block divisions, if it is not divisible, round up, for the non-tail complete block, the division of the layers within the block is divided into multiple layers. Then, the encryption method selected by the layer is used to encrypt the content of the one-time encryption throughput length of each layer in turn, and the encryption within a certain block is completed. Then, the next non-tail complete block is encrypted in turn using the same method. If the remaining plaintext length is less than the block throughput length, that is, there is a situation where padding encryption is required, the block is divided according to the layers, and the encryption method selected by the layer is used to encrypt the content of the one-time encryption throughput length of each layer that does not need to be padded. If the block cannot be divided evenly, when the first layer that needs to be padded is encountered, the number of padded layers and the padded body code rule or length are recorded, and then the content of the layer is padded and the encryption method selected by the layer is used to encrypt the content of the one-time encryption throughput length of the layer, and then the encryption of this order is ended. Even if there are other layers after this layer of the block, skip it and increment i.
[0065] When the order i ≥ 2, the ciphertext encrypted in the previous order is used as the plaintext to be encrypted in this order, and the encryption work similar to that when i = 1 is repeated, and i is incremented;
[0066] The cycle continues until i=m+1, then the encryption is completed. The ciphertext after i=m-order encryption is the final ciphertext.
[0067] When applied to different scenarios and for different purposes, the encryption method selected for each level and layer of the message to be transmitted has certain limitations:
[0068] When applied to P2N scenarios, since there are multiple receivers and only one sender, the encryption method used for any order and any layer of the transmitted message is limited to any symmetric encryption method, including symmetric encryption method that transmits keys on the network and symmetric encryption method that does not use network transmission keys; it is not allowed to use any asymmetric encryption method for any order and any layer of the transmitted message.
[0069] When applied to N2P scenarios, since there is only one recipient and there can be multiple senders, the encryption method used for any order and layer of the transmitted message is limited to any symmetric encryption method, asymmetric encryption method using the recipient's public key, and encryption method using the recipient's public key to encrypt a symmetric key; asymmetric encryption method using the sender's private key and symmetric encryption method using key exchange are not allowed for any order and layer of the transmitted message.
[0070] When applied to P2P scenarios, since there is only one receiver and one sender, the encryption method used for any order and any layer of the transmitted message is allowed to use any symmetric encryption method and any asymmetric encryption method.
[0071] The following table shows the result:
[0072]
[0073] In a second aspect, an embodiment of the present invention provides a hybrid decryption method (H-decryption method) to decrypt the ciphertext encrypted by the encryption method described in the first aspect into plaintext, the method comprising:
[0074] Get the selected order m, and the number of layers n selected for each order i i (1≤i≤m and i∈Z), which can be recorded in the form of a vector as follows:
[0075] n1 n2 … n m-1 n m ,
[0076] (The acquisition method is derived from the "information management and signature verification method for variable-length header data of hybrid encryption and decryption" and the "management method for encryption means of hybrid encryption and decryption" in the third and fifth aspects of the present invention, which will be introduced below);
[0077] Get the encryption method and key selected for each layer of each stage,
[0078] (The acquisition method is derived from the "Method for Implementing Information Management and Signature Verification for Variable-Length Header Data in Hybrid Encryption and Decryption", "Method for Storing and Managing Hybrid Encryption and Decryption Keys and Certificates", and "Method for Managing Encryption Means in Hybrid Encryption and Decryption" in the following third, fourth, and fifth aspects of the present invention, which will be introduced below);
[0079] Enter the loop;
[0080] Starting from the outermost order i = m, if there is only one layer in this order, the block size is equal to the layer size (decryption throughput). The number of block divisions is obtained by dividing the ciphertext length by the block size. In the case of only one layer, the number of blocks must be an integer. Use the selected decryption method of this layer to decrypt the entire ciphertext until the last block is encountered. Obtain the recorded number of padding layers (1 when recording the plaintext), obtain the recorded padding body code rule or length, use the selected decryption method of this layer to decrypt the content with the length of one-time decryption throughput of this layer, delete the length of the trailing padding from the decrypted content, and then end the decryption of this order and decrement i; if there are multiple layers in this order, the block size is equal to the sum of the sizes (decryption throughputs) of all layers in this order. The number of block divisions is obtained by dividing the ciphertext length by the block size. If it is not divisible, round up. For non-trailing complete blocks, within the block, according to the layer division, successively use the selected decryption method of each layer to decrypt the content with the length of one-time decryption throughput of this layer. After completing the decryption within a block, use the same method to decrypt the next non-trailing complete block successively until the last block is encountered. Obtain the recorded number of padding layers and the recorded padding body code rule or length. If the recorded padding length is 0, decrypt the trailing block in the same way, otherwise, within the block, according to the layer division, first successively use the selected decryption method of each non-padding layer to decrypt the content with the length of one-time decryption throughput of this layer until the recorded padding layer is encountered, use the selected decryption method of this layer to decrypt the content with the length of one-time decryption throughput of this layer, delete the length of the trailing padding from the decrypted content, and then end the decryption of this order and decrement i;
[0081] When the order number i < m, use the plaintext encrypted in the previous order as the ciphertext to be decrypted in this order, repeat the decryption work similar to that when i = m, and decrement i;
[0082] Loop until i = 0, then jump out of the loop, and the decryption is completed. The plaintext after the first-order decryption is the final plaintext.
[0083] In a third aspect, an embodiment of the present invention provides an encapsulation format of variable-length header data, in particular, a method for implementing information management and signature verification for variable-length header data for hybrid encryption and decryption, used in conjunction with the hybrid encryption method (H-encryption method) and hybrid decryption method (H-decryption method) of the first and second aspects above, in conjunction with the following fourth, fifth, and sixth aspects of the H-key certificate, encryption method, and key distribution related methods, using variable-length header data to implement information encapsulation encapsulation format; at the same time, encryption method identification, usage method identification, plaintext hash verification, key hash verification, encryption method management, and digital signature authentication functions are implemented, and the method includes:
[0084] A packaging format, different from the distinguishing header information of other file formats, the indefinite-length header data involved in the third aspect of the present invention has the characteristics of a distinguishing file format, and is usually used for packaging various types of ciphertext, configuration information containing keys and certificates, etc.
[0085] A method for encapsulating information, generating corresponding indefinite length header data according to the information to be encapsulated and the encryption method involved, and encapsulating the information;
[0086] A method for decapsulating information, identifying and checking the indefinite-length header data carried by the information, performing integrity check and digital signature check on the data field of the indefinite-length header data according to the indefinite-length header data, performing integrity check on the encapsulated information according to the indefinite-length header data, generating a corresponding encryption method according to the indefinite-length header data, decapsulating the information if the check and generation pass;
[0087] An interface that can be called by H-encryption, decryption and related encapsulation programs to cooperate with H-encryption, decryption and encapsulation to realize all functions related to operations with variable-length header data;
[0088] An interface that calls other related methods and functions to obtain, process, and transmit information, and is used to implement all functions related to operations with variable-length header data.
[0089] Furthermore, for the encapsulation format of variable-length header data, the methods used include:
[0090] Three areas of variable-length header data are established, namely: content area, check area, and segmentation area.
[0091] Distinguish two forms of variable-length header data: visual form (long form) and simplified form (short form).
[0092] In the content field and check field of the indefinite-length header data, different information exists in the form of modules. There are three types of areas in the module, namely: standard descriptor field, body code rule field, and module information field.
[0093] The content domain records the following modules in sequence. The necessary modules are:
[0094] Identify an identification module using the variable-length header information of the third aspect of the present invention;
[0095] Identify the version number module using the non-lengthy header information of the third aspect of the present invention;
[0096] A module that describes the encryption used by the encapsulated information, usually a set of optional encryption types, H-hybrid encryption types, or plain text flags;
[0097] The type description module of the encapsulated information is usually a set of optional configuration files, text information, binary information, file information, public key certificates, private key certificates, etc.
[0098] The method description module of the encryption algorithm used is usually a set of symbols and corresponding body code rules for various existing encryption methods. This module is default or ineffective when H- is selected;
[0099] The module describing the padding method used is usually a set of padding types and corresponding body code rules. This module is default or ineffective when H- is selected;
[0100] The hash management module of the encapsulated information content is usually a set of hash marks containing the ciphertext form of the encapsulated information content, and the body code rules of the selected hash function are used to hash the ciphertext of the encapsulated information content.
[0101] The hash management module of the encryption method used, etc., is usually a set of symbols including the hash of the key used, the certificate used or the content of the H-module, the body code rules of the selected hash function, and the hash value of the hash of the key used, the certificate used or the content of the H-module;
[0102] Optional modules are:
[0103] The H-encryption means management content module is usually a set of secondary packaged content containing H-encryption means management content;
[0104] The non-H-encryption means management module is generally a set of the latest modified unique code of the data structure used when the non-H-encryption covert distribution without transferring the certificate is performed in coordination with the storage and management method for hybrid encryption and decryption keys and certificates according to the fourth aspect of the present invention, the ranks, groups, parent key or certificate usage methods, and subkeys or certificates recorded in the form of a replacement table;
[0105] The remark content module usually contains customizable remark information. It may also be used for length alignment in stream encryption and may be used to store encrypted temporary keys when using temporary symmetric keys.
[0106] The streaming management module is usually a set of information including the streaming state, the unique streaming code of the previous streaming and the unique streaming code of the current streaming.
[0107] It should be noted that when some optional modules are selected, some necessary modules in the data domain may be omitted. For details, please see the following table:
[0108]
[0109] Therefore, the above-mentioned necessary modules are only the modules necessary for complete writing under normal circumstances. Under special circumstances and special optimizations, some modules may not need to be written. At this time, the modules that need to be written should be based on the requirements under special circumstances and optimizations.
[0110] The verification domain only contains a hash management module that hashes all the contents in the content domain, including functions such as content verification and digital signature, to achieve complete functions of hash management and digital signature verification; when digital signature verification is selected, the module stores data encrypted with the hash value using the private key used for signing.
[0111] The segmentation domain only records the module used to end the entire variable-length header data and to segment the variable-length header and the following valid information.
[0112] Further, according to the module's definition of variable-length header data, operations related to variable-length header data include:
[0113] A method for encapsulating information, comprising:
[0114] According to the information to be encapsulated and the encryption method involved, select the module in the content domain to be used, and complete the processing and writing preparation of the data in the module;
[0115] In the file header, the hash value of the encapsulated ciphertext and the encryption method (key, certificate or H-module content) is calculated, and the modules that need to be written in the content domain are written in sequence, namely, the identification module of the indefinite-length header information, the version number module, the encryption situation description module, the type description module, the encryption algorithm method description module, the padding method description module, the encapsulated information content hash management module, and the adopted encryption method hash management module; according to the selection, the optional H-encryption means management content module, the non-H-encryption means management module, the remarks content module, the streaming management module, etc. are optionally written; thus completing the writing of the content domain;
[0116] Hash the content of the content domain using the corresponding method, optionally digitally sign the hash, and write it into the verification domain;
[0117] Write the contents of the split domain;
[0118] Write to all areas to complete the data encapsulation.
[0119] A method for unblocking information, comprising:
[0120] Identify and check the indefinite-length header data carried by the information, and read the modules in the content domain in the file header in sequence, namely, the identification module of the indefinite-length header information, the version number module, the encryption description module, the type description module, the encryption algorithm method description module, the filling method description module, the encapsulated information content hash management module, and the adopted encryption method hash management module; according to the existing optional modules, read the possible H-encryption means management content module, non-H-encryption means management module, remark content module, streaming management module, etc.; thus completing the reading of the content domain;
[0121] Read the method for hash transformation and optional digital signature in the verification domain, read the hash or the hash after digital signature, if the digital signature is selected, it is necessary to verify and decrypt the signature to obtain the hash plaintext of the content domain;
[0122] Perform hash verification, perform integrity verification on the content field of the variable-length header data according to the hash plaintext of the content field, perform integrity verification on the encapsulated information according to the variable-length header data, and perform integrity verification on the encryption method (key, certificate or H-module content) used for the encapsulated information according to the variable-length header data;
[0123] Perform the work of restoring the encryption method, and derive and generate the corresponding encryption method according to the information about the encryption method in the variable-length header data (which needs to be completed based on other aspects of the present invention, such as the management method of the encryption means of hybrid encryption based on the fifth aspect of the present invention);
[0124] The checksum is generated successfully, and the data is unsealed.
[0125] It should be noted that the data and operations involved in the indefinite-length header data involved in the third aspect of the present invention have the characteristics of scalability, which is manifested in that: the content domain can add or delete corresponding modules according to the actual use and the development needs of science and technology, and the verification domain can also add or delete corresponding functions according to the actual use needs and the development needs of science and technology. It can add or delete corresponding operations according to the actual use and the development needs of science and technology. At the same time, there is no theoretical restriction on the storage form and storage length, and it is scalable. At the same time, the relevant data and operations involved in the method for implementing information management and signature verification for indefinite-length header data for hybrid encryption and decryption involved in the third aspect of the present invention are only some necessary data and operations. Any additions, deletions, and other modifications to the method of the third aspect of the present invention by ordinary technicians in this field without creative labor are within the scope of protection of the present invention.
[0126] In a fourth aspect, an embodiment of the present invention provides a method for storing and managing hybrid encryption and decryption keys and certificates, in particular, a method for cooperating with the hybrid encryption method (H-encryption method) and hybrid decryption method (H-decryption method) of the first and second aspects, cooperating with the digital signature function of the indefinite-length header data of the third aspect, and cooperating with the following fifth and sixth aspects of the management method and distribution method of the encryption means for hybrid encryption and decryption. For the storage and management method of hybrid encryption and decryption keys and certificates, the method includes:
[0127] A data structure of a key and certificate database. The data structure corresponding to the key and certificate storage and management method involved in the fourth aspect of the present invention has the characteristics of a database and is generally used to store the key and certificate data of the current user, store the key and certificate data that other users need to store locally and transmit in the form of configuration files, store the management method of the encryption means related to hybrid encryption and decryption, etc.
[0128] A management method related to the data structure of a database of keys and certificates, capable of initializing, generating, modifying, and verifying data in the data structure, capable of writing the data in the data structure to a local file, saving it in the form of a disk file, and capable of reading the data structure written in the disk file and regenerating the data structure;
[0129] An interface that can be called by H-encryption, decryption and related packaging programs, used to cooperate with H-encryption and decryption to realize the full functions of the storage and management method of hybrid encryption and decryption keys and certificates;
[0130] An interface that calls other related methods and functions to obtain, process, and transmit information, and is used to implement all functions of the storage and management method of hybrid encryption and decryption keys and certificates.
[0131] Furthermore, for the storage of hybrid encryption and decryption keys and certificates, the complete data structure needs to include the following:
[0132] According to the storage status of the key or certificate stored in the row or column, usually true in bool form indicates that the row or column stores the key or certificate;
[0133] According to the latest modification of the key or certificate stored in the row or column, usually true in bool form indicates that the key or certificate of the row or column was modified the most recently;
[0134] Store the corresponding keys or certificates by row, column, or group;
[0135] A substitution table used to mix and encrypt the key or certificate content in a row or column, usually a random set of substitution tables covering all existing keys or certificates;
[0136] The substitution table used for mixed encryption and decryption group numbers is usually a random set of substitution tables containing all possible group numbers;
[0137] A substitution table for mixed encryption and decryption key usage, usually a random set of substitution tables containing all possible key usage methods for different purposes;
[0138] A substitution table for different possible combinations of mixed encryption and decryption levels and layer settings, usually a random set of substitution tables that supports all combinations;
[0139] A replacement table for mixed encryption and decryption scenarios and usage flags, usually a random set of optional P2P, P2N, and N2P replacement tables;
[0140] The padding substitution table used for hybrid encryption and decryption is usually a random set of substitution tables containing all possible padding orders, layer positions and padding lengths;
[0141] A digital substitution table for time involved in mixed encryption and decryption, usually a random set of substitution tables containing year time, month time and each digit;
[0142] A mark indicating the private key certificate of the user or the key certificate of another user obtained through transmission;
[0143] A flag that indicates the integrity of the data structure, usually a set of optional errors, user data, other user interface public keys, other user complete public keys, etc.
[0144] Version number, creation date, last modified date, expiration date, number of modifications since initial creation;
[0145] the machine code of the machine that generated the stored keys and certificates;
[0146] The unique code issued at the time of the last modification;
[0147] The unique identifier of the most recently modified keystore in use.
[0148] Further, according to the definition of complete storage content, methods and operations related to the data structure for storage and management of hybrid encryption and decryption keys and certificates include:
[0149] Compliance verification of stored content (different ownership and integrity flags have different verification contents), usually used to check whether there are illegal settings and incomplete content in the data structure;
[0150] Generate version number, creation date, last modified date, validity period, and number of modifications since initial creation;
[0151] Get the version number, creation date, last modified date, validity period, and number of modifications since initial creation;
[0152] the machine code of the machine that generated the stored keys and certificates;
[0153] Generate the unique code issued at the time of the last modification and the unique code after the latest modification;
[0154] Set a mark to mark the private key certificate of this user or the key certificate of other users obtained through transmission;
[0155] Set the flags that indicate the integrity of the data structure;
[0156] When marking the key certificate of this user, the data structure is initialized, and the version number, creation date, last modification date, validity period, number of modifications since initial creation, machine code, unique code at the time of last modification, and unique code after the latest modification are automatically generated;
[0157] When signing other users' key certificates, initialize the data structure to allow setting of the generated version number, creation date, last modified date, validity period, number of modifications since initial creation, machine code, unique code issued at the last modification, and unique code after the latest modification;
[0158] conversion of all relevant data members to corresponding substitution tables, and conversion of corresponding substitution tables to all relevant data members;
[0159] Generate a random key of a specific length that can be used for symmetric encryption;
[0160] When marking the key certificate of this user, it is allowed to obtain the key or certificate stored in the row, column or group through the row, column or group, to modify the key or certificate stored in the row, column or group through the row, column or group, and to delete the key or certificate stored in the row, column or group through the row, column or group; it is allowed to obtain the key or certificate stored in the row, column or group through the replacement table, to modify the key or certificate stored in the row, column or group through the replacement table, and to delete the key or certificate stored in the row, column or group through the replacement table; and all the asymmetric keys or certificates of public key cryptography stored must contain the public key and the private key; the above-mentioned modification and deletion allow single modification of a single item, and also allow single modification of multiple items;
[0161] When marking the key certificate of other users, it is allowed to obtain the key or certificate corresponding to the row, column, or group storage through the replacement table, it is allowed to modify the key or certificate corresponding to the row, column, or group storage through the replacement table, and it is allowed to delete the key or certificate corresponding to the row, column, or group storage through the replacement table; and all stored asymmetric keys or certificates of public key cryptography must only contain public keys; the above-mentioned modification and deletion allow single modification of a single item, and also allow single modification of multiple items;
[0162] When marking the key certificate of this user, each time the initial setting or modification of the stored key or certificate is completed, the storage status of the key or certificate stored in rows and columns, the latest modification status of the key or certificate, the last modification date, the validity period, the number of modifications since the initial creation, the unique code issued at the last modification, and the unique code after the latest modification are automatically modified, and the entire replacement table is automatically refreshed and reset;
[0163] When marking other users' keys and certificates, each time the initial setting or modification of the stored keys or certificates is completed, the storage status of the keys or certificates stored in rows and columns, the latest modification status of the keys or certificates are automatically modified, and the last modification date, validity period, number of modifications since the initial creation, unique code issued at the last modification, and unique code after the latest modification are allowed and must be set, and all replacement tables are automatically refreshed and reset;
[0164] When marking the key certificate of this user, automatically generate a substitution table for the key or certificate content in the mixed encryption and decryption row and column, automatically generate a substitution table for the mixed encryption and decryption group number, automatically generate a substitution table for the key usage method, automatically generate a substitution table for different possible combinations of the order and layer settings, automatically generate a substitution table for the decryption scene and purpose mark, automatically generate a substitution table for the filling situation, and automatically generate a digital substitution table involving time;
[0165] When marking the key certificate of other users, it is allowed and necessary to set a substitution table for the key or certificate content in the mixed encryption and decryption row and column, automatically generate a substitution table for the mixed encryption and decryption group number, automatically generate a substitution table for the key usage method, automatically generate a substitution table for different possible combinations of the order and layer settings, automatically generate a substitution table for the decryption scenario and purpose mark, automatically generate a substitution table for the filling situation, and automatically generate a digital substitution table involving time;
[0166] When marking the key certificate of this user, each time any replacement table is modified, it will automatically detect whether the replacement content in each replacement table is repeated and automatically replace the repeated items, automatically modify the last modification date, validity period, number of modifications since the initial creation, the unique code issued at the last modification, and the unique code after the latest modification, and set the latest modification status (for the key and certificate) to all false; each time any replacement table is modified, all data in the table must be modified and reset at the same time;
[0167] When marking other users' key certificates, each time any replacement table is modified, the replacement content in each replacement table is automatically detected to see if it is repeated and the repeated items are automatically replaced. The last modification date, validity period, number of modifications since initial creation, unique code issued at the last modification, and unique code after the latest modification are allowed and must be set. The latest modification (for keys and certificates) is set to all false. Each time any replacement table is modified, all data in the table must be modified and reset at the same time.
[0168] When marking the key certificate of this user, after completing the initialization operation and compliance inspection, it is allowed to write local files for all contents in the data structure, which are used to locally save the distributed database (this file is defined as the personal key library of this user), including the version number, creation date, last modification date, validity period, number of modifications since the initial creation, machine code, unique code issued at the last modification, unique code after the latest modification, mark of the private key certificate of this user or the key certificate of other users obtained through transmission (marked as this user), storage status of keys or certificates, all keys and all certificates, replacement table of key or certificate contents, replacement table of group numbers, replacement table of key usage methods, replacement table of different possible combinations of order and layer settings, replacement table of scene and use marks, replacement table of filling status, digital replacement table involving time and other data; this user is allowed to read the personal key library written to the local file into the data structure and perform compliance inspection;
[0169] When marking the key certificate of this user, after completing the initialization operation and compliance inspection, it is allowed to write local files for all contents in the data structure, which is used for the first plain text distribution of part of the configuration file to other users (this file is defined as the interface public key for transmission), including the version number, creation date, last modification date, validity period, number of modifications since the initial creation, machine code, unique code issued at the last modification, unique code after the latest modification, mark of the private key certificate of this user or the key certificate of other users obtained through transmission (marked as other users), storage status of interface key or public key certificate, interface public key certificate (a specific group of key certificates among all key certificates, and exported as public key certificate) and other data; other users (specific or non-specific) who receive this file are allowed to read the interface public key for transmission written to the local file into the data structure, perform compliance inspection and write local files;
[0170] When marking the key certificate of this user, after completing the initialization operation and compliance inspection, it is allowed to write local files to all the contents in the data structure for the second encrypted distribution of part of the configuration file to other users (this file is defined as the complete public key for transmission), including version number, creation date, last modification date, validity period, number of modifications since initial creation, machine code, unique code issued at the last modification, unique code after the latest modification (required to have the same unique code as the interface public key file, that is, no changes are allowed to the data structure during the two distribution processes), marking the private key certificate of this user or the key of other users obtained through transmission Writing of data such as certificate marks (marks for other users), storage status of keys or certificates (or the latest modification of keys or certificates), all keys and public key certificates (or the latest modified keys or certificates), replacement table of key or certificate content, replacement table of group numbers, replacement table of key usage methods, replacement table of different possible combinations of tier settings, replacement table of scene and usage marks, replacement table of filling status, and digital replacement table involving time; allowing other users (specific or non-specific) who receive this file to read the complete public key for transmission written to the local file into the data structure, perform compliance checks, and write local files;
[0171] When marking the key certificate of another user, if it is necessary to modify the data structure according to the new other user's complete public key for transmission and thus update the locally stored old other user's complete public key for transmission, if the machine code of the new other user's complete public key for transmission is the same as the machine code of the old other user's complete public key for transmission, the unique code issued when the new other user's complete public key for transmission was last modified is the same as the latest modified unique code of the old other user's complete public key for transmission, and all the interface public keys in the other user's complete public key for transmission have not changed, then the new other user's complete public key for transmission can be used to overwrite the old complete public key for transmission of this user, and the information of all items is updated to the information in the new complete public key for transmission.
[0172] It should be noted that the data structure and operation of the storage and management method of the hybrid encryption and decryption keys and certificates involved in the fourth aspect of the present invention have the characteristics of scalability, which is manifested in that: the corresponding data and operations that need to be added or deleted can be added or deleted according to the actual use and the development of science and technology, and the corresponding storage data and the form of implementing the operation can be changed according to the actual use needs and the development of science and technology. At the same time, there is no theoretical restriction on the storage form and storage length, and it is scalable. At the same time, the relevant required data and operations involved in the storage and management method of the hybrid encryption and decryption keys and certificates involved in the fourth aspect of the present invention are only some of the necessary data and operations. Any additions, deletions, and other modifications to the method of the fourth aspect of the present invention by ordinary technicians in this field without the need for creative labor are within the scope of protection of the present invention.
[0173] In a fifth aspect, an embodiment of the present invention provides a management method for hybrid encryption and decryption encryption means, in particular, a hybrid encryption method (H-encryption method) and a hybrid decryption method (H-decryption method) in cooperation with the first and second aspects, an optional H-module for variable-length header data in cooperation with the third aspect, a storage and management method for hybrid encryption and decryption keys and certificates in cooperation with the fourth aspect, a method for operating, managing and protecting hybrid encryption and decryption in cooperation with distributed secret-in-secret double-layer distribution in the sixth aspect, a management method for hybrid encryption and decryption encryption means, the method comprising:
[0174] A data structure for managing hybrid encryption and decryption methods;
[0175] A method for initializing, generating, and modifying data members in a data structure;
[0176] A method for exporting the encryption means in the data structure in a specific format in cooperation with the optional H-module of the third aspect of the indefinite-length header data, and for writing the optional H-module of the indefinite-length header data;
[0177] A method for importing data in the optional H-module of the indefinite-length header data in a specific format in cooperation with the optional H-module of the indefinite-length header data of the third aspect to generate various encryption means required in the data structure;
[0178] A compliance check, usually used to check whether the data structure has illegal settings and incomplete content;
[0179] Used to cooperate with the keys and certificates stored in the hybrid encryption method (H-encryption method) of the first aspect and the key and certificate storage and management method of the fourth aspect, and guide the hybrid encryption method to perform hybrid encryption;
[0180] Used to cooperate with the keys and certificates stored in the hybrid decryption method (H-decryption method) of the second aspect and the key and certificate storage and management method of the fourth aspect, and guide the hybrid decryption method to perform hybrid decryption;
[0181] An interface that can be called by H-encryption, decryption and related encapsulation programs to cooperate with H-encryption and decryption to realize the full functions of the management of hybrid encryption and decryption methods;
[0182] An interface that calls other related methods and functions to obtain, process and transmit information, and is used to implement all functions of managing hybrid encryption and decryption encryption methods.
[0183] Furthermore, for the data structure of the hybrid encryption and decryption means management method, the complete data structure needs to include:
[0184] A unique identifier of the most recently modified data structure of the target user's database of keys and certificates;
[0185] Optional unique identifier of the most recent modification of the data structure of the user's database of keys and certificates;
[0186] H-The plain text and cipher text form of the information encapsulated by the module and header data;
[0187] Flag H-The flag for the purpose of the information encapsulated by the module and the header data, usually a set of optional ciphertexts, ciphertexts encrypted by a fixed method, interface public keys for transmission, complete public keys for transmission, updates of complete public keys for transmission, and flags for the user's personal key library for local storage;
[0188] The scenario and usage mark of mixed encryption and decryption;
[0189] The level and layer settings of hybrid encryption and decryption;
[0190] The keys and certificates used at each level and layer and the methods of use are expressed in the form of rows, columns, and groups. Usually, it is a set of secondary data structures including rows of parent keys or certificates, columns of parent keys or certificates, groups of parent keys or certificates, methods of use of parent keys or certificates, rows of child keys or certificates, columns of child keys or certificates, and groups of child keys or certificates.
[0191] The padding situation is expressed in terms of the number of layers and the padding code rule or length, which is usually a set of secondary data structures including the position of each layer of padding, the padding code rule or length of each layer of padding;
[0192] The flag for the type of information encapsulated in the variable-length header data;
[0193] Optional time limit for allowing decryption, usually a data structure containing the start time and end time of allowing decryption;
[0194] Optional restrictions on the machines that are allowed to decrypt, usually a data structure containing the machine code of one or more machines that are allowed to decrypt;
[0195] Further, according to the definition of the complete data structure for managing the hybrid encryption and decryption encryption means, the operations related to the complete data structure for the hybrid encryption and decryption encryption means include:
[0196] The latest modified unique code of the data structure of the database of the target user key and certificate used, the latest modified unique code of the data structure of the optional database of the user key and certificate used, the plaintext and ciphertext forms of the information encapsulated by the H-module and the header data used, the purpose of the information encapsulated by the H-module and the header data used, the scenario and purpose of the hybrid encryption and decryption used, the order and layer of the hybrid encryption and decryption used, the keys and certificates used for each order and layer in the form of rows, columns and groups and the method of use, the type of information encapsulated in the indefinite-length header data used, the optional time limit for decryption allowed, the optional machine limit for decryption allowed, etc.;
[0197] Allow external modification of the filling situation expressed by the number of layers per level and the filling body code rule or length;
[0198] Export the encryption method in the data structure in a specific format, which is used to write the optional H-module of variable length header data;
[0199] The data in the optional H-module of the variable-length header data is imported in a specific format to generate various encryption methods required in the data structure.
[0200] Furthermore, for an optional H-module that exports the encryption means in the data structure in a specific format and writes it into the indefinite-length header data, the content of the optional H-module that writes the indefinite-length header data needs to include:
[0201] A unique identifier of the most recently modified data structure of the target user's database of keys and certificates;
[0202] The unique identifier of the most recent modification to the data structure of the user's key and certificate database;
[0203] H-The plain text and cipher text form of the information encapsulated by the module and header data;
[0204] Flag H-The flag for the purpose of the information encapsulated by the module and the header data, usually a set of optional ciphertexts, ciphertexts encrypted by a fixed method, interface public keys for transmission, complete public keys for transmission, updates of complete public keys for transmission, and flags for the user's personal key library for local storage;
[0205] Replacement table for scenarios and uses of hybrid encryption and decryption;
[0206] A substitution table for the order and layer settings of hybrid encryption and decryption;
[0207] The keys and certificates used at each level and layer and the usage methods are expressed in the form of a substitution table of the target user (or the current user), which is usually a combination of a parent key or certificate row and column substitution table, a parent key or certificate group substitution table, a parent key or certificate usage method substitution table, a subkey or certificate row and column substitution table, and a subkey or certificate group substitution table; usually followed by random byte random number interference;
[0208] The padding situation expressed in the form of a substitution table for the target user is usually a combination of a layer position substitution table for each level of padding, a padding body code rule for each level of padding, or a length substitution table; usually followed by random byte random number interference;
[0209] The time point at which the H-encapsulation is completed in the form of a substitution table for the target user;
[0210] The time limit for allowing decryption expressed in the form of a replacement table of the target user is usually a combination of a replacement table of the start time for allowing decryption and a replacement table of the end time for allowing decryption;
[0211] The restriction of machines allowed to decrypt is expressed in the form of a substitution table for the target user, usually a set of machine codes containing one or more machines allowed to decrypt; usually followed by a standard hash value for all machine codes;
[0212] The encapsulated information represented in the form of a substitution table for the target user is encrypted and a length substitution table of random bytes and random numbers is appended to the end, which is usually recorded in the form of a filler code rule or a length substitution table;
[0213] It should be noted that the above content that needs to be exported and written is only necessary for complete writing under normal circumstances. In special circumstances and special optimizations, some content may not need to be written. At this time, the content that needs to be written should be based on the needs of special circumstances and optimizations.
[0214] Furthermore, the data in the optional H-module of the indefinite-length header data is imported in a specific format to generate various encryption methods required in the data structure. The content imported from the optional H-module of the indefinite-length header data needs to include the same content as the above-mentioned exported content. It should be noted that the above-mentioned content that needs to be imported is only the content necessary for a complete import under normal circumstances. In special circumstances and special optimizations, some content may not need to be imported by default. At this time, the content that needs to be imported should be based on the needs of the special circumstances and optimizations.
[0215] It should be noted that the data structure of the management method for the encryption means for hybrid encryption and decryption involved in the fifth aspect of the present invention and the data written into the H-module are both scalable, which is manifested in that: the corresponding data that needs to be added or deleted can be added or deleted according to the actual use and the development of science and technology, and the form of the corresponding stored data can be changed according to the actual use needs and the development of science and technology. At the same time, there is no theoretical restriction on the storage form and storage length, and it is scalable. At the same time, the relevant required data involved in the management method for the encryption means for hybrid encryption and decryption involved in the fifth aspect of the present invention is only part of the necessary data. Any additions, deletions, and other modifications to the method of the fifth aspect of the present invention by ordinary technicians in this field without creative labor are within the scope of protection of the present invention.
[0216] In a sixth aspect, an embodiment of the present invention provides a method for the operation, management and protection of hybrid encryption and decryption in combination with distributed secret-in-secret dual-layer distribution, in particular, a method for operating, managing and protecting hybrid encryption and decryption in combination with the hybrid encryption method (H-encryption method) and hybrid decryption method (H-decryption method) in combination with the first and second aspects, an optional H-module for variable-length header data in combination with the third aspect, a method for storing and managing hybrid encryption and decryption keys and certificates in combination with the fourth aspect, a method for managing encryption means for hybrid encryption and decryption in combination with the fifth aspect, a method for operating, managing and protecting hybrid encryption and decryption in combination with distributed secret-in-secret dual-layer distribution, the method comprising:
[0217] Generate user information;
[0218] The first plaintext distribution of the interface public key;
[0219] The second ciphertext distribution of the complete public key;
[0220] Resetting of interface public key;
[0221] Update of complete public key (non-interface public key);
[0222] H-encryption, encapsulation and distribution of ciphertext;
[0223] Receiving, H-decryption and unsealing of ciphertext;
[0224] Improved digital signature scheme based on H-;
[0225] Optimization for streaming encryption and encapsulation;
[0226] Optimization for anti-decryption of symmetric encryption;
[0227] Optimization of temporary symmetric keys in encapsulation;
[0228] An interface that calls other related methods and functions to obtain information, process information, transmit information, and implement encryption, decryption, encapsulation, and calculations, which is used to implement the operation, management, and protection of hybrid encryption and decryption with distributed secret-in-secret double-layer distribution, that is, to comprehensively realize all the functions of the above-mentioned aspects one to five of the present invention.
[0229] Furthermore, for the process of generating user information, the method used is:
[0230] Relying on the data structure and operation of the storage and management method of hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, a complete data structure of all keys and certificates of this user is generated, compliance checks are completed, and written to local files to save the user's personal key library.
[0231] Furthermore, for the process of distributing the plain text of the first interface public key, the method used includes and is limited to the P2N mode, which is:
[0232] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates according to the fourth aspect of the present invention, the personal key library of the user is used to restore the complete data structure of the original user's key and certificate, and the interface public key of the user for transmission is derived; in plain text form, it is encapsulated using variable-length header data: the H-module is selected for encapsulation in the variable-length header data, the type of encapsulated information is selected as a configuration file, the digital signature is not selected, the mark in H- is plain text, the purpose is selected as the interface public key, the time point for encapsulation is written, and the time limit for decryption is allowed to be set (the time limit for decryption may not be set), and other contents are defaulted;
[0233] Publicly send the user's interface public key for transmission on the network;
[0234] Receive the interface public key for transmission from other users on the network, implement information encapsulation based on the indefinite-length header data of the third aspect of the present invention, check and verify the indefinite-length header data and H-data, and then restore the data structure of other users containing information such as the interface public key based on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates of the fourth aspect of the present invention, write it into a local file, and preliminarily save the personal key library of other users;
[0235] It should be noted that the plain text distribution of the first interface public key does not support P2N and N2P modes. Due to the characteristics of public distribution, only P2N mode is supported.
[0236] Furthermore, for the second ciphertext distribution of the complete public key, the method used includes and is limited to the P2P and P2N modes, including:
[0237] Second ciphertext distribution of the complete public key (P2P mode):
[0238] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates according to the fourth aspect of the present invention, the personal key library of the present user is used to derive the complete public key of the present user for transmission; for the user who has the interface public key of the present user and needs to receive the complete public key, relying on the operation of the hybrid encryption method (H-encryption method) according to the first aspect of the present invention, the preset H-encryption method of the complete public key for transmission is used, first the interface private key of the present user is used for hybrid encryption, and then the interface public key of the recipient is used for hybrid encryption, and after each hybrid encryption, a random bit stream less than the output throughput length of the next layer of the outermost order is attached to the tail of the encrypted ciphertext; encapsulation is performed using variable-length header data: the H-module is selected for encapsulation in the variable-length header data, the type of the encapsulated information is selected as a configuration file, the digital signature is not selected, the mark in H- is ciphertext, the purpose is selected as the complete public key, the plaintext mark in H- is P2P mode, the time point for encapsulation is written, and the machine code of the user to be received is set as the only machine allowed to decrypt, and the time limit for allowing decryption is allowed to be set (the time limit for allowing decryption may also not be set), other contents are defaulted, and compliance inspection is performed;
[0239] Send the (encapsulated and encrypted) complete public key of the user for transmission to the receiving user;
[0240] Receive the complete public key (encapsulated and encrypted) for transmission sent by the to-be-received user, implement information encapsulation operation based on the indefinite-length header data of the third aspect of the present invention, check and verify the indefinite-length header data and H-data, analyze the H-data based on the data structure and operation of the management method for hybrid encryption and decryption encryption means of the fifth aspect of the present invention, confirm that it is the complete public key for transmission of the user, and confirm that the interface public key for transmission is already possessed; based on the operation of the hybrid decryption method (H-decryption method) of the second aspect of the present invention, use the preset H-decryption method of the complete public key for transmission, first use the interface private key of the user to decrypt, and then use the interface public key of the other user to decrypt; and then rely on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates of the fourth aspect of the present invention to restore the data structure of the user containing the complete public key, substitution table and other information, and write it into a local file to complete the storage of the user's personal key library;
[0241] as well as:
[0242] Second ciphertext distribution of the complete public key (P2N mode):
[0243] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, the user's personal key library is used to derive the user's complete public key for transmission; for all possible other users who have the user's interface public key and need to receive the complete public key, relying on the operation of the hybrid encryption method (H-encryption method) in the first aspect of the present invention, the preset H-encryption method for the complete public key for transmission is used, first using the user's interface private key for hybrid encryption, and then using the negotiated but not network-transmitted symmetric key for hybrid encryption, after each hybrid encryption, a symmetric key less than the outermost key is appended to the end of the encrypted ciphertext. The next layer outputs a random bit stream of throughput length; encapsulation is performed using variable-length header data: the H-module is selected for encapsulation in the variable-length header data, the type of encapsulated information is selected as a configuration file, the digital signature is not selected, the H- is marked as ciphertext, the purpose is selected as the interface public key, the plaintext mark in the H- is P2N mode, the time point for encapsulation is written, and the machine code of all possible other users to be received is allowed to be set as the only machine allowed to decrypt (the machine allowed to decrypt may not be set), the time limit for decryption may be set (the time limit for decryption may not be set), the other contents are defaulted, and compliance inspection is performed;
[0244] Send the user's complete public key for transmission (encapsulated and encrypted) to all other possible recipients;
[0245] From receiving the complete public key (encapsulated and encrypted) for transmission sent by all possible other users, relying on the indefinite-length header data of the third aspect of the present invention to implement the operation of information encapsulation, checking and verifying the indefinite-length header data and H-data, relying on the data structure and operation of the management method of hybrid encryption and decryption encryption means of the fifth aspect of the present invention, analyzing the H-data, confirming that it is the complete public key for transmission of other users, and confirming that the interface public key for transmission is already possessed; relying on the operation of the hybrid decryption method (H-decryption method) of the second aspect of the present invention, using the preset H-decryption method of the complete public key for transmission, first use the symmetric key that has been negotiated but not transmitted over the network to decrypt, and then use the interface public key of the other user to decrypt; and then relying on the data structure and operation of the storage and management method of hybrid encryption and decryption keys and certificates of the fourth aspect of the present invention, restore the data structure of other users containing complete public keys, replacement tables and other information, and write them into local files to complete the storage of other users' personal key libraries.
[0246] It should be noted that in addition to being transmitted over the network, the second encrypted distribution of the complete public key can also be physically transmitted to further enhance security. In the P2P mode, double hybrid encryption is performed using the sender and receiver keys respectively, which is actually a variant of the digital signature. Only the correct sender can generate valid encryption. In addition, the second encrypted distribution of the complete public key does not support the N2P mode. Due to the possible targeted distribution and confidentiality features, it only supports the P2P and P2N modes.
[0247] The support of different distribution and encryption and decryption modes for N2P, P2P, and P2N is shown in the following table:
[0248]
[0249] Furthermore, the method used for resetting the interface public key includes:
[0250] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, when a new interface public key for transmission of the user is generated, all other data in the data structure are forced to be refreshed due to the change of the interface public key, including clearing other certificates and keys, resetting the machine code, resetting the unique identification code twice, resetting the replacement table and resetting other data;
[0251] Complete the regeneration of all other keys and certificates of this user to form a complete personal key library;
[0252] Write to a local file to save the new personal keystore of this user.
[0253] It should be noted that the new personal keystore does not inherit the unique code issued when the old personal keystore was last modified and its latest modified unique code, loses association with the old personal keystore, and cannot be modified to generate a new personal keystore by modifying the old personal keystore; therefore, in normal use, resetting the interface public key should be avoided; at the beginning of the design, the strength of the interface public key is relatively strong, therefore, the interface public key should be reset when and only when there is a risk of the interface public key being deciphered.
[0254] It should be noted that after resetting the interface public key, it should be distributed twice again in sequence.
[0255] Furthermore, for the update of the complete public key (non-interface public key), the method used includes and is limited to P2P and P2N modes, including:
[0256] Update of the complete public key (non-interface public key) (P2P mode):
[0257] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates according to the fourth aspect of the present invention, the old personal key library of the user is used to modify the complete public key (non-interface public key), and relevant operations are performed to complete the compliance check, write to the local file, and save the new personal key library of the user;
[0258] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, the personal key library of this user is used to export the updated version of the complete public key of this user for transmission (the modified keys and certificates are saved, and the unmodified keys and certificates are not saved); since the interface public key has not changed, the latest modified unique code of the old personal key library becomes the unique code issued when the new personal key library was last modified, and other users can rely on the old personal key library of this user; for users who have the original complete public key of this user and need to receive the newly modified complete public key, the preset H-encryption method of the complete public key for transmission is used to first use the interface private key of this user for hybrid encryption The data is encrypted and then mixedly encrypted with the interface public key of the receiver. After each mixed encryption, a random bit stream less than the output throughput length of the next layer of the outermost order is added to the tail of the encrypted ciphertext; encapsulation is performed using variable-length header data: the H-module is selected for encapsulation in the variable-length header data, the type of encapsulated information is selected as a configuration file, the digital signature is not selected, the H- is marked as ciphertext, the purpose is selected as the modification of the complete public key, the plaintext mark in the H- is P2P mode, the time point for encapsulation is written, and the machine code of the user to be received is set as the only machine allowed to decrypt, and the time limit for decryption is allowed to be set (the time limit for decryption can also be set), the other contents are left blank, and compliance inspection is performed;
[0259] Send the (encapsulated and encrypted) complete public key of the user for transmission to the receiving user;
[0260] Receive the update of the complete public key for transmission (encapsulated and encrypted) sent by the to-be-received user, implement the information encapsulation operation based on the indefinite-length header data of the third aspect of the present invention, check and verify the indefinite-length header data and H-data, analyze the H-data based on the data structure and operation of the management method for hybrid encryption and decryption encryption means of the fifth aspect of the present invention, confirm that it is the update of the complete public key for transmission of the user, and confirm that the complete public key originally used for transmission is already owned; based on the operation of the hybrid decryption method (H-decryption method) of the second aspect of the present invention, use the preset H-decryption method of the complete public key for transmission, first use the interface private key of the user to decrypt, and then use the interface public key of the other user to decrypt; and then based on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates of the fourth aspect of the present invention, update the data structure of the modified complete public key, replacement table and other information contained in the user, and write it into the local file to complete the update of the user's personal key library;
[0261] as well as:
[0262] Update of the complete public key (non-interface public key) (P2N mode):
[0263] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates according to the fourth aspect of the present invention, the old personal key library of the user is used to modify the complete public key (non-interface public key), and relevant operations are performed to complete the compliance check, write to the local file, and save the new personal key library of the user;
[0264] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, the personal key library of this user is used to derive an updated version of the complete public key of this user for transmission (modified keys and certificates are saved, and unmodified keys and certificates are not saved); since the interface public key has not changed, the latest modified unique code of the old personal key library becomes the unique code issued when the new personal key library was last modified, and other users can rely on the old personal key library of this user; for all possible other users who have the original complete public key of this user and need to receive the newly modified complete public key, the preset H-encryption method of the complete public key for transmission is used, first using the interface private key of this user for hybrid encryption, and then using the negotiated but not network-connected private key to perform hybrid encryption. The symmetric key transmitted over the network is hybrid encrypted. After each hybrid encryption, a random bit stream less than the output throughput length of the next layer of the outermost order is attached to the end of the encrypted ciphertext; variable-length header data is used for encapsulation: the H-module is selected for encapsulation in the variable-length header data, the type of encapsulated information is selected as a configuration file, the digital signature is not selected, the ciphertext is marked in H-, the purpose is selected as the modification of the complete public key, the plaintext mark in H- is P2N mode, the time point for encapsulation is written, and the machine code of all possible other users to be received is allowed to be set as the only machine allowed to decrypt (or not set the machine allowed to decrypt), and the time limit for decryption is allowed to be set (or not set the time limit for decryption), other contents are left blank, and compliance inspection is performed;
[0265] Send the user's complete public key for transmission (encapsulated and encrypted) to all other possible recipients;
[0266] Receive the update of the complete public key for transmission (encapsulated and encrypted) sent by the to-be-received user, implement the information encapsulation operation based on the indefinite-length header data of the third aspect of the present invention, check and verify the indefinite-length header data and H-data, analyze the H-data based on the data structure and operation of the management method for hybrid encryption and decryption encryption means of the fifth aspect of the present invention, confirm that it is the update of the complete public key for transmission of the user, and confirm that the complete public key originally used for transmission is already owned; based on the operation of the hybrid decryption method (H-decryption method) of the second aspect of the present invention, use the preset H-decryption method of the complete public key for transmission, first use the symmetric key that has been negotiated but not used for network transmission to decrypt, and then use the interface public key of the other user to decrypt; and then based on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates of the fourth aspect of the present invention, update the data structure of the modified complete public key, replacement table and other information contained in the user, and write it into the local file to complete the update of the user's personal key library;
[0267] It should be noted that in addition to being transmitted over the network, physical transmission of the complete public key (non-interface public key) can further enhance security. In P2P mode, double hybrid encryption is performed using the sender and receiver keys respectively, which is actually a variant of the digital signature. Only the correct sender can generate valid encryption. In addition, the update of the complete public key (non-interface public key) does not support the N2P mode. Due to the possible targeted distribution and confidentiality features, it only supports P2P and P2N modes.
[0268] Furthermore, for H-encryption, ciphertext encapsulation and distribution, the methods used include P2P, N2P, and P2N modes, including:
[0269] H-encryption, ciphertext encapsulation and distribution (P2P mode):
[0270] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, when there is a personal key base of the user to be received, the personal key base of the current user and the personal key base of the user to be received are selected, and the complete data structure of the original user's key and certificate and the complete data structure of the interface public key of the user to be received are restored;
[0271] Relying on the data structure and operation of the management method of the hybrid encryption and decryption means in the fifth aspect of the present invention, a data structure for managing the hybrid encryption and decryption means is created, and the following aspects are set in sequence for the data structure: the latest modified unique code of the data structure of the database of the key and certificate of the user to be received is set, the latest modified unique code of the data structure of the database of the key and certificate of the user to be received is set, the plain text and cipher text form of the information encapsulated by the mark H-module and the header data used, the purpose of the information encapsulated by the mark H-module and the header data used, the scenario and purpose of the hybrid encryption and decryption used, the order and layer of the hybrid encryption and decryption used, the keys and certificates used for each order and each layer in the form of rows, columns and groups, and the method of use, the type of information encapsulated in the indefinite-length header data used, the optional time limit for allowing decryption, and setting the machine code of the user to be received as the machine limit for allowing decryption, etc.; finally, a compliance check is performed;
[0272] Relying on the data structure for managing the hybrid encryption and decryption means according to the fourth aspect of the present invention, relying on the hybrid encryption method (H-encryption method) according to the first aspect of the present invention and the keys and certificates stored by the storage and management method for keys and certificates according to the fourth aspect of the present invention, the hybrid encryption method is guided to hybrid encrypt the data to be encrypted to obtain the ciphertext after H-encryption, and a random digital stream of random length is appended to the end of the ciphertext to temporarily store the length of the random digital stream; during the encryption process, the padding condition represented by the number of layers and the padding body code rule or length is written into the data structure for managing the hybrid encryption and decryption means;
[0273] Use variable-length header data to encapsulate the encrypted ciphertext: select the H-module for encapsulation in the variable-length header data, select the type of encapsulated information as the corresponding data format, and select the digital signature. Write the latest modified unique code of the personal key library of the to-be-received user in H-, write the latest modified unique code of the personal key library of this user, the content mark is ciphertext, the purpose is selected as ciphertext, and the replacement table in the data structure corresponding to the personal key library of the to-be-received user is used as a reference. Write the P2P mode in the form of a replacement table, and write the order and layer settings adopted by H-encryption in the form of a replacement table; if the selected key or certificate is the key or certificate of this user, use the replacement table in the data structure corresponding to the personal key library of this user as a reference, and use the replacement table in the data structure corresponding to the personal key library of the to-be-received user as a reference for other keys or certificates. According to the order and layer settings, write the rows, columns, groups, and methods of using the parent keys or certificates used in each layer in the form of a replacement table. , subkeys or certificates, rows, columns, groups; then add a random bit stream of random length interference; with reference to the replacement table in the data structure corresponding to the personal key library of the user to be received, according to the order and layer settings, write the number of layers of each order filling and the length of the filling or the body code rule in the form of a replacement table, then add a random bit stream of random length interference, write the time point for encapsulation in the form of a time replacement table, and set the machine code of the user to be received as the only machine allowed to decrypt, allowing the time limit for decryption to be set in the form of a time replacement table (the time limit for decryption may not be set), and finally write the length of the random bit stream attached after encryption in the form of a replacement table; relying on the third aspect of the present invention, the variable-length header data realizes the operation of information encapsulation, hashes the ciphertext in the variable-length header data, hashes the key or certificate (in this case, hashes the H-module content), and completes the writing of the content field; then hashes the content field, performs a digital signature, completes the writing of the check field, and completes the whole encapsulation;
[0274] Send the encapsulated ciphertext to the receiving user;
[0275] It needs to be emphasized again that in the P2P mode, the encryption methods that can be used at each level and layer in H-encryption include and are limited to all symmetric encryption methods and all asymmetric encryption methods, including: symmetric encryption methods that transmit keys on the network, symmetric encryption methods that do not use network transmission keys, asymmetric encryption methods that use the public key of the receiver to encrypt, asymmetric encryption methods that use the private key of the sender to encrypt, methods that use the public key of the receiver to encrypt symmetric keys, and symmetric encryption methods that use key exchange;
[0276] as well as:
[0277] H-encryption, ciphertext encapsulation and distribution (N2P mode):
[0278] Relying on the data structure and operation of the storage and management method for the hybrid encryption and decryption key and certificate in the fourth aspect of the present invention, when the personal key library of the user to be received is available, the personal key library of the user to be received is selected, and the data structure of the complete interface public key of the user to be received is restored;
[0279] Relying on the data structure and operation of the management method of the hybrid encryption and decryption encryption means in the fifth aspect of the present invention, a data structure for managing the hybrid encryption and decryption encryption means is created, and the following aspects are set in sequence for the data structure: the latest modified unique code of the data structure of the database of the key and certificate of the user to be received is set, the plain text and cipher text forms of the information encapsulated by the mark H-module and the header data used, the purpose of the information encapsulated by the mark H-module and the header data used, the scenario and purpose of the hybrid encryption and decryption used, the order and layer of the hybrid encryption and decryption used, the keys and certificates used for each order and each layer represented in the form of rows, columns and groups, and the method of use, the type of information encapsulated in the indefinite-length header data used, the optional time limit for allowing decryption, setting the machine code of the user to be received as the machine limit for allowing decryption, etc.; finally, a compliance check is performed;
[0280] Relying on the data structure for managing the hybrid encryption and decryption means according to the fourth aspect of the present invention, relying on the hybrid encryption method (H-encryption method) according to the first aspect of the present invention and the keys and certificates stored by the storage and management method for keys and certificates according to the fourth aspect of the present invention, the hybrid encryption method is guided to hybrid encrypt the data to be encrypted to obtain the ciphertext after H-encryption, and a random digital stream of random length is appended to the end of the ciphertext to temporarily store the length of the random digital stream; during the encryption process, the padding condition represented by the number of layers and the padding body code rule or length is written into the data structure for managing the hybrid encryption and decryption means;
[0281] Use variable-length header data to encapsulate the encrypted ciphertext: select H-module for encapsulation in the variable-length header data, select the corresponding data format for the type of encapsulated information, do not select digital signature, write the latest modified unique code of the personal key library of the to-be-received user in H-, mark the content as ciphertext, select the purpose as ciphertext, use the replacement table in the data structure corresponding to the personal key library of the to-be-received user as a reference, write the N2P mode in the form of a replacement table, write the order and layer settings adopted by H-encryption in the form of a replacement table, according to the order and layer settings, write the ranks, groups, usage methods of the parent key or certificate, ranks, groups of subkeys or certificates used in each layer in the form of a replacement table, and then attach an interfering random bit stream of random length, according to the order and layer Set, write the number of filling layers and the length of filling or body code rules of each order in the form of a replacement table, then attach a random bit stream of random length interference, write the time point for encapsulation in the form of a time replacement table, and set the machine code of the user to be received as the only machine allowed to decrypt, allow the time limit for decryption to be set in the form of a time replacement table (or do not set the time limit for decryption), and finally write the length of the random bit stream attached after encryption in the form of a replacement table; rely on the third aspect of the present invention to implement the information encapsulation operation of the indefinite-length header data, hash the ciphertext in the indefinite-length header data, hash the key or certificate (at this time, hash the H-module content), and complete the writing of the content field; then hash the content field, complete the writing of the check field, and complete the whole encapsulation;
[0282] Send the encapsulated ciphertext to the receiving user;
[0283] It needs to be emphasized again that in the N2P mode, the encryption methods that can be used at each level and layer in H-encryption include and are limited to all asymmetric encryption methods and some asymmetric encryption methods, including: symmetric encryption methods that transmit keys on the network, symmetric encryption methods that do not use network transmission keys, asymmetric encryption methods that use the public key of the receiver to encrypt, and methods that use the public key of the receiver to encrypt symmetric keys; it is not allowed to use asymmetric encryption methods that use the private key of the sender to encrypt at any level or layer of the transmitted data and symmetric encryption methods that use key exchange for encryption;
[0284] as well as:
[0285] H-encryption, ciphertext encapsulation and distribution (P2N mode):
[0286] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, the personal key library of the user is selected to restore the data structure of the complete interface public key of the user;
[0287] Relying on the data structure and operation of the management method of the hybrid encryption and decryption means in the fifth aspect of the present invention, a data structure for managing the hybrid encryption and decryption means is created, and the following aspects are set in sequence for the data structure: the latest modified unique code of the data structure of the database of the key and certificate of the user used is set, the plain text and cipher text forms of the information encapsulated by the mark H-module and the header data used, the purpose of the information encapsulated by the mark H-module and the header data used, the scene and purpose of the hybrid encryption and decryption used, the order and layer of the hybrid encryption and decryption used, the key used for each order and each layer represented by rows, columns and groups and the method of use, the type of information encapsulated in the indefinite-length header data used, the optional time limit for allowing decryption, setting the machine code of the user to be received as the machine limit for allowing decryption, etc.; finally, a compliance check is performed;
[0288] Relying on the data structure for managing the hybrid encryption and decryption means according to the fourth aspect of the present invention, relying on the hybrid encryption method (H-encryption method) according to the first aspect of the present invention and the keys and certificates stored by the storage and management method for keys and certificates according to the fourth aspect of the present invention, the hybrid encryption method is guided to hybrid encrypt the data to be encrypted to obtain the ciphertext after H-encryption, and a random digital stream of random length is appended to the end of the ciphertext to temporarily store the length of the random digital stream; during the encryption process, the padding condition represented by the number of layers and the padding body code rule or length is written into the data structure for managing the hybrid encryption and decryption means;
[0289] Use variable-length header data to encapsulate the encrypted ciphertext: select H-module for encapsulation in the variable-length header data, select the corresponding data format for the type of encapsulated information, do not select digital signature, write the latest modified unique code of the user's personal key library in H-, mark the content as ciphertext, select the purpose as ciphertext, use the replacement table in the data structure corresponding to the user's personal key library as a reference, write the P2N mode in the form of a replacement table, write the order and layer settings used by H-encryption in the form of a replacement table, according to the order and layer settings, write the ranks, groups, usage methods of the parent key or certificate, ranks, groups of subkeys or certificates used in each layer in the form of a replacement table, and then append an interfering random bit stream of random length, according to the order and layer settings, in the form of a replacement table. Write the number of padding layers and the length of padding or body code rules for each order, then attach an interfering random bit stream of random length, write the time point for encapsulation in the form of a time replacement table, allow all possible machine codes of the receiving users to be set as machines that allow decryption (may not be set for machines that allow decryption), allow the time limit for decryption to be set in the form of a time replacement table (may not be set for time limit for decryption), and finally write the length of the random bit stream attached after encryption in the form of a replacement table; rely on the third aspect of the present invention to implement the information encapsulation operation of the indefinite-length header data, hash the ciphertext in the indefinite-length header data, hash the key or certificate (at this time, hash the H-module content), and complete the writing of the content field; then hash the content field to complete the writing of the check field, and thus complete the entire encapsulation;
[0290] Send the encapsulated ciphertext to all possible receiving users;
[0291] It needs to be emphasized again that in the P2N mode, the encryption methods that can be used at each level and layer in H-encryption include and are limited to all asymmetric encryption methods, including: symmetric encryption methods for transmitting keys on the network, and symmetric encryption methods that do not use network transmission keys; it is not allowed to use any asymmetric encryption method at any level or layer of the transmitted data.
[0292] Furthermore, for receiving, H-decrypting and unsealing ciphertext, the methods used include P2P, N2P and P2N modes, including:
[0293] Receiving, H-decrypting and unsealing ciphertext (P2P mode):
[0294] Receive the encapsulated ciphertext;
[0295] Relying on the indefinite-length header data of the third aspect of the present invention to realize the operation of information unsealing, the encapsulation of the ciphertext using the indefinite-length header data is unsealed, and hash and digital signature verification (P2P mode supports digital signature verification) are performed at the same time, and the latest updated unique code of the key library used is obtained (usually containing two, the former belongs to the receiving user, and the latter belongs to the sending user), and the first unique code is verified to belong to the user, and the second unique code does not belong to the user; the H-encryption method in the form of plain text and substitution table is obtained in the H-module; relying on the data structure and operation of the management method of the hybrid encryption and decryption encryption means of the fifth aspect of the present invention, a data structure for managing the hybrid encryption and decryption encryption means is preliminarily established;
[0296] Relying on the data structure and operation of the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect of the present invention, according to the unique code of the key library used, when the personal key library of the sending user is available, the configuration file saved locally in the key library used (usually the personal key library of the sending user and the personal key library of the receiving user) is called to restore the complete data structure of the sending user's key and certificate and the complete data structure of the receiving user's (this user's) interface public key;
[0297] According to the obtained H-encryption method, relying on the complete data structure of the sending user's key and certificate and the complete data structure of the receiving user's (this user's) interface public key, with the replacement table in the data structure corresponding to the receiving user's (this user's) personal key library as a reference, the part of the replacement table involved in the H-module is converted into the original text, including: P2P mode, the order and layer settings adopted by H-encryption; if the selected key or certificate is the key or certificate of the receiving user, with the replacement table in the data structure corresponding to the sending user's personal key library as a reference, and other keys or certificates with the replacement table in the data structure corresponding to the receiving user's (this user's) personal key library as a reference, the parent key or certificate used in each layer, the array, group, the method of using the parent key or certificate, the array, group of subkeys or certificates, and the original text are converted; remove the additional After the random bit stream with random length interference is received, the replacement table in the data structure corresponding to the personal key library of the receiving user (this user) is used as a reference to continue the conversion: the number of filling layers at each stage and the length of the filling or the body code rule; after removing the random bit stream with random length interference that is attached thereafter, the replacement table in the data structure corresponding to the personal key library of the receiving user (this user) is used as a reference to continue the conversion: the time point for encapsulation; read the machine code of the machine that allows decryption, complete the verification of the internal hash of the machine code, and verify whether the machine code of this user meets the machine that allows decryption; continue to convert: the time limit for allowing decryption, and verify whether the current time meets the time limit for allowing decryption; after successful verification, continue to convert: the length of the random bit stream attached after encryption is completed; complete the establishment of the data structure for managing the hybrid encryption and decryption encryption means, and perform compliance inspection;
[0298] Relying on the data structure of the fourth aspect of the present invention for managing the hybrid encryption and decryption means, relying on the data structure corresponding to the personal key library in the hybrid decryption method (H-decryption method) of the second aspect of the present invention and the storage and management method of keys and certificates of the fourth aspect of the present invention, the hybrid decryption method is guided, after deleting the random length random number stream attached at the end of the ciphertext, the data part to be decrypted is hybrid decrypted to obtain the plaintext after H-decryption; in the decryption process, according to the padding situation represented by the number of layers and the padding body code rule or length in the data structure for managing the hybrid encryption and decryption means, the algorithm is correctly completed to de-fill;
[0299] The data after decryption is the final plaintext.
[0300] It is necessary to emphasize again that in the P2P mode, the decryption methods that can be used at each level and layer in H-encryption include and are limited to all symmetric decryption methods and all asymmetric decryption methods, including: symmetric decryption methods that transmit keys on the network, symmetric decryption methods that do not use network transmission keys, asymmetric decryption methods that encrypt using the public key of the receiver, asymmetric decryption methods that encrypt using the private key of the sender, methods that encrypt symmetric keys using the public key of the receiver (decrypted using the private key of the receiver), and symmetric decryption methods that use key exchange; in addition, when using the last two decryption methods mentioned above, the corresponding keys or certificates in the personal key library of the sender and the personal key library of the receiver may be used at the same time;
[0301] as well as:
[0302] Receiving, H-decryption and unsealing of ciphertext (N2P mode):
[0303] Receive the encapsulated ciphertext;
[0304] Relying on the indefinite-length header data of the third aspect of the present invention to realize the operation of information unsealing, the encapsulation of the ciphertext using the indefinite-length header data is unsealed, and a hash check is performed at the same time (the N2P mode does not support digital signature verification), and the latest updated unique code of the key library used is obtained (usually contains one, belonging to the receiving user), and the unique code is verified to belong to the user; the H-encryption method in the form of plain text and substitution table is obtained in the H-module; relying on the data structure and operation of the management method of the hybrid encryption and decryption encryption means of the fifth aspect of the present invention, a data structure for managing the hybrid encryption and decryption encryption means is preliminarily established;
[0305] The fourth aspect of the invention is directed to the data structure and operation of the storage and management method of the hybrid encryption and decryption key and certificate. According to the unique code of the key library used, when confirming that the personal key library of the receiving user is the personal key library of the user, the configuration file saved locally is called to restore the data structure of the complete interface public key of the receiving user (the user);
[0306] According to the obtained H-encryption method, relying on the data structure of the complete interface public key of the receiving user, and taking the replacement table in the data structure corresponding to the personal key library of the receiving user (this user) as a reference, the part of the replacement table involved in the H-module is converted into the original text, including: P2P mode, the order and layer settings adopted by H-encryption, the ranks and groups of the parent key or certificate used in each layer, the method of using the parent key or certificate, the ranks and groups of the child key or certificate; after removing the interfering random bit stream with a random length attached thereafter, continue to convert: the number of layers of each order filling and the length of the filling or the body code rule; after removing the interfering random bit stream with a random length attached thereafter again, continue to convert: the time point for encapsulation; read the machine code of the machine allowed to decrypt, complete the verification of the internal hash of the machine code, and verify whether the machine code of this user meets the machine allowed to decrypt; if the verification is successful, continue to convert: the time limit for allowing decryption, and verify whether the current time meets the time limit for allowing decryption; if the verification is successful, continue to convert: the length of the random bit stream attached after the encryption is completed; complete the establishment of a data structure for managing hybrid encryption and decryption encryption means, and perform compliance inspection;
[0307] Relying on the data structure of the fourth aspect of the present invention for managing the hybrid encryption and decryption means, relying on the data structure corresponding to the personal key library in the hybrid decryption method (H-decryption method) of the second aspect of the present invention and the storage and management method of keys and certificates of the fourth aspect of the present invention, the hybrid decryption method is guided, after deleting the random length random number stream attached at the end of the ciphertext, the data part to be decrypted is hybrid decrypted to obtain the plaintext after H-decryption; in the decryption process, according to the padding situation represented by the number of layers and the padding body code rule or length in the data structure for managing the hybrid encryption and decryption means, the algorithm is correctly completed to de-fill;
[0308] The data after decryption is the final plaintext.
[0309] It needs to be emphasized again that in the N2P mode, the decryption methods that can be used at each level and layer in H-encryption include and are limited to all symmetric decryption methods and some asymmetric decryption methods, including: symmetric decryption methods that transmit keys on the network, symmetric decryption methods that do not use network transmission keys, asymmetric decryption methods that encrypt using the public key of the recipient, methods that encrypt symmetric keys using the public key of the recipient (decrypt using the private key of the recipient), and symmetric decryption methods that use key exchange; it is not allowed to use asymmetric decryption methods that encrypt using the private key of the sender and symmetric decryption methods that use key exchange at any level or layer of the decrypted data; in addition, when using the N2P mode for decryption, only the corresponding key or certificate in the personal key library of the receiving user will be used, and the personal key library of the sending user will not be used, and the identity of the sender will not be confirmed;
[0310] as well as:
[0311] Receiving, H-decryption and unsealing of ciphertext (P2N mode):
[0312] Receive the encapsulated ciphertext;
[0313] Relying on the indefinite-length header data of the third aspect of the present invention to realize the operation of information unsealing, the encapsulation of the ciphertext using the indefinite-length header data is unsealed, and hash and digital signature verification (P2N mode supports digital signature verification) are performed at the same time, and the latest updated unique code of the key library used is obtained (usually contains one, belonging to the sending user), and the unique code is verified not to belong to the user; the H-encryption method in the form of plain text and substitution table is obtained in the H-module; relying on the data structure and operation of the management method of the hybrid encryption and decryption encryption means of the fifth aspect of the present invention, the data structure for managing the hybrid encryption and decryption encryption means is preliminarily established;
[0314] The fourth aspect of the invention is directed to the data structure and operation of the storage and management method of the hybrid encryption and decryption key and certificate. According to the unique code of the key library used, when the personal key library of the sending user is available, the configuration file saved locally is called to restore the data structure of the complete interface public key of the sending user;
[0315] According to the obtained H-encryption method, relying on the data structure of the complete interface public key of the sending user, and taking the replacement table in the data structure corresponding to the sending user's personal key library as a reference, the part of the replacement table involved in the H-module is converted into the original text, including: P2P mode, the order and layer settings adopted by H-encryption, the ranks and groups of the parent keys used in each layer, the method of using the parent key, the ranks and groups of the child keys; after removing the interfering random bit streams with random lengths attached thereto, continue to convert: the number of layers of each order filling and the length of the filling or the body code rule; after removing the interfering random bit streams with random lengths attached thereto again, continue to convert: the time point for encapsulation; if it exists, read the machine code of the machine allowed to decrypt, complete the verification of the internal hash of the machine code, and verify whether the machine code of this user meets the machine allowed to decrypt; if the verification is successful, continue to convert: the time limit for allowing decryption, and verify whether the current time meets the time limit for allowing decryption; if the verification is successful, continue to convert: the length of the random bit stream attached after the encryption is completed; complete the establishment of the data structure for managing the hybrid encryption and decryption encryption means, and perform compliance inspection;
[0316] Relying on the data structure of the fourth aspect of the present invention for managing the hybrid encryption and decryption means, relying on the data structure corresponding to the personal key library in the hybrid decryption method (H-decryption method) of the second aspect of the present invention and the storage and management method of keys and certificates of the fourth aspect of the present invention, the hybrid decryption method is guided, after deleting the random length random number stream attached at the end of the ciphertext, the data part to be decrypted is hybrid decrypted to obtain the plaintext after H-decryption; in the decryption process, according to the padding situation represented by the number of layers and the padding body code rule or length in the data structure for managing the hybrid encryption and decryption means, the algorithm is correctly completed to de-fill;
[0317] The data after decryption is the final plaintext;
[0318] It needs to be emphasized again that in P2N mode, the decryption methods that can be used at each level and layer in H-encryption include and are limited to all symmetric decryption methods, including: symmetric decryption methods that transmit keys on the network, and symmetric decryption methods that do not use network transmission keys; no asymmetric decryption methods are allowed to be used at any level or layer of the decrypted data; in addition, when using N2P mode for decryption, only the corresponding key or certificate in the personal key library of the sending user will be used, and the personal key library of the receiving user will not be used.
[0319] It should be emphasized that due to different requirements for confirming the identity of the sender in different scenarios and for different purposes, the support for the digital signature function of the variable-length header data in P2N, N2P, and P2P modes is different, which is reflected in: P2N and P2P modes support digital signatures and require confirmation of the sender's identity; N2P mode does not support digital signatures and does not require confirmation of the sender's identity.
[0320] The following table shows the result:
[0321]
[0322] Further, for the H-improved digital signature scheme, the methods used include:
[0323] Relying on the personal key library of the sender in the hybrid encryption method (H-encryption method) of the first aspect of the present invention and the storage and management method of keys and certificates of the fourth aspect of the present invention, a group of asymmetric keys specified outside the interface key group in the personal key library for digital signature is used, and the hash value of the data to be signed is used as the data to be encrypted. The preset H-encryption method for digital signature is used to perform hybrid encryption on each order and layer of the hash value using the asymmetric encryption method encrypted with the sender's private key to obtain the H-encrypted ciphertext, and a random bit stream less than the output throughput length of the next layer of the outermost order is attached to the end of the encrypted ciphertext without any encapsulation as a digital signature;
[0324] When verifying the signature, relying on the hybrid decryption method (H-decryption method) of the second aspect of the present invention and the complete public key of the sender in the key and certificate storage and management method of the fourth aspect of the present invention, a group of asymmetric public keys dedicated to digital signatures specified outside the interface public key group in the sender's complete public key is used, and the digital signature is used as the data to be decrypted. The preset H-decryption method for digital signatures is used to perform hybrid decryption on each order and layer of the hash value using the asymmetric decryption method of the sender's public key. After decrypting the outermost order, the random number stream attached to the end of the ciphertext is removed, and hybrid decryption is performed step by step to obtain the plaintext after H-decryption, that is, the hash value of the decrypted data to be signed; the hash value of the data to be signed is calculated, and the verification is completed if it is equal to the hash value of the decrypted data to be signed.
[0325] Furthermore, the methods used for optimizing streaming encryption and encapsulation include:
[0326] After the key is distributed twice and the personal key library necessary for encryption and decryption is obtained, the transmission steps of the streaming ciphertext are divided into handshake, communication, first data transmission, continuous data transmission, and repair data transmission. The beginning and end of the streaming transmission are also counted as the stream state.
[0327] The various steps include the following:
[0328] The handshake step, as the first step of stream transmission, is used for information transmission or stream transmission application by the stream transmission applicant (sender);
[0329] Communication step, used for information transmission between both parties of the stream transmission for status transmission, error alarm, and retransmission request;
[0330] The first data transmission step is used to transmit H-encrypted data for the first time;
[0331] The data transmission step is used to continue the initial transmission and sequentially transmit the remaining data to be transmitted after the initial transmission;
[0332] The data repair transmission step is used to retransmit the data that was not completely transmitted when the receiver requests retransmission;
[0333] When performing any step of streaming transmission, length alignment can be used for all data including variable-length header data, that is, the throughput of a streaming transmission is set. When the estimated data after encapsulation is less than the throughput of a streaming transmission, the remark module in the variable-length header data is used to attach a random bit stream to it until the throughput of a streaming transmission is met.
[0334] The entire process of H-encryption used in streaming transmission is exactly the same as the general H-encryption corresponding to different scenarios and purposes, see the P2P, P2N, and N2P modes corresponding to the above H-encryption; it should be noted that the handshake step is encrypted with the H-method as the first transmission of streaming transmission, and the H-encryption method used for all subsequent transmissions should be completely consistent with the H-encryption method used for handshake content encryption, which is reflected in: the latest modified unique code of the personal key library used, the content mark, the purpose mark, the order and layer settings adopted by H-encryption, the ranks and groups of the parent keys or certificates used in each layer, the method of using the parent keys or certificates, the ranks and groups of the child keys or certificates, the only machine allowed to decrypt, and the consistency of the time limit for decryption; the padding of each order and layer is allowed to be different, the time point of encapsulation is allowed to be different, and the length of the random number stream attached to the end of the encrypted ciphertext is allowed to be different; in addition, the padding of each order and layer in the first transmission step and the subsequent transmission step should be consistent, and the length of the random number stream attached to the end of the encrypted ciphertext should also be consistent;
[0335] When using variable-length header data to encapsulate encrypted ciphertext, the situation is different from the general situation:
[0336] When encapsulating the handshake step, select the H-module for encapsulation in the indefinite-length header data, select the corresponding data format for the type of encapsulated information, select the streaming transmission module, write the streaming transmission status into the handshake, the unique code of the previous stream is defaulted, generate and write the unique code of the current stream, write the latest modified unique code of the personal key library corresponding to the P2P, P2N, and N2P modes in H-, the content mark is ciphertext, the purpose is selected as ciphertext, and the corresponding mode is written in the form of a replacement table with reference to the replacement table corresponding to the P2P, P2N, and N2P modes. The order and layer settings adopted by H-encryption are written in the form of a replacement table. According to the order and layer settings, the ranks, groups, usage methods of the master key or certificate, ranks, and groups of subkeys or certificates used in each layer are written in the form of a replacement table in turn, and then a random length of interference is attached. Scramble the random bit stream, write the number of filling layers and the length of filling or body code rules of each order in the form of a replacement table according to the order and layer settings, and then attach a random length of the jammed random bit stream, write the time point of encapsulation in the form of a time replacement table, set the machine allowed to decrypt (optionally according to the P2P, P2N, N2P mode and actual needs), set the time limit for allowing decryption (optionally according to the P2P, P2N, N2P mode and actual needs), and finally write the length of the random bit stream attached after encryption in the form of a replacement table; rely on the third aspect of the present invention to implement the information encapsulation operation of the indefinite length header data, hash the ciphertext in the indefinite length header data, hash the key or certificate (at this time, hash the H-module content), and complete the writing of the content field; then hash the content field to complete the writing of the check field; perform length alignment, and thus complete the encapsulation of the handshake step;
[0337] When encapsulating the communication step, except that the streaming state is written as communication and the unique stream code of the previous stream needs to be written, the rest of the methods are the same as the encapsulation of the handshake step;
[0338] When encapsulating the data in the first transmission step, select the H-module in the indefinite-length header data for encapsulation, select the type of the encapsulated information as the corresponding data form, select the streaming transmission module, write the streaming transmission status to the first transmission (if it is the last transmission, write the tail), write the stream unique code of the previous stream, generate and write the stream unique code of this stream, and default the version number module, the encryption algorithm method description module, the padding method description module, and the hash management module of the encryption method used in the indefinite-length header data; because the H-encryption method used should be completely consistent with the H-encryption method used for handshake content encryption, only the number of padding layers and the length of padding or body code rules of each order are written in sequence in the form of a replacement table in H-, and then an interfering random bit stream of random length is attached, the time point for encapsulation is written in the form of a time replacement table, and the length of the random bit stream attached after encryption is completed is written in the form of a replacement table; relying on the indefinite-length header data of the third aspect of the present invention to implement the information encapsulation operation, hash the ciphertext in the indefinite-length header data to complete the writing of the content field; then hash the content field to complete the writing of the check field; perform length alignment, and thus complete the encapsulation of the first transmission step;
[0339] When encapsulating the data transmission step, select the H-module for encapsulation in the variable-length header data, select the corresponding data format for the type of encapsulated information, select the streaming transmission module, write the streaming transmission status into the continuous transmission (if it is the last transmission, write the tail), write the stream unique code of the previous stream, generate and write the stream unique code of this stream, and default the version number module, encryption status description module, information type description module, encryption algorithm method description module, padding method description module, and hash management module of the encryption method used in the variable-length header data; since the H-encryption method used should be completely consistent with the H-encryption method used for handshake content encryption, each step The filling situation is consistent with the first transmission step. In H-, only the time point for encapsulation is written in the form of a time replacement table, and the length of the random bit stream attached after encryption is completed is written in the form of a replacement table; relying on the third aspect of the present invention, the variable-length header data realizes the information encapsulation operation, and the ciphertext in the variable-length header data is hashed to complete the writing of the content field; the content field is hashed again to complete the writing of the check field; the length is aligned, and the encapsulation of the subsequent transmission step is completed; it should be noted that in order to make the filling situation of each order in the subsequent transmission step consistent with the first transmission step, the amount of data to be encrypted for each data transmission (whether it is the first transmission or the subsequent transmission) should be consistent, otherwise the repair transmission should be used;
[0340] When encapsulating the data in the patch transmission step, except that the streaming transmission state is written as patch transmission, the rest of the methods are the same as the encapsulation of the first transmission step.
[0341] When streaming is performed at different steps of encapsulation, the content that needs to be written in the H-module varies depending on the step, as shown in the following table:
[0342]
[0343] Combined with the optimization for streaming transmission, it allows the maximum amount of data stream to be transmitted with the minimum external cost, fully utilizes the continuity of streaming transmission, maximizes the sending and receiving throughput of extended data by reducing the content written by the encapsulation, improves the efficiency of streaming transmission, and enables H-encryption and related encapsulation to adapt to the modern Internet where streaming transmission has been widely used.
[0344] Furthermore, for the optimization of symmetric encryption anti-decryption, the method used is:
[0345] When multiple symmetric encryption methods are used in H-encryption or symmetric encryption methods are used entirely (especially symmetric keys that do not rely on personal key libraries and do not rely on network transmission are selected), or when P2P mode is used for hybrid encryption that allows key exchange, in order to give full play to the role of H- in decryption obfuscation, optionally, a certain level is allowed to use a symmetric encryption method that only contains one layer during encryption, and the key used can be generated using other symmetric keys used in all other levels and layers, the public key part of an asymmetric key, and a key generated by key exchange of an asymmetric key (only in P2P mode), using a unique and definite method (the key is derived from the real-time generation of the remaining keys, without any storage, exchange or distribution), usually by combining other symmetric keys or by hashing to generate a key, and using the key to encrypt the first layer (only one layer) of the selected level for plaintext;
[0346] In fact, in H-multiple levels, layers, any level can be made to contain only one layer, and this method can be used to encrypt this level, but it is usually easier to implement the above method with the first level and the first layer;
[0347] Implementing one-level, one-layer encryption using all keys ensures that before all the keys and certificates used are completely deciphered, the cracker cannot partially decipher the ciphertext by deciphering part of the keys, further increasing the complexity of cracking and ensuring the security of transmitted information. Especially for instances where a large number of symmetric encryption methods are used, the cracker is often faced with the need to crack multiple uncertain symmetric keys at the same time, and it is impossible to verify the correctness of the symmetric key used at a certain level or layer without other keys. Decryption can only be achieved when multiple uncertain symmetric keys are correct at the same time. In fact, this increases the difficulty of permutations and combinations faced during cracking, thereby increasing the complexity of cracking. This can further ensure the security of encrypted transmitted information when applied to instances where a large number of symmetric encryption methods are used.
[0348] Furthermore, for the optimization of temporary symmetric keys in encapsulation, the method used is:
[0349] When a temporary symmetric key is required for H-encryption of data or when the symmetric key in a symmetric encryption method that does not use a network transmission key is difficult to transmit physically, the use of an H-hybrid encryption method, an interface public key, or other keys selected for H-encryption of data can facilitate the distribution of the above-mentioned temporary symmetric key in the form of ciphertext, while reducing security to a certain extent.
[0350] When it is desired to use the interface public key to encrypt all temporary symmetric keys used, according to the corresponding methods of P2P and P2N, first use the interface private key of the user for hybrid encryption, and then use the interface public key of the recipient for hybrid encryption, or: use the preset H-encryption method of the complete public key for transmission, first use the interface private key of the user for hybrid encryption, and then use the negotiated but not network-transmitted symmetric key for hybrid encryption; attach a random bit stream of equal length to the data when H-encrypting the data at the end of the ciphertext for interference, without encapsulation, as the ciphertext result; it should be noted that the use of the interface public key to encrypt all temporary symmetric keys does not support N2P mode;
[0351] When it is desired to use other keys of the key selected for H-encryption of data to encrypt all temporary symmetric keys used, all temporary symmetric keys used are removed from all keys and certificates selected for H-encryption, and the order and layer positions corresponding to all temporary symmetric keys used are removed from the corresponding hierarchy settings (e.g., (1, 4, 9) becomes (1, 3, 7)) to form new order and layer settings, and then all the keys and certificates selected for H-encryption after removal are used for H-hybrid encryption according to the new hierarchy settings, and the padding conditions represented by the receiver substitution table are written; a random bit stream of equal length to the data when H-encryption is performed is attached to the end of the ciphertext for interference, without encapsulation, as the ciphertext result;
[0352] The above unencapsulated encrypted data is the encrypted temporary symmetric key, which can be written into the usage method of the parent key or the comment module in the variable-length header data and distributed together with the encrypted data.
[0353] It should be noted that all methods for the operation, management and protection of hybrid encryption and decryption with distributed secret-in-secret double-layer distribution involved in the sixth aspect of the present invention are scalable, which is manifested in that: the corresponding data used can be added or deleted according to the actual use and the development of science and technology, the corresponding method of processing data can be changed according to the actual use needs and the development of science and technology, and the corresponding method of transmitting data can be improved according to the actual use needs and the development of science and technology. At the same time, there is no theoretical restriction on the content of transmission, no restriction on the form of transmission, and no restriction on the length of transmission, and it is scalable. At the same time, the methods for the operation, management and protection of hybrid encryption and decryption with distributed secret-in-secret double-layer distribution involved in the sixth aspect are only some necessary methods. Any additions, deletions and other modifications to the methods of the sixth aspect of the present invention by ordinary technicians in this field without creative labor are within the scope of protection of the present invention.
[0354] In the seventh aspect, an embodiment of the present invention provides a system, especially a system that cooperates with any inventive content and any method involved in any embodiment of the present invention, and can execute any aspect of the present invention related to: hybrid encryption and decryption (H-encryption and decryption), encapsulation and decapsulation of variable-length header data, management and storage of keys and certificates, management and storage of H-encryption methods, operation, management and protection of distributed secret-in-secret double-layer distribution, etc.
[0355] In an eighth aspect, an embodiment of the present invention provides a device, in particular, a device that cooperates with any of the inventive contents and methods of any of the embodiments of the present invention, and can perform any of the aspects of the present invention related to: hybrid encryption and decryption (H-encryption and decryption), encapsulation and decapsulation of variable-length header data, management of keys and certificates, management of H-encryption methods, operation, management and protection of distributed secret-in-secret double-layer distribution, etc.;
[0356] A sender device is provided that can perform hybrid encryption (H-encryption), variable length header data encapsulation, key and certificate management, H-encryption method management, distributed secret-in-secret double-layer distribution operation, management and protection work, etc.;
[0357] It includes a receiving device capable of performing hybrid decryption (H-decryption), unpacking of variable-length header data, managing keys and certificates, managing H-encryption methods, and the operation, management and protection of distributed secret-in-secret dual-layer distribution;
[0358] It includes a compatible sending and receiving device that can perform hybrid encryption and decryption (H-encryption and decryption), encapsulation and decapsulation of variable-length header data, management of keys and certificates, management of H-encryption methods, operation, management and protection of distributed secret-in-secret double-layer distribution, etc.
[0359] In the ninth aspect, an embodiment of the present invention provides a storage medium, especially a storage medium that can store the executable instructions involved in any aspect of the present invention and any data generated during the execution process in conjunction with any inventive content and any embodiment of the present invention, including a storage medium that can store: executable instructions involved in any aspect of the present invention, hybrid encryption and decryption (H-encryption and decryption) data, variable-length header data encapsulation data, data for managing and storing keys and certificates, data for managing and storing H-encryption methods, data generated in distributed secret-in-secret double-layer distribution, etc.
[0360] In a tenth aspect, an embodiment of the present invention provides a method for generating a standard hash and a substitution table, in particular, a method for providing a method for generating a standard hash of a machine code portion that allows decryption in an H-module in the data structure and operation of the management method for hybrid encryption and decryption in the fifth aspect, and a method for providing a method for generating a substitution table involved in the third to sixth aspects, the method comprising:
[0361] A method for generating a secure standard hash using an existing hash function for data to be hashed, usually a traceable method for generating the same standard hash using the same data to be hashed;
[0362] A method for generating a random replacement table corresponding to the replaced data based on the replaced data by using an existing hash function and a random bit stream is generally an irreversible and irreversible method that can generate different replacement tables using the same replaced data.
[0363] Furthermore, for generating a standard hash, the method used includes:
[0364] Select several (denoted as n) hash functions (especially cryptographic hash functions) with different output lengths, group lengths, and operation methods, and arrange them from small to large according to the output length, and record them as HF1, HF2, ... HF n ;
[0365] Enter the loop;
[0366] In the first cycle, if the data to be hashed is smaller than the packet length of the hash function HF1, the data is copied and expanded until the packet length of the hash function HF1 is filled, and the filled data is hashed to obtain the hash value H1; if the data to be hashed is larger than the packet length of the hash function HF1, the data to be hashed is directly hashed using HF1 (using the tail filling mechanism inside the hash function) to obtain the hash value H1;
[0367] In the second cycle, the hash value H1 is used as the data to be hashed in this round. Since the hash functions are arranged from small to large according to the output length, usually, the hash value H1 must be smaller than the packet length of the hash function HF2 (if not, it will not be filled and directly transformed, and the tail filling mechanism inside the hash function will be used). The data is copied and expanded until the packet length of the hash function HF2 is filled. The filled data is hashed using HF2 to obtain the hash value H2.
[0368] When the number of cycles i is greater than 2 and less than or equal to n, similar to the second cycle, the hash value H generated in the i-1th round is used. i-1 As the data to be hashed in the i-th round, fill it until the hash function HF is filled up i After the packet length is reached, use HF for the filled data i Perform hash transformation to obtain the hash value H i ;
[0369] When the number of loops i is greater than n, the loop is exited and the hash value H n This is the desired standard hash.
[0370] It should be noted that after multiple rounds of transformation using hash functions with different output lengths, the standard hash has the characteristics of resisting reverse attacks and dictionary attacks: only by using the original image in the same way can the corresponding hash be generated, and the hash function usage method can be customized so that the original dictionary cannot directly locate the original text through multiple rounds of hashing. This not only increases the security of the hash value against attacks, but also allows different output lengths to be achieved by selecting different methods according to actual usage needs.
[0371] Further, for generating a random substitution table, the method used includes:
[0372] Select several (denoted as n) hash functions (especially cryptographic hash functions) with different output lengths, group lengths, and operation methods, and arrange them in descending order according to their output lengths, and denoted as HF1, HF2, ... HF n ;
[0373] Enter the loop;
[0374] In the first cycle, if the replaced data is smaller than the packet length of the hash function HF1, a random bit stream is used to fill the replaced data until the packet length of the hash function HF1 is filled, and a hash transformation is performed on the filled data to obtain a hash value H1; if the replaced data is larger than the packet length of the hash function HF1, a hash transformation is performed directly on the replaced data using HF1 to obtain a hash value H -1 , with hash value H -1 As the replaced data, use a random bit stream to hash the data to be hashed (H -1) and then fill until the packet length of the hash function HF1 is filled, and a hash transformation is performed on the filled data to obtain a hash value H1;
[0375] In the second cycle, the hash value H1 is used as the replaced data in this round. Since the hash functions are arranged from large to small according to the output length, if the hash value H1 is less than the packet length of the hash function HF2, a random bit stream is used to fill the replaced data until the packet length of the hash function HF2 is filled, and a hash transformation is performed on the filled data to obtain the hash value H2; if the hash value H1 is greater than the packet length of the hash function HF2, the replaced data is directly hashed using HF2 to obtain the hash value H -2 , with hash value H -2 As the replaced data, a random number stream is used to replace the data (hash value H -2 ) and then fill until the packet length of the hash function HF2 is filled, and a hash transformation is performed on the filled data to obtain a hash value H2;
[0376] When the number of cycles i is greater than 2 and less than or equal to n, similar to the second cycle, the hash value H generated in the i-1th round is used. i-1 As the replaced data in the i-th round, fill it with a random bit stream until the hash function HF is filled i The packet length or hash transformation to obtain the hash value H -i Then fill the hash function HF with a random number stream i After the packet length is reached, use HF for the filled data i Perform hash transformation to obtain the hash value H i ;
[0377] When the number of loops i is greater than n, the loop is exited and the hash value H n This is the desired random replacement table.
[0378] It should be noted that by adding salt and using hash functions with different output lengths for multiple rounds, the length of the hash function output is compressed successively, which can ensure the randomness, non-traceability, and irreversibility of the output replacement table, and can ensure that different replacement tables can be generated by using the same replaced data multiple times, and can also obtain replacement table outputs of different lengths by customizing the hash function usage method; however, HF n The output length should not be too short, otherwise there may be duplication of replacement tables and poor resistance to birthday attacks; in order to prevent the use of statistical distribution to speculate the replaced data corresponding to the replacement table, important replaced data should be represented by multiple sets of different, randomly used replacement tables.
[0379] In summary, the present invention provides a set of solutions that can realize a hybrid encryption and decryption system and method based on hierarchical layering and secret-in-secret distribution, including a hybrid encryption method, a hybrid decryption method, a method for information management and signature verification of variable-length header data for hybrid encryption and decryption, a storage and management method for hybrid encryption and decryption keys and certificates, a management method for encryption means for hybrid encryption and decryption, a method for operation, management and protection of hybrid encryption and decryption with distributed secret-in-secret double-layer distribution, a system, device, storage medium for realizing the above functions, and a method for generating a standard hash and substitution table.
[0380] The overall implementation process is: on devices, systems and storage media that can realize relevant functions, use the storage and management methods of keys and certificates, guide hybrid encryption (H-encryption) through the management method of hybrid encryption and decryption, encrypt the plaintext, use variable-length header data to achieve encapsulation and management, and after distributing the interface public key and the complete public key twice, transmit the hybrid encrypted and encapsulated data; similarly, after receiving the hybrid encrypted and encapsulated data, according to the obtained complete public key, after unsealing the variable-length header data, use the storage and management methods of keys and certificates, guide hybrid decryption (H-decryption) through the management method of hybrid encryption and decryption, and restore the plaintext.
[0381] The beneficial effects of the present invention can be described in different aspects.
[0382] The hybrid encryption method (H-encryption method) and hybrid decryption method (H-decryption method) in the first aspect and the second aspect of the present invention enable the encryption process to be customized, and the cracking complexity of the hybrid encryption is enhanced by performing multiple encryptions by dividing the stages, and the group encryption of different keys of the same stage by dividing the layers ensures that the overall time complexity of the first-order encryption remains unchanged. Combined with the encryption idea of dividing the stages and layers, the time complexity is reduced as much as possible while the cracking complexity is enhanced. This is particularly obvious when symmetric encryption is used: when the decryptor is unable to know the multi-stage, multi-layer and multi-group symmetric keys, even if he knows the stage and layer arrangement method used for encryption and the encryption algorithm used for each stage and layer, he can still use brute force to complete the cracking. The premise must be that all symmetric keys are completely and correctly cracked (the correctness of the cracked keys cannot be determined independently); it uses multiple groups of keys, hierarchical division, and permutation and combination, which essentially increases the length of the total key (the sum of all keys), so that the number of possible combinations of permutations and combinations when the cracker cracks a specific bit length key by brute force increases greatly, but the key length processed during encryption is only part of the total key. The layered process makes the length of the plaintext processed during encryption much smaller than the total number of groups of keys used. Therefore, the time complexity is reduced as much as possible while the cracking complexity is enhanced, effectively solving the problem of cryptographic technology with higher security at a lower encryption and decryption time complexity. At the same time, the ability to customize the encryption process can effectively interfere with the cracker's identification of specific encryption methods, and frequently changing the order and layer arrangement method used in encryption and the encryption algorithm and encryption key used in each order and layer makes the hybrid encryption process more random and concealed, and also makes the use of hybrid encryption more extensive.
[0383] The storage and management methods of variable-length header data, keys and certificates, and the management methods of encryption means in the third, fourth and fifth aspects of the present invention can provide necessary data and method guidance for the H-encryption and H-decryption processes, as well as provide encapsulation for the encrypted data for identification, transmission and processing, so that the invention of the H-encryption and decryption method is operational, easy to maintain and changeable; at the same time, the preparation of data such as unique codes and replacement tables lays the foundation for the subsequent sixth aspect of the method for double-layer distribution of secret within secret.
[0384] The secret-within-secret double-layer distribution method in the sixth aspect of the present invention ensures that the keys or certificates (even public keys) that actually participate in the encryption will not be exposed to the network due to the distribution of the configuration file. The decryptor cannot obtain any valid keys related to the encryption based on the encapsulated ciphertext alone. In order to obtain the symmetric key or the public key part of the asymmetric key required for encryption, the decryptor often needs to obtain a second ciphertext distribution containing the complete public key. The second ciphertext distribution has undergone a more complex and specially optimized specific H-encryption method (the theoretical complexity is equivalent to the complexity of using brute force to crack the ciphertext), which includes multiple mixed symmetric encryption and asymmetric encryption. In addition, in the absence of When the network is used for the second distribution, the decryptor has no way of obtaining any valid key related to encryption. Due to the permutation and combination characteristics of the H-hybrid encryption method, brute force cracking is extremely complicated. Therefore, the secret-in-secret double-layer distribution method can greatly reduce the possibility of the decryptor obtaining the valid key related to encryption. On the contrary, when the public key related to encryption is obtained (when asymmetric encryption is involved), it is extremely complicated to obtain the private key based on the public key (which often has a long bit length). Therefore, after deciphering the content of the second distribution, the decryptor cannot decipher the ciphertext in a short time. All these factors make the secret-in-secret double-layer distribution method greatly provide a good solution for the H-encryption method. Good distribution characteristics protect the key during the distribution process, further enhancing the security of encryption; using a substitution table instead of plain text to write indefinite-length header data prevents the decryptor from obtaining other information related to the encryption method, such as the setting of the order and layer in H-encryption, the encryption algorithm selected for each order and layer, and the padding after each order encryption. The decryptor cannot obtain any encryption method related to encryption based only on the encapsulated ciphertext. In the case of being unable to obtain the encryption method, the decryptor often needs to obtain the second ciphertext distribution containing the complete public key, and the second ciphertext distribution has undergone a more complex and specially optimized specific H-encryption method (theoretical complexity The complexity is equivalent to that of using brute force to crack the ciphertext), including multiple mixed symmetric encryption and asymmetric encryption. In addition, without using the network for the second distribution, the decryptor has no way of obtaining any encryption method related to encryption. Similarly, due to the permutation and combination characteristics of the H-hybrid encryption method, brute force cracking is extremely complicated. In addition, since the random replacement table is salted, the replacement table has an untraceable anti-reversal hash processing capability. Therefore, the secret-in-secret double-layer distribution method can greatly reduce the possibility of the decryptor obtaining the encryption method related to encryption, so that the encryption method is protected during the ciphertext transmission process, further enhancing security;The update and distribution method of the complete public key (non-interface public key) enables the encryption key and the replacement table related to the encryption method to be updated in time, and can be refreshed in time when the original key has security risks. The customizable update method can maximize the pertinence of the update process (for example, only update the symmetric key part), saving the waste of resources for update distribution and further enhancing security; for streaming encryption, encapsulation and optimization of symmetric encryption anti-decryption, according to different specific usage scenarios, general H-encryption and general secret-in-secret double-layer distribution are improved in terms of efficiency and security, so that the former can adapt to the characteristics of maximizing the use of transmission bandwidth in streaming transmission, making transmission more efficient, and the latter can provide resistance to partial decryption for encrypted data, making encryption more secure, expanding the scope of application of hybrid encryption solutions, and attempting to establish relevant standards. ;
[0385] The systems, media, and storage devices in the seventh, eighth, and ninth aspects of the present invention provide hardware and platform support for the execution of the methods in the first to sixth aspects above, so that the invented methods can be put into practical use in reality and industry, and scientific and technological knowledge can be applied to the protection of information security, thus achieving a leap from theory to practice.
[0386] The generation method of the standard hash and random replacement table in the tenth aspect of the present invention meets the generation of relevant data for H-encapsulation. The complexity and repeatability of the former and the randomness and (relative) uniqueness of the latter can maximize the protection of the encryption method during the distribution process, laying the foundation for the realization of high-security solutions.
[0387] Therefore, the beneficial effect of the present invention is that it provides a cryptographic encryption, encoding, and distribution technology that can bring higher security with lower encryption and decryption time complexity, and independently establishes standards for encryption, decryption, encapsulation, management, and transmission, which helps to further ensure information security in the contemporary Internet+ era. BRIEF DESCRIPTION OF THE DRAWINGS
[0388] In order to more clearly illustrate the technical solution adopted by the present invention, further description is given below in conjunction with the accompanying drawings.
[0389] Obviously, some of the drawings described below are only some specific embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the inventive ideas and the following drawings without paying any creative work.
[0390] Figure 1 It is a schematic diagram of the steps in the present invention; in multiple encryptions, one encryption of a message is defined as one-step encryption, and the H-hybrid encryption algorithm relies on multi-step and multi-layer encryption.
[0391] Figure 2 It is a schematic diagram of the middle stage of the present invention; in multiple encryptions, if the encryption of a certain step of the message needs to be divided into blocks, a part of each block of the message that uses different encryption algorithms, different keys or different encryption methods for encryption operations is defined as a layer, and each stage of the H-hybrid encryption algorithm supports multiple layers of encryption.
[0392] Figure 3 This is a flowchart of implementing encryption using the H-hybrid encryption method based on the first aspect and embodiment 1 of the present invention.
[0393] Figure 4 It is a schematic diagram of the encryption process using the H-hybrid encryption method based on the first aspect and embodiment 1 of the present invention, taking the three-order (1, 4, 9) layers as an example.
[0394] Figure 5 This is a flowchart of implementing decryption using the H-hybrid decryption method based on the second aspect and embodiment 2 of the present invention.
[0395] Figure 6 It is a schematic diagram of the process of decryption using the H-decryption encryption method based on the second aspect and embodiment 2 of the present invention, taking the third-order (1, 4, 9) layers as an example.
[0396] Figure 7 This is a content diagram of a variable-length header data encapsulation format based on the third aspect and embodiment three of the present invention.
[0397] Figure 8 It is a structural diagram of a method and interface for cooperating with variable-length header data based on the third aspect and embodiment three of the present invention.
[0398] Fig. 9 This is a schematic diagram of the content of the data structure of the database of keys and certificates based on the fourth aspect and embodiment 4 of the present invention.
[0399] Fig.10 It is a structural diagram of a storage and management method of hybrid encryption and decryption keys and certificates and a corresponding interface based on the fourth aspect and embodiment 4 of the present invention.
[0400] Fig.11 It is a schematic diagram of the contents of a data structure for managing hybrid encryption and decryption means based on the fifth aspect and embodiment five of the present invention.
[0401] Fig.12 It is a schematic diagram of the contents of an H-module in which variable-length header data can be optionally written based on the fifth aspect and embodiment five of the present invention.
[0402] Fig.13It is a structural diagram of a method for managing hybrid encryption and decryption means and corresponding interfaces based on the fifth aspect and embodiment five of the present invention.
[0403] Fig.14 It is a schematic diagram of the process of implementing distributed dense-in-dense double-layer distribution based on the sixth aspect and embodiment six of the present invention.
[0404] Fig.15 It is a schematic diagram of the process of comprehensively implementing H-encryption, ciphertext encapsulation and distribution based on the sixth aspect and embodiment 6 of the present invention.
[0405] Fig.16 It is a schematic diagram of the process of comprehensively implementing the reception, H-decryption and unsealing of ciphertext based on the sixth aspect and embodiment 6 of the present invention.
[0406] Fig.17 It is a flow chart for implementing a digital signature based on the sixth aspect and embodiment 6 of the present invention, using the H-hybrid encryption and hybrid decryption method.
[0407] Fig.18 This is a comparison diagram of the differences in encapsulation for different steps of streaming transmission based on the sixth aspect and embodiment 6 of the present invention.
[0408] Fig.19 Based on the seventh aspect and embodiment seven of the present invention, a structural diagram of a system that can execute any of the above aspects of the present invention related to: hybrid encryption and decryption (H-encryption and decryption), variable-length header data encapsulation and decapsulation, management and storage of keys and certificates, management and storage of H-encryption methods, and distributed secret-in-secret double-layer distribution operations, management and protection work.
[0409] Fig. 20 It is a structural diagram of a sending device, a receiving device or a device compatible with sending and receiving based on the eighth aspect and embodiment eight of the present invention.
[0410] Fig.21 It is an implementation flow chart of generating a standard hash based on the tenth aspect and embodiment ten of the present invention.
[0411] Fig. 22 This is an implementation flow chart of generating a random replacement table based on the tenth aspect and embodiment ten of the present invention. DETAILED DESCRIPTION
[0412] In order to clearly explain the purpose, internal mechanism and implementation process of the present invention and to demonstrate the advantages of the present invention, the following will clearly and completely describe the technical solution of the present invention in conjunction with the drawings of this document. It should be noted that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments described in the present invention, all embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.
[0413] It should be emphasized that the pseudocode computer language used in the following specific implementation methods is C++ language, the operating system used is Windows system, and the program body is encapsulated by function. This is due to the convenience of implementation and expression, but it does not mean that the scope of protection of the present invention is limited to C++ language, Windows operating system and implementation methods encapsulated by function. Any implementation based on the present invention implemented in any computer language, any operating system and in any form falls within the scope of protection of the present invention.
[0414] The example content of the specific implementation method will show ten different embodiments, respectively targeting: H-hybrid encryption method, H-hybrid decryption method, hybrid encryption and decryption variable-length header data to achieve information management and signature verification method, hybrid encryption and decryption key and certificate storage and management method, hybrid encryption and decryption encryption means management method, hybrid encryption and decryption combined with distributed secret-in-secret double-layer distribution operation, management and protection method, systems, devices, storage media for realizing the above functions, and standard hash and replacement table generation method. These ten different aspects will be specifically explained in detail.
[0415] Embodiment 1
[0416] according to Figure 3 The procedure used to solve the hybrid encryption method (H-encryption method) is from the first level to the outermost level m, and within each level, piece by piece, and within each piece, from the 1st level to the nth level. i The encryption process is layer by layer, and the general form is as follows:
[0417] Select an integer order m, and select a layer number n for each order i (1≤i≤m and i∈Z) i (1≤i≤m and i∈Z), the vector method is denoted by n1 n2 … n m-1 n m , in computers, it can be represented by an integer array including int as STAGE[m], and each element STAGE[k] is the number of layers at each stage;
[0418] For each layer n of each order i iSelect an encryption method Func() and key Key. For simplicity, we assume that the encryption algorithm function prototype is void Func(unsigned char*plain, unsigned char*cipher), that is, the first parameter of the two parameters passes in the address of the data to be encrypted with the input throughput length, and the second parameter saves the address of the ciphertext with the output throughput length after encryption. In addition, all necessary elements of the symmetric key and the asymmetric key are encapsulated into Key and do not need to be explicitly passed to the encryption algorithm function;
[0419] Loop: Starting from the first stage i=1, encrypt each stage step by step, and judge:
[0420] If there is only one layer in this order, the block size block_size is equal to the size of the only layer, that is, the input throughput input_size_of_Func_STEPi_STAGE1 of the encryption algorithm selected for this layer. The plaintext length Length_of_Plain is divided by the block size block_size to get the number of block divisions Number_of_block. If it is not divisible, it is rounded up (in order to deal with long plaintext, it is recommended to use UI for both the plaintext length Length_of_Plain and the number of block divisions Number_of_block NT64 type), for the complete block other than the tail, use the encryption method Func_STEPi_STAGE1() selected by this layer to encrypt the entire plaintext. If the block cannot be divided evenly, then when the first layer that needs to be filled is encountered, the number of the filled layer is recorded (1 for plaintext records), the body code rule or length of the filled code is recorded, and then the content of the layer is filled with Padding_Func() and the encryption method Func_STEPi_STAGE1() selected by this layer is used to encrypt the content of the one-time encryption throughput length of this layer, and then the encryption of this stage is terminated, and i is incremented;
[0421] If there are multiple layers in this stage, the block size block_size is equal to the sum of the sizes of all layers (layers 1 to ni) of this stage, that is, block_size = input_size_of_Func_STEPi_STAGE1 + … + input_size_of_Func_STEPi_STAGEni. The length of the plaintext Length_of_Plain divided by the block size block_size gives the number of block partitions Number_of_block. If it is not divisible, round up (to handle the case of long plaintexts, both the length of the plaintext Length_of_Plain and the number of block partitions Number_of_block are recommended to be of type UINT64). For non-tail complete blocks, within the block according to the layer partition, starting from the first block, for each layer (layers 1 to ni) in each block in turn, use the encryption method Func_STEPi_STAGEj() selected for that layer (layer j) to encrypt the content of the length of the one-time encryption throughput of that layer. After completing the encryption within a block, use the same method in turn to encrypt the next non-tail complete block. If there is a remaining plaintext length less than the block throughput length, that is, there is a situation where padding encryption is required, within the block according to the layer partition, first use the encryption method Func_STEPi_STAGEi() selected for each non-padding layer (for example, layers 1 to i) in turn to encrypt the content of the length of the one-time encryption throughput of that layer. If it is not divisible during block partitioning, when until the first layer that needs to be padded is encountered, let's assume it is layer j, record the layer number j for padding, record the padding body code rule or length, then perform padding Padding_Func() on the content of that layer (layer j) and use the encryption method Func_STEPi_STAGEj() selected for that layer to encrypt the content of the length of the one-time encryption throughput of that layer, and then end the encryption of this stage. Even if there are other layers after this layer of this block (that is, when j < ni), skip it and increment i by 1;
[0422] Until the loop condition i ≤ m is not satisfied, break out of the loop;
[0423] After encryption is complete, the ciphertext after the m-th stage encryption of i = m is the final ciphertext.
[0424] Write the process of general form H-mixed encryption as program pseudocode, that is:
[0425]
[0426]
[0427]
[0428] To facilitate the description of the process of performing H-hybrid encryption using the method of this embodiment in other embodiments, the H-hybrid encryption method shown in this embodiment is now encapsulated into a Hybrid_Minus_Encrypt() function. Calling this function means performing H-hybrid encryption using the method of this embodiment.
[0429] It should be noted that the general form of the H-hybrid encryption method has the following order m and the number of layers per order n: i Theoretically, there is no limit to the selection. It is often determined by the protection strength, the tolerance of the number of keys, the time complexity, etc. The order is usually not more than 5 and the number of layers per layer is not more than 9. Increasing the number of layers without increasing the order can increase the complexity and security without increasing the time complexity. However, blindly increasing the number of layers of a certain order may cause the encrypted data to be smaller than the block size and fail to fully utilize the protection brought by each layer of encryption. In this case, it is necessary to increase the order to obtain further security. Increasing the order can effectively prevent the possibility of partial decryption. In order to make a certain layer of a certain order of H-hybrid encryption have a confusing and masking effect on the encrypted content of a certain layer of the previous order, so that the cross-order decryption layer cannot obtain part of the plaintext information (decrypting the layers at the corresponding positions of different orders, such as decrypting the first layer of all orders, hoping to obtain the plaintext corresponding to all the ciphertext content of the first layer), in addition to increasing the number of orders and using the optimization of the sixth aspect of the invention content for symmetric encryption anti-decryption, it is usually recommended to make the layer sizes (encryption throughput) of the corresponding layers of different orders unaligned. For example, the first layer of the first order uses RSA 2048 with a layer size of 256-11 bytes (under PCKS 1.5 filling mode), and the first layer of the second order uses AES 256 with a layer size of 16 bytes.
[0430] In each order and each layer of H-hybrid encryption, multiple encryption methods can be selected according to the corresponding P2P, P2N, and N2P requirements, including various symmetric encryption methods and asymmetric encryption methods; at the beginning of the invention, the existing symmetric encryption methods and asymmetric encryption methods have shown their own advantages and disadvantages, and each has its best application conditions. Similarly, when the key is not transmitted through the network, a symmetric encryption method that does not use network transmission of the key is used, or the database storage key or certificate involved in the content of the invention or other embodiments described below is used, but the physical transmission configuration file is used. The case is the safest application example of the H-hybrid encryption method in any case (for example, user A and user B can transmit the key through physical means, and encrypt the ciphertext through symmetric encryption, and use the Internet to transmit the ciphertext). Input ciphertext): When the decryptor is unable to know the multi-level and multi-layer symmetric keys, even if he knows the arrangement method of the levels and layers used in encryption and the encryption algorithm used in each level and layer, the premise of using brute force to complete the cracking must be to completely and correctly crack all the symmetric keys (the correctness of the cracked keys cannot be independently determined). By using multiple groups of keys, hierarchical division, and permutations and combinations, the number of possible combinations of the decryptor when brute-forcing a specific bit length key is greatly increased. Therefore, the increase in the number of brute force cracking combinations due to the lack of a starting point is the fundamental reason why the H-hybrid encryption method is more secure. Combined with the effect of preventing partial cracking by multiple levels (it is difficult to determine whether the decrypted content is the real plaintext), H- has extremely strong cracking complexity while reducing time complexity;
[0431] However, generally, only using a symmetric encryption method without using a network transmission key is not in line with the current status of modern Internet information transmission (user A and user B or the user and the server are only connected through the Internet, lacking a secure channel to transmit the symmetric key). Therefore, we support the use of multiple asymmetric encryption methods to deal with instances where a network transmission key (public key) is required; however, when an asymmetric encryption method is used for encryption and the public key needs to be transmitted on the network, the H-hybrid encryption method cannot be fully utilized to enhance the decryption complexity by using the idea of permutations and combinations. Since the process of calculating the corresponding private key according to each public key is independent, and the correctness of the decrypted private key can be independently determined, its security completely depends on the strength of the asymmetric encryption corresponding to the public key used; in order to further enhance the decryption complexity, it is necessary to cooperate with the secret-in-secret double-layer distribution mechanism involved in the sixth aspect of the invention content of the present invention or the following sixth embodiment;
[0432] The use of the symmetric key stored in the database involved in the third aspect of the invention or the following embodiment 3 (when the interface public key is used for encryption and the configuration file is transmitted over the network) and the encryption using the symmetric encryption method for transmitting the key over the network is a relatively safe application example when the configuration file is not deciphered, and its security still depends on the strength of the asymmetric encryption corresponding to the interface public key, and can be considered safe within a certain period of time; compared with the example of using the asymmetric key in the database and the asymmetric encryption method, since the process of calculating the corresponding private key according to each public key is still complicated, the example of using the asymmetric key in the database and the asymmetric encryption method for encryption is safer than the example of using the symmetric key stored in the database and the symmetric encryption method for transmitting the key over the network; since asymmetric encryption often requires a great deal of time complexity, the method of using (asymmetric) key exchange (generating symmetric keys) for symmetric encryption can often balance security and time complexity in this case;
[0433] Although symmetric encryption or asymmetric encryption has different security characteristics, when applied to different scenarios and for different purposes, we have made restrictions on the encryption method selected for each level and layer of the message to be transmitted. The argumentation part is detailed in the first aspect of the invention content of the present invention. The conclusion is as follows: when applied to the P2N scenario, the encryption method used for any level and any layer of the message to be transmitted is limited to only any symmetric encryption method, and any asymmetric encryption method is not allowed to be used for any level and any layer of the message to be transmitted; when applied to the N2P scenario, the encryption method used for any level and any layer of the message to be transmitted is limited to only any symmetric encryption method, asymmetric encryption method encrypted by the public key of the receiver, and encryption method using the public key of the receiver to encrypt the symmetric key, and it is not allowed to use asymmetric encryption method encrypted by the private key of the sender and symmetric encryption method using key exchange for any level and any layer of the message to be transmitted; when applied to the P2P scenario, the encryption method used for any level and any layer of the message to be transmitted is allowed to use any symmetric encryption method and any asymmetric encryption method, and there is no actual restriction;
[0434] In addition, although in the above pseudocode implementation, we have completed the storage of the encrypted content of each order and each layer in the form of memory and pointers, when a large amount of data is actually encrypted and the reading and writing of local disk files is safe, using the file system interface functions in interfaces such as Windows API to read and write disk files can reduce the program's memory usage.
[0435] It should be further specially explained that, in the actual solution, the processes of selecting the order, selecting the number of layers, selecting the encryption method, selecting the key, storing the filling status, etc. all depend on the corresponding selection, settings, data, etc. of the storage and management method of hybrid encryption and decryption keys and certificates in the fourth aspect and the fifth aspect of the invention content of the present invention and the corresponding embodiments four and five, and the encryption means management method of hybrid encryption and decryption. No manual selection and setting are required. This embodiment only briefly introduces the complete operation process of the H-hybrid encryption method.
[0436] In addition, according to Figure 4 We give an instantiation of the H-hybrid encryption method, which is divided into three stages, each stage is 1, 4, and 9 layers (in fact, according to different application needs, the encryption algorithm should focus on selecting symmetric encryption algorithm or asymmetric encryption algorithm). For the sake of simplicity, it is used to vividly demonstrate the details of H-hybrid decryption in practical applications. The principle is exactly the same as the above process. Due to space limitations, we will not go into details here.
[0437] Embodiment 2
[0438] according to Figure 5 The procedure used to solve the hybrid decryption method (H-decryption method) is to proceed from the outermost level m to the first level, block by block within each level, and from the first level to the nth level within each block. i Decryption is done layer by layer. The specific process of its general form is as follows:
[0439] Get the selected order m and the selected number of layers n for each order i (1≤i≤m and i∈Z) i (1≤i≤m and i∈Z), the vector method is denoted by n1 n2 … n m-1 n m , in computers, it can be represented by an integer array including int as STAGE[m], and each element STAGE[K] is the number of layers at each stage;
[0440] Get each layer n of each order i i The selected encryption method and key obtain the corresponding decryption method Func() and key Key. For simplicity, we assume that the prototype of the decryption algorithm function is void Func(unsigned char*cipher,unsigned char*plain), that is, the first parameter of the two parameters passes in the address of the data to be decrypted with the input throughput length, and the second parameter saves the address of the plaintext with the output throughput length after decryption. In addition, all necessary elements of the symmetric key and the asymmetric key are encapsulated into Key and do not need to be explicitly passed to the decryption algorithm function;
[0441] Loop: Starting from the outermost level i=m, decrypt each level step by step, and judge:
[0442] If there is only one layer in this stage, the block size block_size is equal to the size of the only layer, that is, the input throughput input_size_of_Func_STEPi_STAGE1 of the decryption algorithm selected for this layer. The ciphertext length Length_of_Cipher is divided by the block size block_size to obtain the number of block divisions Number_of_block. In the case of only one layer, the number of blocks must be an integer (in order to cope with the long ciphertext, the ciphertext length Length_of_Cipher and the number of block divisions Number_of_block are recommended to use UINT64 type). For the complete block other than the tail, the decryption method Func_STEPi_STAGE1() selected by this layer is used to decrypt the entire ciphertext until the first layer that needs to be defilled is encountered. The recorded filling body code rule or length is obtained, and the decryption method Func_STEPi_STAGE1() selected by this layer is used to decrypt the content of the decryption throughput length of this layer, and then the content of this layer is defilled DePadding_Func(), and then the encryption of this stage is terminated, and i is decremented;
[0443] If there are multiple layers in this stage, the block size block_size is equal to the sum of the sizes of all layers (layers 1 to ni) in this stage, that is, block_size = input_size_of_Func_STEPi_STAGE1 + … + input_size_of_Func_STEPi_STAGEni. The length of the ciphertext Length_of_Cipher divided by the block size block_size gives the number of block partitions Number_of_block. If it is not divisible, round up (to handle long ciphertext cases, both the ciphertext length Length_of_Cipher and the number of block partitions Number_of_block are recommended to use the UINT64 type). For non-tail complete blocks, within the block according to the layer partition, starting from the first block, for each layer (layers 1 to ni) in each block in turn, use the selected decryption method Func_STEPi_STAGEj() of this layer (layer j) to decrypt the content of the one-time decryption throughput length of this layer. After completing the decryption within a block, use the same method in turn to encrypt the next non-tail complete block until the last block is encountered. Obtain the recorded number of layers for padding, and obtain the recorded padding body code rule or length. First, for each layer that does not need to be padded, use the selected decryption method of this layer to decrypt the content of the one-time decryption throughput length of this layer. When encountering the recorded layer for padding (layer j), use the selected decryption method Func_STEPi_STAGEj() of this layer to decrypt the content of the one-time decryption throughput length of this layer, and then end the decryption of this stage. Even if there are other layers after this layer (i.e., when j < ni) in this block, skip it and decrement i by 1;
[0444] Until the loop condition i ≥ 1 is not satisfied, break out of the loop;
[0445] After the decryption is completed, the plaintext after the first-stage decryption of i = 1 is the final plaintext.
[0446] Write the process of the general form of H - hybrid decryption as program pseudocode, that is:
[0447]
[0448]
[0449]
[0450] To facilitate the description of the process of using the method of this embodiment for H - hybrid decryption in other embodiments, the H - hybrid decryption method shown in this embodiment is encapsulated into the Hybrid_Minus_Decrypt() function. Calling this function means using the method of this embodiment for H - hybrid decryption.
[0451] It should be noted that when applied to different scenarios and different purposes, we have made restrictions on the encryption method selected for each order and layer of the message to be transmitted. Therefore, the corresponding decryption method used should also be limited to the corresponding method. For details, see the first aspect of the invention content of the present invention and the above-mentioned embodiment 1, which will not be repeated here;
[0452] In actual use, a certain error reporting mechanism is required, such as obtaining the selected order, the selected number of layers, the selected key, etc., to improve the actual decryption efficiency and improve the user experience, but it does not belong to the content of the present invention, so it will not be discussed for the time being;
[0453] In addition, although in the above pseudocode implementation, we have completed the storage of the decrypted content of each order and each layer in the form of memory and pointers, when a large amount of data is actually encrypted and the reading and writing of local disk files is safe, using the file system interface functions in interfaces such as Windows API to read and write disk files can reduce the program's memory usage.
[0454] It should be further specially explained that, in the actual solution, the processes of obtaining the selected order, the selected number of layers, the selected decryption method, the selected key, the storage filling status, etc. all depend on the corresponding selection, settings, data, etc. of the storage and management method of hybrid encryption and decryption keys and certificates in the fourth aspect and the fifth aspect of the invention content of the present invention and the corresponding embodiments four and five, and the encryption means management method of hybrid encryption and decryption. This embodiment only briefly introduces the complete operation process of the H-hybrid decryption method.
[0455] In addition, according to Figure 6 We give an instantiation of the H-hybrid decryption method, which is divided into three stages, each stage is 1, 4, and 9 layers, to vividly demonstrate the details of H-hybrid decryption in practical applications. The principle is exactly the same as the above process. Due to space limitations, we will not go into details here.
[0456] Embodiment 3
[0457] according to Figure 7 , Figure 8 In order to solve the problem of implementing information management and signature verification method for variable-length header data of hybrid encryption and decryption, this embodiment provides an encapsulation format of variable-length header data, which is used for various ciphertext encapsulation, configuration information encapsulation containing keys and certificates, etc. In addition, this embodiment provides a method for encapsulating information and a method for decapsulating information using variable-length header data, which are used for encapsulating data and decapsulating data. The specific methods used are as follows:
[0458] According to the encapsulation format of variable-length header data, the variable-length header data is divided into three areas, namely: content field, check field, and segmentation field; the content field writes the basic information, encryption information, and check information of the encapsulated data, the check field supports hash functions and digital signature tools to verify the integrity of the content field information and the authenticity of the source, and the segmentation field is used to indicate the end of the variable-length header data and enter the encapsulated valid data;
[0459] Two forms of indefinite-length header data are distinguished, namely: visual form (long form) and simplified form (short form); the visual form (long form) specifically displays the encapsulated content, especially the visual form of the encapsulated content corresponding to the standard descriptor, which is used to find vulnerabilities and locate error information in the development and debugging stages, and has a longer data volume; the simplified form (short form) displays the encapsulated content with abstract symbols, especially the symbolic form of the encapsulated content corresponding to the standard descriptor, which is used for encapsulation in practical applications, and has a shorter data volume and higher space utilization;
[0460] In the content field and check field of the indefinite-length header data, different information exists in the form of modules. There are three types of areas in the module, namely: standard specifier field, body code rule field, and module information field. The standard specifier field not only indicates what kind of module the module is, but also displays the selected content under the optional standard specifier. The body code rule field is usually used to replace the storage of encryption and decryption keys and the type and method of hash functions, which is generally a four-digit number. The module information field stores complete information that cannot be stored using simple replacement, such as hash values.
[0461] Specifically, for the format to be written, the following characters or strings are defined (the characters outside the brackets correspond to the long form, and the characters inside the brackets correspond to the short form):
[0462] The left boundary character of the content field is '<' ('<'), and its ASCII code is 60. The right boundary character of the content field is '>' ('>'), and its ASCII code is 62. These characters are used to mark the left and right boundaries of the content field.
[0463] Module separator: '-' (short form does not exist), ASCII code is 45; used to distinguish between long form modules;
[0464] Module left boundary character: '[' (short form does not exist), ASCII code is 91; module domain right boundary character: ']' (short form does not exist), ASCII code is 93; used to identify the left and right boundaries of the long form module;
[0465] The separator between the module standard specifier field and the body code rule field is ':' (':'), ASCII code is 58; it is used to distinguish the standard specifier field and the body code rule field within the module;
[0466] The separator between the body code rule domain and the information domain is ':' (':'), ASCII code is 58; it is used to distinguish the body code rule domain and the information domain within the module;
[0467] Corresponding to the modular form, the necessary modules of the content domain are:
[0468] The variable-length header data identification module of the third aspect of the present invention is used to identify the use of the variable-length header data of the present invention for encapsulation, does not contain a boundary symbol, and only includes a fixed standard descriptor field; wherein the standard descriptor of the variable-length header data identification module is: "DOFMULTIUSAGESAFEHEAD" ("DOFS");
[0469] A version number module for identifying and using the indefinite-length header information of the third aspect of the present invention, used for indicating the version information encapsulating the indefinite-length header data, used for version identification, compatibility and exclusion, limited to the long form containing boundary characters, only including a fixed standard descriptor field and a module information field consisting of a 6-digit digital version number consisting of ASCII codes; wherein the standard descriptor of the version number module is: "HEAD_BUILT" ("%%0"), and the 6-digit digital version number is composed of a 2-digit year number, a 2-digit month number, and a 2-digit day number of the software update, such as 210819;
[0470] The encryption description module used by the encapsulated information is used to preliminarily identify the plaintext or encrypted form of the variable-length header data encapsulation data, locate the encryption method or H-hybrid encryption method used, limited to the long form containing boundary characters, and only includes the optional standard descriptor field; wherein the long form of the standard descriptor of the encryption description module is composed of the preset supported encryption algorithm, and the short form is composed of sequentially arranged symbols, such as: "PLAIN" ("%00"), "RSA_PUB_PRI" ("%01"), "RSA_PRI_PUB" ("%02"), "H_MINUS" ("%03");
[0471] The type description module of the encapsulated information is used to identify the type of data encapsulated by the indefinite-length header data, such as ciphertext, certificate, configuration file (interface public key, complete public key...), binary optimization type, text optimization type, etc., limited to the long form containing boundary characters, and only including the optional standard descriptor field; wherein the long form of the standard descriptor of the type description module is composed of the preset supported encapsulation data structure, and the short form is composed of sequentially arranged symbols, such as: "CIPHER" ("%10"), "PUB_CERT" ("%11"), "PRI_CERT" ("%12"), "CONFIG" ("%13"), "BIN" ("%14"), "TEXT" ("%15");
[0472] The method description module of the encryption algorithm used is used to identify the encryption algorithm used when a non-H-encryption method is used when the data encapsulated by the variable-length header data is in ciphertext form. It is limited to the long form containing boundary characters, and only includes a fixed standard descriptor field and an encryption algorithm body code rule composed of 4 ASCII codes. The body code rule uniquely corresponds to a specific encryption algorithm; wherein the standard descriptor of the encryption algorithm method description module is: "ALG_PATH" ("%20"), and the encryption algorithm body code rule composed of 4 ASCII codes is limited to the setting of the specific version of the variable-length header data software, and is replaced by the supported encryption algorithm using the body code rule, such as AES-128 can be replaced by "0040" and AES-256 can be replaced by "0044";
[0473] The padding method description module used is used to identify the encryption padding form used when the data encapsulated by the variable-length header data is in ciphertext form when a non-H-encryption method is used. It is limited to long-form and boundary-containing characters, and only includes a fixed standard descriptor field and a padding body code rule or padding length composed of 4 ASCII codes. Under a specific encryption algorithm, the body code rule uniquely corresponds to a padding form. When the padding form cannot be used to identify the padding situation and the padding length must be used, the padding length composed of 4 ASCII codes is allowed. The standard descriptor of the padding method description module is: "PADDING" ("%30"), and the padding body code rule composed of 4 ASCII codes is limited to the setting of the specific version of the variable-length header data software. The body code rule is replaced by the padding mode supported by the encryption algorithm. For example, the body code rule of the padding form using PCKS 1.5 under RSA asymmetric encryption can be defined as "0001";
[0474] The hash management module of the encapsulated information content is used to store the hash value of the data encapsulated by the variable-length header data, and then verify the integrity of the data, which is limited to the long form containing boundary characters, including a fixed standard descriptor field and a module information field for storing the hash value; wherein the standard descriptor of the hash management module of the encapsulated information content is: "CONTEXT_HASH" ("%40"), and the hash value obtained by hashing the data encapsulated by the variable-length header data using the same hash function as the verification field is stored in the module information field in plain text;
[0475] The hash management module of the encryption method adopted, when the data encapsulated by the indefinite-length header data is in ciphertext form, is used to store the hash value of the key or certificate for encrypting the data encapsulated by the indefinite-length header data; when the H-hybrid encryption algorithm and H-module are selected, the hash value of the H-module content is stored, and then the integrity of the encryption method is verified, limited to the long form containing boundary characters, including a fixed standard descriptor field and a module information field for storing hash values; wherein the standard descriptor of the hash management module of the encryption method adopted is: "KEY_HASH" ("%50"), and the module information field stores in plain text the hash value of the key, certificate or H-module content after hashing using the same hash function as the verification field;
[0476] Optional modules are:
[0477] H-encryption means management content module (abbreviated as: H-module), when the data encapsulated by the indefinite length header data is data related to H-hybrid encryption, such as ciphertext using H-hybrid encryption, interface public key cooperating with H-hybrid encryption, complete public key cooperating with H-hybrid encryption, personal key library cooperating with H-hybrid encryption, etc., select to use H-module, limited to long form containing boundary characters, including a fixed standard descriptor field and a module information field for storing and managing the exported data of the hybrid encryption and decryption means data structure; wherein the standard descriptor of the H-encryption means management content module is: "H_MINUS" ("% / 0"), and the module information field stores the H-module content exported in the fifth aspect of the present invention and embodiment 5;
[0478] A non-H-encryption means management module (abbreviated as: non-H-module), when the data encapsulated by the variable-length header data does not adopt H-hybrid encryption, optionally, when the key or certificate in the personal key library in the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect and embodiment of the present invention is used for encryption, it is used to store the key and encryption method used for encryption in the form of a replacement table, limited to the long form containing boundary characters, including a fixed standard descriptor field and a module information field for storing non-H-encryption means; wherein the standard descriptor of the non-H-encryption means management module is: "ECP_H_M" ("% / 1"), and the module information field stores the latest modified unique code of the personal key library in the storage and management method for hybrid encryption and decryption keys and certificates in the fourth aspect and embodiment of the present invention used for encryption, the rows, groups, parent key or certificate usage methods, and the rows, groups, and subkeys or certificates recorded in the form of a replacement table;
[0479] A remark content module, when remark information needs to be written, is used by the encryptor to write other remark information as needed. When streaming transmission is selected, it can be used to add a random digital stream to achieve length alignment. When a temporary symmetric key is selected, it can be used to store the encrypted temporary key. It is limited to the long form containing boundary characters, including a fixed standard descriptor field and a module information field of the remark content module; wherein the standard descriptor of the remark content module is: "EX_NOTE" ("% / 2"), and other remark information can be stored in the module information field as needed, or a random digital stream can be written to achieve streaming transmission length alignment and the encrypted temporary key can be written to cooperate with the use of the temporary key in accordance with the sixth aspect and embodiment 6 of the present invention;
[0480] The streaming management module, when streaming is selected in conjunction with the relevant contents of the sixth aspect and embodiment 6 of the present invention, is used to transmit the status information and judgment information necessary for streaming, which is limited to the long-shaped boundary characters, including a fixed standard descriptor field, a streaming status body code rule composed of 4 bits in ASCII code, and a module information field of the streaming management module; wherein the standard descriptor of the streaming management module is: "STREAM" ("% / 3"), and the 4-bit streaming status body code rule composed of ASCII code represents different streaming states, which can be simply defined as: first ("0001"), last ("0002"), handshake step ( "0010"), communication step ("0020"), first data transmission step ("0030"), data continuation transmission ("0040"), data repair transmission ("0050"), the steps and the body code rules of the head and tail can be obtained by digital addition operation to obtain a composite solution, such as the data continuation transmission step + tail is "0042", the data repair transmission step + tail is "0052", the module information domain of the streaming management module stores the unique code of the previous stream and the unique code of this stream respectively (the unique code of this stream can also be used as the "unique code of the previous stream" of the next stream), which is used to realize the block continuity of streaming transmission;
[0481] Corresponding to the modular form, the verification domain only includes the hash management module that hashes or digitally signs all the contents in the content domain, namely:
[0482] The content domain hash management module is used to verify the integrity of the content domain information and the authenticity of the source (source subject verification), supports hash functions and digital signatures, and is limited to the long form containing boundary characters, including an optional standard descriptor field, a hash body code rule composed of 4 ASCII codes, (optionally) a digital signature encryption algorithm body code rule composed of 4 ASCII codes, and a content domain hash management module information field; wherein the standard descriptor of the content domain hash management module is composed of only hash and supported digital signature methods in the long form, and the short form is composed of symbols arranged in sequence, such as: "HASH_ONLY" ("%?0"), "SIGN_RSA" ("%?1"), "SIGN_DSA" ("%?2"), "SIGN_ECC" ("%?3"), "SIGN_H_M" ("%?4"), the 4-bit hash body code rule composed of ASCII codes is limited to the setting of the specific version of the indefinite-length header data software, and the supported hash function Use body code rules instead, such as SHA-1 can be replaced by "0160", SHA-256 can be replaced by "0256", SHA-512 can be replaced by "0512", etc. The (optional) 4-bit digital signature encryption algorithm body code rule composed of ASCII code is limited to the setting of the specific version of the variable-length header data software. The encryption algorithm that supports digital signatures uses body code rules instead, such as RSA3072 can be replaced by "0018", RSA4096 can be replaced by "0020", etc. The module information domain stores the hash value of all the contents in the content domain after being hashed using the selected hash function. When using digital signatures, the signature information after the digital signature signs the hash value is stored; it should be noted that the choice of digital signature is limited by the scenario and purpose of encryption. Relevant discussion has been given in the sixth aspect of the invention content of the present invention. Now just reiterate the conclusion: only P2P and P2N modes support the use of digital signature functions in variable-length header data;
[0483] Corresponding to the modular form, the segmentation domain only includes a module for indicating the end of the variable-length header data, which is used to end the entire variable-length header data. After that, the valid information does not include a boundary symbol, but only includes a segmentation domain symbol, that is, "====!!!!" ("====!!!!");
[0484] Therefore, without considering the actual application, the form of the indefinite-length header data showing all modules can be expressed as follows:
[0485] Visual form (long form): <DOFMULTIUSAGESAFEHEAD - [HEAD_BUILT: ***Six - digit version number***] - [***Encryption method specifier***] - [***Type specifier***] - [ALG_PATH: **Four - digit encryption algorithm body code rule**] - [PADDING: **Four - digit padding body code rule**] - [CONTEXT_HASH: *****Hash value of the encapsulated information content*****] - [KEY_HASH: *****Hash value of the encryption method*****] - [H_MINUS: *****H - module content*****] - [ECP_H_M: ***Unique code of the key library***: ****Key and method replacement table****] - [EX_NOTE: ****Remarks content****] - [STREAM, **Four - digit status body code rule**: ****Unique code of the previous stream****: ****Unique code of the current stream****]>[***Content domain hash specifier***, **Four - digit hash body code rule**, **Four - digit digital signature algorithm body code rule**: *****Hash value or signature content of the content domain*****] ====!!!!
[0486] Simple form (short form): DOFS%%0: ***Six - digit version number***%0*%1*%20: **Four - digit encryption algorithm body code rule**%30: **Four - digit padding body code rule**%40: *****Hash value of the encapsulated information content*****%50: *****Hash value of the encryption method*****% / 0: *****H - module content*****% / 1: ***Unique code of the key library***: ****Key and method replacement table****% / 2: ****Remarks content****% / 3, **Four - digit status body code rule**: ****Unique code of the previous stream****: ****Unique code of the current stream****%?*, **Four - digit hash body code rule**, **Four - digit digital signature algorithm body code rule**: *****Hash value or signature content of the content domain***** ====!!!!
[0487] Generally, these modules do not always need to be present simultaneously. When selecting the H - module or the streaming module, some necessary modules will be defaulted. Additionally, the optional modules are also partially mutually exclusive, such as the H - module and the non - H - module. The dependencies on the modules in different cases have been discussed in the sixth aspect of the invention content of the present invention and will not be elaborated here. However, it should be noted that the unused modules can be directly defaulted (not written), rather than writing empty content, to improve the space utilization rate of the encapsulated information;
[0488] In addition, we provide a set of variable-length header data instantiated in the experiment, which does not use any optional modules:
[0489] Examples of visual forms (long forms): <DOFMULTIUSAGESAFEHEAD-[HEAD_BUILT:210719]-[RSA_PUB_PRI]-[CIPHER]-[ALG_PATH:0008]-[PADDING:0000]-[CONTEXT_HASH:CF02A41447FEA4B8C1CB9D645E67B3E0]-[KEY_HASH:765648A2C60A81C2961343DCAD0C0331]> [HASH_ONLY,0128:F81F0162157D99C755EC1C162777ECC1]======! ! ! !
[0490] Example of simplified form (short form): DOFS%%0:210719%01%15%20:0008%35:0000%40:CF02A41447FEA4B8C1CB9D645E67B3E0%50:765648A2C60A81C2961343DCAD0C0331%?0,0128:42E09A1D7C3AA199F6D8CE046A326E93=====! ! ! !
[0491] Regarding the method of encapsulating information using variable-length header data, generally, the corresponding module is first selected, and after calculating and generating the information of all modules, the space reserved for the header of the encapsulated data is written (pre-calculation is required to reserve space) to complete the encapsulation. The specific process of its general form is as follows:
[0492] According to the information to be encapsulated and the encryption method involved, select the necessary modules in the content domain to be used according to the purpose, select the optional modules in the content domain to be used according to the selection, obtain the required data in the selected module (such as version number, encryption status of the encapsulated information, type of encapsulated information, etc.), and complete the data generation for the data to be generated in the selected module (such as converting the encryption status of the encapsulated information into the optional options corresponding to the standard descriptor Encrypt_Condition, converting the type of the encapsulated information into the optional options corresponding to the standard descriptor Data_Type, etc.), and calculate the hash values of the encapsulated ciphertext and encryption method (key, certificate or H-module content) in turn, and prepare for writing;
[0493] Perform pre-calculation to calculate the space reserved for the header;
[0494] In the space reserved for the header, the modules that need to be written in the content domain are written in sequence according to the content that actually needs to be written, including: an identification module of the indefinite-length header information, a version number module, an encryption description module, a type description module, an encryption algorithm method description module, a padding method description module, a hash management module of the encapsulated information content, and a hash management module of the encryption method adopted; according to the selection, an optional H-encryption means management content module, a non-H-encryption means management module, a remark content module, a streaming management module, etc. are optionally written, and the writing of the content domain is completed;
[0495] Hash the entire content of the content field using the selected hash function, optionally digitally sign the hash, and write the hash value or signature into the verification field;
[0496] Write the contents of the segmentation domain to complete the data encapsulation.
[0497] The general process of encapsulating information using variable-length header data is simplified and written into program pseudocode, namely:
[0498]
[0499]
[0500]
[0501] To facilitate the explanation of the process of encapsulating variable-length header data using the method of this embodiment in other embodiments, the method of encapsulating variable-length header data shown in this embodiment is now encapsulated into a Head_Package() function. Calling this function means using the method of this embodiment to encapsulate information using variable-length header data.
[0502] It should be noted that, since the various modules of the indefinite-length header data involve issues such as selection and non-selection in different application situations, mutual exclusion of selection, information transmission and storage, differences between selection and actual writing, writing of short and long forms, and non-compliance detection, the actual process of using indefinite-length header data to encapsulate information is very complicated. Due to space limitations, this article uses simplified pseudocode to briefly describe the process without losing generality, which can serve as an introduction and explanation. Nevertheless, the pseudocode is still not rigorous enough in many aspects, so please be aware of this.
[0503] It should be specially noted that, in theory, there is no form, length or specification restriction for variable-length header data; however, in practical applications, in order to facilitate identification of information in the module information domain of a module, the encoding form of the data in the module information domain needs to be restricted, usually to hexadecimal character encoding (other special encodings are not allowed to affect module identification). In other cases, expansion to Base64 encoding is also permitted. In order to maximize the use of memory and ensure complete storage of required data, it is usually necessary to limit the length of variable-length header data according to the module restrictions with larger content. Experiments have shown that H-modules are usually modules with larger content, which can reach KB level when complete. Therefore, the length of variable-length header data should be at least KB level. Taking into account possible digital signature content, usually a length of more than 4KB can meet general needs.
[0504] Regarding the method of decapsulating the information encapsulated by the indefinite-length header data, generally, the identification module is first used to identify the indefinite-length header data. If the identification module is identified, the contained modules are read, and after the information related to encryption and content in the module is exported, the encryption method and the encapsulated ciphertext are hash-checked, and the content domain is hash-checked and optionally the digital signature is checked. After all the verifications are passed, the encryption method involved is restored. The specific process of its general form is as follows:
[0505] Use the identification module to identify the indefinite-length header data. If the identification module is identified, read the modules in the content domain in sequence, namely, the identification module of the indefinite-length header information, the version number module, the encryption description module, the type description module, the encryption algorithm method description module, the filling method description module, the encapsulated information content hash management module, and the adopted encryption method hash management module; read the existing optional modules according to the provided optional modules, including: H-encryption means management content module, non-H-encryption means management module, remark content module, streaming management module, etc.; the reading of the content domain is completed at this point;
[0506] Read the body code rules of the hash function and optional digital signature encryption algorithm in the verification domain, restore the method of the hash function used and the optional digital signature encryption algorithm, read the hash value in the information domain or the hash value after digital signature. If the digital signature is selected, it is necessary to perform signature decryption Resign_Sigunature_Rule() to obtain the hash plaintext of the content domain;
[0507] Perform hash verification, perform integrity verification on the encapsulated information based on the variable-length header data (compare the calculated hash with the hash in the module to see if they are the same), perform integrity verification on the encryption method (key, certificate, or H-module content) used for the encapsulated information based on the variable-length header data (compare the calculated hash with the hash in the module to see if they are the same), and perform integrity verification on the content field of the variable-length header data based on the hash plaintext of the content field (compare the calculated hash with the hash in the module to see if they are the same);
[0508] Perform the work of restoring the encryption method, and derive and generate the corresponding encryption method according to the information about the encryption method in the variable-length header data (which needs to be completed based on other aspects of the present invention, such as the management method of the encryption means of hybrid encryption based on the fifth aspect of the present invention);
[0509] The checksum is generated successfully, and the data is unsealed.
[0510] The general process of unpacking the information encapsulated by the indefinite-length header data is simplified and written into program pseudocode, namely:
[0511]
[0512]
[0513]
[0514] To facilitate the explanation of the process of unpacking variable-length header data using the method of this embodiment in other embodiments, the method of unpacking variable-length header data shown in this embodiment is now encapsulated into a Head_DePackage() function. Calling this function means using the method of this embodiment to unpack information using variable-length header data.
[0515] It should be noted that, since the various modules of the indefinite-length header data involve the problems of selection and non-selection in different application situations, the mutual exclusion of selection, information transmission and storage, the difference between selection and actual writing, the problem of distinguishing short and long forms, and the problem of non-compliance detection, the actual method of unpacking the information using indefinite-length header data is very complicated. Due to space limitations, this article uses simplified pseudocode to briefly describe the process without losing generality, which can serve as an introduction and explanation. Nevertheless, the pseudocode is still not rigorous enough in many aspects, so please be aware of this;
[0516] In addition, according to Figure 8In this embodiment, all methods for encapsulating and decapsulating using variable-length header data can be encapsulated into an interface. By calling the interface, encrypted data can be encapsulated using variable-length header data to obtain encapsulated data; at the same time, by calling the interface, encapsulated data can be encapsulated using variable-length header data to obtain decapsulated data; in conjunction with the fifth aspect of the present invention and the interface for importing and exporting the H-module in the fifth embodiment, the functions of storing encryption methods, exporting and generating corresponding encryption-related methods, etc. can be further realized.
[0517] Embodiment 4
[0518] according to Fig. 9 , Fig.10 In order to solve the problem of storage and management methods of hybrid encryption and decryption keys and certificates, this embodiment provides a data structure for storage and management of hybrid encryption and decryption keys and certificates, which is used to store keys, certificates, replacement tables and other information required for H-hybrid encryption and decryption and secret-in-secret dual-layer distribution; in addition, this embodiment provides a method for management methods related to the data structure of a database of keys and certificates, which is used to initialize, generate, modify and verify data in a data structure, write data in a data structure to a local file, save it in the form of a disk file, and read the data structure written in the disk file to regenerate the data structure. The specific methods used are as follows:
[0519] The data structure for storage and management of hybrid encryption and decryption keys and certificates is named classKey_Cert_Series in this embodiment. The content and format of its specific data members can be referred to as follows:
[0520] According to the storage situation of the keys or certificates stored in the rows and columns, it is used to mark which positions of the three-dimensional array storing the keys or certificates are stored with the corresponding keys or certificates; the storage situation of the keys or certificates stored in the rows and columns is usually implemented with a two-dimensional array, such as bool Series_Used[m][n]; m and n represent the reserved lengths of the rows and columns respectively. According to the results of the previous experiments, it can be divided into 11 rows (1 row for interface keys, 1 row for digital signatures, and 9 rows for encryption) and 137 columns (the body code rule is arranged from 0 to 136), that is, to establish bool Series_Used
[11]
[137] ; usually, true in bool form indicates that the row or column stores the keys or certificates, and false in bool form indicates that the row or column does not store the keys or certificates;
[0521] According to the latest modification of the key or certificate stored in the row or column, it is used to mark which positions of the three-dimensional array storing the key or certificate are modified in the latest update, which can be used to transmit and modify only the changed complete public key when transmitting and updating the complete public key; the latest modification of the key or certificate stored in the row or column is usually implemented by a two-dimensional array, such as bool Series_Changed[m][n]; m and n also represent the reserved length of the row and column respectively. Taking the previous example, bool Series_Changed
[11]
[137] can be established; usually true in bool form indicates that the key or certificate of the row or column is the latest modification, and false in bool form indicates that the key or certificate of the row or column is not the latest modification;
[0522] The corresponding keys or certificates are stored in rows, columns, and groups. They are used to store the contents of keys or certificates. They are usually stored in plain text. They are stored only in the corresponding positions of rows and columns. Otherwise, they are defaulted. The corresponding keys or certificates are usually stored in three-dimensional arrays, such as unsigned char Key_Cert[m][n][length]; m and n indicate the reserved length of rows and columns, respectively. Length indicates the length reserved for the key and certificate content. Since the columns are arranged according to the body code rules, the keys or certificates stored in each column are applied to the same encryption method and have the same length. Since different groups are written continuously in the same column, the reserved length of length should be long enough, usually requiring a length of KB level. Taking the previous example, unsigned char Key_Cert
[11]
[137]
[65536] can be established; However, since the total space required to be reserved is often large, the space that does not store keys or certificates may be wasted. In order to maximize the use of space, this three-dimensional array can be established in the C++ environment in the form of dynamic allocation: unsigned char*Key_Cert
[11]
[137] ;, at this time, the array only has pointers. When storage is needed, it is dynamically allocated for the i rows and j columns to be stored: Key_Cert[i][j] = new unsigned char[length];, to create space to maximize the use of space; the keys or certificates stored in the three-dimensional array rely on external input or generation;
[0523] The substitution table for the key or certificate content in the row or column of the hybrid encryption and decryption is used to indicate which row or column of the key or certificate is used for the hybrid encryption in the form of a substitution table in the variable-length header data H-module. The substitution table is usually generated by randomly generating a fixed-length hash value, and only the corresponding position of the key or certificate is stored in the corresponding position of the row or column (otherwise it is defaulted). With the double-layer distribution of secret in secret, the key or certificate selected for encryption is concealed; the substitution table for the key or certificate content in the row or column of the hybrid encryption and decryption is usually implemented as a three-dimensional array, such as unsigned char Key_Cert_Substitution[m][n][static_length]; m and n respectively identify the reserved length of the row and column, and static_length indicates the fixed length of the substitution table used. Taking the previous example, unsigned char Key_Cert_Substitution
[11]
[137]
[32] can be established; Similarly, in order to maximize the use of space, this three-dimensional array can be established in the C++ environment in the form of dynamic allocation: unsigned char*Key_Cert_Substitution
[11]
[137] ;, at this time, the array only has a pointer, and when storage is required, it is dynamically allocated for the i rows and j columns to be stored: Key_Cert_Substitution[i][j] = new unsigned char[static_length];, to create space to maximize the use of space; the substitution table generation method of the tenth aspect and embodiment 10 of the present invention can be used to generate the substitution table;
[0524] A substitution table for mixed encryption and decryption group numbers is used to indicate which group of keys or certificates of the row and column are used for mixed encryption when multiple groups of keys or certificates are stored in the same row and column (otherwise the group number defaults to 0), and cooperates with secret-in-secret double-layer distribution to make the key or certificate selected for encryption concealed, and usually includes a substitution table with all preset supported group numbers; the substitution table for mixed encryption and decryption group numbers is usually implemented as a two-dimensional array, such as unsigned char Group_Substitution[amount][static_length]; amount represents the maximum number of groups supported in a column, and static_length represents the fixed length of the substitution table used. According to the results of the previous experiments, unsigned charGroup_Substitution
[128]
[32] can be established; the substitution table generation method of the tenth aspect and embodiment 10 of the present invention can be used to generate the substitution table;
[0525] A substitution table for a hybrid encryption and decryption key usage method is used to indicate an encryption method using a key (especially a master key) for encryption. With the secret-in-secret double-layer distribution, the encryption method selected for encryption is concealed. The table usually includes a substitution table of all supported encryption methods for different purposes. The substitution table for a hybrid encryption and decryption key usage method is usually implemented as a two-dimensional array, such as unsigned char Enc_Method_Substitution[amount][static_length], where amount represents the number of supported encryption methods, static_length represents the fixed length of the substitution table used, and the present invention supports 6 different encryption methods (as described above, including two symmetric methods and four asymmetric methods). static_length represents the fixed length of the substitution table used. Taking the results of the previous experiments as an example, unsigned char Enc_Method_Substitution[6]
[32] can be established. The substitution table can be generated by the substitution table generation method of the tenth aspect and embodiment ten of the present invention.
[0526] A substitution table for different possible combinations of hybrid encryption and decryption stage and layer settings, used to indicate the stage and layer settings used by H-hybrid encryption, and in conjunction with secret-in-secret double-layer distribution, makes the stage and layer settings selected for encryption concealed, and usually contains a substitution table for all supported stage and layer setting combinations; a substitution table for different possible combinations of hybrid encryption and decryption stage and layer settings is usually implemented as a multidimensional array, such as unsigned char Step_Stage_Set_Substitution[Step][Stage_1]…[Stage_m][static_length]; Step represents the maximum number of supported stages, Stage_i represents the number of layers supported in each stage, and static_length represents the fixed length of the substitution table used. Based on the results of previous experiments, it is supported to establish an unsigned char Step_Stage_Set_Substitution[4][9][9][9][9]
[32] , if a 2-order (1, 4) layer is used, then the corresponding substitution table is at the position [2][1][4][0][0]; if a 4-order (1, 4, 7, 9) layer is used, then the corresponding substitution table is [4][1][4][7][9]; in addition, each number of the order and layer can be regarded as an independent bit number, making it a number, and using a two-dimensional array to implement it. Taking the above example, unsigned char Step_Stage_Set_Substitution
[49999]
[32] can be established. If a 2-order (1, 4) layer is used, then the corresponding substitution table is at the position
[21400] ; if a 4-order (1, 4, 7, 9) layer is used, then the corresponding substitution table is at the position
[41479] ; the substitution table generation method of the tenth aspect and embodiment 10 of the present invention can be used to generate the substitution table;
[0527] A replacement table for hybrid encryption and decryption scenarios and purpose flags is used to indicate the scenarios and purpose flags used in H-hybrid encryption, and cooperates with secret-in-secret double-layer distribution to make the encryption selected scenario and purpose flag settings concealed. It is usually a replacement table for optional P2P, P2N, and N2P. The replacement table for hybrid encryption and decryption scenarios and purpose flags is usually implemented as a two-dimensional array, such as unsigned char Condition_Substitution[3][static_length]; 3 represents the supported P2P, P2N, and N2P modes, and static_length represents the fixed length of the replacement table used. Taking the above example as an example, unsigned char Condition_Substitution[3]
[32] can be established, corresponding to the replacement tables of the three modes of P2P, P2N, and N2P respectively; the replacement table generation method of the tenth aspect and embodiment ten of the present invention can be used to generate the replacement table;
[0528] Padding situation replacement table for hybrid encryption and decryption, which is used to indicate the padding situation of each stage of H-hybrid encryption. It is combined with the double-layer distribution of the inner cipher to make the padding situation of each stage of encryption concealed. Usually, it is a replacement table that includes the order, layer position, and padding body code rule or length of all possible paddings; the padding situation replacement table for hybrid encryption and decryption is usually implemented by two two-dimensional arrays, which respectively indicate the order, layer position of the padding and the corresponding four-digit body code rule or length, such as unsigned char Padding_Step_Stage_Substitution[Step][Stage][static_length]; it is used to indicate the order and layer position of the padding. Step represents the order number of the padding position, Stage represents the number of layers of each padding position, and static_length represents the fixed length of the replacement table used; unsigned char Padding_Rule_Substitution[Rule_Length][static_length]; it is used to indicate the body code rule or length of the padding. Rule_Length represents the largest number corresponding to the body code rule or the maximum length of the padding, and static_length represents the fixed length of the replacement table used. Taking the results of previous experiments as an example, unsigned char Padding_Step_Stage_Substitution[4][9]
[32] ; and unsigned char Padding_Rule_Substitution
[8192]
[32] ; can be established; the replacement table can be generated by using the replacement table generation method of the tenth aspect and Embodiment Ten of the present invention;
[0529] The digital substitution table used for hybrid encryption and decryption involving time is used to indicate the relevant time conditions, such as the encapsulation time, the time allowed for decryption, etc., and can limit the decryption time in conjunction with the time allowed for decryption in the H-module. In conjunction with the secret-in-secret double-layer distribution, the information related to time is concealed. When used to indicate time containing year, month, day, hour, minute, second, and millisecond, it is usually a substitution table containing year time, month time, and each digit; the digital substitution table used for hybrid encryption and decryption involving time is usually implemented as three two-dimensional arrays, indicating the year time, month time, and each digit is used to identify the hour, minute, second, and millisecond, such as unsigned char Year_Substitution[Year_from_base][static_length];, used to indicate the year time, Year_from_base indicates the number of years supported after the base year (the industry practice is 1970), and static_length indicates the fixed length of the substitution table used; unsigned char Month_Substitution
[12] [static_length];, used to indicate the month time, 12 indicates 12 months away, and static_length indicates the fixed length of the substitution table used; unsigned char Number_Substitution
[10] [static_length]; is used to identify the hour, minute, second, and millisecond digitally, 10 represents the numbers 0 to 9, and static_length represents the fixed length of the substitution table used; according to the results of the previous experiments, unsigned char Year_Substitution
[100]
[32] ;, unsigned char Month_Substitution
[12]
[32] ; and unsigned char Number_Substitution
[10]
[32] ; can be established; the substitution table can be generated by the substitution table generation method of the tenth aspect and embodiment 10 of the present invention;
[0530] The flag that marks the private key certificate of this user or the key certificate of other users obtained through transmission is used to identify that the data stored in the data structure is self-owned, self-generated, and contains private keys, or is generated using other people's data such as interface public keys and complete public keys. It marks the ownership of data members in the data structure and corresponds to different initialization, modification and other operations and related methods; the flag that marks the private key certificate of this user or the key certificate of other users obtained through transmission is usually implemented as a bool type variable, such as bool Mine_or_Others; usually true in bool form indicates that the data structure is owned by oneself, and false in bool form indicates that the data structure is owned by others;
[0531] The flag that marks the integrity of the data structure is used to identify the form of the data stored in the data structure, and then to test it according to different rules in the compliance test. It usually includes flags such as error, current user data, other user interface public key, other user complete public key (complete public key), etc. The flag that marks the integrity of the data structure is usually implemented as an int or char type variable, such as int Integrity; or char Integrity;, and usually different options are marked with different values or different ASCII codes, such as "1" for error, "2" for current user data, "3" for other user interface public key, "4" for other user complete public key (complete public key), etc.
[0532] Version number, used to indicate the version information of the data structure for storing and managing hybrid encryption and decryption keys and certificates, and is used for version identification, compatibility, and exclusion; the mark that marks the integrity of the data structure is usually implemented as a one-dimensional array, such as unsigned char Version[6]; 6 represents the version number, which consists of 6 bits in ASCII code. The 6-bit version number is composed of a 2-digit year number, a 2-digit month number, and a 2-digit day number of the software update, such as 210819; it is automatically generated or manually set when the data structure is created;
[0533] Creation date, that is, the date when the data in the data structure was first created, is used to record the data creation date, and records the creation time including year, month, day, hour, minute, second, and millisecond. The creation date is usually implemented as a one-dimensional array, such as unsigned charCreate_Time
[18] ; 18 represents the creation date, which consists of 18 digits in ASCII code. The 18-digit creation date consists of 4-digit year number, 2-digit month number, 2-digit day number, 2-digit hour number, 2-digit minute number, 2-digit second number, and 4-digit millisecond number, such as 202108191735192540. The data structure is automatically generated or manually set.
[0534] The last modified date, that is, the date when the data in the data structure was last modified, is used to record the last modified date of the data. The record contains the creation time of year, month, day, hour, minute, second, and millisecond. The last modified date is usually implemented as a one-dimensional array, such as unsigned char Lated_Change_Time
[18] ; 18 represents the last modified date, which is composed of 18 ASCII codes. The 18-bit last modified date consists of 4-digit year number, 2-digit month number, 2-digit day number, 2-digit hour number, 2-digit minute number, 2-digit second number, and 4-digit millisecond number, such as 202108192151170950; the data structure is automatically refreshed or manually set when it is modified;
[0535] The validity period is the recommended expiration date of the key and certificate in the data structure. It is used to record the expiration date of the key and certificate and determine whether the key and certificate in the data structure are valid. The record contains the effective expiration time of year, month, day, hour, minute, second, and millisecond. The validity period is usually implemented as a one-dimensional array, such as unsigned char Valid_Time
[18] . 18 represents the last modification date, which is composed of 18 ASCII codes. The 18-bit last modification date consists of 4-digit year number, 2-digit month number, 2-digit day number, 2-digit hour number, 2-digit minute number, 2-digit second number, and 4-digit millisecond number, such as 202308192151170950. When modifying, the last modification date plus the validity period (recommended to be 2 years) is automatically generated or manually set.
[0536] The number of modifications since the initial creation, that is, the number of times the data in the data structure has been modified since the initial creation, is used to record the number of times the data has been modified since the initial creation; the number of modifications since the initial creation is usually implemented as a UNINT64 variable, such as UNINT64Change_Times; the purpose of using UNINT64 is to support the counting of a large number of modifications; the data structure is initially set to 0 when it is created, and automatically incremented or manually set when modified;
[0537] The machine code of the machine that generates the stored keys and certificates, that is, the identification code of the machine that initially creates the keys and certificates in the data structure, is used to record the machine code of the user to whom the keys or certificates belong, and to identify the ownership of the keys and certificates in the data structure. In addition, in conjunction with the machines that are allowed to decrypt in the H-module, it can limit the decryption machines. The machine code of the machine that generates the stored keys and certificates is usually implemented as a one-dimensional array, such as unsigned char Device_Code[static_length]; static_length indicates the fixed length of the machine code used. According to the results of the previous experiments, unsigned char Device_Code
[128] can be established, corresponding to the machine code created using SHA-512, and saved in hexadecimal expansion bytes; it is automatically generated or manually set when the data structure is created;
[0538] The unique code issued at the last modification, that is, the unique code randomly generated when the data structure was last modified, is used to uniquely mark the historical version of the data structure after the last modification, and is used with the latest modified unique code to locate the old and new databases, thereby realizing the update of the key or certificate; the unique code issued at the last modification is usually implemented as a one-dimensional array, such as unsigned char Last_Unique_Code[static_length]; static_length represents the fixed length of the unique code used. According to the results of the previous experiment, unsigned char Unique_Code
[128] can be established, corresponding to the unique code created by SHA-512, and saved in hexadecimal expansion bytes; automatically generated or manually set when the data structure is modified;
[0539] The latest modified unique code, that is, the unique code randomly generated after the latest modification of the data structure, is used to uniquely locate and mark the code of the data structure. It is used for many purposes such as the database used by the H-module to locate encryption, to complete the corresponding complete public key according to the first distribution of the interface public key, to update the complete public key, and to identify the identity of the other party in P2P mode. The latest modified unique code is usually implemented as a one-dimensional array, such as unsigned char Unique_Code[static_length]; static_length represents the fixed length of the unique code used. According to the results of the previous experiment, unsigned char Unique_Code
[128] can be established, corresponding to the unique code created by SHA-512, and saved in hexadecimal expansion bytes; it is automatically generated or manually set when the data structure is modified; it should be specially noted that the latest modified unique code, as a representative of the uniqueness of the data structure content, can uniquely locate, identify, and find the data structure. When the data structure needs to be called, the latest modified unique code is often used to find the corresponding file locally, and read and restore the data structure;
[0540] For the sake of convenience, the above-mentioned replacement tables are all generated from the data to be replaced in a one-to-one manner; generally, the one-to-one generation can meet the actual needs, but the one-to-one generated and used replacement tables usually have poor statistical anti-decryption capabilities, that is, the decryptor can use statistical methods to guess the data to be replaced corresponding to the frequently appearing replacement tables; therefore, in actual application, when necessary, some replacement tables should adopt the method of multiple backup generation and random use, that is, use one data to be replaced to generate multiple groups of unrelated replacement tables, and randomly select one of the multiple groups of replacement tables when using them, and one-to-one correspondence can be achieved when searching for the data to be replaced through the replacement table; possibly, all of the above The replacement table requires multiple backups to be generated and used randomly. Considering the actual space utilization and statistical probability issues, the backup volume generated by multiple backups should theoretically satisfy the characteristics of making the call frequency of the replacement table meet the statistical uniform distribution. That is, no matter how high the frequency of a certain replaced data is, when the replacement table is randomly called after multiple backups are generated for it, the frequency of each group of replacement tables should be equivalent. This usually requires relying on a large amount of statistical data and the selection preference problem of specific usage scenarios. According to the results of previous experiments, the present invention gives a specific situation here: a replacement table for mixed encryption and decryption group numbers. The situation recommended in the previous article is unsigned char Group_Substitution
[128]
[32] ; that is, each column supports up to 128 groups, and usually, only one group of data is stored in each column, and the frequency of using the group number is inversely proportional to the size of the group number. According to statistics, 256 different substitution tables can be established for the group with group number 0, 128 different substitution tables can be established for the group with group number 1, ..., 2 different substitution tables can be established for the group with group number 7, and 1 substitution table can be established for the group with group number greater than 7, so that the calling frequency of the substitution table can meet the characteristics of statistical uniform distribution;
[0541] The methods and operations related to the data structure for storage and management of hybrid encryption and decryption keys and certificates are mostly operations for assigning values to data, such as initialization, generation, modification, and verification, which can be easily implemented by ordinary technicians in this field without creative work. Since the operation is relatively easy and the specific operation content has been described in detail in the content of the invention, this embodiment will repeat the description of all methods and operations. For some operations that may involve more complex steps, the following supplements are made to their specific implementation methods:
[0542] For steps that need to rely on the ownership flags of the current user or other users to perform different operations, different operations need to be performed according to different ownership flags. It is recommended that different operations can be encapsulated into the same interface, and different statements can be executed based on the nature of the flags in the data members.
[0543] For the compliance inspection of stored content, under different ownership marks of this user or other users and under different integrity marks, the compliance inspection corresponds to different operations: when it is private to this user and the data is from this user, it is necessary to verify the existence and standardization of all data members (generated according to the specifications), the storage certificate must contain the private key, all stored keys and certificates have corresponding replacement tables, and the data structure is still within the validity period, etc.; when it is owned by other users and it is the interface public key of other users, it is necessary to verify the version number, creation date, last modification date, validity period, number of modifications since creation, machine code, two unique codes, key or certificate storage status, existence and standardization of all interface public key certificates, the storage certificate must contain and only contain the interface public key, does not contain any replacement table, and the data structure is still within the validity period, etc.; when it is owned by other users and it is the complete public key of other users, it is necessary to verify the existence and standardization of all data members (generated according to the specifications), the storage certificate must contain and contain all public keys, all stored keys and certificates have corresponding replacement tables, and the data structure is still within the validity period, etc.
[0544] For the conversion of all relevant data members to the corresponding replacement table, and the conversion of the replacement table to all corresponding information, different conversion functions should be developed for replacement tables of different forms and uses, and optimized database algorithms should be used as much as possible to make the conversion process consume as few resources as possible; the conversion process is basically a table lookup process, which can be easily completed by a person skilled in the art using a known method without creative work, so it will not be described in detail;
[0545] For generating a random key with a specific length that can be used for symmetric encryption, an existing pseudo-random number generator can be used to generate a random bit stream with statistical randomness as the key for symmetric encryption. There are many known algorithms, which will not be described in detail here.
[0546] For initialization generation and writing of keys or certificates, a complete initialization (after writing all keys or certificates, writing all data members, and writing all replacement tables) is recorded as one modification, and the number of modifications is 0, which means that it has been initialized; for subsequent modification and deletion of any key or certificate, when a single modification is selected, after the modification or deletion, the storage status, the latest modification status, the forced refresh of the replacement table, and the update of the unique code are rewritten, it is recorded as one modification, and the number of modifications is increased by 1. When multiple modifications are selected, after the modification or deletion of all items, the storage status, the latest modification status, the forced refresh of the replacement table, and the update of the unique code are rewritten, it is recorded as one modification, and the number of modifications is increased by 1; for all replacement tables, independent modification of a certain replacement table is allowed, and all elements in the table must be modified at the same time. After the modification, the unique code is updated, which is recorded as one modification, and the number of modifications is increased by 1;
[0547] Regarding writing data in the data structure to local files, when marking the key certificate of this user, after completing the compliance inspection, it is allowed to directly write all data members in plain text to the local file to become the personal key library of this user, and the relevant data required to export the interface public key is allowed to be written to the local file in plain text (and encapsulated) to become the interface public key, and the relevant data required to export the complete public key is allowed to be written to the local file in plain text (and then encrypted and encapsulated) to become the complete public key, and the relevant data required to export the update of the complete public key is allowed to be written to the local file in plain text (and then encrypted and encapsulated) to become the update of the complete public key; when marking the key certificate of other users, it is not allowed to write to the local file in any case except the update of the complete public key, but it is allowed to read and restore the data structure of the interface public key, complete public key, and update of the complete public key of other users; it should be noted that when the data stored in the local hard disk is no longer safe, the written local files, especially the personal key library and complete public key of this user, should be encrypted and written. The specific encryption method recommended is the symmetric encryption method. The key is provided by the logged-in user and the key is not stored.
[0548] To facilitate the explanation of other embodiments that use the method of this embodiment to initialize, generate, modify, verify, write local files, and restore the data structure of storage and management of the hybrid encryption and decryption key and certificate from local files, all methods related to the storage and management of hybrid encryption and decryption keys and certificates shown in this embodiment are encapsulated into three functions with different functions, including: Key_Cert_Manage(MODE); function, calling this function with different MODEs means initializing, generating, modifying, and verifying the data structure in this embodiment, Key_Cert_Write(MODE); function, calling this function with different MODEs means writing the data structure to a local file in the form of a personal key store, an interface public key, a complete public key, and an update of the complete public key, Key_Cert_Read(); function, calling this function means reading the data in the local file and restoring the data structure.
[0549] It should be noted that a large number of database-related operations such as data storage and retrieval are required in this embodiment. The above operations are only used as implementation examples to focus on explaining aspects that may be confusing or complicated. In actual use, appropriate implementation methods such as database storage and retrieval should be selected as needed to fully implement all operations of this embodiment corresponding to the fourth aspect of the invention content, so as to achieve the purpose of storing and managing hybrid encryption and decryption keys and certificates.
[0550] The data structure for storage and management of hybrid encryption and decryption keys and certificates in this embodiment can not only be used for H-hybrid encryption and secret-in-secret dual-layer distribution of the present invention, but also cooperate with the third aspect, the fifth aspect, the sixth aspect of the present invention and the third, fifth and sixth aspects of the present invention to be used as a key database for calling keys and certificates, generating or importing interface public keys, generating or importing complete public keys, etc.; when non-H-hybrid encryption is used, the non-H-module in the indefinite-length header data of the third aspect of the present invention can still be used to call the key certificate in the data structure for storage and management of hybrid encryption and decryption keys and certificates in this embodiment to complete encryption and encapsulation;
[0551] In addition, according to Fig.10 In this embodiment, the methods related to the storage and management of hybrid encryption and decryption keys and certificates (i.e., the above three functions) can be encapsulated into an interface. By calling this interface, in conjunction with the interface for generating keys and certificates and the interface for generating replacement tables, the data structure in this embodiment can be initialized, generated, modified, and verified to obtain a complete data structure; at the same time, by calling this interface, the complete data structure can be written to a local file to obtain a database that can be used for storage and distribution. In conjunction with the interface for secret-in-secret distribution in the sixth aspect of the present invention and embodiment six, double-layer secret-in-secret distribution can be realized; in conjunction with the interface for importing H-modules and exporting H-modules in the fifth aspect of the present invention and embodiment five, it is possible to further call the key, certificate or replacement table in the data structure to realize H-hybrid encryption and related encapsulation.
[0552] Embodiment 5
[0553] according to Fig.11 , Fig.12 , Fig.13 In solving the problem of the management method of the hybrid encryption and decryption encryption means, this embodiment provides a data structure for managing the hybrid encryption and decryption encryption means, which is used to store the database, order, layer settings, keys, certificates, replacement tables and other information used for H-hybrid encryption and decryption and secret-in-secret double-layer distribution; in addition, this embodiment provides a series of management methods related to the data structure for managing the hybrid encryption and decryption encryption means, a method for exporting the encryption means in the data structure in a specific format for writing the variable-length header data H-module, and a method for importing the content of the variable-length header data H-module to generate various encryption means required in the data structure, and a method for using the encryption means in the data structure to guide H-hybrid encryption and decryption. The specific methods used are as follows:
[0554] The data structure for managing hybrid encryption and decryption means is named class H_Minus_Manager in this embodiment, and the content and form of its specific data members can be referred to as follows:
[0555] The latest modified unique code of the data structure of the database of the target user key and certificate is used to indicate the latest modified unique code of the data structure of the database used by the H-hybrid encryption in the P2N and N2P modes, and is used to indicate the latest modified unique code of the data structure of the receiving user database in the H-hybrid encryption in the P2P mode, so as to locate the corresponding database and call it; the implementation form of the latest modified unique code of the data structure of the database of the target user key and certificate corresponds to the latest modified unique code in the data structure in the fourth aspect of the present invention and the fourth embodiment, and is usually implemented in a one-dimensional array, such as unsigned char Target_Unique_Code[static_length]; static_length represents the fixed length of the unique code used. Taking the data member in the data structure of the fourth embodiment as an example, unsigned char Target_Unique_Code
[128] can be established, corresponding to the unique code created using SHA-512, and saved in hexadecimal expansion bytes;
[0556] The latest modified unique code of the data structure of the optional database of user keys and certificates is used to indicate the latest modified unique code of the data structure of the sender user database in H-hybrid encryption in P2P mode, so as to locate the corresponding database and call it. It will only be used in P2P mode to locate the key or certificate required by some encryption methods supported by P2P mode; the implementation form of the latest modified unique code of the data structure of the database of user keys and certificates corresponds to the latest modified unique code in the data structure in the fourth aspect of the present invention and the fourth embodiment, and is usually implemented in a one-dimensional array, such as unsigned char Sent_Unique_Code[static_length]; static_length represents the fixed length of the unique code used. According to the data member in the data structure of the fourth embodiment, unsigned char Sent_Unique_Code
[128] can be established, corresponding to the unique code created using SHA-512, and saved in hexadecimal expansion bytes;
[0557] The flag for marking the plain text and cipher text form of the information encapsulated by the H-module and the header data is used to mark the plain text and cipher text form of the encapsulated data before encapsulation. For example, the database and interface public key stored locally all use the H-method, but are encapsulated in plain text form, while the encrypted data, complete public key, and complete public key update all use the H-method, but are encapsulated in cipher text form; the flag for marking the plain text and cipher text form of the information encapsulated by the H-module and the header data is usually implemented as a bool type variable, such as: boolPlain_Cipher; usually, true in bool form represents plain text, and false in bool form represents cipher text;
[0558] The flag for marking the purpose of the information encapsulated by the H-module and the header data is used to mark the specific purpose of the encapsulated data, which usually includes ciphertext, ciphertext encrypted by a fixed method, interface public key for transmission, complete public key for transmission, update of complete public key for transmission, and flag options for saving to the local personal key library of this user; the flag for marking the purpose of the information encapsulated by the H-module and the header data is usually implemented as an int type variable, such as: intMethod; different values represent different options, such as ciphertext corresponds to "1", ciphertext encrypted by a fixed method corresponds to "2", interface public key for transmission corresponds to "3", complete public key for transmission corresponds to "4", update of complete public key for transmission corresponds to "5", and personal key library for this user for saving to the local corresponds to "6";
[0559] The scenario and purpose flag of hybrid encryption and decryption is used to indicate the scenario and purpose flag used by H-hybrid encryption. It is usually a replacement table of optional P2P, P2N, and N2P. It is stored in plain text here. The scenario and purpose flag of hybrid encryption and decryption is usually implemented as an int variable, such as int Condition. Different values represent different options. It supports three modes: P2P, P2N, and N2P. For example, P2P corresponds to "1", P2N corresponds to "2", and N2P corresponds to "3".
[0560] The order and layer settings of hybrid encryption and decryption are used to indicate the order and layer settings used by H-hybrid encryption. Here, they are stored in plain text. The order and layer settings used for hybrid encryption and decryption are usually implemented as a one-dimensional array, int Step_Stage_Set[Step_amount+1]; Step_amount indicates the maximum number of orders supported. In each element of Step_amount+1, the order of H-hybrid encryption selected and the number of layers of each order are stored respectively. According to the results of the previous experiments, it is supported to establish int Step_Stage_Set[4+1]; if a 2-order (1, 4) layer is used, each element is stored separately, that is, Step_Stage_Set[0]=2; Step_Stage_Set[1]=1; Step_Stage_Set[2]=4; if a 4-order (1, 4, 7, 9) layer is used, each element is stored separately, that is, Step_Stage_Set[0]=4; Step_Stage_Set[1]=1; Step_Stage_Set[2]=4; Step_Stage_Set[3]=7; Step_Stage_Set[4]=9;;
[0561] The keys and certificates used at each level and layer and their usage methods are expressed in the form of rows, columns, and groups. They are used to explain which row and column of keys or certificates (in the corresponding recipient database or the user database) are used as the parent and child keys or certificates for hybrid encryption, as well as which encryption method is used. They usually contain a secondary data structure of several parent key or certificate rows, parent key or certificate columns, parent key or certificate groups, parent key or certificate usage methods, child key or certificate rows, child key or certificate columns, and child key or certificate groups. Here, they are stored in plain text. The secondary data structure can be named classKey_Cert_Method_Sec. The reference implementation form is:
[0562]
[0563] The keys and certificates used at each level and each layer, as well as the methods of use, are usually implemented as a one-dimensional array in the form of rows, columns, and groups, such as Key_Cert_Method_Sec Key_Cert[support_length]; support_length indicates the maximum number of layers used when the full number of levels and layers are supported. For example, taking the maximum number of levels 4 and 9 as an example, Key_Cert_Method_Sec Key_Cert
[36] can be established; in each element, the keys and certificates used at each level from the first level and the first layer to the last level and the last layer are stored in ascending order and ascending order, i.e., the secondary data structure Key_Cert_Method mentioned above.
[0564] The padding situation expressed by the number of layers and the padding code rule or length is used to illustrate the padding situation of each level of hybrid encryption. It usually contains a secondary data structure of the layer position of each level of padding, the padding code rule or length of each level of padding, which is stored in plain text here; this secondary data structure can be named class Padding_Sec; the reference implementation form is:
[0565]
[0566] The padding conditions represented by the number of each level and the padding code rule or length are usually implemented as a one-dimensional array, such as Padding_SecPadding_per_Step[support_length]; support_length represents the maximum number of supported levels, and in each element, the padding conditions of each level from the first level to the last level are stored in ascending order, that is, the above-mentioned secondary data structure Padding_Sec;
[0567] The flag of the encapsulated information type in the variable-length header data is used to optimize the random padding and other methods for different encapsulated information types, corresponding to the type description module of the encapsulated information in the variable-length header data; the flag of the encapsulated information type in the variable-length header data is usually implemented as an int variable, such as: int Data_Type; different values represent different options, such as: ciphertext corresponds to "0", public key certificate corresponds to "1", private key certificate corresponds to "2", "configuration file corresponds to "3", binary optimization type corresponds to "4", text optimization type corresponds to "5";
[0568] The optional time limit for decryption is used to limit the decryption time. It usually contains a data structure of the start time and the end time of decryption. Here it is stored in plain text. The time limit for decryption is usually implemented in the form of a data structure. The data structure can be named class Time_Limit. The reference implementation form is:
[0569]
[0570] Optional machine restrictions for decryption are used to restrict decryption machines. They usually contain one or more data structures of machine codes for decryption machines, which are stored in plain text here. Machine restrictions for decryption are usually implemented in the form of data structures, which can be named classMachine_Limit. The reference implementation form is:
[0571]
[0572] Regarding the method of exporting the data structure of the management method of the hybrid encryption and decryption means in a specific format and writing it into the H-module, generally, the information of all data members is set and generated first, and then the plaintext information that needs to be converted into the replacement table is converted into the replacement table and written into the H-module. The specific process of its general form is as follows:
[0573] In the H-module's space, or in temporary space to be written to the H-module:
[0574] Write the identifier "%H_0"; write the latest modified unique code Target_Unique_Code of the data structure of the target user's key and certificate database in plain text, and optionally the latest modified unique code Sent_Unique_Code of the data structure of the user's key and certificate database;
[0575] Write the identifier "%H_1"; use the conversion function to convert the plain text and cipher text of the plain_cipher bool type of the information encapsulated by the H-module and the header data into the corresponding char type ASCII code 0 and 1, and write the plain text and cipher text of the information encapsulated by the H-module and the header data;
[0576] Write the identifier "%H_2"; use the conversion function to convert the int type Method of the flag H-module and the purpose of the information encapsulated by the header data into the corresponding char type ASCII code (because the number is small, it can be converted), and write the flag H-module and the purpose of the information encapsulated by the header data;
[0577] Write the identifier "%H_3"; use the conversion function to convert the scenario and purpose flag Condition of the hybrid encryption and decryption into a replacement table, and write the replacement table of the scenario and purpose of the hybrid encryption and decryption;
[0578] Write the identifier "%H_4", use the conversion function to convert the hybrid encryption and decryption step and layer setting Step_Stage_Set into a replacement table, and write the hybrid encryption and decryption step and layer setting replacement table;
[0579] Write the identifier "%H_5", use the conversion function to convert the parent key or certificate, the method of using the parent key or certificate, and the child key or certificate (encapsulated into the data structure Key_Cert_Method_Sec) used in each order and each layer into a replacement table, and write the replacement table corresponding to the parent key and certificate, the method of using the parent key or certificate, the child key and certificate used in each layer from the first order and the first layer to the last order and the last layer in each order from the smallest to the largest;
[0580] Call the random bit stream generation function to generate a random bit stream with a random byte length, and then add the interference of random bytes and random numbers;
[0581] Write the identifier "%H_6", use the conversion function to convert the number of padding layers, body code rule or length of each stage (encapsulated into the data structure Padding_Sec) into a replacement table, and write the replacement table corresponding to the number of padding layers, body code rule or length of each stage from the first stage to the last stage in ascending order;
[0582] Call the random bit stream generation function to generate a random bit stream with a random byte length, followed by the interference of random bytes and random numbers;
[0583] Write the identifier "%H_7", use the conversion function to convert the year, month, day, hour, minute, second, and millisecond in the time point of completing the H-encapsulation (which can be written into the H-module time point record) into a replacement table, and write the time point of completing the H-encapsulation in the form of the replacement table of the target user;
[0584] Write the identifier "%H_8", use the conversion function to convert the year, month, day, hour, minute, second, and millisecond of the start and end time points (encapsulated into the data structure Time_Limit) in the time limit for allowing decryption into a replacement table, first write the replacement table group corresponding to the start time point for allowing decryption, and then write the replacement table group corresponding to the end time point for allowing decryption;
[0585] Write the identifier "%H_9", and then write the machine code corresponding to each machine allowed to decrypt (encapsulated into the data structure Machine_Limit), usually followed by a standard hash value for all machine codes;
[0586] Write the identifier "%H_A", use the conversion function to convert the length of the random number of random bytes appended to the end after H-hybrid encryption into a replacement table, and write the replacement table with the length of the random number of random bytes appended to the end after encryption;
[0587] The general process of exporting data structures and writing them into H-modules is simplified into program pseudocode, namely:
[0588] Write("%H_0"); Write(Target_Unique_Code); / / Write "%H_0", write the latest modified unique code
[0589] if(Condition == 1)Write(Sent_Unique_Code); / / When P2P is selected, write the unique code of this user
[0590] Write("%H_1"); Write(Convert(Plain_Cipher)); / / Write "%H_1", write the plain text and cipher text flags
[0591] Write("%H_2"); Write(Convert(Method)); / / Write "%H_2", write the flag of the purpose of the encapsulated information
[0592] Write("%H_3"); Write(Convert(Condition)); / / Write "%H_3", write the replacement table of scene and usage flags
[0593] Write("%H_4"); Write(Convert(Step_Stage_Set)); / / Write "%H_4", write the replacement table of step and stage settings
[0594] Write("%H_5");
[0595] for(int i=0; i <Number_of_All_Stage;i++)Write(Convert(Key_Cert_Method_Sec));
[0596] / / Write "%H_5" and write the replacement table corresponding to each layer of parent key and certificate, usage method, subkey and certificate in order
[0597] / / When the layer does not have subkeys and certificates, replace them with a random bit stream of the same length as the replacement table
[0598] Write(PRNG()); / / Write random bytes and random number interference
[0599] Write("%H_6");
[0600] for(int i=0; i <Number_of_Step;i++)Write(Convert(Padding_Sec));
[0601] / / Write "%H_6" and write the replacement table corresponding to the number of filling layers, body code rules or length of each order in order
[0602] Write(PRNG()); / / Write random bytes and random number interference
[0603] Write("%H_7"); Write(Convert(Time_Now)); / / Write "%H_7", write the replacement table of the time point when the H-encapsulation is completed
[0604] Write("%H_8"); Write(Convert(Time_Limit)); / / Write "%H_8", write the replacement table that allows decryption time limit
[0605] Write("%H_9"); Write(Machine_Limit); / / Write "%H_9", write all the machine codes of the machine limit that is allowed to be decrypted
[0606] Write(HASH(Machine_Limit)); / / Write the standard hash of all machine codes of the machine limit allowed for decryption
[0607] Write("%H_A"); Write(Convert(Random_Length_After_Cipher)); / / Write "%H_A", write the replacement table with the length of random bytes and random numbers at the end after H-hybrid encryption
[0608] / / At this point, the writing of all the contents of the H-module is completed
[0609] To facilitate the explanation of the process of using the method of this embodiment to export data structures and write them into the H-module in other embodiments, the method of using the method of this embodiment to export data structures and write them into the H-module shown in this embodiment is now encapsulated into a Write_to_H_M_Module() function. Calling this function means exporting the encryption method information of the data structure of this embodiment and writing it into the H-module.
[0610] It should be noted that the actual process of exporting data structures and writing them into H-modules is very complicated, as the export of data structures and writing them into H-modules involves issues such as selection and non-selection in different application situations, mutual exclusion of selection, information transmission and storage, differences between selection and actual writing, and non-compliance detection. Due to space limitations, this article uses simplified pseudocode to briefly describe the process without losing generality, which can serve as an introduction. However, the pseudocode is still not rigorous enough in many aspects, so please be aware of this.
[0611] It should be specially noted that, since it may be necessary to convert the data members in the data structure into the corresponding format using a certain form of conversion function before writing into the H-module, different data members correspond to different conversion functions, and the conversion functions used are divided into two categories, one is a function for converting bool or int into char type ASCII code, and the other is a function for converting plain text into a corresponding replacement table; the first type of function is very simple, and ordinary technicians in this field can easily complete it using known methods without creative work, so it will not be introduced again, the second type of function uses the corresponding conversion function in the data structure for storage and management of hybrid encryption and decryption keys and certificates in the fourth aspect of the invention and embodiment 4 of the invention, which can be directly converted; all the replacement tables used are usually replacement tables in the data structure corresponding to the user database to be received;
[0612] When writing "%H_5" and "%H_6", the purpose of writing random bytes and random number interference is usually to prevent the decoder from obtaining the order and layer setting information of the H-hybrid encryption method used by observing the replacement table corresponding to each layer of the mother key and certificate, the usage method, the child key and the certificate, and the replacement table corresponding to the number of filling layers, the body code rule or the length of each order, so as to make the H-hybrid encryption method more concealed and increase its security; the attached random number bit stream should be longer and should be an integer multiple of the length of the replacement table (preferably 3*replacement table length (%H_5) and 2*replacement table length (%H_6)) According to the results of the previous experiments, the random bit stream should be an integer multiple of 32 bytes (preferably 96 bytes (%H_5) and 64 bytes (%H_6)), and the concealment effect can be better; in addition, for different types of information in the flag of the encapsulated information type,...
Claims
1. A hybrid encryption method, characterized in that: The encryption process adopts a hierarchical hybrid encryption form, which performs multiple encryptions on the encrypted content at multiple levels, divides the encrypted content into blocks in each encryption level, and uses different encryption methods and keys to encrypt different blocks in groups. The encryption process includes: Select the encryption level, the number of layers in each level, and select the encryption method and key level by level and layer by layer; Starting from the first level, the content to be encrypted is divided into blocks with the sum of the sizes of all layers of the level as one block; in each block, the data to be encrypted of the size of the layer is encrypted in turn according to the encryption method of each layer and using the key of each layer; encryption is performed block by block; until the tail block of the content to be encrypted of the level, after the tail layer in the tail block is filled, the data to be encrypted of the size of the layer is encrypted according to the encryption method of the layer and using the key of the layer, and then the encryption of the level is completed; If there is a second stage, starting from the second stage, the ciphertext encrypted in the previous stage is used as the content to be encrypted, and encryption is performed step by step until the encryption of the last stage is completed; The hybrid encryption is completed, and the ciphertext after the last level of encryption is the final hybrid encrypted ciphertext.
2. A hybrid decryption method, characterized in that: The decryption process adopts a hybrid decryption form of multi-level decryption, which performs multiple decryptions on the content to be decrypted in multiple levels, divides the content to be decrypted into blocks in each level of decryption, and uses different decryption methods and keys to decrypt different blocks in groups; The hybrid decryption method is capable of decrypting the ciphertext generated by the hybrid encryption method described in claim 1; The decryption process includes: According to the encryption order, the number of layers of each order, and the encryption method and key of each order and each layer, the decryption order, the number of layers of each order, and the decryption method and key are selected step by step and layer by layer; Starting from the last level, the content to be decrypted is divided into blocks, with the sum of the sizes of all layers of the level as one block; in each block, the data to be decrypted of the size of the layer is decrypted in turn according to the decryption method of each layer and using the key of each layer; decryption is performed block by block; until the tail block of the content to be decrypted of the level, the data to be decrypted of the size of the layer is decrypted according to the decryption method of the layer and using the key of the layer, and the tail layer in the tail block is decrypted. After de-stuffing, the decryption of this order is then completed; If there is a penultimate stage, starting from the penultimate stage, the data decrypted in the previous stage is used as the content to be decrypted, and decryption is performed stage by stage until the decryption of the first stage is completed; The hybrid decryption is completed, and the data after the first-order decryption is the plaintext after the final hybrid decryption.
3. A method for implementing information management and signature verification using variable-length header data, characterized in that: The method comprises the steps of encapsulating data using a variable-length header data encapsulation format and unpacking data encapsulated using the variable-length header data; The steps of encapsulating using the variable-length header data encapsulation format include: selecting a module to be used in the encapsulation format of the variable-length header data, writing content domain data according to relevant information of the encapsulated content, calculating and generating and writing check domain data, and writing segmentation domain data; The steps of unpacking the data encapsulated with the variable-length header data include: identifying the variable-length header data, reading the content domain data, reading the check domain data and checking the content domain, outputting relevant information, determining the end position of the variable-length header data according to the segmentation domain and locating the starting point of the encapsulated data; The encapsulation format of the variable-length header data is suitable for encapsulating the ciphertext generated by the hybrid encryption method described in claim 1; the encapsulation format can store the necessary information required for decryption by the hybrid decryption method described in claim 2; The encapsulation format of the variable-length header data includes: Content domain, an area for storing information related to the encapsulated data, which may include a variable-length header flag, a variable-length header version number, an encryption description, a data type description, an encryption method description, a padding method description, an encapsulated data hash, an encryption method hash used for the encapsulated data, H-encryption management, non-H-encryption management, remarks, and a streaming management module; A verification domain stores information related to the verification content domain data, which may include a hash or digital signature module of the content domain data; The segmentation field stores the segmentation mark for separating the variable-length header data and the encapsulated content.
4. A method for storing and managing hybrid encryption and decryption keys and certificates, characterized in that: The method comprises the steps of initializing, generating, modifying and verifying data members in a data structure, exporting from the data structure and writing into a local key database, and reading from the local key database and importing the data structure. The data structure in the step is a data structure storing a key, a certificate and a hybrid encryption substitution table. It also includes steps for external calls to obtain data members in the data structure; The data structure storing the key, certificate, and hybrid encryption replacement table can provide the hybrid encryption method described in claim 1 with the encryption algorithm, key, and other required database information selected for hybrid encryption, and can provide the information required for encapsulation of the variable-length header data format; The encapsulation format of the variable-length header data includes: Content domain, an area for storing information related to the encapsulated data, which may include a variable-length header flag, a variable-length header version number, an encryption description, a data type description, an encryption method description, a padding method description, an encapsulated data hash, an encryption method hash used for the encapsulated data, H-encryption management, non-H-encryption management, remarks, and a streaming management module; A verification domain stores information related to the verification content domain data, which may include a hash or digital signature module of the content domain data; The segmentation domain stores the segmentation mark for segmenting the variable-length header data and the encapsulated content; The data structure storing the key, certificate, and hybrid encryption replacement table can obtain encryption, padding, hashing, and other relevant information about the encapsulated content from the decapsulation of the variable-length header data format, thereby providing the hybrid decryption method of claim 2 with the decryption algorithm, key, and other required database information required for hybrid decryption; The data structure storing the key, certificate and hybrid encryption substitution table includes: Keys and certificates, data storing keys and certificates, and related storage and modification information, which may include storage information of keys and certificates, modification information of keys and certificates, and keys and certificates; A replacement table stores the data to be replaced and the corresponding replacement table, which may include a replacement table corresponding to the key and certificate position, a group number replacement table, an encryption method replacement table, a hybrid encryption layer setting replacement table, a scene and purpose flag replacement table, a filling situation replacement table, and a time replacement table; The information of the data structure itself, which stores the nature, identity, ownership, and integrity of the data structure, may include version number, creation time, last modification time, validity period, cumulative number of modifications, machine code of creation, unique code of last modification, unique code of latest modification, and integrity flag.
5. A method for managing a hybrid encryption and decryption method, characterized in that: The method comprises the steps of initializing, generating and modifying data members in a data structure, wherein the data structure in the step is a data structure for managing hybrid encryption and decryption means; The method comprises the steps of exporting the relevant encryption means from the data structure in a specific format and importing the relevant encryption means in a specific format and generating corresponding data members in the data structure; It also includes steps for external calls to obtain data members in the data structure, as well as steps for H-encryption management and non-H-encryption management in reading and writing variable-length header data; The encapsulation format of the variable-length header data includes: Content domain, an area for storing information related to the encapsulated data, which may include a variable-length header flag, a variable-length header version number, an encryption description, a data type description, an encryption method description, a padding method description, an encapsulated data hash, an encryption method hash used for the encapsulated data, H-encryption management, non-H-encryption management, remarks, and a streaming management module; A verification domain stores information related to the verification content domain data, which may include a hash or digital signature module of the content domain data; The segmentation domain stores the segmentation mark for segmenting the variable-length header data and the encapsulated content; The data structure for managing hybrid encryption and decryption means can provide the hybrid encryption method described in claim 1 with the encryption means selected for hybrid encryption, the location information of the key and certificate used for encryption in the database, and other required information related to hybrid encryption. In conjunction with the data structure storing the key, certificate, and hybrid encryption replacement table, it can guide the hybrid encryption method described in claim 1 to perform hybrid encryption operations. The encapsulation format of the variable-length header data can derive the encryption means and store it in the variable-length header data; the data structure for managing the hybrid encryption and decryption means can obtain information about the encryption means from the variable-length header data format, thereby cooperating with the data structure storing the key, certificate, and hybrid encryption replacement table to generate a decryption means corresponding to the encryption means, and can guide the hybrid decryption method described in claim 2 to perform a hybrid decryption operation; The data structure storing the key, certificate and hybrid encryption substitution table includes: Keys and certificates, data storing keys and certificates, and related storage and modification information, which may include storage information of keys and certificates, modification information of keys and certificates, and keys and certificates; A replacement table stores the data to be replaced and the corresponding replacement table, which may include a replacement table corresponding to the key and certificate position, a group number replacement table, an encryption method replacement table, a hybrid encryption layer setting replacement table, a scene and purpose flag replacement table, a filling situation replacement table, and a time replacement table; The information of the data structure itself, which stores the nature, identity, ownership, and integrity of the data structure, may include version number, creation time, last modification time, validity period, cumulative modification times, creation machine code, last modified unique code, latest modified unique code, and integrity flag; The data structure for managing the hybrid encryption and decryption means includes: Database location information, which stores the location mark of the database that encryption and decryption rely on, and may include the unique code of the target user database and the unique code of the user database; Hybrid encryption and decryption means, which store the encryption and decryption means required for hybrid encryption and decryption, which may include plaintext and ciphertext flags, scene and purpose flags, order and layer settings, key and certificate locations and encryption methods, and padding conditions; Security information, which stores the security conditions for allowing mixed decryption, and may include the machine code for allowing decryption and the time for allowing decryption; The step of exporting the relevant encryption means from the data structure in a specific format is characterized by: exporting part or all of the data members in plain text or other forms as information in a specific format; The characteristics of importing the relevant encryption means in a specific format and generating the corresponding data members in the data structure are: importing the information containing the mixed encryption means and having a specific format into the data structure, and generating the corresponding data members and content.
6. A method for operating, managing and protecting secret-in-secret double-layer distribution, characterized in that: The method comprises the step of distributing the interface public key in plain text, wherein the step of distributing the interface public key in plain text belongs to the first distribution in the secret-in-secret double-layer distribution, and the public key group distributed in plain text is used as the interface public key; The interface public key is derived from a data structure storing keys, certificates, and hybrid encryption replacement tables, and is encapsulated using an encapsulation format of variable-length header data, and can provide the encryption and decryption algorithms, keys, and other required encryption and decryption information selected for hybrid encryption and decryption for the hybrid encryption method described in claim 1 and the hybrid decryption method described in claim 2, and can provide partial keys, certificates, replacement tables, and other required database information for the data structure storing keys, certificates, and hybrid encryption replacement tables; The distribution is carried out in the form of network distribution or physical distribution; after receiving the interface public key, it can be unpacked using the encapsulation format of the variable-length header data, can import the data structure storing the key, certificate, and hybrid encryption replacement table and write it into the local database, can provide the hybrid encryption method of claim 1 and the hybrid decryption method of claim 2 with the selected encryption and decryption algorithm, key, and other required encryption and decryption information, and can provide sufficient data to provide key information for the hybrid encryption and decryption process of the complete public key ciphertext distribution; The method further comprises a step of distributing a complete public key ciphertext, wherein the step of distributing the complete public key ciphertext belongs to the second distribution in the secret-in-secret double-layer distribution, and the ciphertext distribution is a set of data including a key, a certificate and other required information used as a complete public key; The complete public key is derived from the data structure storing the key, certificate, and hybrid encryption substitution table, uses the interface public key as the key, uses the hybrid encryption method of claim 1 for hybrid encryption, and is encapsulated using the encapsulation format of the variable-length header data, and can provide the hybrid encryption and decryption algorithm, key, and other required encryption and decryption information selected for the hybrid encryption method of claim 1 and the hybrid decryption method of claim 2, and can provide the key, certificate, substitution table, and other required database information for the data structure storing the key, certificate, and hybrid encryption substitution table; The distribution is carried out in the form of network distribution or physical distribution; after receiving the complete public key, it can be unpacked using the encapsulation format of the variable-length header data, can import the data structure storing the key, certificate, and hybrid encryption replacement table and write it into the local database, can provide the encryption and decryption algorithm, key and other required encryption and decryption information selected for the hybrid encryption method of claim 1 and the hybrid decryption method of claim 2, and can provide sufficient data for the key distributed using the secret-in-secret double-layer for hybrid encryption and decryption to provide the key, certificate, replacement table and other required information; The method comprises the steps of resetting the interface public key, the steps comprising: resetting the data in the interface public key, and distributing the data using the steps of distributing the interface public key in plain text; The step of updating the complete public key includes: updating the data in the interface public key and distributing it using the step of distributing the complete public key ciphertext; The method comprises the steps of using a secret-in-secret double-layer distributed key to perform hybrid encryption, decryption and encapsulation, the steps comprising: using the local database written by the complete public key, importing the data structure storing the key, certificate and hybrid encryption replacement table as the database of the key, certificate and hybrid encryption replacement table, using the data structure for managing hybrid encryption and decryption means to set hybrid encryption and decryption means, using the data structure for managing hybrid encryption and decryption means to guide hybrid encryption and hybrid decryption, using the hybrid encryption method according to claim 1 to perform hybrid encryption or using the hybrid decryption method according to claim 2 to perform hybrid decryption, and using the encapsulation format of the variable-length header data to perform encapsulation and decapsulation; The method comprises the steps of improving the digital signature based on the hybrid encryption method, the steps comprising: the encryption and decryption processes in the digital signature are performed by using the hybrid encryption method of claim 1 for hybrid encryption or by using the hybrid decryption method of claim 2 for hybrid decryption; The method comprises optimization steps for hybrid encryption and encapsulation under streaming transmission, wherein the steps include: handshake, communication, first data transmission, continuous data transmission, and data repair transmission steps, and encryption, decryption, and encapsulation are performed using the method for hybrid encryption, decryption, and encapsulation using the key distributed in a secret-in-secret double layer; The method comprises an optimization step for anti-decryption under symmetric encryption, the steps comprising: using multiple groups of keys to jointly generate a symmetric key, which is used as a key of a certain level with only one layer in the hybrid encryption method described in claim 1, and using the hybrid encryption, decryption and encapsulation method using the key distributed in a secret-in-secret double layer to perform encryption, decryption and encapsulation; The method comprises an optimization step for the temporary symmetric key in encapsulation, the step comprising: encrypting the temporary symmetric key using the hybrid encryption method of claim 1, and storing the encrypted key in the encapsulation format of the variable-length header data; The encapsulation format of the variable-length header data includes: Content domain, an area for storing information related to the encapsulated data, which may include a variable-length header flag, a variable-length header version number, an encryption description, a data type description, an encryption method description, a padding method description, an encapsulated data hash, an encryption method hash used for the encapsulated data, H-encryption management, non-H-encryption management, remarks, and a streaming management module; A verification domain stores information related to the verification content domain data, which may include a hash or digital signature module of the content domain data; The segmentation domain stores the segmentation mark for segmenting the variable-length header data and the encapsulated content; The data structure for managing hybrid encryption and decryption means can provide the hybrid encryption method described in claim 1 with the encryption means selected for hybrid encryption, the location information of the key and certificate used for encryption in the database, and other required information related to hybrid encryption. In conjunction with the data structure storing the key, certificate, and hybrid encryption replacement table, it can guide the hybrid encryption method described in claim 1 to perform hybrid encryption operations. In conjunction with the encapsulation format of the variable-length header data, the encryption means can be derived and stored in the variable-length header data. The data structure for managing hybrid encryption and decryption means can obtain information about the encryption means from the variable-length header data format, thereby generating a decryption means corresponding to the encryption means in conjunction with the data structure storing the key, certificate, and hybrid encryption replacement table, and can guide the hybrid decryption method described in claim 2 to perform hybrid decryption operations. The data structure storing the key, certificate and hybrid encryption substitution table includes: Keys and certificates, data storing keys and certificates, and related storage and modification information, which may include storage information of keys and certificates, modification information of keys and certificates, and keys and certificates; A replacement table stores the data to be replaced and the corresponding replacement table, which may include a replacement table corresponding to the key and certificate position, a group number replacement table, an encryption method replacement table, a hybrid encryption layer setting replacement table, a scene and purpose flag replacement table, a filling situation replacement table, and a time replacement table; The information of the data structure itself, which stores the nature, identity, ownership, and integrity of the data structure, may include version number, creation time, last modification time, validity period, cumulative modification times, creation machine code, last modified unique code, latest modified unique code, and integrity flag; The data structure for managing the hybrid encryption and decryption means includes: Database location information, which stores the location mark of the database that encryption and decryption rely on, and may include the unique code of the target user database and the unique code of the user database; Hybrid encryption and decryption means, which store the encryption and decryption means required for hybrid encryption and decryption, which may include plaintext and ciphertext flags, scene and purpose flags, order and layer settings, key and certificate locations and encryption methods, and padding conditions; Security information stores security conditions that allow mixed decryption, which may include machine codes that allow decryption and the time when decryption is allowed.
7. A system, characterized in that: The method according to any one of claims 1 to 6 can be performed.
8. A device, characterized in that: It may include in part or in whole: instruction interaction equipment, instruction interface, system containing executable programs, random access memory device, data and address bus, general computing equipment, I / O interface, hardware storage device, transmission and communication equipment; The system including the executable program is characterized in that when the executable instructions therein are executed by a processor, the method described in any one of claims 1 to 6 can be implemented.
9. A storage medium, characterized in that: A storage medium containing computer executable instructions, wherein when the executable instructions are executed by a processor, the method according to any one of claims 1 to 6 can be implemented.
10. A method for generating a standard hash and random substitution table, characterized in that: Use multiple groups of hash functions and perform multiple hash transformations to generate a traceable, replayable standard hash with a specified length and a non-traceable, non-reversible random replacement table with a specified length; The standard hash and random substitution table are suitable for managing the data structure of hybrid encryption and decryption means and the standard hash and substitution table required in the data structure storing the key, certificate, and hybrid encryption substitution table; The process of generating a standard hash includes: Select several hash functions with different output lengths, grouping lengths, and operation methods, and arrange them in descending order according to output length, and record them as HF1, HF2, ... HFn; Use the selected hash functions HF1, HF2, ... HFn in order from the largest to the smallest output length to perform hash transformation on the data to be hashed after non-random padding; The hash value obtained after the last hash transformation using HFn is the generated standard hash; The process of generating a random substitution table includes: Select several hash functions with different output lengths, grouping lengths, and operation methods, and arrange them in ascending order according to output length, denoted as HF1, HF2, ... HFn; Use the selected hash functions HF1, HF2, ... HFn in order from the smallest to the largest output length to perform hash transformation on the replaced data after random padding; The hash value obtained after the last hash transformation using HFn is the generated random replacement table; The data structure storing the key, certificate and hybrid encryption substitution table includes: Keys and certificates, data storing keys and certificates, and related storage and modification information, which may include storage information of keys and certificates, modification information of keys and certificates, and keys and certificates; A replacement table stores the data to be replaced and the corresponding replacement table, which may include a replacement table corresponding to the key and certificate position, a group number replacement table, an encryption method replacement table, a hybrid encryption layer setting replacement table, a scene and purpose flag replacement table, a filling situation replacement table, and a time replacement table; The information of the data structure itself, which stores the nature, identity, ownership, and integrity of the data structure, may include version number, creation time, last modification time, validity period, cumulative modification times, creation machine code, last modified unique code, latest modified unique code, and integrity flag; The data structure for managing the hybrid encryption and decryption means includes: Database location information, which stores the location mark of the database that encryption and decryption rely on, and may include the unique code of the target user database and the unique code of the user database; Hybrid encryption and decryption means, which store the encryption and decryption means required for hybrid encryption and decryption, which may include plaintext and ciphertext flags, scene and purpose flags, order and layer settings, key and certificate locations and encryption methods, and padding conditions; Security information stores security conditions that allow mixed decryption, which may include machine codes that allow decryption and the time when decryption is allowed.
