Soft key conversion method, soft key conversion device and storage medium

The soft key is decrypted and verified by the client, and the encryption and format conversion process is carried out on the server side to generate the hard key of the hardware encryption machine, solving the problem of low import efficiency, realizing automated conversion process and efficient key import , enhances security.

CN119030754APending Publication Date: 2024-11-26CHINA MERCHANTS BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411050211.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-01
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

When importing soft keys to hardware encryption machines, the types and types of keys are mostly inefficient in importing, requiring complicated operations and input of large amounts of data.

Method used

The soft key is decrypted and verified by the client, and asymmetric or symmetric encryption and format conversion are performed according to the encryption transmission method of the hardware encryption machine, to generate the hard key of the hardware encryption machine, and reduce the user's operation content on the client.

Benefits of technology

It improves the efficiency of key import hardware encryption machine, reduces complex operations in the computer room, realizes the automated conversion process of soft key to hard key, and enhances the security of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030754A_ABST
    Figure CN119030754A_ABST
Patent Text Reader

Abstract

The invention discloses a soft key conversion method, soft key conversion equipment and a medium, and relates to the technical field of information security, and the soft key conversion method comprises the following steps: carrying out decryption and verification processing on a soft key in an encryption state sent by a client, and determining an encryption transmission mode of a hardware encryption machine when the verification result is successful; when the encryption transmission mode is asymmetric encryption transmission, performing asymmetric encryption and format conversion processing on plaintext information of the decrypted soft key based on a transmission public key to obtain an asymmetric encryption ciphertext; and decrypting the asymmetric encrypted ciphertext according to a hardware encryption machine and a transmission private key, and generating a hard key of the hardware encryption machine based on the decrypted plaintext information. Through the plaintext information of the soft key input by the user at the client, the soft key is automatically decrypted, compared and re-encrypted, the soft key is encrypted into a hard key which can be used by the hardware encryption machine, and the efficiency of importing the key into the encryption machine is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information security technology, and in particular to a soft key conversion method, a soft key conversion device and a storage medium. Background Art

[0002] When converting the soft key used by the business system into a hard key that can be used by the hardware encryption machine, the key administrator usually imports the soft key into the hardware encryption machine. During the import process, the key administrator needs to inject the local master key of the hardware encryption machine into the encryption machine, then manually piece together the key import instructions, and then send the instructions to the hardware encryption machine through the network port or serial port. Finally, parse the instruction content returned by the hardware encryption machine to obtain the key ciphertext corresponding to the key plaintext. When there are many types of keys to be imported, there is a lot of data to be operated, resulting in low key import efficiency.

