An attribute-based encryption method and system for layout files

CN122926475APending Publication Date: 2026-10-16BEIJING ZHONGHONG LIDA TECH DEV CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611424121.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-15
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

现有版式文件加密技术存在的主要问题是:文件一旦加密后,所有授权用户看到的文件内容完全相同,缺乏面向用户属性的动态内容呈现能力

Benefits of technology

通过将待加密版式文件所对应文档内容按访问控制策略划分为独立加密分块,结合属性密码技术,实现了基于用户属性的文档内容细粒度访问控制。通过将同一加密文件面向不同属性用户呈现不同内容,突破了传统文件级加密只能“全有或全无”的限制。访问控制策略,采用属性表达式描述,支持AND、OR、门限(Threshold)等逻辑运算符的组合,可以实现灵活的访问策略表达(如“部门=财务部 AND 密级=机密”等复杂组合策略),将访问策略嵌入属性密文中,无需为每个用户单独生成密钥,极大简化了密钥管理。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122926475A_ABST
    Figure CN122926475A_ABST
Patent Text Reader

Abstract

The present application relates to a kind of layout file encryption method and decryption method and system based on attribute password, belong to information security technical field.Encryption method includes: based on the access control policy of the document content corresponding to the layout file to be encrypted, the layout file to be encrypted is divided into multiple independent blocks and is respectively symmetrically encrypted to obtain ciphertext data;Attribute encryption is carried out based on the access control policy of each block to symmetric key to obtain attribute ciphertext;Based on attribute ciphertext and each block ciphertext data, generate encrypted layout file.Decryption method includes: according to the attribute of user based on the access control policy Key decryption attribute ciphertext in layout file to obtain symmetric key;Based on symmetric key, each block ciphertext data is decrypted;Present the block plaintext visible to user permission to user.The present application method realizes the fine-grained block access control of layout file, realizes the same encrypted file to different attribute users and presents different content, and provides file leakage tracing ability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security technology, and in particular to a method and system for encrypting and decrypting formatted documents based on attribute cryptography. Background Technology

[0002] With the rapid development of information technology, organizations are paying great attention to internal information security.

[0003] Existing document encryption systems primarily employ file-level or page-level overall encryption, meaning they uniformly encrypt and protect the entire file or page. The main problem with existing document encryption technologies is that once a file is encrypted, all authorized users see exactly the same content, lacking the ability to dynamically present content based on user attributes.

[0004] Furthermore, most existing solutions employ server-side encrypted storage, meaning the server holds the user's plaintext or encryption keys, posing a risk of server-side data leakage. Once the server-side database or file storage system is compromised, attackers can obtain the plaintext content of the files. Moreover, existing solutions lack effective source tracing capabilities for formatted files. When files are leaked, it is impossible to quickly locate the source of the leak and trace the file's flow path. Summary of the Invention

[0005] Based on the above analysis, the present invention aims to disclose an attribute-based password-based encryption and decryption method and system for OFD formatted files, so as to realize fine-grained access control for dynamically presenting different content for different user attributes in OFD formatted files.

[0006] On the one hand, the present invention provides a method for encrypting formatted documents based on attribute cryptography, specifically including the following steps: Based on the access control policy corresponding to the document content of the file to be encrypted, the file to be encrypted is divided into multiple independent blocks, and each block is encrypted using its own SM4 symmetric key. Each block is encrypted using SM4 to obtain the ciphertext data of each block. ,in The block number is defined as follows; each independent block corresponds to a different access control policy. Access control policies based on each of the aforementioned blocks SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. ; Ciphertext based on each attribute Obtain the key description file; Based on each of the aforementioned block ciphertext data Generate an encrypted layout file using the key description file.

[0007] Furthermore, the access control policies based on each of the aforementioned blocks... SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. include: Using the CP-ABE algorithm for access control policies For input, the SM4 symmetric key for each block Perform attribute encryption to generate attribute ciphertext. .

