Signature method, device and equipment
By verifying and signing JAVA code packets by signing devices, the problem of low signature flexibility caused by the limitation of USB Key plugging in the prior art is solved, and the flexible signature requirements for multiple users and multiple regions are realized, and the security and efficiency of signatures are improved.
Patent Information
- Application Number
- CN202411819412.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-04
AI Technical Summary
In the prior art, USB Key needs to be plugged into the device to obtain the private key for signature, resulting in less flexibility in signing JAVA code packets for multiple users and multiple regions.
The signature device receives the signature request sent by the compilation device, verifies the legality of the data packet, and obtains the signature information corresponding to the signature identifier when the verification is passed, performs packet signature processing, and generates the target data packet.
It realizes the signing requirements for JAVA code packets in multiple users and regions, improves the flexibility and security of signatures, and avoids data leakage and signature errors caused by the signature device obtaining incorrect signature information.
Smart Images

Figure CN119760789A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a signature method, device and equipment. Background Art
[0002] With the widespread application of embedded systems, the deployment and update of JAVA code in embedded systems have become increasingly frequent. In order to ensure the security of JAVA code, JAVA code can be signed.
[0003] In actual application, the JAVA code is compiled to obtain a data packet. The data packet corresponding to the JAVA code is signed by the private key of the secure hardware medium USBKey. In the above process, since the USB Key needs to be inserted into the device to obtain the private key for signing, one USB Key cannot meet the needs of multiple users and multiple regions to sign the data packets corresponding to the JAVA code. As a result, the flexibility of signing the data packet is low. Summary of the invention
[0004] The embodiments of the present application provide a signing method, apparatus and device to solve the problem of low flexibility in signing data packets.
[0005] In a first aspect, an embodiment of the present application provides a signing method, including:
[0006] Receive a signature request sent by a compiling device, wherein the signature request includes a data packet to be signed and a signature identifier;
[0007] Performing verification processing on the data packet to obtain a verification result;
[0008] When the verification result is that the verification is passed, obtaining the signature information corresponding to the signature identifier;
[0009] The data packet is signed according to the signature information to obtain a target data packet, and the target data packet is sent to the compiling device.
[0010] In the embodiment of the present application, the signature device can realize the need of signing the data packets corresponding to the JAVA code by multiple users and multiple regions, thereby improving the flexibility of signing the data packets.
[0011] In a possible implementation manner, performing verification processing on the data packet to obtain a verification result includes:
[0012] Obtaining a data packet type and a data packet size of the data packet;
[0013] Get the preset type and preset range;
[0014] According to the data packet type and data packet size of the data packet, the preset type and the preset range, the data packet is verified to obtain a verification result.
[0015] In the embodiment of the present application, the data packet is verified to determine whether the data packet is a safe data packet, thereby improving the security of the signing process.
[0016] In a possible implementation, performing verification processing on the data packet according to the data packet type and data packet size of the data packet, the preset type, and the preset range to obtain a verification result includes:
[0017] If the data packet type matches the preset type and the data packet size is within the preset range, determining that the verification result is successful verification;
[0018] If the data packet type does not match the preset type, and / or the data packet size is not within the preset range, then the verification result is determined to be a verification failure.
[0019] In the embodiment of the present application, whether a data packet is a data packet to be signed is determined by a preset range and a preset type, thereby improving the accuracy and security of the signature.
[0020] In a possible implementation, when the verification result is verification passed, obtaining signature information corresponding to the signature identifier includes:
[0021] In response to a first device being plugged into a signature device, obtaining a device type of the first device;
[0022] If the device type is a preset device type, then in the first device, signature information corresponding to the signature identifier is obtained, where the signature information includes key information, a valid period, and a user identifier.
[0023] In the embodiment of the present application, when it is determined that the first device is a device corresponding to the preset device type (USB Key), the signature information is obtained, thereby avoiding the situation where the signature device obtains wrong signature information, resulting in data leakage, signature error, etc., and improving the security of the signature.
[0024] In a possible implementation, performing signature processing on the data packet according to the signature information to obtain a target data packet includes:
[0025] According to the key information, the data packet is signed to obtain a signature result;
[0026] If the signature result is a successful signature, the target time when the signature is successful is obtained, and the target data packet is generated according to the target time. The target data packet includes the data packet, the signature information and the target time.
[0027] In the embodiment of the present application, the data packet can be automatically signed, thereby improving the efficiency of the signature.
[0028] In a possible implementation, the method further includes:
[0029] If the signature result is a signature failure, the signature process is repeated until the signature is successful, and the target data packet is generated according to the target time when the signature is successful;
[0030] If the number of signature processing times is equal to the preset number of times, the second signature device performs signature processing according to the signature request to obtain the signature result, and generates the target data packet according to the signature result.
[0031] In the embodiment of the present application, when the signature result is determined to be a signature failure, the signature can be repeated or signed by a second signature device. In this way, the situation where a signature error or a signature device failure causes a signature failure can be avoided, thereby improving the success rate of the signature.
[0032] In a second aspect, an embodiment of the present application provides a signature device, the device comprising:
[0033] A receiving module, used to receive a signature request sent by a compiling device, wherein the signature request includes a data packet to be signed and a signature identifier;
[0034] A first processing module, used for performing verification processing on the data packet to obtain a verification result;
[0035] An acquisition module, used for acquiring the signature information corresponding to the signature identifier when the verification result is verification passed;
[0036] The second processing module is used to perform signature processing on the data packet according to the signature information to obtain a target data packet, and send the target data packet to the compiling device.
[0037] In a possible implementation manner, the first processing module is specifically configured to:
[0038] Obtaining a data packet type and a data packet size of the data packet;
[0039] Get the preset type and preset range;
[0040] According to the data packet type and data packet size of the data packet, the preset type and the preset range, the data packet is verified to obtain a verification result.
[0041] In a possible implementation manner, the first processing module is specifically configured to:
[0042] If the data packet type matches the preset type and the data packet size is within the preset range, determining that the verification result is successful verification;
[0043] If the data packet type does not match the preset type, and / or the data packet size is not within the preset range, then the verification result is determined to be a verification failure.
[0044] In a possible implementation manner, the acquisition module is specifically used to:
[0045] In response to a first device being plugged into a signature device, obtaining a device type of the first device;
[0046] If the device type is a preset device type, then in the first device, signature information corresponding to the signature identifier is obtained, where the signature information includes key information, a valid period, and a user identifier.
[0047] In a possible implementation manner, the second processing module is specifically configured to:
[0048] According to the key information, the data packet is signed to obtain a signature result;
[0049] If the signature result is a successful signature, the target time when the signature is successful is obtained, and the target data packet is generated according to the target time. The target data packet includes the data packet, the signature information and the target time.
[0050] In a possible implementation manner, the device further includes a third processing module.
[0051] Wherein, the third processing module is used for:
[0052] If the signature result is a signature failure, the signature process is repeated until the signature is successful, and the target data packet is generated according to the target time when the signature is successful;
[0053] If the number of signature processing times is equal to the preset number of times, the second signature device performs signature processing according to the signature request to obtain the signature result, and generates the target data packet according to the signature result.
[0054] In a third aspect, an embodiment of the present application provides a signature device, including:
[0055] at least one processor; and
[0056] a memory communicatively connected to the at least one processor; wherein,
[0057] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform any method described in the first aspect.
[0058] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute any one of the methods described in the first aspect.
[0059] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements any method in the first aspect when executed by a processor.
[0060] The signature method, device and equipment provided by the embodiment of the present application can obtain signature information when the verification result of the data packet is determined to be passed. The data packet is signed according to the signature information. In the above process, the signature device can meet the needs of multiple users and multiple regions to sign the data packets corresponding to the JAVA code. The flexibility of signing the data packet is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0062] Figure 1 A schematic diagram of an application scenario provided by an embodiment of the present application;
[0063] Figure 2 A flowchart of a signing method provided in an embodiment of the present application;
[0064] Figure 3 A flowchart of another signing method provided in an embodiment of the present application;
[0065] Figure 4 A schematic diagram of the signing process provided for an embodiment of the present application;
[0066] Figure 5 A schematic diagram of the structure of a signature device provided in an embodiment of the present application;
[0067] Figure 6 A schematic diagram of the structure of another signature device provided in an embodiment of the present application;
[0068] Figure 7 A schematic diagram of the structure of the signature device provided in an embodiment of the present application.
[0069] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0070] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0071] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0072] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0073] For ease of understanding, below, combined Figure 1 , the application scenarios to which the embodiments of the present application are applicable are described.
[0074] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1, including a terminal device 101 and a Universal Serial Bus (USB) device 102. The terminal device 101 may be a tablet computer, a computer, etc. The USB device 102 may be a USB Key. The USB device 102 is plugged into the terminal device 101, and the USB device 102 stores signature information. A user may write JAVA code through the terminal device 101, and sign the JAVA code through the USB device 102 to ensure the security of the JAVA code during use.
[0075] In actual application, the JAVA code is compiled to obtain a data packet. The data packet corresponding to the JAVA code is signed by the private key of the secure hardware medium USBKey. In the above process, since the USB Key needs to be inserted into the device to obtain the private key for signing, one USB Key cannot meet the needs of multiple users and multiple regions to sign the data packets corresponding to the JAVA code. As a result, the flexibility of signing the data packet is low.
[0076] In the embodiment of the present application, a signature device is provided. The signature device can obtain signature information when determining that the verification result of the data packet is passed. The data packet is signed according to the signature information. In the above process, the signature device can meet the needs of multiple users and multiple regions to sign the data packets corresponding to the JAVA code. The flexibility of signing the data packet is improved.
[0077] The method shown in the present application is described below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be described repeatedly in different embodiments.
[0078] Figure 2 A flowchart of a signature method provided in an embodiment of the present application. Figure 2 , the method may include:
[0079] S201. Receive a signature request sent by a compiling device.
[0080] The execution subject of the embodiment of the present application may be a signature device, or a signature device set in the signature device. The signature device may be implemented by software, or by a combination of software and hardware. The signature device may be a server.
[0081] The signature request includes the data package to be signed and the signature identifier.
[0082] After the user completes writing the JAVA code corresponding to the application program through the terminal device, the JAVA code is embedded in the image file through the JAVA program. The compilation device obtains the image file and compiles the JAVA code in the image file to obtain a data packet corresponding to the JAVA code. The data packet type of the data packet can be a Jar package type. The compilation device can be a server.
[0083] When compiling, the compiling device can divide the JAVA code in the image file to obtain at least one sub-JAVA code. The JAVA code is compiled sequentially to obtain a data packet corresponding to each sub-JAVA code. The JAVA code corresponds to an application, and a sub-JAVA code corresponds to a module in the application.
[0084] After the data packet is compiled and processed, the compiling device generates a signature request based on the data packet and the signature identifier, and sends the signature request to the signature device. The signature request can be sent to the signature device via the Hypertext Transfer Protocol (HTTP).
[0085] For example, the compiling device divides the JAVA code in the image file A1 to obtain at least one sub-JAVA code including code A1, code A2 and code A3. The compiling device compiles code A1 to obtain data packet A1 corresponding to code A1. The compiling device generates a signature request based on data packet A1 and signature identifier A, and sends the signature request to the signature device.
[0086] S202: Verify the data packet and obtain a verification result.
[0087] The data packet can be verified and processed to obtain a verification result in the following manner: obtaining the data packet type and data packet size of the data packet; obtaining a preset type and a preset range; and verifying the data packet according to the data packet type and data packet size, the preset type and the preset range of the data packet to obtain a verification result.
[0088] By verifying the data packet, it can be determined whether the data packet is a safe data packet, thereby improving the security of the signing process.
[0089] The signature device can receive multiple messages sent by the compilation device, and for any message, determine whether the message is a signature request. If so, the data packet is verified to obtain a verification result. If not, the message is discarded.
[0090] The preset type can be a Jar package type, and the preset range can be 500M~800M.
[0091] For example, assuming that the preset type is the Jar package type and the preset range is 500M~800M. For the data packet A1 shown in the above example, it is determined that the data packet type of data packet A1 is the Jar package type and the data packet size of data packet A1 is 600M. It can be determined that the data packet type of data packet A1 is the preset type and the data packet size of data packet A1 is within the preset range. Therefore, the signature device determines that the verification result is verification passed.
[0092] S203. When the verification result is that the verification is passed, the signature information corresponding to the signature identifier is obtained.
[0093] The signature information corresponding to the signature identifier can be obtained in the following manner: in response to the first device being plugged into the signature device, the device type of the first device is obtained; if the device type is a preset device type, the signature information corresponding to the signature identifier is obtained in the first device, and the signature information includes key information, validity period and user identifier.
[0094] When it is determined that the first device is a device corresponding to the preset device type (USB Key), the signature information is obtained, thereby avoiding situations such as data leakage and signature errors caused by the signature device obtaining wrong signature information, thereby improving the security of the signature.
[0095] The preset device type may be a USB type. The first device may be a USB Key, and the first device stores at least one signature identifier and signature information corresponding to each signature identifier.
[0096] The signature information corresponding to the signature identifier can be obtained through key and certificate management tools.
[0097] The key information may include a public key and a private key.
[0098] For example, according to the above example, the verification result of data packet A1 is determined to be passed. The signature device determines that the first device plugged into the signature device is UBS Key A. The signature device determines that the device type of UBS Key A is USB type. Therefore, the signature device obtains the signature information A corresponding to the signature identifier A shown in the above example in UBS Key A through the key and certificate management tool. The signature information A can be specifically shown in Table 1:
[0099] Table 1
[0100]
[0101] S204 . Perform signature processing on the data packet according to the signature information to obtain a target data packet, and send the target data packet to the compiling device.
[0102] After the compilation device receives the target data packet sent by the signature device, it determines that the signature is successful. The compilation device continues to compile other JAVA codes in the image file to generate data packets. It also sends a signature request to the signature device until the entire image file is signed successfully.
[0103] For example, according to the above example, it is determined that the image file A1 includes code A1, code A2 and code A3. The signature device performs signature processing on the data packet A1 corresponding to the code A1 according to the signature information shown in Table 1 above to obtain the target data packet A11. The signature device sends the target data packet A11 to the compilation device. The compilation device determines that the signature of data packet A1 is successful, continues to compile code A2, obtains data packet A2 corresponding to code A2, and generates a signature request. The compilation device sends the signature request to the signature device. The signature device repeats the above process (S201~S204) to sign data packet A2 to obtain the target data packet A21. The signature device sends the target data packet A21 to the compilation device. The compilation device determines that the signature of data packet A2 is successful, and continues to repeat the above compilation process. And the signature device performs signature processing on data packet A2 to obtain the target data packet A31. The compilation device determines that data packet A3 is signed successfully, and determines that the signature of the image file A1 is successful.
[0104] The signing method provided in the embodiment of the present application receives a signing request sent by a compilation device. The data packet is verified to obtain a verification result. When the verification result is that the verification is passed, the signature information corresponding to the signature identifier is obtained. According to the signature information, the data packet is signed to obtain a target data packet, and the target data packet is sent to the compilation device. In the above process, through the signing device, the needs of signing data packets corresponding to JAVA codes by multiple users and multiple regions can be met. The flexibility of signing data packets is improved.
[0105] Based on any of the above embodiments, Figure 3 , the detailed process of signing is explained.
[0106] Figure 3 This is a flowchart of another signing method provided in the embodiment of the present application. Figure 3 , the method comprising:
[0107] S301: Receive a signature request sent by a compiling device.
[0108] It should be noted that the execution process of S301 can refer to S201 and will not be repeated here.
[0109] S302: Obtain the data packet type and data packet size of the data packet.
[0110] The data packet type and data packet size of the data packet can be obtained according to the configuration information in the data packet.
[0111] S303: Obtain a preset type and a preset range.
[0112] The preset type and the preset range may be set in advance and stored in a preset storage space of the signature device.
[0113] S304: Verify the data packet according to the data packet type and data packet size, the preset type and the preset range of the data packet to obtain a verification result.
[0114] The data packet can be verified and processed according to the data packet type and data packet size, the preset type and the preset range of the data packet to obtain a verification result in the following manner: if the data packet type matches the preset type and the data packet size is within the preset range, the verification result is determined to be a successful verification; if the data packet type does not match the preset type, and / or the data packet size is not within the preset range, the verification result is determined to be a failed verification.
[0115] Whether a data packet is a data packet to be signed is determined by a preset range and a preset type, thereby improving the accuracy and security of the signature.
[0116] For example, the compilation device compiles the code B1 to obtain the data packet B1 corresponding to the code B1. The compilation device generates a signature request based on the data packet B1 and the signature identifier B. And sends the signature request to the signature device. The signature device determines that the data packet type of the data packet B1 is the Jar package type and the data packet size of the data packet B1 is 640M based on the configuration information in the data packet B1. The signature device obtains the preset type as the Jar package type in the preset storage space, and the preset range is 500M~800M. Therefore, the signature device determines that the data packet type matches the preset type and the data packet size is within the preset range, then it can be determined that the verification result is successful.
[0117] After the verification result is successful, the signature device can generate an identifier corresponding to the data packet, so as to avoid confusion of signatures when the data packets are named the same.
[0118] If the signature device determines that the verification result is a verification failure, the data packet is not signed, and a prompt message is generated and sent to the compilation device. The prompt message is used to indicate that there is an error in the data packet.
[0119] S305. When the verification result is that the verification is passed, the signature information corresponding to the signature identifier is obtained.
[0120] For example, according to the above example, the verification result is determined to be successful. The signature device obtains the signature information B corresponding to the signature identifier B.
[0121] S306: Sign the data packet according to the key information to obtain a signature result.
[0122] The data packet can be signed by the signature tool in the signature device to obtain the signature result, which can be a signature success or a signature failure.
[0123] The signature tool can be used to automate the signature process, thus improving the efficiency of signature.
[0124] For example, according to the above example, determine the key information B in the signature information B. The signature device signs the data packet B1 through the signature tool according to the key information B, and obtains a signature result that the signature is successful.
[0125] S307: If the signature result is successful, the target time when the signature is successful is obtained, and a target data packet is generated according to the target time.
[0126] The target data packet includes the data packet, signature information and target time.
[0127] For example, according to the above example, it is determined that the signature result corresponding to the data packet B1 is a successful signature. Then the moment when the signature device successfully obtains the signature is moment B. According to the target moment, the target data packet can be generated as shown in Table 2:
[0128] Table 2
[0129]
[0130] If the signature result is a signature failure, the signature process is repeated until the signature is successful, and the target data packet is generated according to the target time when the signature is successful. If the number of signature processes is equal to the preset number of times, the second signature device performs signature processing according to the signature request to obtain a signature result, and generates a target data packet according to the signature result.
[0131] The second signing device is a signing device with a different timestamp from the signing device.
[0132] When the data packet is signed by the second signature device, if the signature result is a successful signature, a target data packet is generated according to the signature result. If the signature result is a failed signature, a signature status is generated and sent to the compilation device.
[0133] The signature status can be determined by the status code. If the status code is a preset status code, the signature status can be determined to be a successful signature. If the status code is not a preset status code, the signature status can be determined to be a failed signature. The preset status code can be 200.
[0134] When the signature result is determined to be a signature failure, the signature can be repeated or signed through a second signature device. In this way, the situation where a signature error or a signature device failure causes a signature failure can be avoided, thereby improving the success rate of the signature.
[0135] For example, suppose that the data packet B1 shown in the above example is signed by the signature device A, and the signature result obtained is a signature failure. If the preset number of times is 3 times, then in the process of the subsequent 2 repeated signature processing of the data packet B1 by the signature device A, the signature result can be obtained as a signature success. The signature device A generates a target data packet according to the target time when the signature is successful. If in the process of the subsequent 2 repeated signature processing of the data packet B1 by the signature device A, the signature result obtained is a signature failure, then the data packet B1 is signed by the signature device B. If the signature result obtained by the signature processing of the data packet B1 by the signature device B is a signature success, then the target data packet is generated according to the target time when the signature is successful. If the signature result is a signature failure, a status code 111 is generated. And the status code 111 is sent to the compilation device.
[0136] Since the signature timestamp may be limited in number of times, during the signing process, signing devices with different timestamps can be used to ensure successful signing.
[0137] For example, when data packet A1 is signed, it can be signed by a signature device of timestamp A. When data packet B1 is signed, it can be signed by a signature device of timestamp B.
[0138] S308: Send the target data packet to the compiling device.
[0139] The compiling device can determine whether an error occurs during the signing process based on the target data packet and / or status code sent by the signing device.
[0140] For example, the signature device may send the target data packet shown in Table 2 to the compilation device. After receiving the target data packet, the compilation device may continue to compile the code and sign it through the signature device until the image file containing the code is signed.
[0141] The signature method provided in the embodiment of the present application receives a signature request sent by a compilation device. The data packet is verified to obtain a verification result. When the verification result is that the verification is passed, the signature information corresponding to the signature identifier is obtained. According to the key information, the data packet is signed to obtain a signature result. If the signature result is a successful signature, the target time when the signature is successful is obtained, and the target data packet is generated according to the target time. If the signature result is a failed signature, the signature process is repeated until the signature is successful, and the target data packet is generated according to the target time when the signature is successful. In the above process, through the signature device, the needs of signing the data packets corresponding to the JAVA code by multiple users and multiple regions can be met. The flexibility of signing the data packet is improved. And a remote JAVA code signing method is implemented, and the compilation process and the signature process are decoupled by maintaining a single signature server.
[0142] Based on any of the above embodiments, Figure 4 , the signing process is illustrated with examples.
[0143] Figure 4 This is a schematic diagram of the signing process provided by the embodiment of this application. Figure 4 , including a compiling device 401, a signing device 402 and a USB device 403. The compiling device 401 and the signing device 402 may be servers. An image file is stored in the compiling device 401. A signing tool, as well as a key and certificate management tool are provided in the signing device 402. The USB device 403 may be a UBS Key, and the USB device 403 is plugged into the signing device 402. At least one signature information is stored in the USB device 403.
[0144] The compiling device 401 divides the JAVA code in the image file A1 to obtain at least one sub-JAVA code including code C1, code C2 and code C3. The compiling device compiles the code C1 to obtain a data packet C1 corresponding to the code C1. The compiling device generates a signature request based on the data packet C1 and the signature identifier C. And sends the signature request to the signature device 402.
[0145] The signature device 402 obtains the data packet type of the data packet C1 as the Jar package type, and the data packet size of the data packet C1 is 550M. The signature device 401 obtains the preset type as the Jar package type in the preset storage space, and the preset range is 500M~800M. Therefore, the signature device 402 determines that the data packet type matches the preset type, and the data packet size is within the preset range, and then it can be determined that the verification result is successful. At this time, the signature device 402 obtains the signature information corresponding to the signature identifier C through the key and certificate management tool, which can be specifically shown in Table 3:
[0146] Table 3
[0147]
[0148] The signature device 402 signs the data packet C1 through the signature tool according to the key information shown in Table 3, and obtains the signature result of successful signature. The signature device 402 obtains the target time C when the signature is successful, and generates the target data packet C according to the target time. The target data packet C includes the data packet B1, the signature information C, and the time C. The signature device 402 sends the target data packet C to the compilation device 401. After receiving the data packet C, the compilation device 401 continues to compile the code C2 and the code C3, and performs the signature processing through the signature device 402, so that the image file is signed successfully.
[0149] The signing process provided in the embodiment of the present application receives a signing request sent by a compilation device. The data packet is verified to obtain a verification result. When the verification result is that the verification is passed, the signature information corresponding to the signature identifier is obtained. According to the key information, the data packet is signed to obtain a signing result. If the signing result is a successful signature, the target time when the signature is successful is obtained, and the target data packet is generated according to the target time. If the signing result is a failed signature, the signing process is repeated until the signature is successful, and the target data packet is generated according to the target time when the signature is successful. In the above process, through the signing device, the needs of signing the data packets corresponding to the JAVA code by multiple users and multiple regions can be met. The flexibility of signing the data packet is improved. And a remote JAVA code signing method is implemented, and the compilation process and the signature process are decoupled by maintaining a single signature server.
[0150] Figure 5 This is a schematic diagram of the structure of a signature device provided in an embodiment of the present application. Figure 5 , the signature device 10 may include:
[0151] The receiving module 11 is used to receive a signature request sent by the compiling device, wherein the signature request includes a data packet to be signed and a signature identifier;
[0152] The first processing module 12 is used to perform verification processing on the data packet to obtain a verification result;
[0153] The acquisition module 13 is used to acquire the signature information corresponding to the signature identifier when the verification result is verification passed;
[0154] The second processing module 14 is used to perform signature processing on the data packet according to the signature information to obtain a target data packet, and send the target data packet to the compiling device.
[0155] In a possible implementation manner, the first processing module 12 is specifically configured to:
[0156] Obtaining a data packet type and a data packet size of the data packet;
[0157] Get the preset type and preset range;
[0158] According to the data packet type and data packet size of the data packet, the preset type and the preset range, the data packet is verified to obtain a verification result.
[0159] In a possible implementation manner, the first processing module 12 is specifically configured to:
[0160] If the data packet type matches the preset type and the data packet size is within the preset range, determining that the verification result is successful verification;
[0161] If the data packet type does not match the preset type, and / or the data packet size is not within the preset range, then the verification result is determined to be a verification failure.
[0162] In a possible implementation manner, the acquisition module 13 is specifically used to:
[0163] In response to a first device being plugged into a signature device, obtaining a device type of the first device;
[0164] If the device type is a preset device type, then in the first device, signature information corresponding to the signature identifier is obtained, where the signature information includes key information, a valid period, and a user identifier.
[0165] In a possible implementation manner, the second processing module 14 is specifically configured to:
[0166] According to the key information, the data packet is signed to obtain a signature result;
[0167] If the signature result is a successful signature, the target time when the signature is successful is obtained, and the target data packet is generated according to the target time. The target data packet includes the data packet, the signature information and the target time.
[0168] The signature device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0169] Figure 6 A schematic diagram of the structure of another signature device provided in an embodiment of the present application. Figure 5 Based on the examples shown, see Figure 6The signature device 10 also includes a third processing module 15.
[0170] Wherein, the third processing module 15 is used for:
[0171] If the signature result is a signature failure, the signature process is repeated until the signature is successful, and the target data packet is generated according to the target time when the signature is successful;
[0172] If the number of signature processing times is equal to the preset number of times, the second signature device performs signature processing according to the signature request to obtain the signature result, and generates the target data packet according to the signature result.
[0173] The signature device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0174] Figure 7 This is a schematic diagram of the structure of the signature device provided in the embodiment of this application. Figure 7 The signature device 20 may include: a memory 21 and a processor 22. Exemplarily, the memory 21 and the processor 22 are interconnected via a bus 23.
[0175] The memory 21 is used to store program instructions;
[0176] The processor 22 is used to execute the program instructions stored in the memory, so as to enable the signature device 20 to execute the method shown in the above method embodiment.
[0177] The signature device provided in the embodiment of the present application can execute the technical solution shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.
[0178] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the above method.
[0179] The embodiment of the present application may also provide a computer program product, including a computer program, which can implement the above method when executed by a processor.
[0180] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The above-mentioned program can be stored in a readable memory. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the above-mentioned memory (storage medium) includes: read-only memory (ROM), random access memory (RAM), flash memory, hard disk, solid state drive, magnetic tape, floppy disk, optical disc and any combination thereof.
[0181] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0182] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0183] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0184] Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0185] In the present application, the term "include" and its variations may refer to non-restrictive inclusion; the term "or" and its variations may refer to "and / or". The terms "first", "second", etc. in the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In the present application, "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previously associated objects are in an "or" relationship.
Claims
1. A signature method, characterized in that: The method comprises: Receive a signature request sent by a compiling device, wherein the signature request includes a data packet to be signed and a signature identifier; Performing verification processing on the data packet to obtain a verification result; When the verification result is that the verification is passed, obtaining the signature information corresponding to the signature identifier; The data packet is signed according to the signature information to obtain a target data packet, and the target data packet is sent to the compiling device.
2. The method according to claim 1, characterized in that: Performing verification processing on the data packet to obtain a verification result includes: Obtaining a data packet type and a data packet size of the data packet; Get the preset type and preset range; According to the data packet type and data packet size of the data packet, the preset type and the preset range, the data packet is verified to obtain a verification result.
3. The method according to claim 2, characterized in that According to the data packet type and data packet size of the data packet, the preset type and the preset range, the data packet is verified to obtain a verification result, including: If the data packet type matches the preset type and the data packet size is within the preset range, determining that the verification result is successful verification; If the data packet type does not match the preset type, and / or the data packet size is not within the preset range, then the verification result is determined to be a verification failure.
4. The method according to any one of claims 1 to 3, characterized in that: When the verification result is that the verification is passed, the signature information corresponding to the signature identifier is obtained, including: In response to a first device being plugged into a signature device, obtaining a device type of the first device; If the device type is a preset device type, then in the first device, signature information corresponding to the signature identifier is obtained, where the signature information includes key information, a valid period, and a user identifier.
5. The method according to any one of claims 1 to 3, characterized in that: According to the signature information, the data packet is signed to obtain a target data packet, including: According to the key information, the data packet is signed to obtain a signature result; If the signature result is a successful signature, the target time when the signature is successful is obtained, and the target data packet is generated according to the target time. The target data packet includes the data packet, the signature information and the target time.
6. The method according to claim 5, characterized in that The method further comprises: If the signature result is a signature failure, the signature process is repeated until the signature is successful, and the target data packet is generated according to the target time when the signature is successful; If the number of signature processing times is equal to the preset number of times, the second signature device performs signature processing according to the signature request to obtain the signature result, and generates the target data packet according to the signature result.
7. A signature device, characterized in that: The device comprises: A receiving module, used to receive a signature request sent by a compiling device, wherein the signature request includes a data packet to be signed and a signature identifier; A first processing module, used for performing verification processing on the data packet to obtain a verification result; An acquisition module, used for acquiring the signature information corresponding to the signature identifier when the verification result is verification passed; The second processing module is used to perform signature processing on the data packet according to the signature information to obtain a target data packet, and send the target data packet to the compiling device.
8. A signature device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: in, The computer instructions are used to make a computer execute the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.