CN111447059A - Ciphertext equivalence testing method, device, electronic equipment, storage medium and system - Google Patents

Ciphertext equivalence testing method, device, electronic equipment, storage medium and system Download PDF

Info

Publication number
CN111447059A
CN111447059A CN202010238607.9A CN202010238607A CN111447059A CN 111447059 A CN111447059 A CN 111447059A CN 202010238607 A CN202010238607 A CN 202010238607A CN 111447059 A CN111447059 A CN 111447059A
Authority
CN
China
Prior art keywords
ciphertext
segment
plaintext
integer
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010238607.9A
Other languages
Chinese (zh)
Other versions
CN111447059B (en
Inventor
朱慧君
闫小斌
刘平
王励成
闫青乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lhasa Koda Technology Co ltd
Original Assignee
Nanyang Institute of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanyang Institute of Technology filed Critical Nanyang Institute of Technology
Priority to CN202010238607.9A priority Critical patent/CN111447059B/en
Publication of CN111447059A publication Critical patent/CN111447059A/en
Application granted granted Critical
Publication of CN111447059B publication Critical patent/CN111447059B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/06Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols the encryption apparatus using shift registers or memories for block-wise or stream coding, e.g. DES systems or RC4; Hash functions; Pseudorandom sequence generators
    • H04L9/0618Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation
    • H04L9/0625Block ciphers, i.e. encrypting groups of characters of a plain text message using fixed encryption transformation with splitting of the data block into left and right halves, e.g. Feistel based algorithms, DES, FEAL, IDEA or KASUMI

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)

Abstract

The embodiment of the invention provides a ciphertext equivalence testing method, a device, electronic equipment, a storage medium and a system, wherein the method comprises the following steps: determining a test character string corresponding to the first ciphertext based on the second ciphertext segment, the fifth ciphertext segment and the test private key of the extracted first ciphertext; determining a test character string corresponding to the second ciphertext based on the second ciphertext segment, the fifth ciphertext segment and the test private key of the extracted second ciphertext; converting the test character string corresponding to the first ciphertext into a first coordinate point; converting the test character string corresponding to the second ciphertext into a second coordinate point; determining that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext when a first slope of a straight line formed by the first coordinate point and the origin of coordinates is the same as a second slope of a straight line formed by the second coordinate point and the origin of coordinates; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext. So as to determine whether the plaintext corresponding to the ciphertext is the same or not on the premise of not decrypting the ciphertext.

Description