[0008] Furthermore, the SM4 symmetric keys based on each of the aforementioned blocks... Each block is encrypted using SM4 to obtain the ciphertext data of each block. include: Generate corresponding SM4 symmetric keys for each of the aforementioned blocks. ; Using SM4-CBC mode based on Each block is encrypted to generate its own ciphertext data. ; The SM3 hash algorithm was used to calculate the ciphertext data of each block. Integrity check value The integrity check value Used to verify whether the encrypted data has been tampered with or has a transmission error.

[0009] Furthermore, the ciphertext based on each attribute The obtained key description file includes: Use the SM2 private key to cipher the attributes. The attribute signature value is obtained by performing SM2 signing on the constructed attribute ciphertext set; A key description file is obtained based on the attribute ciphertext set and the attribute signature value.

[0010] Furthermore, the format file encryption method also includes generating and distributing a corresponding attribute decryption key to the user by an attribute key distribution system. This attribute decryption key is used when the user's attribute set satisfies the access control policy. Decrypt the attribute ciphertext in time .

[0011] On the other hand, the present invention also provides a method for decrypting layout documents based on attribute cryptography, used to decrypt encrypted layout documents generated using the layout document encryption method; the decryption method includes: The encrypted layout file is used to obtain the ciphertext data of each block. and the key description file; The attribute ciphertext is obtained based on the key description file. ; Obtain the user's attribute decryption key; Decrypt attribute ciphertext using the user's attribute decryption key. If the user attribute set satisfies the access control policy Decryption was successful, and the SM4 symmetric key was obtained. Otherwise, decryption will fail; Based on the SM4 symmetric key obtained after successful decryption Decrypt each block of ciphertext data Each block is obtained, and the plaintext of each block is presented according to the format file standard.

[0012] Furthermore, the ciphertext of each attribute is obtained based on the key description file. include: The attribute ciphertext set and the SM2 signature value are obtained based on the key description file; Verify the attribute ciphertext set based on the SM2 signature value; Each attribute ciphertext is obtained based on the verified attribute ciphertext set. .

[0013] Furthermore, the attribute ciphertext is decrypted based on the user's attribute decryption key. include: Using the CP-ABE algorithm, attribute ciphertext is decrypted based on the user's attribute decryption key. Decryption, i.e. ).

[0014] Furthermore, the SM4 symmetric key obtained based on successful decryption... Decrypt each block of ciphertext data The obtained plaintext blocks include: The SM3 hash algorithm is used to analyze the ciphertext data in each block. Perform integrity verification; Based on the SM4 symmetric key obtained after successful decryption Decrypt the ciphertext data blocks that have passed integrity verification. The corresponding blocks are obtained.

[0015] On the other hand, the present invention also provides a formatted document encryption and decryption system based on attribute cryptography, comprising: An attribute key system is used to generate and distribute corresponding attribute decryption keys to users. These attribute decryption keys are used when a user's attribute set satisfies an access control policy. Time-decryption attribute ciphertext ,in For serial numbers; The formatted document encryption module, based on access control policies, divides the document in the formatted document to be encrypted into multiple independent blocks, and uses the SM4 symmetric key of each block to encrypt the document. Each block is encrypted using SM4 to obtain the ciphertext data of each block. Access control policies based on each of the aforementioned blocks. SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. Based on each attribute of the ciphertext Obtain the key description file; based on each block of ciphertext data Generate an encrypted layout file from the key description file; The layout file decryption module is used to obtain the ciphertext data of each block based on the encrypted layout file. and the key description file; based on the key description file, obtain the ciphertext of each attribute. ; Obtain the user's attribute decryption key; Decrypt the attribute ciphertext based on the user's attribute decryption key. If the user attribute set satisfies the access control policy Decryption was successful, and the SM4 symmetric key was obtained. Otherwise, decryption will fail; based on the SM4 symmetric key obtained from successful decryption. Decrypt each block of ciphertext data Each block is obtained, and the plaintext of each block is presented according to the format file standard.

