OFD document processing method and device, smart card device, and storage medium
By identifying and verifying the data stream of OFD documents on smart card devices, the lack of OFD document processing on smart card devices is solved, and the functions of data storage and personalized annotation are realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2023-05-29
- Publication Date
- 2026-08-04
AI Technical Summary
The lack of existing technology for processing OFD documents on smart card devices limits the application of OFD documents.
The smart card device identifies data identifiers in the data stream, intercepts and verifies the file header, directory, and directory end data stream, and stores the OFD document data stream after successful verification. It also supports the addition of annotation content and the processing of font information.
It enables smart card devices to effectively store and process OFD documents, ensuring data integrity and supporting the addition of personalized annotations.
Smart Images

Figure CN119046235B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of electronic document processing technology, and in particular to an OFD document processing method, apparatus, smart card device and storage medium. Background Technology
[0002] On October 14, 2016, World Standards Day, the Standardization Administration of China officially approved and released the standard GB / T 33190-2016 "Electronic Document Storage and Exchange Format - Layout Document" (OFD), which is based on independent technology.
[0003] OFD is an independently developed and controllable electronic document format in my country, corresponding to the international standard Portable Document Format (PDF). OFD documents have a fixed layout, do not change format, and offer a WYSIWYG (What You See Is What You Get) experience, making them an ideal document format for electronic document publishing, digital information dissemination, and archiving. Currently, most OFD document processing is applied to computer desktops and web pages, lacking a method for processing OFD documents on smart card devices. Summary of the Invention
[0004] This application proposes an OFD document processing method, apparatus, smart card device, and storage medium for implementing OFD document processing by a smart card device.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, an OFD document processing method is provided, applied to a smart card device. The method includes: the smart card device acquiring a data stream of an OFD document; and identifying data identifiers in the data stream based on preset identifiers, including a file header identifier, a directory identifier, and a directory end identifier. Further, the smart card device extracts data streams based on the data identifiers to obtain a file header data stream, a directory data stream, and a directory end data stream. Further, the smart card device verifies the file header data stream, the directory data stream, and the directory end data stream respectively, and stores the OFD document data stream if the verification is successful.
[0007] In the OFD document processing method provided in this application, after the smart card device obtains the data stream of the OFD document, it first identifies the data identifiers in the data stream through a preset identifier, determines the file header data, directory data, and directory end data included in the data stream, verifies each data separately, and after successful verification, stores the data corresponding to each data identifier in the storage space of the smart card device, thereby realizing the storage processing of the OFD document by the smart card device.
[0008] In one possible design, the smart card device verifies the header data stream, directory data stream, and directory end data stream respectively. The process also includes: the smart card device determining the compressed size of the target file stream and comparing it with a preset length; the target file stream can be any one of the header data stream, directory data stream, and directory end data stream. Further, if the comparison verification is successful, the smart card device decompresses the target file stream to obtain decompressed data and performs cyclic redundancy check on the decompressed data.
[0009] In one possible design, the OFD document processing method further includes: the smart card device acquiring user-inputted annotation content and converting the annotation content into encoded data; and generating template data based on the encoded data and a preset template. Further, the smart card device inserts the template data into the original content file of the OFD document to obtain the target content file. Further, the smart card device updates the OFD document's header data stream, directory file data stream, and directory end data stream based on the target content file.
[0010] In one possible design, the smart card device inserts template data into the original content file of the OFD document, including: the smart card device determining the address of the original content file of the OFD document; and parsing the public resource index in the OFD document to determine the font information of the OFD document, the font information indicating the font of the OFD document. Further, the smart card device inserts the template data into the original content file according to the font indicated by the font information.
[0011] Secondly, an OFD document processing apparatus is provided, deployed in a smart card device. The OFD document processing apparatus includes an acquisition unit, a processing unit, and a storage unit. The acquisition unit acquires the data stream of the OFD document. The processing unit identifies data identifiers in the data stream based on preset identifiers, including a file header identifier, a directory identifier, and a directory end identifier. The processing unit also extracts data streams based on the data identifiers to obtain a file header data stream, a directory data stream, and a directory end data stream. The processing unit further verifies the file header data stream, the directory data stream, and the directory end data stream respectively. The storage unit stores the OFD document data stream if the processing unit's verification is successful.
[0012] In one possible design, the aforementioned OFD document processing apparatus further includes a determining unit. The determining unit determines the compressed size of the target file stream and compares it with a preset length. The target file stream can be any one of a header data stream, a directory data stream, or a directory end data stream. The processing unit is further configured to decompress the target file stream to obtain decompressed data if the comparison verification is successful. The processing unit is also configured to perform cyclic redundancy check on the decompressed data.
[0013] In one possible design, the OFD document processing apparatus described above further includes an acquisition unit for acquiring user-input annotation content and converting the annotation content into encoded data. The processing unit is further configured to generate template data based on the encoded data and a preset template. The processing unit is also configured to insert the template data into the original content file of the OFD document to obtain a target content file. Finally, the processing unit is configured to update the OFD document's header data stream, directory file data stream, and directory end data stream based on the target content file.
[0014] In one possible design, the determining unit in the aforementioned OFD document processing apparatus is further configured to determine the address of the original content file of the OFD document. The processing unit is further configured to parse the public resource index in the OFD document to determine the font information of the OFD document, the font information indicating the font of the OFD document. The processing unit is further configured to insert template data into the original content file according to the font information.
[0015] Thirdly, a smart card device is provided, the smart card device including a memory and a processor; the memory and the processor are coupled, the memory being used to store computer program code including computer instructions, and when the processor executes the computer instructions, the smart card device performs an OFD document processing method as provided in the first aspect or any possible design thereof.
[0016] Fourthly, a computer-readable storage medium is provided, which stores instructions that, when executed on a smart card device, cause the smart card device to perform the OFD document processing method provided in the first aspect or any possible implementation thereof.
[0017] Fifthly, a computer program product is provided, comprising computer instructions that, when executed on a smart card device, enable the smart card device to perform the OFD document processing method provided in the first aspect or any possible implementation thereof. Attached Figure Description
[0018] Figure 1 A schematic diagram of an OFD document processing system structure provided for an embodiment of this application;
[0019] Figure 2 A flowchart illustrating an OFD document processing method provided for embodiments of this application. Figure 1 ;
[0020] Figure 3 A flowchart illustrating an OFD document processing method provided for embodiments of this application. Figure 2 ;
[0021] Figure 4A flowchart illustrating an OFD document processing method provided for embodiments of this application. Figure 3 ;
[0022] Figure 5 A flowchart illustrating an OFD document processing method provided for embodiments of this application. Figure 4 ;
[0023] Figure 6 A schematic diagram of an OFD document processing device provided for an embodiment of this application;
[0024] Figure 7 A schematic diagram of a smart card device structure provided for embodiments of this application. Figure 1 ;
[0025] Figure 8 A schematic diagram of a smart card device structure provided for embodiments of this application. Figure 2 . Detailed Implementation
[0026] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0027] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0028] In the description of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" and "multiple" refer to two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.
[0029] OFD is an independently developed and controllable electronic document format in my country, corresponding to the international standard Portable Document Format (PDF). OFD documents have a fixed layout, do not change format, and offer a WYSIWYG (What You See Is What You Get) experience, making them an ideal document format for electronic document publishing, digital information dissemination, and archiving. Currently, most OFD document processing is done on computer desktops and web pages, lacking a method for processing OFD documents on smart card devices.
[0030] To address the aforementioned issues, this application proposes an OFD document processing method, apparatus, smart card device, and storage medium. The smart card device acquires the data stream of an OFD document and identifies data identifiers within the data stream based on preset identifiers. These data identifiers include a file header identifier, a directory identifier, and a directory end identifier. Further, the smart card device extracts data streams based on these data identifiers, obtaining a file header data stream, a directory data stream, and a directory end data stream. Further, the smart card device verifies each of the file header data stream, directory data stream, and directory end data stream, and stores the OFD document data stream if the verification is successful. In this way, after acquiring the OFD document data stream, the smart card device first identifies the data identifiers within the data stream using preset identifiers to determine the file header data, directory data, and directory end data included in the data stream. After verifying each data item, and upon successful verification, the data corresponding to each data identifier is stored in the smart card device's storage space, thus realizing the smart card device's storage processing of the OFD document.
[0031] Figure 1 This application discloses an OFD document processing system, and the OFD document processing method provided in this embodiment can be applied to, for example, OFD document processing systems. Figure 1 The OFD document processing system shown is used to enable smart card devices to process OFD documents. For example... Figure 1 As shown, the OFD document processing system 10 includes a smart card device 11 and an electronic device 12.
[0032] The storage location determination device 11 is connected to the electronic device 12. The connection can be wired or wireless, and this application embodiment does not limit the connection.
[0033] It should be noted that the electronic device 12 carries a user-operable host program, through which the data stream of the OFD document can be transmitted to the smart card device 11. Furthermore, after processing the OFD document, the smart card device 11 can transmit the processed OFD document to the electronic device 12, so that the user can obtain the processed OFD document from the smart card device through the host program carried by the electronic device 12.
[0034] The smart card device 11 can be used to acquire the data stream of the OFD document.
[0035] The smart card device 11 receives the data volume of the OFD document sent by the electronic device 12, and after receiving the data stream of the OFD document, determines whether the currently received data volume is a complete OFD document. When it is determined that the currently received data stream is a complete OFD document, the receiving of the data stream is stopped.
[0036] The smart card device 11 can also be used to identify data identifiers in the data stream of an OFD document based on preset identifiers.
[0037] The preset identifiers are set in advance by the OFD document processing system's maintenance personnel in the smart card device. The data identifiers include the file header identifier, the directory identifier, and the directory end identifier.
[0038] The smart card device 11 can also be used to extract data based on data identifiers to obtain file header data stream, directory data stream, and directory end data stream.
[0039] The smart card device 11 can also be used to verify the header data stream, directory data stream, and directory end data stream separately. Furthermore, the smart card device 11 can also be used to store the OFD document data stream if the verification is successful.
[0040] Figure 2 This is a flowchart illustrating an OFD document processing method according to some exemplary embodiments. In some embodiments, the above-described OFD document processing method can be applied to, for example... Figure 1 The OFD document processing system 10 shown includes a smart card device 11. Hereinafter, this application will describe the OFD document processing method using an example of applying the OFD document processing method to the smart card device 11.
[0041] like Figure 2 As shown, the OFD document processing method provided in this application includes the following steps S201-S205.
[0042] S201, The smart card device acquires the data stream of the OFD document.
[0043] As one possible implementation, the smart card device receives a data stream of OFD documents sent by the user through a host program carried by the electronic device, based on the connection between the smart card device and the electronic device.
[0044] In some embodiments, the smart card device receives data streams multiple times, and after each data stream reception, determines whether the current OFD document has been completely received. Further, after determining that the current OFD document has been completely received, the smart card device identifies the received data stream as a single OFD document.
[0045] S202, The smart card device identifies the data identifier in the data stream based on a preset identifier.
[0046] The data identifiers include the file header identifier, the directory identifier, and the directory end identifier.
[0047] As one possible implementation, after acquiring the data stream of the OFD document, the smart card device matches the data identifier in the data stream of the OFD document based on a preset identifier, and identifies the file header identifier, directory identifier, and directory end identifier in the OFD document.
[0048] It should be noted that the preset identifier can be set in advance in the smart card device by the operation and maintenance personnel of the OFD document processing system, and this application embodiment does not specifically limit this.
[0049] Since the binary data stream format of OFD documents conforms to the ZIP data format, as shown in Tables 1, 2 and 3 below, the preset identifiers can be 0x04034b50 (file header identifier), 0x02014b50 (directory identifier) and 0x06054b50 (directory end identifier).
[0050] Table 1: File Header Data Stream
[0051]
[0052] Table 2: Directory Data Flow
[0053]
[0054]
[0055] Table 3: Directory End Data Flow
[0056]
[0057] S203. The smart card device extracts the data stream based on the data representation to obtain the file header data stream, the directory data stream, and the directory end data stream.
[0058] As one possible implementation, the smart card device intercepts the data stream based on the data identifier determined in step S202 above. Specifically, the smart card device intercepts the first bit of the file header identifier and the data stream between the first bit of the file header identifier and the first bit of the directory identifier, and identifies the intercepted data stream as the file header data stream; the smart card device intercepts the first bit of the directory identifier and the data stream between the first bit of the directory identifier and the first bit of the directory end identifier, and identifies the intercepted data stream as the directory data stream; furthermore, the smart card device identifies all other data streams in the OFD document's data stream besides the file header data stream and the directory data stream as the directory end data stream.
[0059] For example, if the data stream of an OFD document is 0x04034b50…3503000x02014b50…7478740x06054b50…0000, then after the smart card device identifies the file header identifier, directory identifier, and directory end identifier as 0x04034b50, x02014b50, and x06054b50 respectively based on the above step S202, it can intercept the file header data stream (0x04034b50…350300), directory data stream (0x02014b50…747874), and directory end data stream (0x06054b50…0000) in the OFD document.
[0060] S204 and the smart card device respectively verify the file header data stream, directory data stream, and directory end data stream.
[0061] As one possible implementation, the smart card device determines the length of the header data stream, the directory data stream, and the end-of-directory data stream, respectively.
[0062] Furthermore, the smart card device compares the compressed size of the header data stream shown in Table 1 above with the determined length of the header data stream. If they match, the header data stream verification is successful.
[0063] The smart card device compares the compressed size of the directory data stream shown in Table 2 above with the determined length of the directory data stream. If they match, the directory data stream verification is successful.
[0064] The smart card device compares the preset length of the directory end data stream in Table 3 above with the length of the determined directory data stream. If they match, the device determines that the directory end data stream verification is successful.
[0065] As another possible implementation, the smart card device decompresses the header data stream and the directory data stream respectively, and determines the length of the decompressed header data stream and the length of the decompressed directory data stream.
[0066] Furthermore, the smart card device compares the uncompressed size of the header data stream as shown in Table 1 above with the determined length of the decompressed header data stream. If they match, the header data stream verification is successful.
[0067] The smart card device compares the uncompressed size of the directory data stream as shown in Table 2 above with the determined length of the decompressed directory data stream. If they match, the directory data stream verification is successful.
[0068] The smart card device compares the preset length of the directory end data stream in Table 3 above with the length of the determined directory data stream. If they match, the device determines that the directory end data stream verification is successful.
[0069] It should be noted that the smart card device can verify the file header data stream, directory data stream, and directory end data stream in any order, and this application embodiment does not specifically limit this.
[0070] S205. If the smart card device successfully verifies the data stream of the OFD document, it stores the data stream.
[0071] As one possible implementation, in step S204 above, the smart card device verifies the data stream corresponding to each data identifier, and after successful verification, stores the data stream of the OFD document obtained in step S201 above into the storage space of the smart card device.
[0072] In some embodiments, after the smart card device successfully verifies the data stream corresponding to each data identifier, it stores the data stream corresponding to each data identifier in the preset storage space of the smart card device, which facilitates subsequent processing of OFD documents.
[0073] Understandably, in the OFD document processing method provided in the above embodiments of this application, after the smart card device obtains the data stream of the OFD document, it first identifies the data identifiers in the data stream through a preset identifier, determines the file header data, directory data, and directory end data included in the data stream, verifies each data separately, and after successful verification, stores the data corresponding to each data identifier in the storage space of the smart card device, thereby realizing the storage processing of the OFD document by the smart card device.
[0074] In one design, to implement validation of OFD documents, such as... Figure 3 As shown, the OFD document processing method provided in this application embodiment also includes S301-S303.
[0075] S301. The smart card device determines the compressed size of the target file stream and compares it with the preset length for verification.
[0076] The target file stream can be any one of the following: file header data stream, directory data stream, and directory end data stream.
[0077] As one possible implementation, the smart card device, based on the header data stream, directory data stream, and end-of-directory data stream intercepted in step S203 above, determines the size of the data stream corresponding to each data identifier, and sets the size of the determined data stream as the compressed size. Further, when the target file stream is a header data stream, the compressed size carried in the header data stream is set as a preset length, and the compressed size is compared and verified against the preset length; when the target file stream is a directory data stream, the compressed size carried in the directory data stream is set as a preset length, and the compressed size is compared and verified against the preset length; when the target file stream is a end-of-directory data stream, the length of the preset end-of-directory data stream is set as the preset length, and the compressed size is compared and verified against the preset length.
[0078] It should be noted that the size of the data stream is the length of the data stream, that is, the number of bytes included in the data stream. For details on how the smart card device determines the compressed size of the target file stream, please refer to step S204 in the above embodiments of this application; it will not be repeated here.
[0079] S302. If the comparison and verification are successful, the smart card device decompresses the target file stream to obtain the decompressed data.
[0080] As one possible implementation, the smart card device, after completing the verification of the target file stream and if the verification is successful, decompresses the target file stream using a preset decompression method to obtain the decompressed data.
[0081] It should be noted that the preset decompression method can be set in advance in the smart card device by the operation and maintenance personnel of the OFD document processing system, and this application embodiment does not specifically limit this.
[0082] S303, the smart card device performs cyclic redundancy check on the decompressed data.
[0083] It should be noted that the specific implementation method of the smart card device performing cyclic redundancy check on the decompressed data can be referred to the description in the prior art. In this case, the exemplary smart card device can perform cyclic redundancy check on the decompressed data in the form of CRC-8, CRC-16 and CRC-32, etc. The embodiments of this application do not make specific limitations on this.
[0084] It is understood that in the OFD document processing method provided in the above embodiments of this application, the compressed OFD document data stream is first verified, and then a cyclic redundancy check is performed based on the decompressed data to ensure that the OFD document has not been tampered with or lost, thus ensuring the integrity of the OFD document.
[0085] In one possible implementation, to enable the smart card device to perform the annotation processing of OFD documents, such as... Figure 4 As shown, the OFD document processing method provided in this application embodiment also includes S401-S404.
[0086] S401, The smart card device obtains the endorsement content entered by the user and converts the endorsement content into encoded data.
[0087] As one possible implementation, the smart card device obtains the user-input signature information based on the SIM Toolkit (STK) menu. Further, the smart card device converts the obtained signature information into encoded data according to a preset encoding method.
[0088] As another possible implementation, the smart card device receives signature content sent by the user through a host program hosted on the electronic device, based on the connection between the smart card device and the electronic device. Furthermore, the smart card device converts the acquired signature content into encoded data according to a preset encoding method.
[0089] It should be noted that the preset encoding method can be set in advance on the smart card device by the operation and maintenance personnel of the OFD document processing system. For example, the preset encoding method can be 8-bit (Universal Character Set / Unicode Transformation Format, UTF-8) encoding method. This application embodiment does not specifically limit this.
[0090] S402, the smart card device generates template data based on the encoded data and the preset template.
[0091] As one possible implementation, after generating coded data based on the above step S401, the smart card device retrieves a preset template, fills the coded data into the corresponding position in the preset template, and generates template data.
[0092] It should be noted that the preset target can be set in advance by the operation and maintenance personnel of the OFD document processing system in the smart card device, and this application embodiment does not specifically limit this.
[0093] S403. The smart card device inserts the template data into the original content file of the OFD document to obtain the target content file.
[0094] As one possible implementation, the smart card device queries the OFD document for the original content file based on its filename. Further, the smart card device inserts template data into the original content file of the OFD document to obtain the updated, annotated target content file.
[0095] S404. The smart card device updates the header data stream, directory file data stream, and directory end data stream of the OFD document based on the target content file.
[0096] As one possible implementation, the smart card device determines the uncompressed length of the header data stream and the uncompressed length of the directory data stream after adding the signature. Furthermore, the smart card device also calculates a CRC-32 checksum based on the CRC-32 algorithm, compresses the data according to a preset deflate algorithm, and calculates the length of the compressed data.
[0097] After obtaining the above data, the smart card device updates the CRC-32 checksum, compressed size, uncompressed size, and compressed file data in the file header data stream as shown in Table 1 above.
[0098] The smart card device also updates the CRC-32 checksum, compressed size, uncompressed size, and relative displacement of the local file header in the directory data stream as shown in Table 2 above based on the above data.
[0099] The smart card device also updates the size of the core directory in the directory end data stream, as shown in Table 3 above, and the displacement of the core directory start position relative to the start of the archive, based on the updated file header data stream and directory data stream.
[0100] In some embodiments, after updating the header data stream, directory data stream, and directory end data stream, the smart card device stores the updated data streams in the corresponding storage space, and upon receiving an instruction from the electronic device to retrieve the OFD document, sends the corresponding OFD document to the electronic device.
[0101] It is understood that the OFD document processing method provided in the above embodiments of this application realizes that after the smart card device obtains the endorsement content input by the user, it updates the original content file of the OFD document, adds the endorsement content to the OFD document, and updates the data stream corresponding to each data identifier within the added endorsement content, thereby ensuring the correctness of the OFD document while adding personalized data.
[0102] In one design, to insert template data into the original content file of an OFD document, such as... Figure 5 As shown, the OFD document processing method provided in this application embodiment also includes S501-S503.
[0103] S501, The smart card device determines the address of the original content file of the OFD document.
[0104] As a possible implementation, the smart card device searches for the main entry file based on the file name "OFD.xml", and after finding the main entry file, parses the main entry file. Further, the smart card device searches for the root node document "Document.xml" pointing to the OFD document based on the parsed main entry file. Further, the smart card device parses "Document.xml", searches for the original content file based on the file name "Content.xml" of the original content file, and determines that the address of the original content file is "Pages / Page_0 / Content.xml".
[0105] S502. The smart card device parses the public resource index in the OFD document to determine the font information of the OFD document.
[0106] Among them, the font information indicates the font of the OFD document.
[0107] As a possible implementation, the smart card device searches for the public resource index file "PublicRes.xml" and parses the file to obtain the font information of the OFD document.
[0108] Exemplarily, the font information can be <ofd:Font ID="3" FontName="Songti" / >.
[0109] S503. The smart card device inserts the template data into the original content file according to the font indicated by the font information.
[0110] As a possible implementation, the smart card device inserts the template data into the original content file indicated by the address of the original content file according to the font indicated by the font information, based on the font information determined in the above step S502 and the address of the original content file determined in the above step S501.
[0111] It can be understood that in the OFD document processing method provided in the above embodiments of the present application, the smart card device converts the template data into data of the corresponding font through the font indicated in the public resource index of the OFD document, and inserts it into the original content file indicated by the address of the original content file, realizing the addition of the endorsement content by the smart card device.
[0112] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, it includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, in conjunction with the units and algorithm steps of the various examples described in the embodiments disclosed herein, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0113] This application embodiment can divide the user equipment into functional modules according to the above method example. For example, each function can be divided into a separate functional module, or two or more functions can be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. Optionally, the module division in this application embodiment is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.
[0114] Figure 6 This is a schematic diagram of an OFD document processing apparatus provided in an embodiment of this application. This OFD document processing apparatus is used to execute the aforementioned OFD document processing method. Figure 6 As shown, the OFD document processing device 60 includes an acquisition unit 601, a processing unit 602, and a storage unit 603.
[0115] Acquisition unit 601 is used to acquire the data stream of the OFD document. For example, such as... Figure 2 As shown, the acquisition unit 601 can be used to execute S201.
[0116] Processing unit 602 is used to identify data identifiers in the data stream based on preset identifiers. These data identifiers include file header identifiers, directory identifiers, and directory end identifiers. For example, ... Figure 2 As shown, the processing unit 602 can be used to execute S202.
[0117] The processing unit 602 is also used to extract data streams based on data identifiers to obtain a file header data stream, a directory data stream, and a directory end data stream. For example, Figure 2 As shown, the processing unit 602 can be used to execute S203.
[0118] The processing unit 602 is also used to verify the file header data stream, directory data stream, and directory end data stream respectively. For example, Figure 2 As shown, the processing unit 602 can be used to execute S204.
[0119] Storage unit 603 is used to store the data stream of the OFD document if the processing unit verifies the data successfully. For example, ... Figure 2 As shown, storage unit 603 can be used to execute S205.
[0120] Optional, such as Figure 6 As shown, the OFD document processing apparatus 60 provided in this application embodiment also includes a determination unit 604.
[0121] The determining unit 604 is used to determine the compressed size of the target file stream and compare it with a preset length. The target file stream can be any one of the following: a file header data stream, a directory data stream, or a directory end data stream. For example, ... Figure 3 As shown, the determining unit 604 can be used to execute S301.
[0122] The processing unit 602 is also used to decompress the target file stream to obtain decompressed data if the comparison verification is successful. For example, Figure 3 As shown, the processing unit 602 can be used to execute S302.
[0123] The processing unit 602 is also used to perform cyclic redundancy check on the decompressed data. For example, Figure 3 As shown, the processing unit 602 can be used to execute S303.
[0124] Optional, such as Figure 6 As shown, in the OFD document processing apparatus 60 provided in this embodiment, the acquisition unit 601 is further configured to acquire user-inputted annotation content and convert the annotation content into encoded data. For example, such as Figure 4 As shown, the acquisition unit 601 can be used to execute S401.
[0125] The processing unit 602 is also used to generate template data based on the encoded data and a preset template. For example, such as... Figure 4 As shown, the processing unit 602 can be used to execute S402.
[0126] Processing unit 602 is also used to insert template data into the original content file of the OFD document to obtain the target content file. For example, such as Figure 4 As shown, the processing unit 602 can be used to execute S403.
[0127] Processing unit 602 is also used to update the OFD document's header data stream, directory file data stream, and directory end data stream based on the target content file. For example, Figure 4 As shown, the processing unit 602 can be used to execute S404.
[0128] Optional, such as Figure 6As shown, in the OFD document processing apparatus 60 provided in this application embodiment, the determining unit 604 is further used to determine the address of the original content file of the OFD document. For example, as Figure 5 As shown, the determining unit 604 can be used to execute S501.
[0129] Processing unit 602 is also used to parse the common resource index in the OFD document to determine the font information of the OFD document, the font information indicating the font of the OFD document. For example, such as Figure 5 As shown, the processing unit 602 can be used to execute S502.
[0130] The processing unit 602 is also used to insert the template data into the original content file according to the font indicated by the font information. For example, Figure 5 As shown, the processing unit 602 can be used to execute S503.
[0131] In implementing the functions of the integrated modules described above using hardware, this application provides a possible structural diagram of a smart card device. This smart card device is used to execute the OFD document processing method executed by the OFD document processing device in the above embodiments. Figure 7 As shown, the smart card device 70 includes a processor 701, a memory 702, and a bus 703. The processor 701 and the memory 702 can be connected via the bus 703.
[0132] Processor 701 is the control center of the smart card device. It can be a single processor or a collective term for multiple processing elements. For example, processor 701 can be a general-purpose central processing unit (CPU) or other general-purpose processors. The general-purpose processor can be a microprocessor or any conventional processor.
[0133] As one embodiment, processor 701 may include one or more CPUs, for example Figure 7 CPU 0 and CPU 1 are shown in the diagram.
[0134] The memory 702 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0135] As one possible implementation, the memory 702 can exist independently of the processor 701. The memory 702 can be connected to the processor 701 via a bus 703 and is used to store instructions or program code. When the processor 701 calls and executes the instructions or program code stored in the memory 702, it can implement the OFD document processing method provided in the embodiments of this application.
[0136] In another possible implementation, the memory 702 can also be integrated with the processor 701.
[0137] Bus 703 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 7 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0138] It should be pointed out that, Figure 7 The structure shown does not constitute a limitation on the smart card device 70. Except... Figure 7 In addition to the components shown, the smart card device 70 may include more than Figure 7 It can show more or fewer parts, or combine certain parts, or arrange different parts.
[0139] As an example, combined Figure 6 The functions implemented by the acquisition unit 601, processing unit 602, storage unit 603, and determination unit 604 in the OFD document processing device 60 are the same as those of the acquisition unit 601, processing unit 602, storage unit 603, and determination unit 604. Figure 7The processor 701 in it has the same function.
[0140] Optional, such as Figure 7 As shown, the smart card device provided in this application embodiment may further include a communication interface 704.
[0141] Communication interface 704 is used to connect with other devices via a communication network. This communication network can be Ethernet, a wireless access network, a wireless local area network (WLAN), etc. Communication interface 704 may include an acquisition unit for receiving data and a transmission unit for sending data.
[0142] In one design, the communication interface of the smart card device provided in this application embodiment can also be integrated into the processor.
[0143] Figure 8 Another hardware structure of the smart card device in an embodiment of this application is shown. For example... Figure 8 As shown, the smart card device 80 may include a processor 801 and a communication interface 802. The processor 801 is coupled to the communication interface 802.
[0144] The functions of processor 801 can be referred to in the description of processor 701 above. In addition, processor 801 also has storage functions, which can be referred to in the description of memory 702 above.
[0145] The communication interface 802 is used to provide data to the processor 801. The communication interface 802 can be an internal interface of the smart card device or an external interface of the smart card device (equivalent to the communication interface 704).
[0146] It should be pointed out that, Figure 8 The structure shown does not constitute a limitation on smart card devices, except Figure 8 In addition to the components shown, the smart card device 80 may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0147] Through the above description of the embodiments, those skilled in the art will clearly understand that, for the sake of convenience and brevity, only the division of the above functional units is used as an example. In practical applications, the above functions can be assigned to different functional units as needed, that is, the internal structure of the device can be divided into different functional units to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0148] This application also provides a computer-readable storage medium storing instructions. When a computer executes these instructions, the computer performs each step of the method flow shown in the above-described method embodiments.
[0149] Embodiments of this application provide a computer program product containing instructions that, when executed on a computer, cause the computer to perform the OFD document processing method described in the above method embodiments.
[0150] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0151] Since the apparatus, device, computer-readable storage medium, and computer program product in the embodiments of this application can be applied to the above methods, the technical effects that can be obtained can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0152] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An OFD document processing method, characterized in that, Applied to smart card devices, the method includes: Obtain the data stream of the OFD document; Data identifiers in the data stream are identified based on preset identifiers, including file header identifiers, directory identifiers, and directory end identifiers. Based on the data identifier, the data stream is intercepted to obtain a file header data stream, a directory data stream, and a directory end data stream; The file header data stream, the directory data stream, and the directory end data stream are verified respectively, and the data stream of the OFD document is stored if the verification is successful. The method further includes: Obtain the annotation content input by the user and convert the annotation content into encoded data; Based on the encoded data and the preset template, template data is generated; The template data is inserted into the original content file of the OFD document to obtain the target content file; Based on the target content file, update the file header data stream, directory file data stream, and directory end data stream of the OFD document.
2. The OFD document processing method according to claim 1, characterized in that, The step of verifying the file header data stream, the directory data stream, and the directory end data stream respectively also includes: Determine the compressed size of the target file stream and compare it with a preset length. The target file stream can be any one of the file header data stream, the directory data stream, and the directory end data stream. If the comparison and verification are successful, the target file stream is decompressed to obtain the decompressed data; Cyclic redundancy check is performed on the decompressed data.
3. The OFD document processing method according to claim 1, characterized in that, The step of inserting the template data into the original content file of the OFD document includes: Determine the address of the original content file of the OFD document; Parse the public resource index in the OFD document to determine the font information of the OFD document, wherein the font information indicates the font of the OFD document; The template data is inserted into the original content file according to the font indicated by the font information.
4. An OFD document processing device, characterized in that, Deployed in smart card devices, the OFD document processing device includes an acquisition unit, a processing unit, and a storage unit; The acquisition unit is used to acquire the data stream of the OFD document; The processing unit is used to identify data identifiers in the data stream based on preset identifiers, wherein the data identifiers include file header identifiers, directory identifiers, and directory end identifiers. The processing unit is further configured to intercept the data stream based on the data identifier to obtain a file header data stream, a directory data stream, and a directory end data stream; The processing unit is also used to verify the file header data stream, the directory data stream, and the directory end data stream, respectively. The storage unit is used to store the data stream of the OFD document if the processing unit verifies it successfully. The acquisition unit is further configured to acquire the endorsement content input by the user and convert the endorsement content into encoded data; The processing unit is also used to generate template data based on the encoded data and the preset template; The processing unit is also used to insert the template data into the original content file of the OFD document to obtain the target content file; The processing unit is further configured to update the header data stream, directory file data stream, and directory end data stream of the OFD document based on the target content file.
5. The OFD document processing apparatus according to claim 4, characterized in that, The OFD document processing device further includes a determination unit; The determining unit is used to determine the compressed size of the target file stream and compare it with a preset length. The target file stream is any one of the file header data stream, the directory data stream, and the directory end data stream. The processing unit is also used to decompress the target file stream to obtain decompressed data if the comparison and verification are successful. The processing unit is also used to perform cyclic redundancy check on the decompressed data.
6. The OFD document processing apparatus according to claim 4, characterized in that, The OFD document processing device further includes a determination unit; The determining unit is further configured to determine the address of the original content file of the OFD document; The processing unit is further configured to parse the public resource index in the OFD document and determine the font information of the OFD document, wherein the font information indicates the font of the OFD document; The processing unit is also used to insert the template data into the original content file according to the font indicated by the font information.
7. A smart card device, characterized in that, Including memory and processor; The memory and the processor are coupled; The memory is used to store computer program code, which includes computer instructions; When the processor executes the computer instructions, the smart card device performs the OFD document processing method as described in any one of claims 1-3.
8. A computer-readable storage medium storing instructions, characterized in that, When the instruction is executed on the smart card device, the smart card device performs the OFD document processing method as described in any one of claims 1-3.