Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for sending and checking a ciphertext, which can solve the problem that in the prior art, once a password is cracked in the process of transmitting a complete password, all passwords are lost, and finally information is lost. The technical scheme is as follows:
in a first aspect, a method for transmitting a ciphertext is provided, the method including:
after receiving a part of cipher plaintext which accords with a preset decomposition rule, encrypting the part of cipher plaintext to generate an intermediate ciphertext;
sending the intermediate ciphertext to a checking device so that the checking device can combine at least two received intermediate ciphertexts according to a preset combining rule and check the combined ciphertexts;
and receiving a verification result fed back by the verification equipment, and executing corresponding operation.
In one possible implementation, the sending the intermediate ciphertext to the verification device includes any one of:
when an intermediate ciphertext is generated, the intermediate ciphertext is sent to the verification equipment;
and after all the intermediate ciphertexts corresponding to the complete cipher plaintext are generated, sending each intermediate cipher text to the verification equipment according to the generation sequence or the random sequence.
In a possible implementation manner, after receiving a partial cipher plaintext conforming to a preset parsing rule, before encrypting the partial cipher plaintext to generate an intermediate ciphertext, the method further includes:
receiving and decomposing a cipher plaintext according to a preset decomposition rule;
presetting a decomposition rule, which comprises the following steps:
when the cipher plaintext is a number, the number is decomposed into a plurality of groups according to a preset length, and each group is used as a partial cipher plaintext;
when the password plaintext is a graph, decomposing the graph into a plurality of partial graphs according to preset pixel blocks, wherein each partial graph is used as a partial password plaintext;
when the cipher plaintext is sound, the sound is decomposed into a plurality of sections of audio according to the preset time, and each section of audio is used as a partial cipher plaintext.
In one possible implementation, the method further includes:
and cleaning all corresponding intermediate sensitive security parameters cached in the cache every time the transmission operation of the intermediate ciphertext is completed, wherein the intermediate sensitive security parameters comprise a part of received plaintext, an encryption key, a process variable of intermediate calculation, an intermediate ciphertext and the like.
In one possible implementation, the method further includes:
after receiving the complete cipher plaintext, decomposing the complete cipher plaintext according to a preset decomposition rule to obtain a plurality of partial cipher plaintext;
sending the intermediate ciphertext to a check device so that the check device can combine at least two received intermediate ciphertexts according to a preset combining rule and verify the combined ciphertexts;
and receiving a verification result fed back by the verification equipment, and executing corresponding operation.
In a second aspect, a method for checking a ciphertext is provided, the method comprising:
after receiving the at least two intermediate ciphertexts, merging the at least two intermediate ciphertexts according to a preset merging rule to obtain merged ciphertexts;
and verifying the combined ciphertext and feeding back a verification result.
In one possible implementation manner, merging the at least two intermediate ciphertexts according to a preset merging rule includes any one of the following:
when the sequence of transmitting the intermediate ciphertexts is the sequential transmission sequence, sequentially combining at least two intermediate ciphertexts according to the received sequence;
when the sequence for sending the intermediate ciphertexts is determined to be a random sequence, merging at least two intermediate ciphertexts according to the position identification carried by the intermediate ciphertexts; the position identifier is used for identifying the position of the intermediate ciphertext in the ciphertext.
In a third aspect, an apparatus for transmitting a ciphertext is provided, the apparatus comprising:
the encryption module is used for encrypting a part of cipher plaintext to generate an intermediate ciphertext after receiving the part of cipher plaintext which accords with the preset decomposition rule;
the verification module is used for sending the intermediate ciphertext to the verification equipment so that the verification equipment can combine at least two received intermediate ciphertexts according to a preset combination rule and verify the combined ciphertexts;
and the operation module is used for receiving the verification result fed back by the verification equipment and executing corresponding operation.
In a fourth aspect, an electronic device is provided, the device comprising:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: the above-described method of transmitting a ciphertext is performed.
In a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the above-mentioned method for transmitting a ciphertext.
In a sixth aspect, an apparatus for checking a ciphertext is provided, the apparatus comprising:
the merging module is used for merging the at least two intermediate ciphertexts according to a preset merging rule after the at least two intermediate ciphertexts are received, so as to obtain merged ciphertexts;
and the feedback module is used for verifying the combined ciphertext and feeding back a verification result.
In a seventh aspect, an electronic device is provided, including:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: and executing the method for checking the ciphertext.
In an eighth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the program, when executed by a processor, implements the above-mentioned method of checking a ciphertext.
The beneficial effect that technical scheme that this application provided brought is:
the technical scheme provided by the embodiment of the application can decompose the password according to the preset decomposition rule when the user inputs the password, and the decomposition mode enables the password to exist in a plaintext form at the input moment, but only loses part of the password even if being stolen, and a stealing party cannot obtain related data according to the part of the password because the password is decomposed, so that the problem that the password exists in a complete plaintext form for a period of time when the user inputs the password in the prior art, and the complete plaintext password is stolen once being stolen can be avoided. And encrypting the partial cipher plaintext after the decomposition to generate an intermediate cipher text, and sending the intermediate cipher text to the verification equipment according to a preset mode, so that the decomposed ciphers are sent in the sending process, and the possibility of stealing the complete cipher is further prevented. And when the check equipment receives the intermediate ciphertext, decrypting and splicing the received ciphertext to finally obtain the complete password. The scheme can also operate any detachably transmitted passwords such as sound, graphics, gestures and the like.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The application provides a method, a device, equipment and a storage medium for sending and checking a ciphertext, and aims to solve the technical problems in the prior art.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The embodiment of the application provides a method for sending a ciphertext, which can be used in an upper computer, such as password input ends of a USB key, a computer, a mobile phone and the like, and as shown in figure 1, the method comprises the following steps:
step 11, after receiving a part of password plaintext which accords with a preset decomposition rule, the upper computer encrypts the part of password plaintext to generate an intermediate ciphertext;
in the prior art, when a user inputs a password by means of an upper computer, the password exists in a plaintext form for a short time, and the password is extremely easy to crack in the process; according to the scheme provided by the application, when the user inputs the password, the password can be decomposed to obtain a part of password plaintext, and at the moment, the password is only lost partially even being stolen, so that the formed threat is extremely low.
Step 12, the upper computer sends the intermediate ciphertext to the check equipment, so that the check equipment combines at least two received intermediate ciphertexts according to a preset combination rule and checks the combined ciphertexts; the step of sending the intermediate ciphertext to the verification device may include any one of the following:
firstly, each time an intermediate ciphertext is generated, the intermediate ciphertext is sent to a verification device;
and secondly, after all the intermediate ciphertexts corresponding to the complete cipher plaintext are generated, all the intermediate ciphertexts are sent to the verification equipment according to the generation sequence or the random sequence.
In the first mode in the step, the intermediate ciphertext is generated at any time and is sent at any time, so that the timeliness of sending the ciphertext is ensured, and the possibility of stealing the complete password can be completely eradicated; in the second mode in this step, after all the intermediate ciphertexts are obtained, the intermediate ciphertexts can be sent according to the generation sequence or the random sequence of the intermediate ciphertexts, and the flexibility of random sending in the sending mode can ensure that under the condition that a plurality of or all the intermediate ciphertexts are stolen in the process of cipher text transmission, correct complete cipher texts cannot be obtained due to the fact that all the intermediate cipher texts cannot be sequenced, and the safety in the transmission process can be further enhanced;
and step 13, the upper computer receives the verification result fed back by the verification equipment and executes corresponding operation.
In the above process, after receiving the partial cipher plaintext conforming to the preset decomposition rule, before encrypting the partial cipher plaintext to generate an intermediate ciphertext, the method further includes:
receiving and decomposing a cipher plaintext according to a preset decomposition rule;
the preset decomposition rule comprises one of the following modes:
firstly, when a cipher plaintext is a number, the number is decomposed into a plurality of groups according to a preset length, and each group is used as a partial cipher plaintext; the preset length can be set according to actual requirements;
secondly, when the password plaintext is a graph, decomposing the graph into a plurality of partial graphs according to preset pixel blocks, wherein each partial graph is used as a partial password plaintext; the preset pixel block size can be set according to the actual situation;
thirdly, when the cipher plaintext is sound, the sound is decomposed into a plurality of sections of audio according to the preset time, and each section of audio is used as a partial cipher plaintext. The preset time can be set according to the actual situation;
in practical application, one of the three ways can be selected according to practical situations, but the decomposition rule referred to in the application is not limited to the three situations, but is suitable for any situation that can be split.
Further, in order to improve security, each time before the intermediate ciphertext is transmitted, the intermediate ciphertext is stored in the buffer for subsequent transmission, but if the intermediate ciphertext is not cleaned in time after the transmission, the intermediate ciphertext is still stored in the buffer, and the possibility of being stolen is increased, so that after the transmission operation on the intermediate ciphertext is completed each time, corresponding sensitive data cached in the buffer needs to be cleaned, and the sensitive data comprises but is not limited to the received intermediate ciphertext, part of plaintext, an encryption key, process variables of intermediate calculation and the like.
Furthermore, when the upper computer is in a relatively safe environment, the complexity in the upper computer can be correspondingly reduced, so that the complete cipher plaintext can be decomposed according to a preset decomposition rule after the complete cipher plaintext is received, and a plurality of partial cipher plaintext is obtained; sending the intermediate ciphertext to a check device so that the check device can combine at least two received intermediate ciphertexts according to a preset combining rule and verify the combined ciphertexts; and receiving a verification result fed back by the verification equipment, and executing corresponding operation.
According to the technical scheme, the password can be decomposed according to the preset decomposition rule when the user inputs the password, the decomposition mode enables the password to exist in a plaintext form at the input moment, but only part of the password is lost even if the password is stolen because the password is decomposed, and the stealing party cannot obtain related data according to the part of the password, so that the problems that in the prior art, the password exists in a complete plaintext form for a period of time when the user inputs the password, and the complete plaintext password is stolen once the password is stolen can be avoided. And encrypting the partial cipher plaintext after the decomposition to generate an intermediate cipher text, and sending the intermediate cipher text to the verification equipment according to a preset mode, so that the decomposed ciphers are sent in the sending process, and the possibility of stealing the complete cipher is further prevented. And when the check equipment receives the intermediate ciphertext, decrypting and splicing the received ciphertext to finally obtain the complete password. The scheme can also operate any detachably transmitted passwords such as sound, graphics, gestures and the like.
The embodiment of the present application provides a method for checking a ciphertext, which is applied to any device capable of performing password checking, and as shown in fig. 2, the method specifically includes:
step 21, after receiving the at least two intermediate ciphertexts, merging the at least two intermediate ciphertexts according to a preset merging rule to obtain merged ciphertexts;
in this step, at least two intermediate ciphertexts are merged according to a preset merging rule, which includes any one of the following:
firstly, when the sequence of transmitting the intermediate ciphertexts is the sequential transmission sequence, sequentially combining at least two intermediate ciphertexts according to the received sequence;
secondly, when the sequence of sending the intermediate ciphertexts is determined to be a random sequence, merging at least two intermediate ciphertexts according to the position identification carried by the intermediate ciphertexts; the position identifier is used for identifying the position of the intermediate ciphertext in the ciphertext;
in this step, a merging rule corresponding to the sending mode of the upper computer may be set in advance for the verification device, for example, when the sending mode of the upper computer is sequential sending, the merging mode of the verification device is merging according to the received sequence; and when the sending mode of the upper computer is a random sequence, simultaneously sending the position identifications of all the ciphertexts in which the intermediate ciphertexts are located to the verification equipment together, and splicing the intermediate ciphertexts by the verification equipment according to the position identifications after receiving the intermediate ciphertexts.
And step 22, verifying the combined ciphertext and feeding back a verification result.
In the step, after the combination of the intermediate ciphertexts is completed, the work of checking the ciphertexts is carried out, and the specific checking mode can use a corresponding mode in the prior art.
The verification mode can be matched with the method for sending the ciphertext, so that the ciphertext can be prevented from being completely generated in the transmission process, the possibility of obtaining the complete ciphertext through cracking after being stolen is reduced, and the safety in the transmission process of the ciphertext is greatly improved.
In order to better describe the above embodiments, a specific embodiment is described below, for convenience of explanation, taking the example that a user inputs a PIN code in an upper computer, and a password plaintext is "123456", and a corresponding decomposition rule is set to a preset length of 2 for decomposition, then the password plaintext may be divided into 3 groups "12", "34", "56" in the receiving process, and the specific process is as follows:
step A, when the upper computer receives '12' input by a user, the '12' can be used as a group of partial password plaintext to be segmented;
b, the upper computer encrypts the '12' to generate an intermediate ciphertext;
step C, the upper computer sends the encrypted 12 to the checking equipment;
repeating the step A to the step C, and performing decomposition, encryption and sending operations on the received PIN; and the cipher plaintext is sent to the verification equipment in sequence according to the order of receiving the cipher plaintext.
Step D, after the checking equipment receives at least two intermediate ciphertexts, merging the two intermediate ciphertexts;
at this time, the verification device is preset, or the upper computer notifies the verification device of the intermediate ciphertexts transmitted in the sequential transmission order, and at this time, the merging operation is to decrypt the received '12', '34', '56' and then sequentially merge to generate the finally required ciphertexts '123456';
and E, the verification equipment verifies the ciphertext and feeds back a verification result to the upper computer.
Further, in this embodiment, after the intermediate ciphertext is sent once, the intermediate sensitive information stored in the cache before is cleared.
Further, in this embodiment, splitting may be performed after receiving all the PIN codes, for example, after receiving all the PIN codes "123456" input by the user, the PIN codes are decomposed into three groups of partial ciphertexts "12", "34" and "56", and the partial ciphertexts are encrypted and then sequentially sent to the verification device according to the decomposition order, or are sent to the verification device according to the random order. When the random sequence is used for transmission, the position identifiers of the partial passwords, such as the position identifier of "34" as "b", the position identifier of "56" as "c", and the position identifier of "12" as "a, are transmitted simultaneously, and after the verification equipment receives at least two intermediate ciphertexts, splicing can be performed according to the position identifiers.
Further, in this embodiment, after all the intermediate ciphertexts are generated, the intermediate ciphertexts may be transmitted in the sequential order or the random order of the generation.
The present application also provides an apparatus for transmitting a ciphertext, as shown in fig. 3, the apparatus including:
theencryption module 31 is configured to encrypt a part of the cipher plaintext to generate an intermediate ciphertext after receiving the part of the cipher plaintext conforming to the preset decomposition rule;
theverification module 32 is configured to send the intermediate ciphertext to the verification device, so that the verification device merges at least two received intermediate ciphertexts according to a preset merging rule, and verifies the merged ciphertext;
theoperation module 33 is configured to receive a verification result fed back by the verification device and execute a corresponding operation;
theverification module 32 is further configured to, each time an intermediate ciphertext is generated, send the intermediate ciphertext to the verification device; or after all the intermediate ciphertexts corresponding to the complete cipher plaintext are generated, all the intermediate ciphertexts are sent to the verification equipment according to the generation sequence or the random sequence.
The device also comprises a receivingmodule 34, which is used for receiving and decomposing the cipher plaintext according to the preset decomposition rule; presetting a decomposition rule, comprising any one of the following items:
when the cipher plaintext is a number, the number is decomposed into a plurality of groups according to a preset length, and each group is used as a partial cipher plaintext;
when the password plaintext is a graph, decomposing the graph into a plurality of partial graphs according to preset pixel blocks, wherein each partial graph is used as a partial password plaintext;
when the cipher plaintext is sound, the sound is decomposed into a plurality of sections of audio according to the preset time, and each section of audio is used as a partial cipher plaintext.
The device further comprises adecomposition module 35, which is used for decomposing the complete cipher plaintext according to a preset decomposition rule after receiving the complete cipher plaintext, so as to obtain a plurality of partial cipher plaintext.
The device for sending the ciphertext can execute the method for sending the ciphertext shown in the foregoing embodiments of the present application, and the implementation principles are similar, and are not described herein again.
The present application further provides a device for checking a ciphertext, as shown in fig. 4, the device includes:
the mergingmodule 41 is configured to, after receiving the at least two intermediate ciphertexts, merge the at least two intermediate ciphertexts according to a preset merging rule to obtain merged ciphertexts;
and thechecking module 42 is configured to check the combined ciphertext and feed back a checking result. The method comprises the following steps of merging at least two intermediate ciphertexts according to a preset merging rule, wherein the merging comprises any one of the following steps:
when the sequence of transmitting the intermediate ciphertexts is the sequential transmission sequence, sequentially combining at least two intermediate ciphertexts according to the received sequence;
when the sequence for sending the intermediate ciphertexts is determined to be a random sequence, merging at least two intermediate ciphertexts according to the position identification carried by the intermediate ciphertexts; the position identifier is used for identifying the position of the intermediate ciphertext in the ciphertext.
The device for checking a ciphertext of the present embodiment may execute the method for checking a ciphertext as described in the foregoing embodiments of the present application, and the implementation principles thereof are similar and will not be described herein again.
In an alternative embodiment, an electronic device is provided, as shown in fig. 5, theelectronic device 4000 shown in fig. 5 comprising: aprocessor 4001 and amemory 4003.Processor 4001 is coupled tomemory 4003, such as viabus 4002. Optionally, theelectronic device 4000 may further comprise atransceiver 4004. In addition, thetransceiver 4004 is not limited to one in practical applications, and the structure of theelectronic device 4000 is not limited to the embodiment of the present application.
TheProcessor 4001 may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. Theprocessor 4001 may also be a combination that performs a computational function, including, for example, a combination of one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Bus 4002 may include a path that carries information between the aforementioned components. Thebus 4002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. Thebus 4002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
TheMemory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical Disc storage, optical Disc storage (including Compact Disc, laser Disc, optical Disc, digital versatile Disc, blu-ray Disc, etc.), a magnetic Disc storage medium or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
Thememory 4003 is used for storing application codes for executing the scheme of the present application, and the execution is controlled by theprocessor 4001.Processor 4001 is configured to execute application code stored inmemory 4003 to implement what is shown in the foregoing method embodiments.
The electronic device may be configured to perform a method of transmitting a ciphertext or a method of checking a ciphertext as described above.
Among them, electronic devices include but are not limited to: mobile phones, computers, and other electronic devices.
The present application provides a computer-readable storage medium, on which a computer program is stored, which, when running on a computer, enables the computer to execute the corresponding content in the foregoing method embodiments. Compared with the prior art, the technical scheme provided by the embodiment of the application can decompose the password according to the preset decomposition rule when the user inputs the password, and the decomposition mode enables the password to exist in a plaintext form at the input moment, but only a part of the password is lost even if the password is stolen because the password is decomposed, and a stealing party cannot obtain related data according to the part of the password, so that the problem that the password exists in a complete plaintext form for a period of time when the user inputs the password in the prior art, and the complete plaintext password is stolen once the password is stolen can be avoided. And encrypting the partial cipher plaintext after the decomposition to generate an intermediate cipher text, and sending the intermediate cipher text to the verification equipment according to a preset mode, so that the decomposed ciphers are sent in the sending process, and the possibility of stealing the complete cipher is further prevented. And when the check equipment receives the intermediate ciphertext, decrypting and splicing the received ciphertext to finally obtain the complete password. The scheme can also operate any detachably transmitted passwords such as sound, graphics, gestures and the like.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.