[0016] The present invention can achieve at least one of the following beneficial effects: By dividing the document content corresponding to the formatted file to be encrypted into independent encrypted blocks according to access control policies, and combining this with attribute cryptography, fine-grained access control of document content based on user attributes is achieved. By presenting different content to users with different attributes for the same encrypted file, the limitation of traditional file-level encryption being only "all or nothing" is overcome. Access control policies are described using attribute expressions, supporting combinations of logical operators such as AND, OR, and thresholds, enabling flexible expression of access policies (such as complex combinations like "Department = Finance Department AND Security Classification = Confidential"). Embedding the access policy in attribute ciphertext eliminates the need to generate a separate key for each user, greatly simplifying key management.

[0017] A hybrid encryption method combining CP-ABE attribute encryption and the Chinese national standard SM4 symmetric encryption is employed. The SM4 algorithm is used for efficient encryption of large amounts of content data in formatted files (block encryption), while the CP-ABE algorithm is used to protect the SM4 block keys and implement flexible attribute access control. This combination ensures both fine-grained attribute access control and high performance for large file encryption.

[0018] By performing encryption on the publisher's client, the server can store only the encrypted data (the encrypted layout file) without possessing any plaintext keys. Even if the server is compromised, attackers cannot obtain the plaintext content of the file, eliminating the risk of server-side data leakage.

[0019] The method of this invention follows the encryption protocol mechanism of the GM / T 0099-2020 standard. By utilizing the packet structure characteristics of OFD document XML+ZIP, it extends the plaintext-ciphertext mapping table (EntriesMap) and decryption entry file (Encryptions) format as defined by the standard, and adds an extended field of CP-ABE attribute ciphertext to the key description file to achieve compatibility with existing OFD cryptographic application systems.

[0020] By embedding a user's unique identifier into the key structure during the attribute key generation stage, an invisible digital watermark bound to that user is automatically embedded when decrypting and presenting a document. This establishes a cryptographic link between the watermark and the user's identity. When any user who meets the access policy decrypts a document, the presented content will contain watermark information uniquely identified by their attribute key. In the event of a leak, the identity of the leaker can be reconstructed by extracting the watermark, and the source of the leak and the file's circulation path can be determined by combining this with key distribution records. The watermark information is bound to the file content and can still be extracted after printing, screenshotting, and format conversion. This enables file leak tracing capabilities; when a file is leaked, watermark information can be quickly extracted to locate the source of the leak, providing crucial evidence for security incident investigations.

[0021] The method and system of this invention are compatible with existing OFD cryptographic application systems. The encryption methods used meet the national cryptographic compliance requirements, and all adopt the SM2 / SM3 / SM4 national cryptographic algorithm system. They comply with the encryption protocol specifications of the GM / T 0099-2020 standard, meet the cryptographic compliance requirements of government, finance and other industries, and are easy to deploy and promote.

[0022] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0023] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts.

[0024] Figure 1 This is a schematic diagram of the document encryption method of the present invention; Figure 2 This is a schematic diagram of the document decryption method of the present invention; Figure 3 This is a flowchart illustrating how the attribute key distribution system of the present invention generates and distributes corresponding attribute decryption keys to users. Figure 4 This is a schematic diagram illustrating the principle of tracing the source when the encrypted format file of this invention is leaked. Detailed Implementation

[0025] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0026] Method Implementation Examples One embodiment of the present invention discloses a method for encrypting formatted documents based on attribute cryptography, such as... Figure 1 As shown, the specific steps include S01 to S04.

[0027] S01. Based on the access control policy of the document content corresponding to the version file to be encrypted, the version file to be encrypted is divided into multiple independent blocks, and each block is encrypted based on its SM4 symmetric key. Each block is encrypted using SM4 to obtain the ciphertext data of each block. ,in The block number is denoted by ; where each independent block corresponds to a different access control policy.

[0028] Specifically, the layout file mentioned in this invention refers to an OFD format layout file, which adopts a file storage structure of "container (ZIP) + document (XML)".

[0029] In practical applications, the document content corresponding to the formatted file to be encrypted requires differentiated access control for different content targeting different users. Therefore, based on the access control policy for the document content corresponding to the formatted file to be encrypted, the formatted file to be encrypted is divided into multiple independent blocks. The dimensions of the blocks can be pages (Page_N), layers (template layer / content layer / annotation layer), annotations (Annotation_N), etc. Each block is targeted at users with different permissions (i.e., users with different attribute sets) based on different access control policies.