Ciphertext equivalence testing method, device, electronic equipment, storage medium and system
Technical Field
The invention relates to the technical field of information processing, in particular to a ciphertext equivalence testing method, a ciphertext equivalence testing device, electronic equipment, a storage medium and a ciphertext equivalence testing system.
Background
Cryptography is increasingly used in modern life, for example, in information encryption in online payment systems, password login systems, and mobile phone communications. It can be seen that cryptography plays an important role in protecting data security. Cryptography is the science of the art of studying the formulation and decryption of passwords, including encryption and decryption. Generally, encryption and decryption correspond to each other.
Currently, common encryption techniques include symmetric encryption techniques and asymmetric encryption techniques. For example, the DES (data encryption Standard) encryption algorithm is a typical symmetric encryption technique, and the RSA encryption algorithm is a typical asymmetric encryption technique. Asymmetric encryption is that encryption and decryption use different keys, and usually there are two keys, called "public key" and "private key", which must be used in pair, otherwise the encrypted file cannot be opened.
However, the inventor finds that, after the plaintext is encrypted by using the RSA encryption algorithm in the prior art, if it is desired to know whether the plaintext corresponding to each of the two ciphertexts is the same, the two ciphertexts need to be decrypted by using the private key to obtain two plaintexts, and then it can be determined whether the two plaintexts are the same by comparing the two plaintexts.
Disclosure of Invention
The embodiment of the invention aims to provide a ciphertext equivalence testing method, a ciphertext equivalence testing device, electronic equipment, a storage medium and a ciphertext equivalence testing system, so that whether plaintexts corresponding to ciphertexts are the same or not can be determined on the premise that the ciphertexts are not decrypted. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a ciphertext equivalence testing method, where the method includes:
acquiring a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested and a test private key of the second ciphertext, wherein the ciphertext is obtained by encrypting a plaintext based on a point which is positioned on the same straight line in a preset rectangular coordinate system with the plaintext and a public key pair of the plaintext, and the straight line passes through an origin of coordinates of the preset rectangular coordinate system;
extracting a second cipher text segment and a fifth cipher text segment of the first cipher text from the first cipher text, and extracting a second cipher text segment and a fifth cipher text segment of the second cipher text from the second cipher text;
determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext;
determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext and a test private key corresponding to the second ciphertext;
converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system;
when a first slope of a straight line formed by the first coordinate point and the coordinate origin of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the coordinate origin of the preset coordinate system, determining that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
Optionally, the step of encrypting the plaintext to obtain the ciphertext based on a point on the same straight line as the plaintext in the preset rectangular coordinate system and a public key pair of the plaintext includes:
acquiring a plaintext to be encrypted and a public key pair used for encrypting the plaintext; wherein, the plaintext is a character string;
performing hash operation on the plaintext by adopting a first hash algorithm and a second hash algorithm which are determined in advance to obtain a first integer and a second integer corresponding to the plaintext;
taking the first integer and the second integer as a first coordinate point in a rectangular coordinate system, and determining a straight line where the coordinate point is located based on the first coordinate point and a coordinate origin in the rectangular coordinate system;
selecting a second coordinate point other than the first coordinate point in the straight line; splicing the two values in the second coordinate point to obtain a spliced character string;
acquiring a randomly selected third integer and a randomly selected fourth integer; encrypting the third integer by adopting a first public key in the public key pair to obtain a first encrypted text segment; encrypting the fourth integer by adopting a second public key in the public key pair to obtain a second ciphertext fragment;
converting the third integer into a random number by adopting a third Hash algorithm, and performing XOR operation on the plaintext by adopting the random number to obtain a third ciphertext fragment;
converting the plaintext and the third integer into a character string with a first preset length by adopting a fourth Hash algorithm to obtain a fourth ciphertext fragment;
converting a fourth integer, the first ciphertext segment, the second ciphertext segment, the third ciphertext segment and the fourth ciphertext segment into character strings with a second preset length by adopting a fifth hash algorithm, and performing exclusive or operation on the character strings with the second preset length and the spliced character strings to obtain a fifth ciphertext segment;
and obtaining a ciphertext corresponding to the plaintext based on the first ciphertext segment, the second ciphertext segment, the third ciphertext segment, the fourth ciphertext segment and the fifth ciphertext segment.
Optionally, the step of obtaining a public key pair used for encrypting plaintext includes:
selecting a first prime number pair and a second prime number pair in a preset prime number table, wherein the first prime number pair and the second prime number pair respectively comprise two prime numbers;
calculating a first product of two prime numbers in the first prime number pair and an Euler function value of the first product; calculating a second product of two prime numbers in the second prime number pair and an Euler function value of the second product;
selecting a fifth integer and a sixth integer from a preset integer table, wherein the fifth integer is greater than 1 and smaller than the Euler function value of the first product; and the greatest common divisor of the Euler function value of the fifth integer and the first product is 1; the sixth integer is greater than 1 and less than the Euler function value of the second product; and the greatest common divisor of the Euler function value of the sixth integer and the second product is 1;
the fifth integer and the sixth integer are used as a public key pair for encrypting plaintext.
Optionally, after the fifth integer and the sixth integer are used as a public key pair for encrypting plaintext, the method further includes:
calculating a first modulo element of the euler function value of the fifth integer with respect to the first product based on the euler function value of the fifth integer and the first product;
calculating a second modulo element of the euler function value of the sixth integer with respect to the second product based on the sixth integer and the euler function value of the second product;
and taking the first modular inverse element and the second modular inverse element as a private key pair corresponding to the public key, wherein the first modular inverse element is a decryption private key, and the second modular inverse element is a test private key.
Optionally, after determining that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext, the method further includes:
extracting a first ciphertext segment and a third ciphertext segment of the first ciphertext from the first ciphertext; decrypting the first ciphertext based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the first ciphertext;
or
Extracting a first ciphertext segment and a third ciphertext segment of a second ciphertext from the second ciphertext; and the second ciphertext is decrypted based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the second ciphertext.
Optionally, determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext, and the test private key corresponding to the first ciphertext, includes:
based on the first ciphertext C1Second ciphertext fragment C1,2And a first ciphertextCorresponding test private key d1,2By the following formula:
Figure BDA0002431827540000041
determining a test string x corresponding to the first ciphertext1||y1(ii) a Wherein, the symbol
Figure BDA0002431827540000042
Which represents an exclusive or operation, is performed,
Figure BDA0002431827540000043
representing the first ciphertext C by adopting a fifth Hash algorithm1First ciphertext segment C of1,1A second ciphertext segment C1,2The third ciphertext segment C1,3Fourth ciphertext segment C1,4And a first ciphertext C1Second ciphertext fragment C1,2D of1,2The power is converted into a character string with a second preset length;
determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext, and a private key corresponding to the second ciphertext, including:
based on the second ciphertext C2Second ciphertext fragment C2,2Test private key d corresponding to second ciphertext2,2By the following formula:
Figure BDA0002431827540000044
determining a test string x corresponding to the second ciphertext2||y2(ii) a Wherein the content of the first and second substances,
Figure BDA0002431827540000045
representing the second ciphertext C by adopting a fifth Hash algorithm2First ciphertext segment C of2,1A second ciphertext segment C2,2The third ciphertext segment C2,3Fourth ciphertext segment C2,4And a second ciphertext C2Second ciphertext fragment C2,2D of2,2To the power of the second predeterminedA string of length.
In a second aspect, an embodiment of the present invention further provides a ciphertext equivalence testing apparatus, where the apparatus includes:
the system comprises an acquisition module, a data processing module and a data processing module, wherein the acquisition module is used for acquiring a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested and a test private key of the second ciphertext, the ciphertext is obtained by encrypting a plaintext based on a point which is positioned on the same straight line in a preset rectangular coordinate system with the plaintext and a public key pair of the plaintext, and the straight line passes through the origin of coordinates of the preset rectangular coordinate system;
the extraction module is used for extracting a second ciphertext segment and a fifth ciphertext segment of the first ciphertext from the first ciphertext and extracting the second ciphertext segment and the fifth ciphertext segment of the second ciphertext from the second ciphertext;
the test character string determining module is used for determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext;
the test character string determining module is also used for determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext and a test private key corresponding to the second ciphertext;
the conversion module is used for converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system;
the comparison module is used for determining that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext when a first slope of a straight line formed by the first coordinate point and the origin of coordinates of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the origin of coordinates of the preset coordinate system; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
Optionally, the ciphertext equivalence testing apparatus further includes: a decryption module to: extracting a first ciphertext segment and a third ciphertext segment of the first ciphertext from the first ciphertext; decrypting the first ciphertext based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the first ciphertext;
or
Extracting a first ciphertext segment and a third ciphertext segment of a second ciphertext from the second ciphertext; and the second ciphertext is decrypted based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the second ciphertext.
Optionally, the test string determining module is specifically configured to: based on the first ciphertext C1Second ciphertext fragment C1,2Test private key d corresponding to first ciphertext1,2By the following formula:
Figure BDA0002431827540000051
determining a test string x corresponding to the first ciphertext1||y1(ii) a Wherein, the symbol
Figure BDA0002431827540000052
Which represents an exclusive or operation, is performed,
Figure BDA0002431827540000053
representing the first ciphertext C by adopting a fifth Hash algorithm1First ciphertext segment C of1,1A second ciphertext segment C1,2The third ciphertext segment C1,3Fourth ciphertext segment C1,4And a first ciphertext C1Second ciphertext fragment C1,2D of1,2The power is converted into a character string with a second preset length;
optionally, the test string determining module is further configured to: based on the second ciphertext C2Second ciphertext fragment C2,2Test private key d corresponding to second ciphertext2,2By the following formula:
Figure BDA0002431827540000054
determining a test string x corresponding to the second ciphertext2||y2(ii) a Wherein the content of the first and second substances,
Figure BDA0002431827540000055
representing the second ciphertext C by adopting a fifth Hash algorithm2First ciphertext segment C of2,1A second ciphertext segment C2,2The third ciphertext segment C2,3Fourth ciphertext segment C2,4And a second ciphertext C2Second ciphertext fragment C2,2D of2,2And the power is converted into a character string with a second preset length.
An embodiment of the present invention further provides an encryption apparatus, where the encryption apparatus includes:
the public key pair acquisition module is used for acquiring a plaintext to be encrypted and a public key pair used for encrypting the plaintext; wherein, the plaintext is a character string;
the integer acquisition module is used for carrying out hash operation on the plaintext by adopting a first hash algorithm and a second hash algorithm which are determined in advance to obtain a first integer and a second integer corresponding to the plaintext;
the straight line determining module is used for taking the first integer and the second integer as a first coordinate point in the rectangular coordinate system and determining a straight line where the coordinate point is located based on the first coordinate point and a coordinate origin in the rectangular coordinate system;
the splicing module is used for selecting second coordinate points except the first coordinate points in the straight line; splicing the two values in the second coordinate point to obtain a spliced character string;
the ciphertext section acquisition module is used for acquiring a randomly selected third integer and a randomly selected fourth integer; encrypting the third integer by adopting a first public key in the public key pair to obtain a first encrypted text segment; encrypting the fourth integer by adopting a second public key in the public key pair to obtain a second ciphertext fragment;
the ciphertext block obtaining module is further configured to convert the third integer into a random number by using a third hash algorithm, and perform an exclusive or operation on the plaintext by using the random number to obtain a third ciphertext block;
the ciphertext block acquiring module is further configured to convert the plaintext and the third integer into a character string with a first preset length by using a fourth hash algorithm to obtain a fourth ciphertext block;
the ciphertext section obtaining module is further configured to convert the fourth integer, the first ciphertext section, the second ciphertext section, the third ciphertext section and the fourth ciphertext section into a character string of a second preset length by using a fifth hash algorithm, and perform an exclusive or operation on the character string of the second preset length and the spliced character string to obtain a fifth ciphertext section;
and the ciphertext obtaining module is used for obtaining a ciphertext corresponding to the plaintext based on the first ciphertext segment, the second ciphertext segment, the third ciphertext segment, the fourth ciphertext segment and the fifth ciphertext segment.
An embodiment of the present invention further provides a key generation apparatus, where the key generation apparatus includes:
the prime number pair selection module is used for selecting a first prime number pair and a second prime number pair in a preset prime number table, wherein the first prime number pair and the second prime number pair respectively comprise two prime numbers;
the calculation module is used for calculating a first product of two prime numbers in the first prime number pair and an Euler function value of the first product; calculating a second product of two prime numbers in the second prime number pair and an Euler function value of the second product;
and the selecting module is used for selecting the fifth integer and the sixth integer in the preset integer table and taking the fifth integer and the sixth integer as a public key pair used for encrypting the plaintext. Wherein the fifth integer is greater than 1 and less than the Euler function value of the first product; and the greatest common divisor of the Euler function value of the fifth integer and the first product is 1; the sixth integer is greater than 1 and less than the Euler function value of the second product; and the greatest common divisor of the sixth integer and the euler function value of the second product is 1.
Optionally, the key generating apparatus further includes:
a modular inverse element calculation module for calculating a first modular inverse element of the euler function value of the fifth integer with respect to the first product based on the euler function value of the fifth integer and the first product; calculating a second modulo element of the euler function value of the sixth integer with respect to the second product based on the sixth integer and the euler function value of the second product;
and the private key pair obtaining module is used for taking the first modular inverse element and the second modular inverse element as a private key pair corresponding to the public key, wherein the first modular inverse element is a decryption private key, and the second modular inverse element is a test private key.
The embodiment of the invention also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing the steps of the ciphertext equivalence testing method in any embodiment when executing the program stored in the memory.
The embodiment of the invention also provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when being executed by a processor, the computer program realizes the steps of the ciphertext equivalence testing method in any embodiment.
Embodiments of the present invention further provide a computer program product including instructions, which when run on a computer, enable the computer to perform the steps of the ciphertext equivalence test method described in any of the above embodiments.
The embodiment of the invention also provides a ciphertext equivalence test system which at least comprises the ciphertext equivalence test device in any embodiment.
Optionally, the test system further includes: a key generation device and an encryption device;
optionally, the key generating device is configured to generate a public key pair and a private key pair, where the private key pair includes a test private key and a decryption private key;
optionally, the encryption device is configured to perform hash operation on the plaintext by using a predetermined first hash algorithm and a predetermined second hash algorithm after obtaining the plaintext to be encrypted and a public key pair used for encrypting the plaintext, so as to obtain a first integer and a second integer corresponding to the plaintext;
the encryption device is also used for taking the first integer and the second integer as a first coordinate point in the rectangular coordinate system and determining a straight line where the coordinate point is located based on the first coordinate point and a coordinate origin in the rectangular coordinate system;
encryption means for selecting a second coordinate point other than the first coordinate point in the straight line; splicing the two values in the second coordinate point to obtain a spliced character string;
the encryption device is also used for acquiring a third integer and a fourth integer which are randomly selected; encrypting the third integer by adopting a first public key in the public key pair to obtain a first encrypted text segment; encrypting the fourth integer by adopting a second public key in the public key pair to obtain a second ciphertext fragment;
the encryption device is also used for converting the third integer into a random number by adopting a third Hash algorithm, and carrying out XOR operation on the plaintext by adopting the random number to obtain a third ciphertext fragment;
the encryption device is also used for converting the plaintext and the third integer into a character string with a first preset length by adopting a fourth Hash algorithm to obtain a fourth ciphertext fragment;
the encryption device is further used for converting a fourth integer, the first ciphertext segment, the second ciphertext segment, the third ciphertext segment and the fourth ciphertext segment into character strings with a second preset length by adopting a fifth hash algorithm, and performing exclusive-or operation on the character strings with the second preset length and the spliced character strings to obtain a fifth ciphertext segment;
and the encryption device is also used for obtaining the ciphertext corresponding to the plaintext based on the first ciphertext segment, the second ciphertext segment, the third ciphertext segment, the fourth ciphertext segment and the fifth ciphertext segment.
Optionally, the key generation apparatus is specifically configured to select a first prime number pair and a second prime number pair in a preset prime number table, where the first prime number pair and the second prime number pair respectively include two prime numbers;
key generating means for calculating a first product of two prime numbers in the first prime number pair and an euler function value of the first product; calculating a second product of two prime numbers in the second prime number pair and an Euler function value of the second product;
and the key generation device is also used for selecting a fifth integer and a sixth integer in the preset integer table and using the fifth integer and the sixth integer as a public key pair used for encrypting the plaintext. Wherein the fifth integer is greater than 1 and less than the Euler function value of the first product; and the greatest common divisor of the Euler function value of the fifth integer and the first product is 1; the sixth integer is greater than 1 and less than the Euler function value of the second product; and the greatest common divisor of the sixth integer and the euler function value of the second product is 1.
Key generating means for calculating a first modulo element of the euler function value of the fifth integer with respect to the first product based on the euler function value of the fifth integer and the first product; calculating a second modulo element of the euler function value of the sixth integer with respect to the second product based on the sixth integer and the euler function value of the second product;
and the key generation device is further configured to use the first modular inverse element and the second modular inverse element as a private key pair corresponding to the public key, where the first modular inverse element is a decryption private key, and the second modular inverse element is a test private key.
The embodiment of the invention has the following beneficial effects:
according to the ciphertext equivalence testing method, the device, the electronic equipment, the storage medium and the system, after a first ciphertext to be tested, a testing private key of the first ciphertext, a second ciphertext to be tested and a testing private key of the second ciphertext are obtained, a second ciphertext segment and a fifth ciphertext segment of the first ciphertext are extracted from the first ciphertext, and a second ciphertext segment and a fifth ciphertext segment of the second ciphertext are extracted from the second ciphertext; then determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext; determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext and a test private key corresponding to the second ciphertext; converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system; finally, when a first slope of a straight line formed by the first coordinate point and the coordinate origin of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the coordinate origin of the preset coordinate system, determining that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext. The first ciphertext and the second ciphertext are obtained by encrypting the corresponding plaintexts respectively based on a point which is positioned on the same straight line in the preset rectangular coordinate system with the corresponding plaintexts and a public key pair of the corresponding plaintexts respectively, and the straight line passes through the origin of coordinates of the preset rectangular coordinate system; therefore, when the first slope is the same as the second slope, it can be said that the straight line formed by the plaintext corresponding to the first ciphertext and the straight line formed by the plaintext corresponding to the second ciphertext are the same straight line; thus, it can be determined that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext. Therefore, whether the plaintext corresponding to the ciphertext is the same or not can be determined on the premise of not decrypting the ciphertext. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a ciphertext equivalence testing method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart illustrating encryption of a plaintext in a ciphertext equivalence test method according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of generating a public key pair in a ciphertext equivalence testing method according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a ciphertext equivalence testing apparatus according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of an encryption apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a key generation apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a ciphertext equivalence testing system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve the problems in the prior art, embodiments of the present invention provide a ciphertext equivalence testing method, apparatus, electronic device, storage medium, and system, so as to determine whether plaintext corresponding to a ciphertext is the same without decrypting the ciphertext.
First, a ciphertext equivalence test method according to an embodiment of the present invention is described below, as shown in fig. 1, which is a flowchart of a ciphertext equivalence test method according to an embodiment of the present invention, where the method may include:
s110, a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested and a test private key of the second ciphertext are obtained.
The ciphertext is obtained by encrypting the plaintext based on a point which is on the same straight line with the plaintext in a preset rectangular coordinate system and a public key pair of the plaintext, and the straight line penetrates through the origin of coordinates of the preset rectangular coordinate system;
in some examples, the first ciphertext may be obtained by encrypting the plaintext corresponding to the first ciphertext by using a point on a straight line formed by the plaintext corresponding to the first ciphertext and a public key pair of the plaintext corresponding to the first ciphertext. The second ciphertext may be obtained by encrypting the plaintext corresponding to the second ciphertext by using a point on a straight line formed by the plaintext corresponding to the second ciphertext and a public key pair of the plaintext corresponding to the second ciphertext.
And S120, extracting the second cipher text segment and the fifth cipher text segment of the first cipher text from the first cipher text, and extracting the second cipher text segment and the fifth cipher text segment of the second cipher text from the second cipher text.
In some examples, after obtaining the first ciphertext, the test private key of the first ciphertext, the second ciphertext, and the test private key of the second ciphertext, in order to determine whether the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext, the second ciphertext fragment and the fifth ciphertext fragment of the first ciphertext may be extracted from the first ciphertext, and the second ciphertext fragment and the fifth ciphertext fragment of the second ciphertext may be extracted from the second ciphertext.
In some examples, the second ciphertext segment of the first ciphertext may be encrypted using the public key of the plaintext corresponding to the first ciphertext, and the fifth ciphertext segment of the first ciphertext may be encrypted using a point on a straight line formed by the plaintext corresponding to the first ciphertext.
Similarly, the second ciphertext segment of the second ciphertext may be obtained by encrypting using the public key of the plaintext corresponding to the second ciphertext, and the fifth ciphertext segment of the second ciphertext may be obtained by encrypting using a point on a straight line formed by the plaintext corresponding to the second ciphertext.
Therefore, in order to determine whether the plaintext corresponding to the first ciphertext and the plaintext corresponding to the second ciphertext are the same, the second ciphertext fragment and the fifth ciphertext fragment of the first ciphertext may be extracted, and the second ciphertext fragment and the fifth ciphertext fragment of the second ciphertext may be extracted.
S130, determining a test character string corresponding to the first ciphertext according to the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and the test private key corresponding to the first ciphertext.
S140, determining a test character string corresponding to the second ciphertext according to the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext and the test private key corresponding to the second ciphertext.
S150, converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; and converting the test character string corresponding to the second ciphertext into a second coordinate point in the preset coordinate system.
After the second ciphertext segment and the fifth ciphertext segment of the first ciphertext are extracted, the test character string corresponding to the first ciphertext may be determined based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext, and the test private key corresponding to the first ciphertext.
After the second ciphertext segment and the fifth ciphertext segment of the second ciphertext are extracted, the test character string corresponding to the second ciphertext may be determined based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext, and the test private key corresponding to the second ciphertext.
In some examples, the test string corresponding to the first ciphertext may be determined based on the first ciphertext C when determining the test string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext, and the test private key corresponding to the first ciphertext1Second ciphertext fragment C1,2Test private key d corresponding to first ciphertext1,2By the following formula:
Figure BDA0002431827540000121
determining a test string x corresponding to the first ciphertext1||y1(ii) a Wherein, the symbol
Figure BDA0002431827540000122
Which represents an exclusive or operation, is performed,
Figure BDA0002431827540000123
representing the first ciphertext C by adopting a fifth Hash algorithm1First ciphertext segment C of1,1A second ciphertext segment C1,2The third ciphertext segment C1,3Fourth ciphertext segment C1,4And a first ciphertext C1Second ciphertext fragment C1,2D of1,2The power is converted into a character string with a second preset length;
in some examples, the test string corresponding to the second ciphertext may be determined based on the second ciphertext C when determining the test string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext, and the private key corresponding to the second ciphertext2Second ciphertext fragment C2,2Test private key d corresponding to second ciphertext2,2By the following formula:
Figure BDA0002431827540000124
determining a test string x corresponding to the second ciphertext2||y2(ii) a Wherein the content of the first and second substances,
Figure BDA0002431827540000125
representing the second ciphertext C by adopting a fifth Hash algorithm2First ciphertext segment C of2,1A second ciphertext segment C2,2The third ciphertext segment C2,3Fourth ciphertext segment C2,4And a second ciphertext C2Second ciphertext fragment C2,2D of2,2And the power is converted into a character string with a second preset length.
In still other examples, the first ciphertext and the second ciphertext are both strings.
In still other examples, the fifth hashing algorithm may be expressed as: h5:{0,1}5k→{0,1}2lWhere k denotes a security parameter and l denotes a length, i.e., the fifth hashing algorithm denotes converting a 5 k-length string containing 0 and 1 into a 2 l-length string.
Respectively obtaining test character strings x corresponding to the first ciphertext1||y1Test string x corresponding to second ciphertext2||y2Then, the test character string x corresponding to the first ciphertext can be used1||y1Converting the first coordinate point into a first coordinate point in a preset coordinate system, and testing the character string x corresponding to the second ciphertext2||y2Converting into a second coordinate point in a preset coordinate system;
in some examples, x in the first coordinate point1And y1Test character string x corresponding to the first cipher text1||y1The length of the first ciphertext is the same, so the test character string x corresponding to the first ciphertext is used as the first ciphertext1||y1Splitting the coordinate into two parts to obtain a first coordinate point (x)1,y1). TheWhen encrypting the plaintext corresponding to the first ciphertext, the first coordinate point is a point on the same straight line in a preset rectangular coordinate system of the plaintext corresponding to the first ciphertext; that is, the first coordinate point is a coordinate point used when encrypting the plaintext corresponding to the first ciphertext.
Likewise, x in the second coordinate point2And y2Test character string x corresponding to the second cipher text2||y2The length of the second ciphertext is the same, so the test string x corresponding to the second ciphertext is used as the test string2||y2Splitting into two parts to obtain a second coordinate point (x)2,y2) And the second coordinate point is a coordinate point used when encrypting the plaintext corresponding to the second ciphertext.
It is understood that step S130 and step S140 may be executed simultaneously or sequentially, which is all possible.
S160, judging whether a first slope of a straight line formed by the first coordinate point and the coordinate origin of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the coordinate origin of the preset coordinate system, if so, executing the step S170, otherwise, executing the step S180;
s170, determining that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext;
s180, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
The ciphertext is obtained by encrypting the plaintext based on a point which is on the same straight line with the plaintext in a preset rectangular coordinate system and a public key pair of the plaintext, and the straight line penetrates through the origin of coordinates of the preset rectangular coordinate system;
therefore, if the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext, the points used in encrypting the plaintext are necessarily on the same straight line, and the straight line passes through the origin of coordinates of the preset rectangular coordinate system; therefore, when the first slope corresponding to the first coordinate point is the same as the second slope corresponding to the second coordinate point, it can be said that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext.
Therefore, a first coordinate point (x) corresponding to the first ciphertext is obtained1,y1) A second coordinate point (x) corresponding to the second ciphertext2,y2) Then, a first slope of a straight line formed by the first coordinate point and the origin of coordinates of the preset coordinate system can be calculated, then a second slope of a straight line formed by the second coordinate point and the origin of coordinates of the preset coordinate system can be calculated, and finally whether the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext can be determined by judging whether the first slope and the second slope are the same.
According to the ciphertext equivalence test method provided by the embodiment of the invention, after a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested and a test private key of the second ciphertext are obtained, a second ciphertext segment and a fifth ciphertext segment of the first ciphertext are extracted from the first ciphertext, and a second ciphertext segment and a fifth ciphertext segment of the second ciphertext are extracted from the second ciphertext; then determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext; determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext and a test private key corresponding to the second ciphertext; converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system; finally, when a first slope of a straight line formed by the first coordinate point and the coordinate origin of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the coordinate origin of the preset coordinate system, determining that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext. The first ciphertext and the second ciphertext are obtained by encrypting the corresponding plaintexts respectively based on a point which is positioned on the same straight line in the preset rectangular coordinate system with the corresponding plaintexts and a public key pair of the corresponding plaintexts respectively, and the straight line passes through the origin of coordinates of the preset rectangular coordinate system; therefore, when the first slope is the same as the second slope, it can be said that the straight line formed by the plaintext corresponding to the first ciphertext and the straight line formed by the plaintext corresponding to the second ciphertext are the same straight line; thus, it can be determined that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext. Therefore, whether the plaintext corresponding to the ciphertext is the same or not can be determined on the premise of not decrypting the ciphertext.
In some examples, when a plaintext is encrypted to obtain a ciphertext based on a point on the same straight line with the plaintext in a preset rectangular coordinate system and a public key pair of the plaintext, as shown in fig. 2, a possible implementation manner is provided in an embodiment of the present invention, which is a schematic flow diagram of encrypting the plaintext in a ciphertext equivalence test method in an embodiment of the present invention, and the encryption flow may be applied to encrypt the plaintext corresponding to a first ciphertext and may also be applied to encrypt the plaintext corresponding to a second ciphertext. Referring to fig. 2, the method may include:
s210, acquiring a plaintext to be encrypted and a public key pair used for encrypting the plaintext; wherein, the plaintext is a character string;
s220, carrying out hash operation on the plaintext by adopting a first hash algorithm and a second hash algorithm which are predetermined to obtain a first integer and a second integer corresponding to the plaintext;
wherein the first hash algorithm and the second hash algorithm are used for converting the character string into an integer. In some examples, the first and second hashing algorithms may be expressed as: h1,H2:{0,1}k→ Z, i.e. converting a string of length k containing 0 and 1 to an integer Z.
S230, taking the first integer and the second integer as a first coordinate point in the rectangular coordinate system, and determining a straight line where the coordinate point is located based on the first coordinate point and a coordinate origin in the rectangular coordinate system;
for example, assuming that the plaintext to be encrypted is M, a first hash algorithm may be used to perform a hash operation on the plaintext M to obtain a first integer H corresponding to the plaintext M1(M), carrying out Hash operation on the plaintext M by adopting a second Hash algorithm to obtain a second integer H corresponding to the plaintext M2(M),Further, the first coordinate point p can be obtained1=(H1(M),H2(M))。
After the first coordinate point is obtained, a straight line where the first coordinate point is located may be obtained based on the first coordinate point and the origin of coordinates in the rectangular coordinate system, where the equation of the straight line is
Figure BDA0002431827540000151
S240, selecting a second coordinate point except the first coordinate point in the straight line; splicing the two values in the second coordinate point to obtain a spliced character string;
after obtaining the straight line where the first coordinate point is located, a coordinate point other than the first coordinate point may be selected as the second coordinate point on the straight line. Thus, the second coordinate point and the first coordinate point can be aligned. For example, assume that the selected second coordinate point is (x)1,y1) Then, the two values in the second coordinate point may be spliced, so that the spliced character string x may be obtained1||y1
S250, acquiring a randomly selected third integer and a randomly selected fourth integer; encrypting the third integer by adopting a first public key in the public key pair to obtain a first encrypted text segment; encrypting the fourth integer by adopting a second public key in the public key pair to obtain a second ciphertext fragment;
in some examples, let the third integer be r1The fourth integer is r2The first public key of the public key pair is e1The second public key is e2(ii) a The first public key e of the public key pair may be used1By the following formula
Figure BDA0002431827540000152
For the third integer r1Encrypting to obtain a first encrypted text segment C1(ii) a Using the second public key e of the public key pair2By the following formula
Figure BDA0002431827540000153
For the fourth integer r2Encrypting to obtain a second encrypted text segment C2
S260, converting the third integer into a random number by adopting a third Hash algorithm, and performing XOR operation on the plaintext by adopting the random number to obtain a third ciphertext fragment;
in some examples, the data may be represented by the formula:
Figure BDA0002431827540000154
obtaining a third ciphertext segment C3(ii) a Wherein M is a plaintext, H3(r1) For using a third hash algorithm to convert the third integer r1And converted into a random number.
In still other examples, the third hashing algorithm may be expressed as: h3:{0,1}k→{0,1}kThat is, a character string of length k containing 0 and 1 is converted into a random number of length k.
S270, converting the plaintext and the third integer into a character string with a first preset length by adopting a fourth Hash algorithm to obtain a fourth ciphertext fragment;
in some examples, this may be by formula C4=H4(M,r1) Obtaining the fourth ciphertext segment C4Wherein H is4(M,r1) Representing the plaintext M and the third integer r by using a fourth hashing algorithm1And converting the character string into a character string with a first preset length. In still other examples, the fourth hashing algorithm may be expressed as: h4:{0,1}2k→{0,1}kThat is, a 2 k-length string containing 0 and 1 is converted into a k-length string.
S280, converting a fourth integer, the first ciphertext segment, the second ciphertext segment, the third ciphertext segment and the fourth ciphertext segment into character strings with a second preset length by adopting a fifth Hash algorithm, and performing XOR operation on the character strings with the second preset length and the spliced character strings to obtain a fifth ciphertext segment;
in some examples, r may be according to a fourth integer2First ciphertext segment C1A second ciphertext segment C2The third ciphertext segment C3Fourth ciphertext segment C4And the spliced characterString x1||y1By the following formula:
Figure BDA0002431827540000161
obtaining the fifth ciphertext segment C5. Wherein H5(r2,C1,C2,C3,C4) Indicating that the fourth integer r is hashed using the fifth hash algorithm2First ciphertext segment C1A second ciphertext segment C2The third ciphertext segment C3Fourth ciphertext segment C4And converting the character string into a character string with a second preset length.
And S290, obtaining a ciphertext corresponding to the plaintext based on the first ciphertext fragment, the second ciphertext fragment, the third ciphertext fragment, the fourth ciphertext fragment and the fifth ciphertext fragment.
After the five cipher text segments are obtained, the first cipher text segment, the second cipher text segment, the third cipher text segment, the fourth cipher text segment and the fifth cipher text segment are spliced to obtain the cipher text corresponding to the plaintext, so that the plaintext can be encrypted.
By the encryption mode of the embodiment of the invention, the ciphertext can have the point on the straight line where the corresponding plaintext is located, and further whether the plaintext corresponding to the two ciphertexts is the same can be determined by judging the point in the two ciphertexts.
In still other examples, when the first ciphertext and the second ciphertext are obtained, a ciphertext segment included in the first ciphertext and a ciphertext segment included in the second ciphertext may also be obtained; thus, it can be determined which ciphertext fragments are included in the first ciphertext and which ciphertext fragments are included in the second ciphertext.
In some examples, after determining that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext, the first ciphertext or the second ciphertext may be decrypted. Since the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext, any one of the two ciphertexts can be decrypted. For example: decrypting the first ciphertext, for example: and decrypting the second ciphertext.
In some examples, when decrypting the first ciphertext, a first ciphertext segment and a third ciphertext segment of the first ciphertext may be extracted from the first ciphertext; decrypting the first ciphertext based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the first ciphertext;
in still other examples, the first and third cryptographic segments of the second ciphertext may be extracted from the second ciphertext when decrypting the second ciphertext; and the second ciphertext is decrypted based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the second ciphertext.
For example, assume that the ciphertext is CT ═ (C)1,C2,C3,C4,C5) The decryption private key is d1Then, by the formula:
Figure BDA0002431827540000171
and obtaining a plaintext corresponding to the ciphertext, thereby realizing decryption of the ciphertext.
Wherein the content of the first and second substances,
Figure BDA0002431827540000172
the first ciphertext segment C representing the ciphertext CT using the third Hash algorithm1D of1The power is converted into a random number.
In some examples, when obtaining a public key pair used for encrypting a plaintext, an embodiment of the present invention further provides a possible implementation manner, as shown in fig. 3, a flow diagram of generating the public key pair in a ciphertext equivalence testing method according to an embodiment of the present invention, where the method may include:
s310, selecting a first prime number pair and a second prime number pair in a preset prime number table;
s320, calculating a first product of two prime numbers in the first prime number pair and an Euler function value of the first product; calculating a second product of two prime numbers in the second prime number pair and an Euler function value of the second product;
s330, selecting a fifth integer and a sixth integer from a preset integer table, wherein the fifth integer is larger than 1 and smaller than the Euler function value of the first product; and the greatest common divisor of the Euler function value of the fifth integer and the first product is 1; the sixth integer is greater than 1 and less than the Euler function value of the second product; and the greatest common divisor of the Euler function value of the sixth integer and the second product is 1;
s340, using the fifth integer and the sixth integer as a public key pair for encrypting plaintext.
For example, assume that the first prime number pair selected in the preset prime number table is: p is a radical of1,q1The second prime number pair is p2,q2Then, the following formula can be used:
N1=p1q1,φ(N1)=(p1-1)(q1-1)
calculating a first prime number pair p1,q1Of two prime numbers N1And a first product N1Euler function value of
Figure BDA0002431827540000173
By the following formula:
N2=p2q2,φ(N2)=(p2-1)(q2-1)
calculating a second prime number pair p2,q2A second product N of two prime numbers in2And a second product N2Euler function value of
Figure BDA0002431827540000174
Then, a fifth integer and a sixth integer satisfying a condition may be respectively selected based on the euler function value of the first product and the euler function value of the second product. And finally, taking the selected fifth integer and the selected sixth integer which meet the conditions as a public key pair used for encrypting the plaintext.
In some examples, after the fifth and sixth integers are taken as the public key pair used to encrypt the plaintext, the private key pair corresponding to the public key pair may also be determined.
In some examples, a first modulo element of the euler function value of the fifth integer for the first product may be calculated based on the euler function value of the fifth integer, the first product; calculating a second modulo element of the euler function value of the sixth integer with respect to the second product based on the sixth integer and the euler function value of the second product; and taking the first modular inverse element and the second modular inverse element as a private key pair corresponding to the public key, wherein the first modular inverse element is a decryption private key, and the second modular inverse element is a test private key.
In still other examples, the fifth integer e may be based on1The Euler function value phi (N) of the first product1) By the formula:
Figure BDA0002431827540000181
calculating a first modulo element d of the Euler function value of the fifth integer for the first product1
May be based on a sixth integer e2The Euler function value of the first product
Figure BDA0002431827540000182
By the formula:
Figure BDA0002431827540000183
calculating a second modulo element d of the Euler function value of the sixth integer for the second product2
Further, the first modulo element d can be used1And a second modulo element d2As a private key pair corresponding to the public key, wherein the first modulo element is the decryption private key d1Second modulo element d2To test the private key.
The embodiment of the invention generates the decryption private key and the test private key, so that different private keys can be used for testing and decryption respectively, and the ciphertext cannot be decrypted in the testing process, thereby improving the security of the ciphertext.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a ciphertext equivalence testing apparatus, as shown in fig. 4, which is a schematic structural diagram of the ciphertext equivalence testing apparatus according to the embodiment of the present invention, and the apparatus may include:
the obtaining module 410 is configured to obtain a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested, and a test private key of the second ciphertext, where the ciphertext is obtained by encrypting a plaintext based on a point that is on the same straight line as the plaintext in a preset rectangular coordinate system and a public key pair of the plaintext, and the straight line passes through an origin of coordinates of the preset rectangular coordinate system;
the extracting module 420 is configured to extract the second ciphertext segment and the fifth ciphertext segment of the first ciphertext from the first ciphertext, and extract the second ciphertext segment and the fifth ciphertext segment of the second ciphertext from the second ciphertext;
the test character string determining module 430 is configured to determine a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext, and the test private key corresponding to the first ciphertext;
the test character string determining module 430 is further configured to determine a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext, and the test private key corresponding to the second ciphertext;
the conversion module 440 is configured to convert the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system;
the comparison module 450 is configured to determine that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext when a first slope of a straight line formed by the first coordinate point and the origin of coordinates of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the origin of coordinates of the preset coordinate system; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
According to the ciphertext equivalence testing device provided by the embodiment of the invention, after a first ciphertext to be tested, a testing private key of the first ciphertext, a second ciphertext to be tested and a testing private key of the second ciphertext are obtained, a second ciphertext segment and a fifth ciphertext segment of the first ciphertext are extracted from the first ciphertext, and a second ciphertext segment and a fifth ciphertext segment of the second ciphertext are extracted from the second ciphertext; then determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext; determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext and a test private key corresponding to the second ciphertext; converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system; finally, when a first slope of a straight line formed by the first coordinate point and the coordinate origin of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the coordinate origin of the preset coordinate system, determining that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext. The first ciphertext and the second ciphertext are obtained by encrypting the corresponding plaintexts respectively based on a point which is positioned on the same straight line in the preset rectangular coordinate system with the corresponding plaintexts and a public key pair of the corresponding plaintexts respectively, and the straight line passes through the origin of coordinates of the preset rectangular coordinate system; therefore, when the first slope is the same as the second slope, it can be said that the straight line formed by the plaintext corresponding to the first ciphertext and the straight line formed by the plaintext corresponding to the second ciphertext are the same straight line; thus, it can be determined that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext. Therefore, whether the plaintext corresponding to the ciphertext is the same or not can be determined on the premise of not decrypting the ciphertext.
In some examples, the ciphertext equivalence test apparatus further comprises: a decryption module to: extracting a first ciphertext segment and a third ciphertext segment of the first ciphertext from the first ciphertext; decrypting the first ciphertext based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the first ciphertext;
or
Extracting a first ciphertext segment and a third ciphertext segment of a second ciphertext from the second ciphertext; and the second ciphertext is decrypted based on the first ciphertext segment, the third ciphertext segment and a decryption private key of the second ciphertext.
In some examples, the test string determining module 430 is specifically configured to: based on the first ciphertext C1Second ciphertext fragment C1,2Test private key d corresponding to first ciphertext1,2By the following formula:
Figure BDA0002431827540000201
determining a test string x corresponding to the first ciphertext1||y1(ii) a Wherein, the symbol
Figure BDA0002431827540000202
Which represents an exclusive or operation, is performed,
Figure BDA0002431827540000203
representing the first ciphertext C by adopting a fifth Hash algorithm1First ciphertext segment C of1,1A second ciphertext segment C1,2The third ciphertext segment C1,3Fourth ciphertext segment C1,4And a first ciphertext C1Second ciphertext fragment C1,2D of1,2The power is converted into a character string with a second preset length;
in some examples, the test string determination module 430 is further to: based on the second ciphertext C2Second ciphertext fragment C2,2Test private key d corresponding to second ciphertext2,2By the following formula:
Figure BDA0002431827540000204
determining a test string x corresponding to the second ciphertext2||y2(ii) a Wherein the content of the first and second substances,
Figure BDA0002431827540000205
representing the second ciphertext C by adopting a fifth Hash algorithm2First ciphertext segment C of2,1A second ciphertext segment C2,2The third ciphertext segment C2,3Fourth ciphertext segment C2,4And a second ciphertext C2Second ciphertext fragment C2,2D of2,2And the power is converted into a character string with a second preset length.
On the basis of the ciphertext equivalence testing apparatus shown in fig. 4, an embodiment of the present invention further provides a structural schematic diagram of an encryption apparatus, as shown in fig. 5, the encryption apparatus may include:
a public key pair obtaining module 510, configured to obtain a plaintext to be encrypted and a public key pair used for encrypting the plaintext; wherein, the plaintext is a character string;
an integer obtaining module 520, configured to perform hash operation on a plaintext by using a predetermined first hash algorithm and a predetermined second hash algorithm, so as to obtain a first integer and a second integer corresponding to the plaintext;
a straight line determining module 530, configured to use the first integer and the second integer as a first coordinate point in the rectangular coordinate system, and determine a straight line where the coordinate point is located based on the first coordinate point and a coordinate origin in the rectangular coordinate system;
a stitching module 540, configured to select a second coordinate point other than the first coordinate point in the straight line; splicing the two values in the second coordinate point to obtain a spliced character string;
a ciphertext fragment obtaining module 550, configured to obtain a third integer and a fourth integer that are randomly selected; encrypting the third integer by adopting a first public key in the public key pair to obtain a first encrypted text segment; encrypting the fourth integer by adopting a second public key in the public key pair to obtain a second ciphertext fragment;
the encrypted text segment obtaining module 550 is further configured to convert the third integer into a random number by using a third hash algorithm, and perform an exclusive or operation on the plaintext by using the random number to obtain a third encrypted text segment;
the encrypted text segment obtaining module 550 is further configured to convert the plaintext and the third integer into a character string with a first preset length by using a fourth hash algorithm, so as to obtain a fourth encrypted text segment;
the encrypted text segment obtaining module 550 is further configured to convert the fourth integer, the first encrypted text segment, the second encrypted text segment, the third encrypted text segment and the fourth encrypted text segment into a character string with a second preset length by using a fifth hash algorithm, and perform an exclusive or operation on the character string with the second preset length and the spliced character string to obtain a fifth encrypted text segment;
the ciphertext obtaining module 560 is configured to obtain a ciphertext corresponding to the plaintext based on the first ciphertext fragment, the second ciphertext fragment, the third ciphertext fragment, the fourth ciphertext fragment, and the fifth ciphertext fragment.
The encryption device according to the embodiment of the present invention encrypts the plaintext by using the point and the public key pair on the same straight line in the predetermined rectangular coordinate system as the plaintext, and the straight line passes through the origin of coordinates of the predetermined rectangular coordinate system, so that the encrypted ciphertext has the characteristics of the straight line, such as the slope of the straight line. Therefore, when the encrypted ciphertext is tested, whether the plaintexts corresponding to the two ciphertexts are the same or not is determined by analyzing whether the characteristics of the two ciphertexts are the same or not, and whether the plaintexts corresponding to the ciphertexts are the same or not can be determined on the premise of not decrypting the ciphertext.
On the basis of the encryption apparatus shown in fig. 5, an embodiment of the present invention further provides a schematic structural diagram of a key generation apparatus, as shown in fig. 6, the key generation apparatus may include:
a prime number pair selection module 610, configured to select a first prime number pair and a second prime number pair in a preset prime number table, where the first prime number pair and the second prime number pair respectively include two prime numbers;
a calculating module 620, configured to calculate a first product of two prime numbers in the first prime number pair and an euler function value of the first product; calculating a second product of two prime numbers in the second prime number pair and an Euler function value of the second product;
a selecting module 630, configured to select the fifth integer and the sixth integer in the preset integer table, and use the fifth integer and the sixth integer as a public key pair used for encrypting plaintext. Wherein the fifth integer is greater than 1 and less than the Euler function value of the first product; and the greatest common divisor of the Euler function value of the fifth integer and the first product is 1; the sixth integer is greater than 1 and less than the Euler function value of the second product; and the greatest common divisor of the sixth integer and the euler function value of the second product is 1.
In some examples, the key generation apparatus may further include:
a modular inverse element calculation module for calculating a first modular inverse element of the euler function value of the fifth integer with respect to the first product based on the euler function value of the fifth integer and the first product; calculating a second modulo element of the euler function value of the sixth integer with respect to the second product based on the sixth integer and the euler function value of the second product;
and the private key pair obtaining module is used for taking the first modular inverse element and the second modular inverse element as a private key pair corresponding to the public key, wherein the first modular inverse element is a decryption private key, and the second modular inverse element is a test private key.
The embodiment of the invention generates the decryption private key and the test private key, so that different private keys can be used for testing and decryption respectively, and the ciphertext cannot be decrypted in the testing process, thereby improving the security of the ciphertext.
An embodiment of the present invention further provides an electronic device, as shown in fig. 7, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the following steps when executing the program stored in the memory 703:
acquiring a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested and a test private key of the second ciphertext, wherein the ciphertext is obtained by encrypting a plaintext based on a point which is positioned on the same straight line in a preset rectangular coordinate system with the plaintext and a public key pair of the plaintext, and the straight line passes through an origin of coordinates of the preset rectangular coordinate system;
extracting a second cipher text segment and a fifth cipher text segment of the first cipher text from the first cipher text, and extracting a second cipher text segment and a fifth cipher text segment of the second cipher text from the second cipher text;
determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext;
determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext and a test private key corresponding to the second ciphertext;
converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system;
when a first slope of a straight line formed by the first coordinate point and the coordinate origin of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the coordinate origin of the preset coordinate system, determining that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and when being executed by a processor, the computer program implements the steps of the ciphertext equivalence testing method according to any one of the above embodiments.
In a further embodiment of the present invention, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of the ciphertext equivalence test method as described in any of the above embodiments.
The embodiment of the present invention further provides a ciphertext equivalence test system, as shown in fig. 8, the test system includes: a key generation device 810, an encryption device 820, and a ciphertext equivalence test device 830;
a key generation device 810, configured to generate a public key pair and a private key pair, where the private key pair includes a test private key and a decryption private key;
the encryption device 820 is configured to perform hash operation on a plaintext by using a first hash algorithm and a second hash algorithm determined in advance after acquiring the plaintext to be encrypted and a public key pair used for encrypting the plaintext, so as to obtain a first integer and a second integer corresponding to the plaintext;
the encryption device 820 is further configured to use the first integer and the second integer as a first coordinate point in the rectangular coordinate system, and determine a straight line where the coordinate point is located based on the first coordinate point and a coordinate origin in the rectangular coordinate system;
an encryption device 820 for selecting a second coordinate point other than the first coordinate point in the straight line; splicing the two values in the second coordinate point to obtain a spliced character string;
the encryption device 820 is further configured to obtain a randomly selected third integer and a randomly selected fourth integer; encrypting the third integer by adopting a first public key in the public key pair to obtain a first encrypted text segment; encrypting the fourth integer by adopting a second public key in the public key pair to obtain a second ciphertext fragment;
the encryption device 820 is further configured to convert the third integer into a random number by using a third hash algorithm, and perform an exclusive or operation on the plaintext by using the random number to obtain a third ciphertext fragment;
the encryption device 820 is further configured to convert the plaintext and the third integer into a character string with a first preset length by using a fourth hash algorithm, so as to obtain a fourth ciphertext fragment;
the encryption device 820 is further configured to convert the fourth integer, the first ciphertext fragment, the second ciphertext fragment, the third ciphertext fragment and the fourth ciphertext fragment into a character string with a second preset length by using a fifth hash algorithm, and perform an exclusive or operation on the character string with the second preset length and the spliced character string to obtain a fifth ciphertext fragment;
the encryption device 820 is further configured to obtain a ciphertext corresponding to the plaintext based on the first ciphertext segment, the second ciphertext segment, the third ciphertext segment, the fourth ciphertext segment, and the fifth ciphertext segment.
The ciphertext equivalence testing device 830 is configured to obtain a first ciphertext to be tested, a testing private key of the first ciphertext, a second ciphertext to be tested, and a testing private key of the second ciphertext, where the ciphertext is obtained by encrypting a plaintext based on a point on the same straight line with the plaintext in a preset rectangular coordinate system and a public key pair of the plaintext, and the straight line passes through an origin of coordinates of the preset rectangular coordinate system;
the ciphertext equivalence testing device 830 is further configured to extract the second ciphertext segment and the fifth ciphertext segment of the first ciphertext from the first ciphertext, and extract the second ciphertext segment and the fifth ciphertext segment of the second ciphertext from the second ciphertext;
the ciphertext equivalence testing device 830 is further configured to determine a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext, and a test private key corresponding to the first ciphertext;
the ciphertext equivalence testing device 830 is further configured to determine a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext, and a test private key corresponding to the second ciphertext;
the ciphertext equivalence testing device 830 is further configured to convert the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in a preset coordinate system;
the ciphertext equivalence testing device 830 is further configured to determine that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext when a first slope of a straight line formed by the first coordinate point and the origin of coordinates of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the origin of coordinates of the preset coordinate system; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
In some examples, the key generating apparatus 810 is specifically configured to select a first prime number pair and a second prime number pair in a preset prime number table, where the first prime number pair and the second prime number pair respectively include two prime numbers;
a key generating device 810, further configured to calculate a first product of two prime numbers in the first prime number pair and an euler function value of the first product; calculating a second product of two prime numbers in the second prime number pair and an Euler function value of the second product;
the key generating device 810 is further configured to select a fifth integer and a sixth integer in the preset integer table, and use the fifth integer and the sixth integer as a public key pair used for encrypting plaintext. Wherein the fifth integer is greater than 1 and less than the Euler function value of the first product; and the greatest common divisor of the Euler function value of the fifth integer and the first product is 1; the sixth integer is greater than 1 and less than the Euler function value of the second product; and the greatest common divisor of the sixth integer and the euler function value of the second product is 1.
A key generating device 810, further configured to calculate a first modulo element of an euler function value of the first product by the fifth integer based on the euler function value of the first product by the fifth integer; calculating a second modulo element of the euler function value of the sixth integer with respect to the second product based on the sixth integer and the euler function value of the second product;
the key generating device 810 is further configured to use the first modular inverse element and the second modular inverse element as a private key pair corresponding to the public key, where the first modular inverse element is a decryption private key, and the second modular inverse element is a test private key.
The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g., from one website site, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DS L)) or wireless (e.g., infrared, wireless, microwave, etc.) manner to another website site, computer, server, or data center.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device, the electronic apparatus and the system embodiment, since they are substantially similar to the method embodiment, the description is simple, and the relevant points can be referred to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (10)