[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of the present application is to provide a soft key conversion method, a soft key conversion device and a storage medium, aiming to solve the technical problem of low efficiency of key importing into a hardware encryption machine.

[0005] To achieve the above object, the present application proposes a soft key conversion method, the method comprising: Decrypt and verify the encrypted soft key sent by the client, and when the verification result is passed, determine the encryption transmission mode of the hardware encryption machine; When the encrypted transmission mode is asymmetric encrypted transmission, asymmetric encryption and format conversion processing is performed on the decrypted plain text information of the soft key based on the transmission public key to obtain an asymmetric encrypted ciphertext; The asymmetric encrypted ciphertext is decrypted according to the hardware encryption machine and the transmission private key, and a hard key of the hardware encryption machine is generated based on the decrypted plaintext information.

[0006] In one embodiment, the step of decrypting the asymmetric encrypted ciphertext according to the hardware encryption machine and the transmission private key, and generating a hard key of the hardware encryption machine based on the decrypted plaintext information includes: Based on the hardware encryption machine, the asymmetric encrypted ciphertext is decrypted according to the transmission private key to obtain the plaintext information; The plaintext information is encrypted according to the local master key of the hardware encryption machine to obtain the hard key.

[0007] In one embodiment, when the encrypted transmission mode is asymmetric encrypted transmission, the step of performing asymmetric encryption and format conversion processing on the decrypted plaintext information of the soft key based on the transmission public key to obtain the asymmetric encrypted ciphertext includes: When the encrypted transmission mode is asymmetric encrypted transmission, asymmetric encryption processing is performed on the decrypted plaintext information of the soft key based on the transmission public key to obtain a preset encrypted ciphertext; Determining the ciphertext format of the preset encrypted ciphertext; When the ciphertext format of the asymmetric encrypted ciphertext is different from the target format of the hardware encryption machine, the ciphertext format is converted into the target format to obtain the asymmetric encrypted ciphertext in the target format.

[0008] In one embodiment, after the step of decrypting and verifying the encrypted soft key sent by the client, and determining the encryption transmission mode of the hardware encryption machine when the verification result is passed, the step further includes: When the encrypted transmission mode is symmetric encrypted transmission, randomly generating an SM4 key plaintext based on the SM4 algorithm; Perform ECB algorithm encryption on the plaintext information according to the SM4 key plaintext to obtain ECB ciphertext; Generate a decryption key for the ECB ciphertext based on the SM4 key plaintext; The ECB ciphertext is decrypted according to the hardware encryption machine and the decryption key, and the hard key is generated based on the decrypted ECB plaintext information.

[0009] In one embodiment, the step of decrypting the ECB ciphertext according to the hardware encryption machine and the decryption key and generating the hard key based on the decrypted ECB plaintext information includes: Based on the hardware encryption machine, the ECB ciphertext is decrypted according to the decryption key to obtain the ECB plaintext information; The ECB plaintext information is encrypted according to the local master key of the hardware encryption machine to obtain the hard key.

[0010] In one embodiment, the step of generating a decryption key for the ECB ciphertext based on the SM4 key plaintext includes: Asymmetric encryption and format conversion are performed on the SM4 key plaintext based on the transmission public key to obtain a target encrypted ciphertext; Based on the hardware encryption machine, the target encrypted ciphertext is decrypted according to the transmission private key to obtain the target plaintext information; The target plaintext information is encrypted according to the local master key of the hardware encryption machine to obtain the decryption key.

[0011] In one embodiment, the step of performing asymmetric encryption and format conversion processing on the SM4 key plaintext based on the transmission public key to obtain the target encrypted ciphertext includes: Asymmetric encryption is performed on the decrypted SM4 key plaintext based on the transmission public key to obtain a key encrypted ciphertext; Determining a target ciphertext format of the key-encrypted ciphertext; When the ciphertext format of the key-encrypted ciphertext is different from the encryption format of the hardware encryption machine, the target ciphertext format is converted into the encryption format to obtain the target encrypted ciphertext.

[0012] In one embodiment, the step of decrypting and verifying the encrypted soft key sent by the client, and determining the encryption transmission mode of the hardware encryption machine when the verification result is passed, further includes: The client performs asymmetric encryption on the plain text information of the received soft key based on the transmission public key, and then sends the encrypted soft key to the server; The step of decrypting and verifying the encrypted soft key sent by the client, and determining the encryption transmission mode of the hardware encryption machine when the verification result is passed, comprises: After receiving the soft key, the server performs decryption processing on the plain text information of the encrypted soft key based on the transmission private key, and performs integrity check based on the decrypted plain text information; When the verification result is passed, the encryption transmission mode of the hardware encryption machine is determined.

[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a soft key conversion device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the computer program is configured to implement the steps of the soft key conversion method described above.

[0014] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the soft key conversion method described above are implemented.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: The user imports the soft key remotely into the hardware encryption machine based on the client, and then the server confirms the encryption transmission method of the hardware encryption machine, encapsulates and encrypts it based on the encryption transmission method, and then encrypts and converts the plaintext information of the soft key through the hardware encryption machine to obtain the usable key of the hardware encryption machine. Based on this, the user only needs to complete the plaintext input of the soft key on the client, and the server completes the soft key conversion process. The process is automatically processed without complicated operations and complicated data input in the computer room, which improves the efficiency of importing keys into the hardware encryption machine. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] 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.

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0018] Figure 1 A schematic diagram of a first embodiment of the process for converting a soft key of the present application; Figure 2 An optional simplified flowchart of the soft key conversion method provided for this application; Figure 3 A schematic diagram of a second embodiment of the process flow of the soft key conversion method provided in the present application; Figure 4 Another optional simplified flow chart of the soft key conversion method provided in this application; Figure 5 A schematic diagram of the device structure of the hardware operating environment involved in the soft key conversion method in the embodiment of the present application.