[0030] It should be noted that steps S01 to S04 of the present invention are implemented by the publisher of the document corresponding to the format file to be encrypted on the publisher's client, and are not limited to the prior art where the format file can only be encrypted on the server side of the format file encryption and decryption system.

[0031] Specifically, the client where the publisher is located generates a corresponding SM4 symmetric key for each of the aforementioned blocks. Using SM4-CBC mode based on Each block is encrypted to generate its own ciphertext data. The SM3 hash algorithm was used to calculate the ciphertext data of each block. Integrity check value The integrity check value Used to verify whether the encrypted data has been tampered with or a transmission error has occurred when the receiver decrypts it.

[0032] S02, based on the access control policies of each of the aforementioned blocks. SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. .

[0033] Specifically, the client hosting the publisher uses the CP-ABE algorithm for access control policies. For input, the SM4 symmetric key for each block Perform attribute encryption to generate attribute ciphertext. .

[0034] S03, Ciphertext Based on Each Attribute Obtain the key description file.

[0035] Specifically, the SM2 private key is used to cipher the attributes. The attribute signature value is obtained by performing SM2 signing on the constructed attribute ciphertext set; The client where the publisher is located assembles the plaintext-ciphertext mapping table (EntriesMap.xml) and the decryption entry file (Encryptions.xml) according to the encryption description scheme defined in the GM / T 0099-2020 standard, and writes the attribute ciphertext set and the attribute signature value into the key description file (DecryptSeed_ABE.dat).

[0036] S04, Based on each of the aforementioned block ciphertext data Generate an encrypted layout file using the key description file.

[0037] Specifically, the client where the publisher is located will transmit the aforementioned block of encrypted data. and integrity check value The encrypted version file is sequentially written into a compressed package containing the format file to be encrypted, overwriting the plaintext content of the original format file. The ciphertext mapping table, decryption entry file, and key description file are also written into the compressed package to generate the encrypted format file. The encrypted format file is then transmitted through a secure channel and stored on the server side of the format file encryption / decryption system.

[0038] In practical applications, the client where the publisher is located will generate an operation fingerprint by SM3 hash calculation using encrypted operation logs (including operator identity, timestamp, block strategy, etc.), and then write it to the audit log file after signing it using the SM2 algorithm.

[0039] This embodiment achieves fine-grained access control of document content based on user attributes by dividing the document content corresponding to the format to be encrypted into independent encrypted blocks according to the access control policy and combining it with attribute cryptography. By presenting different content to users with different attributes for the same encrypted file, it breaks through the limitation of traditional file-level encryption that can only be "all or nothing". The access control policy is described by attribute expressions and supports combinations of logical operators such as AND, OR, and threshold, which can realize flexible access policy expressions (such as complex combination policies such as "department = finance department AND security level = confidential"). The access policy is embedded in the attribute ciphertext, eliminating the need to generate a separate key for each user and greatly simplifying key management.

[0040] A hybrid encryption method combining CP-ABE attribute encryption and the Chinese national standard SM4 symmetric encryption is employed. The SM4 algorithm is used for efficient encryption of large amounts of content data in formatted files (block encryption), while the CP-ABE algorithm is used to protect the SM4 block keys and implement flexible attribute access control. This combination ensures both fine-grained attribute access control and high performance for large file encryption.

[0041] By performing encryption on the publisher's client, the server can store only the encrypted data (the encrypted layout file) without possessing any plaintext keys. Even if the server is compromised, attackers cannot obtain the plaintext content of the file, eliminating the risk of server-side data leakage.

[0042] The encryption protocol mechanism follows the GM / T 0099-2020 standard. By utilizing the packet structure characteristics of OFD document XML+ZIP, it is extended according to the plaintext-ciphertext mapping table (EntriesMap) and decryption entry file (Encryptions) format defined by the standard. An extended field of CP-ABE attribute ciphertext is added to the key description file to achieve compatibility with the existing OFD cryptographic application system.