1. A ciphertext equivalence testing method, the method comprising:
acquiring a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested and a test private key of the second ciphertext, wherein the ciphertext is obtained by encrypting a plaintext based on a point which is on the same straight line in a preset rectangular coordinate system with the plaintext and a public key pair of the plaintext, and the straight line passes through a coordinate origin of the preset rectangular coordinate system;
extracting a second ciphertext segment and a fifth ciphertext segment of the first ciphertext from the first ciphertext, and extracting a second ciphertext segment and a fifth ciphertext segment of the second ciphertext from the second ciphertext;
determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext;
determining a test character string corresponding to the second ciphertext based on a second ciphertext segment of the second ciphertext, a fifth ciphertext segment of the second ciphertext, and a test private key corresponding to the second ciphertext;
converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in the preset coordinate system;
when a first slope of a straight line formed by the first coordinate point and the origin of coordinates of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the origin of coordinates of the preset coordinate system, determining that a plaintext corresponding to the first ciphertext is the same as a plaintext corresponding to the second ciphertext; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
2. The method according to claim 1, wherein the step of encrypting the plaintext based on a point on the same straight line as the plaintext in a predetermined rectangular coordinate system and a public key pair of the plaintext to obtain a ciphertext comprises:
acquiring a plaintext to be encrypted and a public key pair used for encrypting the plaintext; wherein, the plaintext is a character string;
performing hash operation on the plain text by adopting a first hash algorithm and a second hash algorithm which are determined in advance to obtain a first integer and a second integer corresponding to the plain text;
taking the first integer and the second integer as a first coordinate point in a rectangular coordinate system, and determining a straight line where the coordinate point is located based on the first coordinate point and a coordinate origin in the rectangular coordinate system;
selecting a second coordinate point other than the first coordinate point in the straight line; splicing the two values in the second coordinate point to obtain a spliced character string;
acquiring a randomly selected third integer and a randomly selected fourth integer; encrypting the third integer by adopting a first public key in the public key pair to obtain a first encrypted text segment; encrypting the fourth integer by adopting a second public key in the public key pair to obtain a second ciphertext fragment;
converting the third integer into a random number by adopting a third Hash algorithm, and performing XOR operation on the plaintext by adopting the random number to obtain a third ciphertext fragment;
converting the plain text and the third integer into a character string with a first preset length by adopting a fourth Hash algorithm to obtain a fourth ciphertext fragment;
converting the fourth integer, the first ciphertext segment, the second ciphertext segment, the third ciphertext segment and the fourth ciphertext segment into character strings with a second preset length by adopting a fifth hash algorithm, and performing exclusive-or operation on the character strings with the second preset length and the spliced character strings to obtain a fifth ciphertext segment;
and obtaining a ciphertext corresponding to the plaintext based on the first ciphertext segment, the second ciphertext segment, the third ciphertext segment, the fourth ciphertext segment and the fifth ciphertext segment.
3. The method of claim 2, wherein the step of obtaining a public key pair used to encrypt the plaintext comprises:
selecting a first prime number pair and a second prime number pair in a preset prime number table, wherein the first prime number pair and the second prime number pair respectively comprise two prime numbers;
calculating a first product of two prime numbers in the first prime number pair and an Euler function value of the first product; calculating a second product of two prime numbers in the second prime number pair and an Euler function value of the second product;
selecting a fifth integer and a sixth integer in a preset integer table, wherein the fifth integer is greater than 1 and smaller than the Euler function value of the first product; and the greatest common divisor of the Euler function values of the fifth integer and the first product is 1; the sixth integer is greater than 1 and less than the Euler function value of the second product; and the greatest common divisor of the Euler function values of the sixth integer and the second product is 1;
the fifth integer and the sixth integer are used as a public key pair used for encrypting the plaintext.
4. The method according to claim 3, wherein after the using the fifth integer and the sixth integer as a public key pair for encrypting the plaintext, the method further comprises:
calculating a first modulo element of the euler function value of the fifth integer for the first product based on the euler function value of the first product and the fifth integer;
calculating a second modulo element of the euler function value of the sixth integer for the second product based on the sixth integer, the euler function value of the second product;
and taking the first modular inverse element and the second modular inverse element as a private key pair corresponding to the public key, wherein the first modular inverse element is a decryption private key, and the second modular inverse element is a test private key.
5. The method of claim 1, wherein after the determining that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext, the method further comprises:
extracting a first ciphertext segment and a third ciphertext segment of the first ciphertext from the first ciphertext; decrypting the first ciphertext based on a first ciphertext segment, a third ciphertext segment in the first ciphertext and a decryption private key of the first ciphertext;
or
Extracting a first ciphertext segment and a third ciphertext segment of the second ciphertext from the second ciphertext; and decrypting the second ciphertext based on the first ciphertext segment, the third ciphertext segment in the second ciphertext and a decryption private key of the second ciphertext.
6. The method of claim 1, wherein determining the test string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext, and the test private key corresponding to the first ciphertext comprises:
based on the first ciphertext C1Second ciphertext fragment C1,2Test private key d corresponding to the first ciphertext1,2By the following formula:
Figure FDA0002431827530000031
determining a test character string x corresponding to the first ciphertext1||y1(ii) a Wherein, the symbol
Figure FDA0002431827530000032
Represents an exclusive OR operation, said
Figure FDA0002431827530000033
Representing the first ciphertext C by adopting a fifth Hash algorithm1First ciphertext segment C of1,1A second ciphertext segment C1,2The third ciphertext segment C1,3Fourth ciphertext segment C1,4And the first ciphertext C1Second ciphertext fragment C1,2D of1,2The power is converted into a character string with a second preset length;
the determining a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext, and the private key corresponding to the second ciphertext includes:
based on the second ciphertext C2Second ciphertext fragment C2,2Test private key d corresponding to the second ciphertext2,2By the following formula:
Figure FDA0002431827530000041
determining a test character string x corresponding to the second ciphertext2||y2(ii) a Wherein, the
Figure FDA0002431827530000042
Representing the second ciphertext C by adopting a fifth Hash algorithm2First ciphertext segment C of2,1A second ciphertext segment C2,2The third ciphertext segment C2,3Fourth ciphertext segment C2,4And the second ciphertext C2Second ciphertext fragment C2,2D of2,2And the power is converted into a character string with a second preset length.
7. An apparatus for ciphertext equivalence testing, the apparatus comprising:
the system comprises an acquisition module, a data processing module and a data processing module, wherein the acquisition module is used for acquiring a first ciphertext to be tested, a test private key of the first ciphertext, a second ciphertext to be tested and a test private key of the second ciphertext, the ciphertext is obtained by encrypting a plaintext based on a point which is positioned on the same straight line in a preset rectangular coordinate system with the plaintext and a public key pair of the plaintext, and the straight line passes through an origin of coordinates of the preset rectangular coordinate system;
the extracting module is used for extracting a second ciphertext segment and a fifth ciphertext segment of the first ciphertext from the first ciphertext and extracting the second ciphertext segment and the fifth ciphertext segment of the second ciphertext from the second ciphertext;
the test character string determining module is used for determining a test character string corresponding to the first ciphertext based on the second ciphertext segment of the first ciphertext, the fifth ciphertext segment of the first ciphertext and a test private key corresponding to the first ciphertext;
the test character string determining module is further configured to determine a test character string corresponding to the second ciphertext based on the second ciphertext segment of the second ciphertext, the fifth ciphertext segment of the second ciphertext, and a test private key corresponding to the second ciphertext;
the conversion module is used for converting the test character string corresponding to the first ciphertext into a first coordinate point in a preset coordinate system; converting the test character string corresponding to the second ciphertext into a second coordinate point in the preset coordinate system;
the comparison module is used for determining that the plaintext corresponding to the first ciphertext is the same as the plaintext corresponding to the second ciphertext when a first slope of a straight line formed by the first coordinate point and the origin of coordinates of the preset coordinate system is the same as a second slope of a straight line formed by the second coordinate point and the origin of coordinates of the preset coordinate system; otherwise, determining that the plaintext corresponding to the first ciphertext is different from the plaintext corresponding to the second ciphertext.
8. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1-6 when executing a program stored in the memory.
9. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 6.
10. A ciphertext equivalence test system, the test system comprising at least: the ciphertext equivalence test apparatus of claim 7.
CN202010238607.9A 2020-03-30 2020-03-30 Ciphertext equivalent test method, ciphertext equivalent test device, electronic equipment, storage medium and ciphertext equivalent test system Active CN111447059B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010238607.9A CN111447059B (en) 2020-03-30 2020-03-30 Ciphertext equivalent test method, ciphertext equivalent test device, electronic equipment, storage medium and ciphertext equivalent test system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010238607.9A CN111447059B (en) 2020-03-30 2020-03-30 Ciphertext equivalent test method, ciphertext equivalent test device, electronic equipment, storage medium and ciphertext equivalent test system