[0019] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0021] The main solution of the embodiment of the present application is: decrypting and verifying the encrypted soft key sent by the client, and when the verification result is passed, determining the encryption transmission mode of the hardware encryption machine; When the encrypted transmission mode is asymmetric encrypted transmission, asymmetric encryption and format conversion processing is performed on the decrypted plain text information of the soft key based on the transmission public key to obtain an asymmetric encrypted ciphertext; The asymmetric encrypted ciphertext is decrypted according to the hardware encryption machine and the transmission private key, and a hard key of the hardware encryption machine is generated based on the decrypted plaintext information.

[0022] In this embodiment, for ease of description, the following description is made with the server as the execution subject.

[0023] In the prior art, when converting the soft key used by the business system into a hard key that can be used by the hardware encryption machine, the key administrator usually imports the soft key into the hardware encryption machine. During the import process, the key administrator needs to inject the local master key of the hardware encryption machine into the encryption machine, and then manually piece together the key import instructions, and then send the instructions to the hardware encryption machine through the network port or serial port, and finally parse the instruction content returned by the hardware encryption machine to obtain the key ciphertext corresponding to the key plaintext. When there are many types of keys to be imported, there is a lot of data to be operated, resulting in low efficiency in key import.

[0024] The present application provides a solution, which decrypts and verifies the soft key input by the user on the client side through the server side, and after the verification is passed, encrypts and converts the plaintext information of the soft key based on the encryption transmission method of the hardware encryption machine, and finally uses the hardware encryption machine to further decrypt and encrypt the encrypted plaintext information to obtain the hard key corresponding to the plaintext information of the soft key in the hardware encryption machine. In this process, the user only needs to enter the plaintext key to complete the conversion of the soft key to the hard key, thereby reducing the content that needs to be operated and improving the efficiency of importing the key into the hardware encryption machine.

[0025] It should be noted that the execution subject of this embodiment may be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of realizing the above functions, a soft key conversion device, etc. The following takes the soft key conversion device as an example to illustrate this embodiment and the following embodiments.

[0026] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0027] The present application embodiment provides a method for converting a soft key. Figure 1 , Figure 1 This is a flow chart of the first embodiment of the soft key conversion method of the present application.

[0028] In this embodiment, the soft key conversion method includes steps S10 to S30: Step S10, decrypting and verifying the encrypted soft key sent by the client, and when the verification result is passed, determining the encryption transmission mode of the hardware encryption machine; It should be noted that the soft key refers to the key generated by the software algorithm library, and the encrypted soft key sent by the client is the key plaintext information entered by the user in the client and processed by the client through asymmetric encryption. The plaintext information includes specific key plaintext types, such as SM4 (national secret symmetric encryption algorithm) key plaintext, SM2 (national secret asymmetric encryption algorithm) private key plaintext, etc. Among them, the SM2 key contains two parts: the public key and the private key. Whether it is the SM2 key generated by the software cryptographic algorithm library or the hardware encryption machine, its public key is in plaintext form, so you only need to import the SM2 private key plaintext, and the public key can be directly derived from the SM2 private key plaintext. The hardware encryption machine is a hardware device specially designed to perform encryption and decryption operations. The encryption transmission method it uses includes asymmetric SM2 algorithm encryption transmission, SM4 algorithm encryption transmission or other symmetric / asymmetric encryption transmission methods. The encryption transmission method of the hardware encryption machine can be selected by the user or automatically selected by the server according to actual usage.