[0043] Furthermore, prior to step S01 of the attribute-based password-based formatted document encryption method of the present invention, the method further includes: Step S00: The attribute key distribution system generates and distributes the corresponding attribute decryption key to the user. The attribute decryption key is used when the user's attribute set satisfies the access control policy. Decrypt the attribute ciphertext in time .

[0044] In a specific embodiment of the present invention, step S00 includes steps S001 to S004, as follows: Figure 3 As shown.

[0045] Step S001: The attribute key distribution system specifies the user's attribute set based on the user's registration application.

[0046] Generally, the registration application submitted by a user includes information such as the user's organizational role, security level, and job function. The attribute key distribution system specifies the user's attribute set based on the above information.

[0047] Furthermore, the attribute collection is described in the form of attribute-value pairs, for example: {User ID = Zhang San, Department = Finance Department, Security Classification = Confidential, Rank = Section Chief}.

[0048] It should be noted that the user's attribute set must include a user identifier, and the user identifier must be unique within the attribute key distribution system.

[0049] Furthermore, the user's attribute set is specified according to the principle of least privilege, ensuring that the user only obtains the minimum attribute permissions required for their business.

[0050] Step S002: The attribute key distribution system generates the corresponding attribute decryption key based on the user's attribute set.

[0051] Specifically, the attribute key distribution system uses the CP-ABE algorithm, based on the system master key and combined with the user's attribute set, to generate an attribute decryption key SK corresponding to the user's attribute set.

[0052] The attribute decryption key SK satisfies the following condition: the attribute decryption key SK can successfully decrypt the ciphertext if and only if the user's set of attributes satisfies the access control policy embedded in the ciphertext.

[0053] The key generation process is completed in a secure environment, and the system master key does not leave the security domain of the key generation center.

[0054] To enable tracing the source of leaked encrypted format files, the attribute key distribution system embeds the user's unique identification information (such as user ID, registration number, etc.) into the mathematical component structure of the key through irreversible encoding when generating the user attribute decryption key SK. This identification information does not affect the key's decryption capability, but makes each user's attribute decryption key mathematically unique and distinguishable, providing an identification source for dynamically embedding user-specific watermarks during subsequent client decryption.

[0055] Step S003: The attribute key distribution system distributes the user's attribute decryption key.

[0056] Specifically, the attribute key distribution system encrypts the generated attribute decryption key SK using the SM2 asymmetric encryption algorithm, and distributes it to the user's client through a secure channel using the SM2 public key submitted during user registration as the encryption key.

[0057] During the distribution process, the user's client and the attribute key distribution system perform two-way authentication to ensure the security of key transmission and the correctness of the recipient's identity. The transmitted key data packet includes the encrypted attribute decryption key, key version identifier, generation timestamp, and server-side digital signature.

[0058] Step S004: The user receives the attribute decryption key and encrypts and stores it on the local client.

[0059] Specifically, after receiving the transmitted key data, the user verifies the server's digital signature to confirm the legitimacy and integrity of the key's origin. Once verification is successful, the user's SM2 private key is used to decrypt the data to obtain the attribute decryption key.

[0060] Furthermore, the user sets a local protection password. The user's client uses the SM3 hash algorithm to hash the user's password to generate a protection key. This protection key is then used to encrypt the attribute decryption key SK using SM4 and stored in the user's client's local secure environment. Subsequent use requires the user to enter the password to decrypt and recover the attribute decryption key SK.

[0061] Step S00, by generating and distributing the corresponding attribute decryption key to the user through the attribute key distribution system, lays the foundation for steps S01 to S04 of the attribute-based cryptography-based document encryption method of this invention. It also achieves dual security protection for the user's attribute decryption key—transport layer SM2 encryption protection and local storage layer password encryption protection.

[0062] One embodiment of the present invention discloses a method for decrypting layout files based on attribute cryptography, used to decrypt encrypted layout files generated by any of the layout file encryption methods described above. Specifically, it includes steps S11 to S15. Figure 2 This is a flowchart illustrating the format file decryption method of the present invention.

[0063] S11. Obtain each block of ciphertext data based on the encrypted layout file. and the key description file.