Publications (2)

Publication Number Publication Date
CN111447059A true CN111447059A (en) 2020-07-24
CN111447059B CN111447059B (en) 2023-04-28

Family

ID=71651194

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010238607.9A Active CN111447059B (en) 2020-03-30 2020-03-30 Ciphertext equivalent test method, ciphertext equivalent test device, electronic equipment, storage medium and ciphertext equivalent test system

Country Status (1)

Country Link
CN (1) CN111447059B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347498A (en) * 2020-12-01 2021-02-09 南阳理工学院 Encryption method, encryption device, electronic equipment and readable storage medium
WO2022121607A1 (en) * 2020-12-09 2022-06-16 深圳前海微众银行股份有限公司 Data processing method and apparatus
CN115378666A (en) * 2022-08-04 2022-11-22 山东大学 Public key encryption method and system supporting outsourced ciphertext data equality test

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001042767A (en) * 1999-07-27 2001-02-16 Kanazawa Inst Of Technology Method and device for evaluating secrecy safety of secret key in public key ciphering system
CN109981265A (en) * 2019-03-12 2019-07-05 武汉大学 A kind of ciphertext equivalence determination method without using Bilinear map of identity-based

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001042767A (en) * 1999-07-27 2001-02-16 Kanazawa Inst Of Technology Method and device for evaluating secrecy safety of secret key in public key ciphering system
CN109981265A (en) * 2019-03-12 2019-07-05 武汉大学 A kind of ciphertext equivalence determination method without using Bilinear map of identity-based

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱慧君: "基于密文的等值测试密码方案研究", 《中国博士学位论文全文数据库 信息科技辑》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112347498A (en) * 2020-12-01 2021-02-09 南阳理工学院 Encryption method, encryption device, electronic equipment and readable storage medium
CN112347498B (en) * 2020-12-01 2022-10-28 南阳理工学院 Encryption method, encryption device, electronic equipment and readable storage medium
WO2022121607A1 (en) * 2020-12-09 2022-06-16 深圳前海微众银行股份有限公司 Data processing method and apparatus
CN115378666A (en) * 2022-08-04 2022-11-22 山东大学 Public key encryption method and system supporting outsourced ciphertext data equality test