[0029] In this embodiment, after the user inputs the plain text information of the soft key in the client, in order to ensure the confidentiality of data transmission, it is necessary to use the software cryptographic algorithm library built into the client to encrypt the soft key input by the client using the transmission public key. Specifically, the client performs asymmetric encryption on the plain text information of the received soft key based on the transmission public key, and then sends the encrypted soft key to the server. After receiving the soft key sent by the client, the server decrypts the plain text information of the soft key in the encrypted state based on the transmission private key, and performs integrity verification based on the plain text information after decryption. When the verification result is passed, the encryption transmission mode of the hardware encryption machine is determined. Among them, the transmission public key and the transmission private key are generated by the server. After the server generates the transmission public key, it sends it to the client, so that after the client encrypts the soft key based on the public key, the server decrypts the encrypted content through the transmission private key, and then verifies whether the soft key is the data sent by the client based on the decryption result, thereby improving the security of plain text information transmitted from the client to the server.

[0030] Furthermore, in this embodiment, after the soft key verification is passed, the encryption transmission method of the hardware encryption machine needs to be determined so that the encryption transmission method encrypts the plaintext information of the soft key and improves the security of the plaintext information transmitted from the server to the hardware encryption machine.

[0031] Step S20, when the encrypted transmission mode is asymmetric encrypted transmission, asymmetric encryption and format conversion processing is performed on the decrypted plain text information of the soft key based on the transmission public key to obtain an asymmetric encrypted ciphertext; In this embodiment, as an optional implementation, when the soft key is imported into the hardware encryption machine, in order to improve the security of the soft key during transmission, the decrypted soft key needs to be encrypted for transmission before being processed by the hardware encryption machine.

[0032] Therefore, when the encrypted transmission mode is asymmetric encrypted transmission, the decrypted soft key can be asymmetric encrypted based on the transmission public key to obtain a preset encrypted ciphertext, and then the ciphertext format of the preset encrypted ciphertext is determined. When the ciphertext format of the encrypted ciphertext is different from the target format of the hardware encryption machine, the ciphertext format is converted to the target format to obtain the encrypted ciphertext of the target format. Among them, different hardware encryption machines have different requirements for the data formats that can be processed. For example, when the hardware encryption machine is designed to only process the ciphertext of "c1c2c3", it cannot recognize the ciphertext of "c1c3c2" format. Therefore, after the soft key is asymmetric encrypted to obtain the preset encrypted ciphertext, it is also necessary to determine whether its ciphertext format meets the format requirements of the hardware encryption machine. If it does not meet the requirements, it is necessary to perform format conversion processing. Among them, in the format conversion processing of asymmetric encryption, when converting the "c1c3c2" format to "c1c2c3", the ciphertext components can be reordered.

[0033] Exemplarily, the plaintext information of the soft key after decryption is the SM4 key plaintext, and the hardware encryption machine can only process the ciphertext in the format of "c1c2c3". The server encrypts the SM4 key plaintext again based on the SM2 asymmetric encryption algorithm in the software algorithm library by transmitting the public key to obtain the preset encrypted ciphertext. The format of the preset encrypted ciphertext can be split into "c1c3c2". At this time, the preset encrypted ciphertext needs to be converted to the c1c2c3 format to obtain the encrypted ciphertext.

[0034] The soft key is encrypted again based on the national secret asymmetric encryption algorithm SM2, and the encrypted ciphertext format is converted so that the hardware encryption machine can process the ciphertext, thereby improving the data transmission security from the server to the hardware encryption machine and improving the efficiency of importing the soft key into the hardware encryption machine.

[0035] Step S30, decrypting the asymmetric encrypted ciphertext according to the hardware encryption machine and the transmission private key, and generating a hard key of the hardware encryption machine based on the decrypted plaintext information.