[0064] Specifically, the user's client receives an encrypted layout file, and obtains the ciphertext data of each block based on the encrypted layout file. Integrity check value The file contains the decryption entry file (Encryptions.xml), the ciphertext mapping table (EntriesMap.xml), and the key description file (DecryptSeed_ABE.dat).

[0065] S12. Obtain the ciphertext of each attribute based on the key description file. .

[0066] Specifically, it includes: The attribute ciphertext set and the SM2 signature value are obtained based on the key description file; Verify the attribute ciphertext set based on the SM2 signature value; Each attribute ciphertext is obtained based on the verified attribute ciphertext set. .

[0067] S13. Obtain the user's attribute decryption key.

[0068] Specifically, when obtaining the user attribute decryption key, the user's client prompts the user to enter a local protection password. A decryption key is generated based on the entered local protection password through a hash operation. This decryption key is then used to decrypt the attribute decryption key SK using SM4. If the user's entered local protection password is correct, the generated decryption key matches the protection key in step S004, and the attribute decryption key SK can be successfully decrypted; otherwise, decryption fails.

[0069] S14. Decrypt attribute ciphertext using the user's attribute decryption key. If the user attribute set satisfies the access control policy Decryption was successful, and the SM4 symmetric key was obtained. Otherwise, decryption will fail.

[0070] Specifically, the CP-ABE algorithm is used to decrypt the attribute ciphertext based on the user's attribute decryption key SK. Decryption, i.e. ).

[0071] If the user attribute set satisfies the access control policy Decryption is successful. If the user attribute set does not satisfy the access control policy... Decryption will fail, and the SM4 symmetric key cannot be obtained. That is, it is impossible to base on Further decryption of block ciphertext data The receipt of the corresponding plaintext block indicates that the user does not have permission to access that block.

[0072] S15. Based on the SM4 symmetric key obtained after successful decryption. Decrypt each block of ciphertext data Each block is obtained, and the plaintext of each block is presented according to the format file standard.

[0073] Specifically, the user's client uses the SM3 hash algorithm to encrypt each block of data. Integrity verification is performed, specifically by using the SM3 hash algorithm to calculate the ciphertext data of each block. Corresponding integrity check value ,like and If they match, the integrity check passes; otherwise, the check fails.

[0074] Furthermore, based on the SM4 symmetric key obtained from successful decryption... Decrypt the ciphertext data blocks that have passed integrity verification. The corresponding blocks are obtained.

[0075] Furthermore, the client uses the plaintext-ciphertext mapping table (EntriesMap.xml) to render the document content according to the OFD standard rendering process, representing the plaintext content of each decrypted block. For blocks that the user does not have permission to access, the client displays a "Content protected" message or a blank screen.

[0076] Furthermore, while the client successfully decrypts each block of encrypted data and presents the plaintext of each block to the user according to the standard layout file, it extracts the user's unique identifier based on the attribute decryption key SK. This identifier is then embedded in the currently presented layout page in an invisible manner using a digital watermarking algorithm (examples include page background micro-textures, the least significant bit of image pixels, etc.). Because different users' attribute decryption keys SK carry different unique identifiers, the same encrypted file presents differentiated content to different users while also embedding their own independent watermark information. A one-to-one correspondence is formed between the watermark and the user's identity, achieving a unified approach to fine-grained access control and leakage tracing.

[0077] When a leaked document is discovered, the invisible digital watermark information is extracted from the document, and the embedded unique user identifier is restored using a watermark decoding algorithm. Since there is a one-to-one correspondence between the watermark and the user identifier of the attribute key, comparing this identifier with the distribution records of the attribute key distribution service allows for precise identification of which user's attribute key decrypted and presented the leaked document. This helps determine the source of the leak and the file's circulation path, providing technical evidence for security incident investigation and accountability. Figure 4 This is a schematic diagram illustrating the principle of tracing the source when the encrypted format file of this invention is leaked.

