Structured data signature service system based on digital handwriting, signature and signature verification method, equipment and medium
By collecting and encrypting user electronic signature handwriting data, generating personal public and private keys, standardizing the structured data and hash calculations, and signing them with digital handwriting features, solving the limitations of traditional hash calculations when detecting structured data change fields, and achieving fast and accurate data signatures and signature verification.
Patent Information
- Application Number
- CN202411971780.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-04
AI Technical Summary
Traditional whole-package hash calculations have problems such as inability to locate specific change fields, being sensitive to minor changes, and slow processing speed when detecting structured data change fields.
By collecting user's electronic signature handwriting data, extracting and encrypting feature vectors of user's writing habits, generating personal exclusive public and private keys, standardizing and tiling operations on structured data, using hash algorithms to generate unique data fingerprints, and digital signatures are performed in combination with digital handwriting features.
It realizes fast and precise positioning of changing fields, is sensitive to key fields, and is fast processing speed, improves the practicality and efficiency of the algorithm, and enhances the security and authenticity of data.
Smart Images

Figure CN119760792A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of information security technology, and in particular to a method for signing and verifying structured data based on digital handwriting. Background Art
[0002] With the rapid development of information technology, structured data (such as database records, XML documents, JSON objects, etc.) are increasingly used in the Internet and various information systems because structured data documents are not easy to modify and have certain versions. Documents formed by various structured data are widely used in e-commerce, e-government, finance, medical and other fields. Using digital handwriting to sign structured data to ensure the integrity, authenticity and non-tamperability of these data is crucial to maintaining information security.
[0003] Structured data signatures are important in many fields. In the financial field, they can ensure the authenticity and integrity of transaction data and prevent fraud. In the medical field, they can protect patient privacy and verify the authenticity of medical records. In e-commerce, they can verify product information and protect consumer rights.
[0004] Traditional methods for processing structured data often use whole-pack hashing (i.e., hashing the entire data set) to generate a unique identifier or data fingerprint. However, this approach has obvious limitations in detecting changed fields in the data.
[0005] The whole packet hash calculation treats the entire data set as a whole and generates a unique hash value through a hash algorithm. This hash value is usually used for data integrity verification and tampering detection. When using this method to check data, there are the following problems: Unable to locate specific changed fields: When a dataset changes, the hash value generated by the entire packet hash calculation will change. This method cannot provide specific information about which field has been changed, and users need to manually compare the original dataset and the changed dataset to locate the changed field, which can be very time-consuming and error-prone in large datasets.
[0006] Sensitive to minor changes: The whole packet hash calculation is very sensitive to any minor changes in the data set. Even a change of one character will cause the resulting hash value to change. This sensitivity may be unnecessary in some cases, because users may only care about changes in certain key fields, and changes in some non-key fields do not affect the overall content of the structured data.
[0007] Slow processing speed: For large data sets, the whole packet hash calculation may take a long time to generate the hash value. In addition, when detecting data changes, users need to hash the entire data set again, which further increases the processing time.
[0008] Publication number: CN118551417A, name “Electronic Signature and Verification Method for Structured Data Records”, calculates the hash value for each field of the structured data record, constructs a Merkle tree based on the hash values of all fields to be signed, and electronically signs the Merkle root hash value of the tree root to obtain the signature value; when constructing the signature data body structure, the hash values of the field name and the field value are combined into a key-value pair array, and the minimum perfect hash value to be stored is calculated through the minimum perfect hash, and assembled into a signature data structure; when verifying, a Merkle tree of the hash value of the field value is constructed to obtain the Merkle root hash value, and the Merkle root hash value is verified with the signature value.
[0009] The above-mentioned prior art constructs a Merkle tree based on the hash values of all fields to be signed. The SM2 algorithm is used to calculate the signature value. The implementation of the SM2 algorithm depends on a specific hardware or software platform. The Merkle tree structure is complex to construct, so its use is limited in convenience and compatibility. It is difficult to process structured data with complex structures, and the security is poor. At the same time, a complex Merkle tree structure needs to be constructed during verification, and the complexity and cost of verification are high. Summary of the invention
[0010] In view of the above-mentioned problems existing in the prior art, the present invention proposes a method for signing and verifying structured data based on digital handwriting. The electronic signature terminal collects the user's signature handwriting, the business system standardizes the format of the structured data, standardizes the collected signature handwriting, extracts the signature handwriting feature vector to obtain the personal identification password public and private keys, and uses the personal identification password public and private keys to convert the structured data to obtain the elements in the two-dimensional array to perform data signing processing to obtain the structured data signature value.
[0011] Based on the first aspect of the present application, a structured data signature service system based on digital handwriting is proposed, including: a signature terminal, a business system, and a structured data signature service. The signature terminal collects the user's electronic signature handwriting data; the business system performs standardized processing on the structured data; the structured data signature service system performs standardized processing on the electronic signature handwriting data to obtain handwriting standard feature data, generates a personal identification password public and private keys, and generates a structured data hash value based on the standardized structured data; the structured data hash value is digitally signed using the personal identification password public and private keys to obtain a structured data signature value.
[0012] Further preferably, the structured signature service system also includes a signature verification interface, which receives the structured data to be verified and the corresponding structured data signature value, calls the SM3 function to perform hash value calculation on the structured data to be verified, obtains the hash value of the structured data to be verified, uses the personal identification password public key to decrypt the structured data signature value, and obtains the hash value of the original structured data; compares the two hash values to determine whether the structured data has been tampered with.
[0013] Further preferably, the standardized processing of structured data includes converting a multi-level nested data structure into a two-dimensional array structure by tiling the structured data, calculating the hash value of each element in any two-dimensional array, arranging the hash values in the order of the two-dimensional array structure, and obtaining a two-dimensional array containing hash value data of the structured data conversion.
[0014] Further preferably, the digitally signing structured data using the public and private keys of the personal identification password includes: expanding the structured data and flattening it into a two-dimensional array structure, performing hash calculation on each array element of any field or all fields in the two-dimensional array structure to obtain the hash value of each element; encrypting each element hash value with the public key to output ciphertext, decrypting the ciphertext with the private key to generate plaintext and calculate the plaintext hash, and encrypting the plaintext hash with the private key to obtain the structured data signature value.
[0015] Further preferably, the generation of the public and private keys of the personal identification password includes: recording the stroke order of the electronic signature, handwriting point positions, pressure, time, speed, and acceleration, pre-processing to obtain standard handwriting feature data, extracting the signature feature vector and style features reflecting the user's writing habits, corresponding weight biases according to the feature vectors and their style features, reconstructing and generating a unified handwriting feature vector according to the weight bias and the extracted signature feature vector, and calling the SM9 national secret algorithm to encrypt the unified handwriting feature vector to generate the public and private keys of the personal identification password.
[0016] Further preferably, starting from any element in the two-dimensional array, the hash value of each element is calculated sequentially until the calculation of the entire array is completed to obtain a two-dimensional array containing a series of hash value data, and the calculation of the hash value of each element includes: obtaining any i-th element xi in the two-dimensional array, calculating the hash value of the subsequent i+1-th element as the salt f(xi+1), and calculating the hash value f(xi) of the i-th element according to the formula f(xi) = HASH(xi + f(xi+1)).
[0017] Further preferably, the hash values of the elements in all sub-arrays of the structured data are calculated, and the corresponding two-dimensional array of the structured data is arranged in order. The hash values of all sub-arrays are concatenated to obtain the overall hash value f(x0) of the structured data. The signature time, public key, signature algorithm identifier, signature value, electronic handwriting data packet ciphertext, and trusted timestamp are added to the overall hash value to assemble it into structured signature data; the electronic handwriting standard feature data is encoded in a structured data format, the encoded electronic handwriting standard feature data is encrypted, and is merged with the structured signature data to complete the fusion of structured data and handwriting.
[0018] Based on the second aspect of the present application, a structured data signing and verification method based on digital handwriting is proposed, including: collecting user electronic signature handwriting data, standardizing the electronic signature handwriting data to obtain handwriting standard feature data, and generating personal identification password public and private keys according to the handwriting standard feature data; standardizing the structured data and generating a structured data hash value; using the personal identification password public and private keys in combination with the structured data hash value to generate a digital signature value to complete the structured data signature; receiving the structured data to be verified and the corresponding digital signature value, calling the SM3 function to calculate the hash value of the structured data to be verified, obtaining the hash value of the structured data to be verified, and using the personal identification password public key to decrypt the signature value to obtain the hash value of the original structured data; comparing the two hash values to determine whether the structured data has been tampered with.
[0019] Further preferably, the standardized processing of structured data includes converting a multi-level nested data structure into a two-dimensional array structure by tiling the structured data, calculating the hash value of each element in the two-dimensional array, arranging the hash values in the order of the two-dimensional array structure, and obtaining a two-dimensional array containing hash value data of the structured data conversion.
[0020] Further preferably, the digitally signing structured data using the public and private keys of the personal identification password includes: expanding the structured data and flattening it into a two-dimensional array structure, performing hash calculation on each array element of any field or all fields in the two-dimensional array structure to obtain the hash value of each element; encrypting each element hash value with the public key to output ciphertext, decrypting the ciphertext with the private key to generate plaintext and calculate the plaintext hash, and encrypting the plaintext hash with the private key to obtain the structured data signature value.
[0021] Further preferably, generating the public and private keys of the personal identification password includes recording the stroke order of the electronic signature, handwriting point positions, pressure, time, speed, and acceleration, pre-processing to obtain standard handwriting feature data, extracting signature feature vectors and style features that reflect the user's writing habits, assigning weight biases based on the feature vectors and their style features, reconstructing and generating a unified handwriting feature vector based on the weight bias and the extracted signature feature vector, and calling the SM9 national secret algorithm to encrypt the unified handwriting feature vector to generate the public and private keys of the personal identification password.
[0022] Further preferably, starting from any element in the two-dimensional array, the hash value of each element is calculated sequentially until the calculation of the entire array is completed to obtain a two-dimensional array containing a series of hash value data, and the calculation of the hash value of each element includes: obtaining any i-th element xi in the two-dimensional array, calculating the hash value of the subsequent i+1-th element as the salt f(xi+1), and calculating the hash value f(xi) of the i-th element according to the formula f(xi) = HASH(xi + f(xi+1)).
[0023] Further preferably, the hash values of the elements in all sub-arrays of the structured data are calculated, and the corresponding two-dimensional array of the structured data is arranged in order. The hash values of all sub-arrays are concatenated to obtain the overall hash value f(x0) of the structured data. The signature time, public key, signature algorithm identifier, signature value, electronic handwriting data packet ciphertext, and trusted timestamp are added to the overall hash value to assemble it into structured signature data; the electronic handwriting standard feature data is encoded in a structured data format, the encoded electronic handwriting standard feature data is encrypted, and is merged with the structured signature data to complete the fusion of structured data and handwriting.
[0024] Based on the third aspect of the present application, an electronic device is proposed, comprising: a processor; and a memory for storing a program, wherein the program comprises instructions, which, when executed by the processor, enable the processor to execute the structured data signature and verification method based on digital handwriting as described above.
[0025] Based on the fourth aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is proposed, wherein the computer instructions are used to enable the computer to execute the structured data signature and verification method based on digital handwriting described above.
[0026] The present invention collects and processes digital handwriting, extracts and encrypts the characteristic vector of the user's writing habits, generates personal public and private keys, and does not require digital certificates, which greatly improves the personalization of user experience and the convenience of use; uses the user's own writing habits as a key carrier, reduces the use of digital certificates, and improves efficiency. By expanding and tiling the structured data into a two-dimensional array structure, a unique data fingerprint is calculated for each array element. When the data set changes, the changed structured data field can be quickly located. Since each element in the two-dimensional array is signed using handwriting feature data after each field is tiled, the integrity and significant identification of the structured data after signing are guaranteed. During use, any change in any field will cause a change in the calculated hash value of the corresponding structured data. By comparing the original hash value and the changed hash value, the changed field can be quickly located. The user can choose to calculate, sign, encrypt, and other processes for a certain field as needed. This means that the user only pays attention to the changes in key fields and ignores other unimportant fields. This flexibility improves the practicality and efficiency of the algorithm. The tiling operation is combined with the hash algorithm. The tiling operation converts the multi-level nested data structure into a two-dimensional array structure, simplifying the data structure; the hash algorithm can quickly generate a unique data fingerprint, which has a significant speed advantage when processing large data sets. It has higher flexibility, stronger security, and reduces the complexity and cost of verification.
[0027] Hash calculation is performed on the structured data uploaded by users, and digital signature is performed in combination with digital handwriting feature vectors, which improves the speed and accuracy of data processing and ensures the integrity and authenticity of data. It can be widely used in fields such as finance, education, and medical care, providing efficient and secure solutions for scenarios such as identity authentication and data protection. Combined with digital handwriting recognition technology, it aims to provide an efficient and easy-to-manage personalized data signature and verification solution.
[0028] The method proposed in the present invention can process more complex structured data, including multi-level keys and array elements through tiling and hash value calculation, and can flexibly adapt to different data structures and requirements. The hash value calculation is performed by using the reverse salt appending method, which increases the difficulty of cracking and improves the security of data. The electronic signature of digital handwriting is unique and non-replicable, which further enhances the authenticity and integrity of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a schematic diagram of the structured data signature service process in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0030] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be construed as being limited to the embodiments described herein. Instead, these embodiments are provided to provide a more thorough and complete understanding of the present application. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes and are not intended to limit the scope of protection of the present application.
[0031] The various steps described in the method implementation of the present application can be performed in different orders and / or in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of the present application is not limited in this respect.
[0032] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0033] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0034] The names of the messages or information exchanged between multiple devices in the embodiments of the present application are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0035] like Figure 1 The figure shows a schematic diagram of a structured data signature service in an exemplary embodiment of the present application. The structured data signature service system includes: a signature terminal, a business system, and a structured data signature service. The signature terminal collects the user's electronic signature handwriting data, the business system performs standard processing on the structured data, and the structured data signature service system performs standard processing on the electronic signature handwriting data to obtain handwriting standard feature data, generates a structured data hash value, and uses the handwriting standard feature data combined with the structured data hash value to digitally sign the structured data to generate a data fingerprint, which can further add a timestamp and upload to the blockchain for storage.
[0036] The present invention uses digital handwriting to sign and verify structured data. It combines tiling with hash calculation. First, the structured data is expanded and tiled into a two-dimensional array structure. Then, each array element is hashed and signed to generate a unique data fingerprint. This method combines the simplicity of tiling operation and the efficiency of hash algorithm. It can quickly and accurately locate the changed fields, is sensitive to key fields, and has a fast processing speed. When the data set changes, the changed fields can be quickly located.
[0037] Since each field is flattened as an element in a two-dimensional array and hashed, any change to a field will result in a change in the corresponding hash value. Users can quickly determine whether the structured data has been tampered with and accurately locate the tampered data field by restoring the original hash value of the structured data from the structured data signed by handwriting data and comparing it with the current structured data hash value. At the same time, the handwriting data with personal biometrics is used to sign the structured data as a data fingerprint, ensuring the tamper-proof effect of the signed structured data text.
[0038] At the same time, users can choose to perform hash calculations on some specified fields in structured data as needed. This means that users can only focus on changes in key fields and ignore other unimportant fields. This flexibility improves the practicality and efficiency of the algorithm. Due to the combination of tiling operations and hashing algorithms, the processing speed is relatively fast. Tiling operations convert multi-level nested data structures into two-dimensional array structures, simplifying the data structure; hashing algorithms can quickly generate unique data fingerprints. This combination gives the algorithm a significant speed advantage when processing large data sets.
[0039] The electronic signature terminal collects the user's signature handwriting, and the business system standardizes the format of structured data, which can be CSV / JSON / XML. The collected signature handwriting is standardized to obtain the signature handwriting feature vector, and the handwriting feature vector is used to encrypt and numerically sign the structured data to obtain the structured data signature value, add a timestamp, and store it for evidence.
[0040] Structured data refers to data that has a clear, predefined data model and follows a consistent order, often in the form of tables, databases or spreadsheets, such as tables in relational databases, XML documents, CSV files, JSON data, etc. These data types are clear and have clear structures, making the data easy to process and manage in computer systems.
[0041] Digital handwriting collection involves the use of high-precision sensors to capture various parameters during the handwriting process, such as pen pressure, tilt angle, writing speed, etc. These parameters can reflect the writer's unique writing habits and are the basis for subsequent feature extraction and signature generation. Standardization processing involves cleaning, denoising and normalizing these raw data to ensure data stability and consistency.
[0042] Users who initiate structured data signatures in formats such as CSV, JSON, and XML use smart pens, touch screens, or other digital input devices to complete their signatures. The digital handwriting-based structured data signature server collects the user's written signature and records dynamic information such as stroke order, pressure changes, speed, and acceleration. It also performs preprocessing such as denoising, smoothing, and feature point extraction to extract feature vectors that can accurately reflect the user's writing habits.
[0043] Standardize the signature handwriting data features to form a unified handwriting feature vector to build a signature key library. The signature key library includes: electronic signature handwriting feature sequence, signature style features, feature vector and style feature corresponding weight bias, predefined standardized style features, personal identification password public and private keys. Extract signature features based on the collected signature digital handwriting data, predefine standardized style features, set weight bias, reconstruct style features based on weight bias and extracted signature features to obtain a unified handwriting feature vector, call the SM9 national secret algorithm to encrypt and process the unified handwriting feature vector to generate personal identification password public and private keys.
[0044] Digital signature: Use the public key to encrypt the structured data to be signed and output the ciphertext; use the private key to decrypt the ciphertext to generate plaintext and calculate the plaintext hash; use the private key to encrypt the plaintext hash to obtain the structured data signature value. Timestamp addition: Add timestamp information during the encryption process to ensure the timeliness of the signature.
[0045] The user's signature call information is stored locally, including: structured data to be signed, hash value of structured data to be signed, user ID number, ID type, collected handwriting feature vector data, hash value of collected handwriting feature vector data, and signature value after signing. It is stored locally for subsequent query and audit. Send to blockchain: The signature value after signing, hash value of structured data to be signed, and hash value of collected handwriting feature vector data are sent to the blockchain network. It can ensure the security and traceability of data and prevent data from being tampered with or deleted.
[0046] To verify the integrity and source authenticity of structured data, the business system passes structured data and structured data signature values through the signature verification interface. The signature verification service system uses the SM3 hash algorithm to generate a structured data hash value, and uses the public key to decrypt the structured data signature value to obtain the original structured data hash value. By comparing the two hash values, it is verified whether the data has been tampered with. At the same time, the timestamp of the signature is also verified, and the blockchain technology is used to query the records to ensure the timeliness and authenticity of the signature. If all verification steps pass, the data is considered authentic and reliable; if any step fails, the signature is invalid or the data has been tampered with, and the business system needs to take processing measures. This technology provides business systems with efficient and reliable data verification methods to ensure data security and provide strong guarantees for data integrity and source authenticity in business scenarios.
[0047] This application combines the user's digital handwriting to directly generate the keys required for digital signatures, signature verification, encryption, and decryption that meet national secret requirements. It uses the person himself as the "key carrier" to generate an unalterable, unique, and verifiable signature to sign structured data, making the signing of structured data more efficient, convenient, and easy to manage.
[0048] First, through digital handwriting collection and standard processing, the characteristic vector of the user's writing habits is extracted, and then the characteristic vector is encrypted through the national secret algorithm to generate the public and private keys of the personal identification; the hash value of the structured data is calculated, and the encrypted characteristic vector of the user's handwriting data is combined for digital signature. With the person himself as the key carrier, no digital certificate is required, the user's digital signature handwriting is used as the key carrier, the structured data uploaded by the user is hashed, and the characteristic vector of the user's digital handwriting data is combined for digital signature, which greatly improves the convenience of user use and reduces the learning cost and management cost. At the same time, it can also be combined with signature handwriting recognition to play the role of identity authentication and willingness confirmation, which is more secure.
[0049] Digital handwriting collection and standardized processing. Collect the digital handwriting of the user's electronic signature and perform standardized processing.
[0050] When a user needs to initiate a structured data signature and completes the signature using a smart pen, touch screen or other digital input device, the signature collection device collects the user's written signature and records dynamic information including stroke sequence, pressure change, speed, acceleration, etc. The preprocessing unit performs standard processing on the collected digital handwriting data, including denoising, smoothing, feature point extraction, etc., to extract feature vectors such as stroke sequence, pressure change, speed, acceleration, etc. that can accurately reflect the user's writing habits.
[0051] The system supports a variety of digital input devices, including but not limited to smart pens, touch screens, tablet computers and other high-precision data acquisition devices, which are used to capture the user's dynamic writing information. The handwriting data collected and recorded by the acquisition device includes but is not limited to stroke sequence, pressure changes, speed, acceleration, direction, etc. The acquired signature handwriting dynamic data is transmitted to the handwriting data processing unit in real time for standardized processing to form a digital handwriting data package exclusive to the current user.
[0052] Structured data processing. The structured data signature verification service of this application supports a variety of structured data formats, such as CSV, JSON, XML, etc. If uploading is required, the user uploads specific formatted data as required, and encrypts the transmission to ensure the security of the data, such as using the SM4 algorithm for encrypted transmission. Use the SM4 algorithm to decrypt the received structured data. After decryption, first check the integrity, accuracy and consistency of the verification data to ensure that the data has not been tampered with during transmission, and then check whether the uploaded data meets the requirements for uploading structured data formats. The user uploads the structured data to be signed in the format required by the user. The formats of the structured data to be signed include CSV, JSON, XML, etc., to ensure the consistency and accuracy of the data.
[0053] HTML, XML, and JSON are three-dimensional data, consisting of key-value pairs. They are highly integrated data. The CSV format uses comma-separated one-dimensional data representation. For two-dimensional table data, CSV may or may not contain column names, and when included, they are placed in the first line of the file. JSON and XML are formatted data for high-dimensional data. JSON can express and store high-dimensional data. Curly brackets are used to save objects composed of key-value pairs, and attribute values contain sets (not equivalent relationships) - parsed as dictionaries. Square brackets are used to save data composed of key-value pairs, and equivalent relationships contain sets - parsed as lists. JSON and CSV can be converted to each other. Different structured data have different dimensions and structures.
[0054] The present invention first processes the structured data, flattens the structured data of different formats, and converts it into a two-dimensional array structure. For example, if the structured data is converted into a two-dimensional array structure including keys and values, the curly brackets are removed and only the square brackets are retained. A conversion method of an embodiment of the present application can be adopted to directly flatten the multi-level key value key into multiple array elements and directly flatten the array elements.
[0055] Such as [[key1, value1], [key2, key3, value2, value3, value4]...].
[0056] The following is a further explanation using the structured data JSON format as an example: The original structured data is: { key1: value1 key2: { key3: value2 key4:[value3,value4] } key5: value5 } , expand and flatten it to get the 2D array structure containing keys and values as shown below. The array structure is simplified by removing the curly braces and only retaining the square brackets. [ [key1,value1] [key2,key3,value2] [key2,key4,value3,value4] [key5,value5] ].
[0058] Further, the hash value (hash) calculation is performed on the flattened 2D array. This exemplary embodiment adopts the reverse salt appending method for calculation. The calculation method includes: starting from any element of the 2D array, sequentially calculating the hash value of each element until the calculation of the entire array is completed to obtain a 2D array containing a series of hash value data. For example, the 2D array after the structured data is flattened is traversed, and the hash value of the penultimate element of the 2D array is first calculated, and the hash value is used as the salt, and then the value of the penultimate element is taken, and the salt is added to obtain the hash value of the second element. The calculation is performed sequentially in this way until the entire unfolded and flattened 2D array is calculated. The method for calculating the hash value is to obtain any i-th element xi in the two-dimensional array, calculate the hash value of the subsequent i+1-th element as the salt f(xi+1), and calculate the hash value f(xi) of the i-th element according to the formula f(xi) = HASH(xi+ f(xi+1)). The calculation can start from the first element, the last element, or any element. After obtaining the hash values of all elements, a series of hash values are obtained, which are arranged in the order of the two-dimensional array to obtain a two-dimensional array containing hash value data after the two-dimensional array is flattened.
[0059] Through this conversion method, when the structured data is subsequently verified, it is possible to quickly locate where the structured data has changed. Traverse all 2D arrays of the structured data, calculate the hash values of the elements in all sub-arrays of the structured data, and arrange them in the order of the 2D array of the structured data. After concatenating the hash values of all sub-arrays, the overall hash value f(x0) of the structured data is obtained. When the structured data is subsequently verified, this array can be used to determine whether the structured data has changed.
[0060] According to the calculated overall hash value f(x0), the structured signature data is assembled. The structured data signature time, public key information, signature algorithm identifier, signature value, electronic handwriting data packet (ciphertext) can be added to the overall hash value. A trusted timestamp can be further added. If the SM2 or RSA algorithm is used for signing, the public key information is the CA certificate. If the SM9 or other IBC algorithm is used for signing, the public key information is the main public key information and identification information. The electronic handwriting data includes handwriting point data, writer information, handwriting image, device information, etc. The point data includes handwriting point coordinate information, pressure information, sampling time information, etc. The electronic handwriting data is a two-dimensional array with an array structure such as [[x0, y0, p0, t0], [x1, y1, p1, t1], ....], The device information mainly refers to the basic information of the handwriting collection device. The devices include but are not limited to mobile phones, signature boards, drawing boards, handwriting boards and other devices that can collect handwriting data. The data obtained from the device information may be different depending on the device. It usually includes the device model, device serial number, device manufacturer, device pressure sensitivity level, device resolution, device firmware version number, etc. The electronic handwriting data packet is encoded in a structured data format, generally in JSON format, and then the encoded electronic handwriting data packet is encrypted in a digital envelope. The encrypted electronic handwriting data packet is merged with the structured signature data to complete the handwriting fusion. The structured signature data based on the digital handwriting is obtained to sign the structured data for identity authentication.
[0061] Data integration: The pre-processed digital handwriting feature vector data, handwriting image and structured signature data are combined to form a complete signature data structure.
[0062] Key construction: Standardize the user's signature handwriting feature vector to generate personal identification password public and private keys.
[0063] Verify the digital handwriting data to extract signature features, set the key library weight bias, and reconstruct the style features based on the weight bias and the extracted signature features; call the SM9 national secret algorithm to encrypt and process the unified handwriting feature vector to generate the personal identification password public and private keys.
[0064] Digital signature: Use the public key to encrypt the structured data to be signed and output the ciphertext; use the private key to use the SM9 national secret algorithm and combine it with the timestamp to digitally sign the signed data to generate a unique signature value. This process ensures that the signature cannot be forged and is uniquely associated with the user.
[0065] Timestamp addition: Timestamp information can be further added during the encryption process to ensure the timeliness of the signature.
[0066] After the signature is completed, the structured data signature value is stored and the final data is sent to the blockchain to ensure the authenticity and immutability of the data.
[0067] Electronic handwriting data packets are generally encoded in JSON format, then encrypted using a digital envelope, and stored in a structured data signature structure after encryption to complete the fusion of structured data and handwriting for identity authentication.
[0068] The user's signature call information is stored locally, and the call information includes: structured data to be signed, hash value of structured data to be signed, ID number of the signing user, ID type, signature handwriting feature vector, hash value of handwriting feature vector data, and digital signature value. It is stored locally for subsequent query and audit. Send to blockchain: Send the user's signature call information, including: structured data to be signed, hash value of structured data to be signed, ID number of the signing user, ID type, signature handwriting feature vector, hash value of handwriting feature vector data, and signature value to the blockchain network. All information is stored on the blockchain to maintain data consistency. It can ensure the security and traceability of data and prevent data from being tampered with or deleted.
[0069] Verification of structured data. When the business system needs to verify the structured data, call the verification interface of the structured signature verification service, and pass in the structured data to be verified and the corresponding digital signature value. When the signature verification service receives the structured data and the corresponding digital signature value, first, call the SM3 function to calculate the hash value of the structured data to obtain the hash value of the structured data to be verified. Then, use the public key of the user when initiating the structured data signature to decrypt the signature value and obtain the hash value of the original structured data.
[0070] Calculate a new hash value for the structured data and compare it with the original structured data hash value in the signature value to determine whether the structured data has been tampered with. Compare the two hash values and verify the signature timestamp. At the same time, query the blockchain record to ensure the authenticity and integrity of the signature. If the verification passes, it means that the signature for the structured data is valid. Otherwise, it means that the signature is invalid or has been tampered with.
[0071] Extract the hash value information of the original structured data from the signature value, and verify the structured data to be verified passed in by the business system. Specifically, it includes calling the verification interface, signature verification service processing, and hash value comparison and verification. The specific calling of the verification interface is: Business demand trigger: In certain business scenarios (such as transaction confirmation, data exchange, etc.), the business system needs to verify the received structured data to ensure that it has not been tampered with and is indeed from the expected sender. Interface call: In order to meet this requirement, the business system calls the verification interface provided by the structured signature verification service. Parameter input: When calling the interface, the business system needs to pass in the structured data itself and the corresponding signature value. Structured data refers to information with a clear format and structure, and the signature value is the result of processing this data with a specific signature algorithm.
[0072] Signature verification service processing includes: Receiving data: After the signature verification service receives the structured data and signature value from the business system, it starts processing. The structured data is calculated using the SM3 hash algorithm to obtain a unique hash value. Decrypting the signature value: The service will use the public key of the user who initiated the structured data signature to decrypt the signature value. This public key is generated and verified in advance based on the digital handwriting feature vector during the signing process to ensure that only legitimate users can generate valid signatures. After decryption, the hash value of the original structured data (that is, the hash value calculated when signing) is obtained.
[0073] Hash value comparison: Compare the decrypted hash value with the hash value calculated by the SM3 algorithm. If the two are consistent, it means that the structured data has not been tampered with during transmission. Verify the signature timestamp: In addition to the hash value comparison, the signature timestamp can be further verified. The timestamp is a time mark when the signature is generated, which is used to ensure the timeliness of the signature. If the signature timestamp differs too much from the current time (exceeding the set threshold), it may indicate that the signature has expired or there are other problems. Query blockchain records: In order to further ensure the authenticity and integrity of the signature, query the records on the blockchain. By querying the blockchain records, you can verify whether the signature is indeed generated by a legitimate user and has not been tampered with or revoked on the blockchain. Signature validity: If all the above verification steps are passed (that is, the hash value is consistent, the signature timestamp is valid, and the blockchain record is correct), it means that the signature is valid and the structured data is authentic. The signature is invalid or tampered with: If any verification step fails (such as inconsistent hash values, invalid signature timestamp, abnormal blockchain records, etc.), it means that the signature is invalid or tampered with. The business system can take corresponding processing measures based on the verification results (such as refusing to receive data, issuing alarms, etc.).
[0074] The method proposed in the present invention has significant advantages in detecting changed fields of structured data. It can accurately locate changed fields, is sensitive to key fields, and has fast processing speed, which makes the algorithm have broad application prospects in the field of structured data processing.
[0075] The applicant of the present invention has made a detailed explanation and description of the implementation examples of the present invention in conjunction with the drawings in the specification. However, those skilled in the art should understand that the above implementation examples are only preferred implementation schemes of the present invention, and the detailed description is only to help readers better understand the spirit of the present invention, but not to limit the scope of protection of the present invention. On the contrary, any improvements or modifications based on the inventive spirit of the present invention should fall within the scope of protection of the present invention.
Claims
1. A structured data signature service system based on digital handwriting, characterized in that: include: Signature terminal, business system, structured data signature service; signature terminal collects user electronic signature handwriting data; Business systems standardize structured data; The structured data signature service system performs standard processing on the electronic signature handwriting data to obtain the handwriting standard feature data, generates the public and private keys of the personal identification password, and generates the structured data hash value based on the structured data after standardization processing; The structured data hash value is digitally signed using the public and private keys of the personal identification password to obtain the structured data signature value.
2. The system according to claim 1, characterized in that The structured signature service system also includes a signature verification interface, which receives the structured data to be verified and the corresponding structured data signature value, calls the SM3 function to calculate the hash value of the structured data to be verified, obtains the hash value of the structured data to be verified, and uses the personal identification password public key to decrypt the structured data signature value to obtain the hash value of the original structured data; Compare the two hash values to determine whether the structured data has been tampered with.
3. The system according to claim 1 or 2, characterized in that: Standardization of structured data includes converting a multi-level nested data structure into a two-dimensional array structure by tiling the structured data, calculating a hash value of each element in any two-dimensional array, arranging the hash values in the order of the two-dimensional array structure, and obtaining a two-dimensional array containing hash value data of the structured data conversion.
4. The system according to claim 1 or 2, characterized in that: The method of digitally signing structured data using the public and private keys of a personal identification password includes: expanding the structured data and flattening it into a two-dimensional array structure, performing hash calculation on each array element of any field or all fields in the two-dimensional array structure to obtain a hash value of each element; encrypting each element hash value using a public key to output a ciphertext, decrypting the ciphertext using a private key to generate a plaintext and calculating the plaintext hash, and encrypting the plaintext hash using the private key to obtain a structured data signature value.
5. The system according to claim 1 or 2, characterized in that: The generation of the public and private keys of the personal identification password includes: recording the stroke sequence of the electronic signature, handwriting point positions, pressure, time, speed, and acceleration, pre-processing to obtain standard handwriting feature data, extracting the signature feature vector and style features reflecting the user's writing habits, corresponding weight biases according to the feature vectors and their style features, reconstructing and generating a unified handwriting feature vector according to the weight bias and the extracted signature feature vector, and calling the SM9 national secret algorithm to encrypt the unified handwriting feature vector to generate the public and private keys of the personal identification password.
6. The system according to claim 3, characterized in that Starting from any element in the 2D array, the hash value of each element is calculated sequentially until the calculation of the entire array is completed to obtain a 2D array containing a series of hash value data, wherein the calculation of the hash value of each element includes: obtaining any i-th element xi in the 2D array, calculating the hash value of the subsequent i+1-th element as the salt f(xi+1), and calculating the hash value f(xi) of the i-th element according to the formula f(xi) = HASH(xi + f(xi+1)).
7. The system according to any one of claims 1 to 6, characterized in that: Calculate hash values for elements in all sub-arrays of structured data, arrange them in order of the corresponding two-dimensional array of structured data, concatenate the hash values of all sub-arrays to obtain the overall hash value f(x0) of the structured data, add signature time, public key, signature algorithm identifier, signature value, electronic handwriting data packet ciphertext, and trusted timestamp to the overall hash value to assemble it into structured signature data; encode the electronic handwriting standard feature data in a structured data format, encrypt the encoded electronic handwriting standard feature data, and merge it with the structured signature data to complete the fusion of structured data and handwriting.
8. A structured data signature and signature verification method based on digital handwriting, characterized in that: It is characterized in that it includes: collecting the user's electronic signature handwriting data, standardizing the electronic signature handwriting data to obtain handwriting standard feature data, and generating personal identification password public and private keys according to the handwriting standard feature data; standardizing the structured data and generating a structured data hash value; using the personal identification password public and private keys in combination with the structured data hash value to generate a digital signature value to complete the structured data signature; receiving the structured data to be verified and the corresponding digital signature value, calling the SM3 function to calculate the hash value of the structured data to be verified, and obtaining the hash value of the structured data to be verified, using the personal identification password public key to decrypt the signature value to obtain the hash value of the original structured data; comparing the two hash values to determine whether the structured data has been tampered with.
9. The method according to claim 8, characterized in that Standardization of structured data includes converting a multi-level nested data structure into a two-dimensional array structure by tiling the structured data, calculating a hash value for each element in the two-dimensional array, arranging the hash values in the order of the two-dimensional array structure, and obtaining a two-dimensional array containing hash value data of the structured data conversion.
10. The method according to claim 8, characterized in that The method of digitally signing structured data using the public and private keys of a personal identification password includes: expanding the structured data and flattening it into a two-dimensional array structure, performing hash calculation on each array element of any field or all fields in the two-dimensional array structure to obtain a hash value of each element; encrypting each element hash value using a public key to output a ciphertext, decrypting the ciphertext using a private key to generate a plaintext and calculating the plaintext hash, and encrypting the plaintext hash using the private key to obtain a structured data signature value.
11. The method according to claim 8, characterized in that Generating a personal identification password public and private keys includes recording the electronic signature stroke sequence, handwriting point position, pressure, time, speed, and acceleration, pre-processing to obtain standard handwriting feature data, extracting signature feature vectors and style features that reflect the user's writing habits, assigning weight biases based on the feature vectors and their style features, reconstructing a unified handwriting feature vector based on the weight bias and the extracted signature feature vector, and calling the SM9 national secret algorithm to encrypt the unified handwriting feature vector to generate a personal identification password public and private keys.
12. The method according to claims 8-11, characterized in that: Starting from any element in the 2D array, the hash value of each element is calculated sequentially until the calculation of the entire array is completed to obtain a 2D array containing a series of hash value data, wherein the calculation of the hash value of each element includes: obtaining any i-th element xi in the 2D array, calculating the hash value of the subsequent i+1-th element as the salt f(xi+1), and calculating the hash value f(xi) of the i-th element according to the formula f(xi) = HASH(xi + f(xi+1)).
13. The method according to claim 12, characterized in that Calculate hash values for elements in all sub-arrays of structured data, arrange them in order of the corresponding two-dimensional array of structured data, concatenate the hash values of all sub-arrays to obtain the overall hash value f(x0) of the structured data, add signature time, public key, signature algorithm identifier, signature value, electronic handwriting data packet ciphertext, and trusted timestamp to the overall hash value to assemble it into structured signature data; encode the electronic handwriting standard feature data in a structured data format, encrypt the encoded electronic handwriting standard feature data, and merge it with the structured signature data to complete the fusion of structured data and handwriting.
14. An electronic device, characterized in that: include: processor; And a memory for storing a program, wherein the program includes instructions, which, when executed by the processor, enable the processor to execute the structured data signature and verification method based on digital handwriting according to any one of claims 8-12.
15. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: in, The computer instructions are used to enable the computer to execute the structured data signature and signature verification method based on digital handwriting according to any one of claims 8-12.
Citation Information
Patent Citations
Structured data record electronic signature and verification method
CN118551417A