[0036] In this embodiment, before the soft key is imported into the hardware encryption machine, the decrypted soft key is asymmetrically encrypted twice by the server, and then sent to the hardware encryption machine by the server. Then, after the asymmetrically encrypted ciphertext is decrypted based on the server control or the self-control of the hardware encryption machine, the local master key of the hardware encryption machine is used to encrypt the plain text information of the soft key input by the user on the client to obtain the hard key.

[0037] Specifically, based on the hardware encryption machine, the asymmetric encrypted ciphertext can be decrypted according to the transmission private key to obtain the plaintext information, and then the plaintext information can be encrypted according to the local master key of the hardware encryption machine to obtain the hard key.

[0038] For example, to help understand the implementation process of the soft key conversion method obtained in this embodiment, please refer to Figure 2 , Figure 2 A brief flow chart of a soft key conversion method is provided, wherein the encryption transmission method used by the hardware encryption machine is asymmetric encryption transmission, specifically: After the user enters the SM4 key plaintext on the client interface, in order to ensure the confidentiality of data transmission, it is necessary to use the SM2 public key encryption algorithm in the software cryptographic algorithm library built into the client, and use the transmission public key to encrypt the SM4 key plaintext entered by the user. The client then sends the encrypted information to the server. After the server receives the ciphertext sent by the client, it uses the SM2 private key decryption algorithm in the software cryptographic algorithm library and uses the transmission private key to decrypt the ciphertext sent by the client to obtain the SM4 key plaintext, and then performs an integrity check on the decrypted SM4 key plaintext.

[0039] After the verification is passed, in order to ensure the security of data transmission from the server to the hardware encryption machine, based on the asymmetric encryption transmission in the encryption transmission mode of the hardware encryption machine, the server uses the SM2 public key encryption algorithm in the software algorithm library and uses the transmission public key to encrypt the SM4 key plaintext again to obtain ciphertext A, which can be divided into "c1c3c2". The hardware encryption machine can only process ciphertext in the format of "c1c2c3", so it is necessary to convert the ciphertext format of the encrypted ciphertext A, that is, convert the "c1c3c2" format to the "c1c2c3" format to obtain ciphertext B.

[0040] Finally, the server uses the encryption machine and the transmission private key to decrypt the ciphertext B to obtain the decrypted plaintext information, which is the plaintext information originally entered by the user on the client. Then, the SM4 key encrypted by LMK (Local Master Key, encryption machine local master key) and the corresponding check value are generated based on the decrypted plaintext information. The generated SM4 key is the key ciphertext available to the hardware encryption machine corresponding to the SM4 key plaintext entered by the user. Based on this, the SM4 key plaintext can be remotely imported into the hardware encryption machine.

[0041] It should be noted that the specific content of the plaintext information of the soft key recorded in the embodiments of the present application is only used for explanation and is not a limitation on the implementation method of the present application.

[0042] This embodiment provides a method for converting a soft key. After receiving the soft key in an encrypted state sent by the client, the server performs a decryption process on it to verify the accuracy and integrity of the data. After determining that the encryption algorithm of the hardware encryption machine can directly encrypt the plaintext information of the soft key, the plaintext information in the transmission process is first encrypted again. After the hardware encryption machine completes the decryption authentication of the plaintext information by transmitting the private key, the plaintext information is encrypted by the local master key of the hardware encryption machine, thereby realizing the conversion of the soft key to the hard key and successfully importing the soft key into the hardware encryption machine. In this process, the user only inputs the plaintext information of the soft key in the client, and the server automatically completes the conversion process of the soft key to the hard key without inputting complicated parameters. Based on this, the efficiency of importing the soft key into the hardware encryption machine is improved. Furthermore, the network communication between the client, the server, and the hardware encryption machine is all transmitted in ciphertext, which improves the security of data transmission. At the same time, the server verifies whether the received data is complete, ensuring the integrity of data transmission.