[0078] In this embodiment, based on the document encryption method described above, a unique user identifier is embedded into the key structure during the attribute key generation stage. When decrypting and presenting the document, an invisible digital watermark bound to the user is automatically embedded using the unique user identifier carried in the attribute key, establishing a cryptographic association between the watermark and the user's identity. When any user who meets the access policy decrypts the document, the presented content contains watermark information uniquely identified by their attribute key. In the event of a leak, the identity of the leaker can be reconstructed by extracting the watermark, and the source of the leak and the file circulation path can be determined by combining the key distribution record. The watermark information is bound to the file content and can still be extracted after printing, screenshotting, format conversion, etc. This achieves the ability to trace the source of file leaks. When a file is leaked, the watermark information can be quickly extracted to locate the source of the leak, providing crucial evidence for security incident investigations.

[0079] System Implementation Examples Another specific embodiment of the present invention discloses a layout document encryption and decryption system based on attribute cryptography, including an attribute key distribution system, a layout document encryption module, and a layout document decryption module.

[0080] An attribute key distribution system is used to generate and distribute corresponding attribute decryption keys to users. These attribute decryption keys are used when a user's attribute set satisfies an access control policy. Time-decryption attribute ciphertext ,in For serial numbers.

[0081] The formatted document encryption module, located on the client side of the attribute-based formatted document encryption and decryption system, is used to divide the document in the formatted document to be encrypted into multiple independent blocks based on access control policies, and to encrypt each block using its own SM4 symmetric key. Each block is encrypted using SM4 to obtain the ciphertext data of each block. Access control policies based on each of the aforementioned blocks. SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. Based on each attribute of the ciphertext Obtain the key description file; based on each block of ciphertext data Generate an encrypted layout file using the key description file.

[0082] The layout file decryption module, located on the client side of the attribute-password layout file encryption and decryption system, is used to obtain the ciphertext data of each block based on the encrypted layout file. and the key description file; based on the key description file, obtain the ciphertext of each attribute. ; Obtain the user's attribute decryption key; Decrypt the attribute ciphertext based on the user's attribute decryption key. If the user attribute set satisfies the access control policy Decryption was successful, and the SM4 symmetric key was obtained. Otherwise, decryption will fail; based on the SM4 symmetric key obtained from successful decryption. Decrypt each block of ciphertext data Each block is obtained, and the plaintext of each block is presented according to the format file standard.

[0083] The attribute-based password-based formatted document encryption and decryption system and method provided in this embodiment are based on the same inventive concept. Where the description is not repeated, they can be used as references to each other.

[0084] This embodiment provides a formatted document encryption and decryption system based on attribute cryptography, which is compatible with existing OFD cryptographic application systems. Therefore, the server-side architecture will not be described in detail.

[0085] This embodiment maintains compatibility with existing OFD readers and cryptographic application systems. The encryption methods used meet the national cryptographic compliance requirements, and all adopt the SM2 / SM3 / SM4 national cryptographic algorithm system, which conforms to the encryption protocol specifications of the GM / T 0099-2020 standard. It meets the cryptographic compliance requirements of government, finance and other industries, and is easy to deploy and promote.

[0086] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for encrypting formatted documents based on attribute cryptography, characterized in that, Includes the following steps: Based on the access control policy corresponding to the document content of the file to be encrypted, the file to be encrypted is divided into multiple independent blocks, and each block is encrypted using its own SM4 symmetric key. Each block is encrypted using SM4 to obtain the ciphertext data of each block. ,in The block number is defined as follows; each independent block corresponds to a different access control policy. Access control policies based on each of the aforementioned blocks SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. ; Ciphertext based on each attribute Obtain the key description file; Based on each of the aforementioned block ciphertext data Generate an encrypted layout file using the key description file.

2. The method for encrypting formatted documents according to claim 1, characterized in that, The access control policies based on each of the aforementioned blocks SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. include: Using the CP-ABE algorithm for access control policies For input, the SM4 symmetric key for each block Perform attribute encryption to generate attribute ciphertext. .