Also Published As

Publication number Publication date
CN111447059B (en) 2023-04-28

Similar Documents

Publication Publication Date Title
CN112347498B (en) Encryption method, encryption device, electronic equipment and readable storage medium
US11233659B2 (en) Method of RSA signature or decryption protected using a homomorphic encryption
CN112637836B (en) Data processing method and device, electronic equipment and storage medium
JP5079024B2 (en) Verification device, ciphertext decryption device, signature verification device, authentication device, encryption system, and computer program
Farajallah et al. Fast and secure chaos-based cryptosystem for images
CN111447059B (en) Ciphertext equivalent test method, ciphertext equivalent test device, electronic equipment, storage medium and ciphertext equivalent test system
TWI809292B (en) Data encryption and decryption method, device, storage medium and encrypted file
CN110868287A (en) Authentication encryption ciphertext coding method, system, device and storage medium
KR20160131798A (en) Method and system for additive homomorphic encryption scheme with error detection functionality
CN107104788B (en) Terminal and non-repudiation encryption signature method and device thereof
CN106534077B (en) A kind of identifiable proxy re-encryption system and method based on symmetric cryptography
Salam et al. ShiftMod cipher: A symmetrical cryptosystem scheme
CN114362912A (en) Identification password generation method based on distributed key center, electronic device and medium
CN116248258A (en) Password detection method, device, equipment and storage medium
CN115632765A (en) Encryption method, decryption device, electronic equipment and storage medium
CN109361506A (en) Information processing method
CN114884656A (en) Encryption, decryption and password sending method and device
CN112925535A (en) Method and device for installing embedded application of password chip
CN112507349A (en) Data encryption storage, encryption search and application method and related equipment thereof
Neforawati et al. Message Digest 5 (MD-5) Decryption Application using Python-Based Dictionary Attack Technique
Yulianto et al. Digital Certificate Authentication with Three-Level Cryptography (SHA-256, DSA, 3DES)
Mantoro et al. Improving the security guarantees, authenticity and confidentiality in short message service of mobile applications
CN111611595B (en) Data encryption method and device
CN110958115B (en) Digital signature device, method, storage medium and equipment based on SM9 white box
CN115606148A (en) Information leakage mitigation associated with elliptic curve operation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231225

Address after: No. 3605, Floor 5, Building 3, Micro World, Century Avenue, Liuwu New District, Lhasa, Xizang Autonomous Region, 850000

Patentee after: Lhasa Koda Technology Co.,Ltd.

Address before: 473004 No. 80 Changjiang Road, Wancheng District, Nanyang City, Henan Province

Patentee before: NANYANG INSTITUTE OF TECHNOLOGY