[0043] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the first embodiment can refer to the above introduction, and will not be repeated in the following. Figure 3 After step S10, the soft key conversion method further includes steps S40 to S70: Step S40, when the encryption transmission mode is symmetric encryption transmission, randomly generating an SM4 key plaintext based on the SM4 algorithm; In this embodiment, when the encrypted transmission method is symmetric encrypted transmission, it is necessary to randomly generate and encrypt a key plaintext based on the SM4 algorithm in the software cryptographic algorithm library, so that the plaintext information of the soft key can be encrypted by the key plaintext, and at the same time, a decryption key for the encrypted ciphertext can be generated based on the key plaintext.

[0044] Step S50, performing ECB algorithm encryption processing on the plaintext information according to the SM4 key plaintext to obtain ECB ciphertext; In this embodiment, as an optional implementation method, the plaintext information of the soft key input by the user can be encrypted based on the key plaintext generated by the encryption algorithm. The encryption process adopts the ECB mode, and finally the encrypted ECB ciphertext is obtained, so that the hardware encryption machine can recognize the ECB ciphertext when transmitting based on symmetric encryption.

[0045] Step S60, generating a decryption key for the ECB ciphertext based on the SM4 key plaintext; In this embodiment, the decryption key needs to be generated by a hardware encryption machine, and in order to improve the security of the ciphertext transmitted from the server to the hardware encryption machine, the SM4 key plaintext can be encrypted and transmitted by asymmetric encryption. Specifically, the SM4 key plaintext needs to be asymmetric encrypted and format converted based on the transmission public key to obtain the target encrypted ciphertext. Among them, in the process of obtaining the target encrypted ciphertext, the decrypted SM4 key plaintext can be asymmetric encrypted based on the transmission public key to obtain the key encrypted ciphertext, and then the target ciphertext format of the key encrypted ciphertext is determined. When the ciphertext format of the key encrypted ciphertext is different from the encryption format of the hardware encryption machine, the target ciphertext format is converted into the encryption format to obtain the target encrypted ciphertext.

[0046] After obtaining the target encrypted ciphertext, the target encrypted ciphertext is decrypted based on the hardware encryption machine according to the transmission private key to obtain the target plaintext information, and then the target plaintext information is encrypted according to the local master key of the hardware encryption machine to obtain the decryption key.

[0047] During the symmetric encryption transmission process, when the decryption key of the ECB ciphertext is generated, the randomly generated SM4 key is encrypted in plaintext and sent to the hardware encryption machine for processing through asymmetric encryption transmission, thereby improving the security of data transmission and the effectiveness of the encryption key.

[0048] Step S70: decrypt the ECB ciphertext according to the hardware encryption machine and the decryption key, and generate the hard key based on the decrypted ECB plaintext information.

[0049] As an optional implementation, after obtaining the decryption key and ECB ciphertext, the ECB ciphertext can be decrypted based on the hardware encryption machine according to the decryption key to obtain the ECB plaintext information, and then the ECB plaintext information can be encrypted according to the local master key of the hardware encryption machine to obtain the hard key.

[0050] For example, to help understand the implementation process of the soft key conversion method obtained in this embodiment, please refer to Figure 4 , Figure 4 A brief flow chart of another implementation of a soft key conversion method is provided, wherein the encryption transmission method used by the hardware encryption machine is symmetric encryption transmission, specifically: After the user enters the SM2 private key plaintext on the client interface, in order to ensure the confidentiality of data transmission, it is necessary to use the SM2 public key encryption algorithm in the client's built-in software cryptographic algorithm library, and use the transmission public key to encrypt the SM2 private key plaintext entered by the user. The client then sends the encrypted information to the server. After the server receives the ciphertext sent by the client, it uses the SM2 private key decryption algorithm in the software cryptographic algorithm library and uses the transmission private key to decrypt the ciphertext sent by the client to obtain the SM2 private key plaintext, and then performs an integrity check on the decrypted SM2 private key plaintext.