3. The method for encrypting formatted documents according to claim 2, characterized in that, The SM4 symmetric keys based on each of the aforementioned blocks Each block is encrypted using SM4 to obtain the ciphertext data of each block. include: Generate corresponding SM4 symmetric keys for each of the aforementioned blocks. ; Using SM4-CBC mode based on Each block is encrypted to generate its own ciphertext data. ; The SM3 hash algorithm was used to calculate the ciphertext data of each block. Integrity check value The integrity check value Used to verify whether the encrypted data has been tampered with or a transmission error has occurred.

4. The method for encrypting formatted documents according to claim 3, characterized in that, The attribute-based ciphertext The obtained key description file includes: Use the SM2 private key to cipher the attributes. The attribute signature value is obtained by performing SM2 signing on the constructed attribute ciphertext set; A key description file is obtained based on the attribute ciphertext set and the attribute signature value.

5. The method for encrypting formatted documents according to any one of claims 3-4, characterized in that, It also includes an attribute decryption key generated and distributed to the user by the attribute key distribution system, the attribute decryption key being used when the user's attribute set satisfies the access control policy. Decrypt the attribute ciphertext in time .

6. A method for decrypting formatted documents based on attribute cryptography, characterized in that, Used for decrypting encrypted formatted documents generated using any one of the encryption methods of claims 3-5; the decryption method includes: The encrypted layout file is used to obtain the ciphertext data of each block. and the key description file; The attribute ciphertext is obtained based on the key description file. ; Obtain the user's attribute decryption key; Decrypt attribute ciphertext using the user's attribute decryption key. If the user attribute set satisfies the access control policy Decryption was successful, and the SM4 symmetric key was obtained. Otherwise, decryption will fail; Based on the SM4 symmetric key obtained after successful decryption Decrypt each block of ciphertext data Each block is obtained, and the plaintext of each block is presented according to the format file standard.

7. The method for decrypting formatted documents according to claim 6, characterized in that, The attribute ciphertext is obtained based on the key description file. include: The attribute ciphertext set and the SM2 signature value are obtained based on the key description file; Verify the attribute ciphertext set based on the SM2 signature value; Each attribute ciphertext is obtained based on the verified attribute ciphertext set. .

8. The method for decrypting formatted documents according to claim 7, characterized in that, The attribute ciphertext is decrypted using the user's attribute decryption key. include: Using the CP-ABE algorithm, attribute ciphertext is decrypted based on the user's attribute decryption key. Decryption, i.e. ).

9. The method for decrypting formatted documents according to claim 8, characterized in that, The SM4 symmetric key obtained based on successful decryption Decrypt each block of ciphertext data The obtained blocks include: The SM3 hash algorithm is used to analyze the ciphertext data in each block. Perform integrity verification; Based on the SM4 symmetric key obtained after successful decryption Decrypt the ciphertext data blocks that have passed integrity verification. The corresponding blocks are obtained.

10. A formatted document encryption and decryption system based on attribute cryptography, characterized in that, include: An attribute key distribution system is used to generate and distribute corresponding attribute decryption keys to users. These attribute decryption keys are used when a user's attribute set satisfies an access control policy. Time-decryption attribute ciphertext ,in For serial numbers; The formatted document encryption module, based on access control policies, divides the document in the formatted document to be encrypted into multiple independent blocks, and uses the SM4 symmetric key of each block to encrypt the document. Each block is encrypted using SM4 to obtain the ciphertext data of each block. Access control policies based on each of the aforementioned blocks. SM4 symmetric key Perform attribute encryption to obtain the corresponding attribute ciphertext. Based on each attribute of the ciphertext Obtain the key description file; Based on each of the aforementioned block ciphertext data Generate an encrypted layout file from the key description file; The layout file decryption module is used to obtain the ciphertext data of each block based on the encrypted layout file. and the key description file; The attribute ciphertext is obtained based on the key description file. ; Obtain the user's attribute decryption key; Decrypt the attribute ciphertext based on the user's attribute decryption key. If the user attribute set satisfies the access control policy Decryption was successful, and the SM4 symmetric key was obtained. Otherwise, decryption will fail; based on the SM4 symmetric key obtained from successful decryption. Decrypt each block of ciphertext data Each block is obtained, and the plaintext of each block is presented according to the format file standard.