[0051] After the verification is passed, in order to ensure the security of data transmitted from the server to the hardware encryption machine, based on the symmetric encryption transmission of the encryption transmission method of the hardware encryption machine, the server uses the SM4 algorithm of the software cryptographic algorithm library to randomly generate and encrypt the SM4 key plaintext A, and uses the transmission public key to encrypt the SM4 key plaintext A to obtain the ciphertext B, and performs c1c2c3 format conversion on B to obtain the ciphertext C. Then the server uses the hardware encryption machine to decrypt C using the transmission private key, and generates an SM4 key ciphertext D of type ZMK (transmission master key) encrypted by LMK (encryption machine local master key) based on the decrypted plaintext information. At the same time, the server uses the SM4 key plaintext A to encrypt the SM2 private key plaintext entered by the user using the ECB algorithm to obtain the ciphertext E.

[0052] Finally, the server uses the hardware encryption machine to decrypt the ciphertext E using the key D, and generates an SM2 private key encrypted by the LMK (encryption machine local master key) based on the decrypted plaintext information. The SM2 private key generated at this time is the private key ciphertext available to the hardware encryption machine corresponding to the SM2 private key plaintext entered by the user.

[0053] It should be noted that the specific content of the plaintext information of the soft key recorded in the embodiments of the present application is only used for explanation and is not a limitation on the implementation method of the present application.

[0054] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the soft key conversion method of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.

[0055] The present application provides a soft key conversion device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable 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 execute the soft key conversion method in the above-mentioned first embodiment.

[0056] Reference below Figure 5 , which shows a schematic structural diagram of a soft key conversion device suitable for implementing an embodiment of the present application. Figure 5 The soft key conversion device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0057] like Figure 5 As shown, the soft key conversion device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the soft key conversion device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the soft key conversion device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows the soft key conversion device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or less systems can be implemented or have alternatively.

[0058] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0059] The soft key conversion device provided by the present application adopts the soft key conversion method in the above embodiment, which can solve the technical problem of low efficiency of key import into hardware encryption machine. Compared with the prior art, the beneficial effect of the soft key conversion device provided by the present application is the same as the beneficial effect of the soft key conversion method provided by the above embodiment, and the other technical features in the soft key conversion device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0060] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0061] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0062] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the soft key conversion method in the above-mentioned embodiment.

[0063] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0064] The computer-readable storage medium may be included in the soft key conversion device; or may exist independently without being assembled into the soft key conversion device.

[0065] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the soft key conversion device, the soft key conversion device: Decrypt and verify the encrypted soft key sent by the client, and when the verification result is passed, determine the encryption transmission mode of the hardware encryption machine; When the encrypted transmission mode is asymmetric encrypted transmission, asymmetric encryption and format conversion processing is performed on the decrypted plain text information of the soft key based on the transmission public key to obtain an asymmetric encrypted ciphertext; The asymmetric encrypted ciphertext is decrypted according to the hardware encryption machine and the transmission private key, and a hard key of the hardware encryption machine is generated based on the decrypted plaintext information.

[0066] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0067] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0068] The modules involved in the embodiments of the present application may be implemented by software or hardware, wherein the name of the module does not limit the unit itself in some cases.

[0069] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned soft key conversion method, and can solve the technical problem of low efficiency of key import into hardware encryption machine. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the soft key conversion method provided by the above-mentioned embodiment, and will not be described in detail here.

[0070] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A soft key conversion method, It is characterized in that The method comprises: Decrypt and verify the encrypted soft key sent by the client, and when the verification result is passed, determine the encryption transmission mode of the hardware encryption machine; When the encrypted transmission mode is asymmetric encrypted transmission, asymmetric encryption and format conversion processing is performed on the decrypted plain text information of the soft key based on the transmission public key to obtain an asymmetric encrypted ciphertext; The asymmetric encrypted ciphertext is decrypted according to the hardware encryption machine and the transmission private key, and a hard key of the hardware encryption machine is generated based on the decrypted plaintext information.

2. The method according to claim 1, It is characterized in that The step of decrypting the asymmetric encrypted ciphertext according to the hardware encryption machine and the transmission private key, and generating the hard key of the hardware encryption machine based on the decrypted plaintext information includes: Based on the hardware encryption machine, the asymmetric encrypted ciphertext is decrypted according to the transmission private key to obtain the plaintext information; The plaintext information is encrypted according to the local master key of the hardware encryption machine to obtain the hard key.

3. The method according to claim 1, It is characterized in that When the encrypted transmission mode is asymmetric encrypted transmission, the steps of performing asymmetric encryption and format conversion processing on the decrypted plain text information of the soft key based on the transmission public key to obtain the asymmetric encrypted ciphertext include: When the encrypted transmission mode is asymmetric encrypted transmission, asymmetric encryption processing is performed on the decrypted plaintext information of the soft key based on the transmission public key to obtain a preset encrypted ciphertext; Determining the ciphertext format of the preset encrypted ciphertext; When the ciphertext format of the asymmetric encrypted ciphertext is different from the target format of the hardware encryption machine, the ciphertext format is converted into the target format to obtain the asymmetric encrypted ciphertext in the target format.

4. The method according to claim 1, It is characterized in that After the step of decrypting and verifying the encrypted soft key sent by the client, and determining the encryption transmission mode of the hardware encryption machine when the verification result is passed, the method further includes: When the encrypted transmission mode is symmetric encrypted transmission, randomly generating an SM4 key plaintext based on the SM4 algorithm; Perform ECB algorithm encryption on the plaintext information according to the SM4 key plaintext to obtain ECB ciphertext; Generate a decryption key for the ECB ciphertext based on the SM4 key plaintext; The ECB ciphertext is decrypted according to the hardware encryption machine and the decryption key, and the hard key is generated based on the decrypted ECB plaintext information.

5. The method according to claim 4, It is characterized in that The step of decrypting the ECB ciphertext according to the hardware encryption machine and the decryption key and generating the hard key based on the decrypted ECB plaintext information includes: Based on the hardware encryption machine, the ECB ciphertext is decrypted according to the decryption key to obtain the ECB plaintext information; The ECB plaintext information is encrypted according to the local master key of the hardware encryption machine to obtain the hard key.

6. The method according to claim 4, It is characterized in that The step of generating a decryption key for the ECB ciphertext based on the SM4 key plaintext comprises: Asymmetric encryption and format conversion are performed on the SM4 key plaintext based on the transmission public key to obtain a target encrypted ciphertext; Based on the hardware encryption machine, the target encrypted ciphertext is decrypted according to the transmission private key to obtain the target plaintext information; The target plaintext information is encrypted according to the local master key of the hardware encryption machine to obtain the decryption key.

7. The method according to claim 6, It is characterized in that The step of performing asymmetric encryption and format conversion processing on the SM4 key plaintext based on the transmission public key to obtain the target encrypted ciphertext includes: Asymmetric encryption is performed on the decrypted SM4 key plaintext based on the transmission public key to obtain a key encrypted ciphertext; Determining a target ciphertext format of the key-encrypted ciphertext; When the ciphertext format of the key-encrypted ciphertext is different from the encryption format of the hardware encryption machine, the target ciphertext format is converted into the encryption format to obtain the target encrypted ciphertext.

8. The method according to any one of claims 1 to 7, It is characterized in that The step of decrypting and verifying the encrypted soft key sent by the client, and determining the encryption transmission mode of the hardware encryption machine when the verification result is passed, further includes: The client performs asymmetric encryption on the plain text information of the received soft key based on the transmission public key, and then sends the encrypted soft key to the server; The step of decrypting and verifying the encrypted soft key sent by the client, and determining the encryption transmission mode of the hardware encryption machine when the verification result is passed, comprises: After receiving the soft key, the server performs decryption processing on the plain text information of the encrypted soft key based on the transmission private key, and performs integrity check based on the decrypted plain text information; When the verification result is passed, the encryption transmission mode of the hardware encryption machine is determined.

9. A soft key conversion device, It is characterized in that The soft key conversion device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the soft key conversion method according to any one of claims 1 to 8.

10. A storage medium, It is characterized in that The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the soft key conversion method according to any one of claims 1 to 8 are implemented.