Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a compression method of a homomorphic encryption public key of many-to-one on an integer. The technical problem to be solved by the invention is realized by the following technical scheme:
a method for compressing homomorphic encryption public keys of many-to-one on integers comprises the following steps:
substituting the security parameter lambda and the public key element of the decryptor into a public key function of the decryptor to generate a public key vector pk of the decryptor;
performing a replacement operation on the decryptor public key vector pk to obtain a replaced decryptor public key vector
The security parameter lambda and the replaced public key vector of the decryption party
And cipher side public key element substitutionEncryption side public key function generation encryption side public key vector set pk
i;
The public key vector set pk of the encryption party is processediAnd substituting the decryption parameter into a decryption function, and mapping the random plaintext m into a ciphertext c by using the decryption functioni;
The ciphertext ciSubstituting the encryption party private key set into an encryption party private key function to obtain a first decrypted plaintext mi;
The ciphertext ciSubstituting the decryption side private key into a decryption side private key function to obtain a second decryption plaintext m'i。
In one embodiment of the present invention, substituting the security parameter λ and the decryptor public key element into a decryptor public key function to generate a decryptor public key vector pk includes:
generating a decryption side large prime number p through a random library, wherein the decryption side large prime number p is used as a decryption side private key;
selecting a random seed se, and substituting the random seed se into the random library to generate a pseudo-random number generator f (se);
generating a maximum random integer q by the random library0;
According to the decryption square large prime number p and the maximum random integer q0Obtaining a clear public key integer x for the decryptor0;
Generating a set of pseudorandom integers χ by the pseudorandom number generator f (se)i,b;
According to the pseudo-random integer set χi,bObtaining a public key element set delta of a decryptori,b;
The random seed se and the decryption party non-interference public key integer x0And said set δ of public key elements of decryptori,bAnd substituting the public key function of the decryptor to generate a public key vector pk of the decryptor.
In an embodiment of the present invention, the public key vector pk of the decryptor is subjected to a permutation operation to obtain a permuted public key vector of the decryptor
The security parameter lambda and the replaced public key vector of the decryption party
Generating and substituting encryption party public key elements into an encryption party public key function to generate an encryption party public key vector set pk
iThe method comprises the following steps:
generating a large prime number set p of an encryption square through the random libraryiThe set of square large prime numbers piAs a set of encryption party private keys;
randomly permuting the decryptor public key element set δ
i,bThe public key element sequence in (1) to obtain the replaced public key element set of the decryptor
The random seed se and the decryption party non-interference public key integer x
0And the permuted set of public key elements of the decryptor
Substituting the public key function of the decryption party to obtain a replaced public key vector of the decryption party
Generating the rest random integer set q of the encryption party through the random library
i,v,bThe rest noise set r of the encryption side
i,v,bBy said set of encrypter large primes p
iThe set q of the rest random integers of the encryption party
i,v,bThe set r of rest noise of the encryption side
i,v,bAnd the permuted set of public key elements of the decryptor
Obtaining the integer set x of the rest public keys of the encryption party
i,v,b;
According to the rest public key integer set x of the encryption party
i,v,bAnd the rest of the encryption side public key element set
Obtaining a public key vector set pk of an encryption party
i。
In one embodiment of the invention, the set pk of public key vectors of the encryptor is usediAnd substituting the decryption parameter into a decryption function, and mapping the random plaintext m into a ciphertext c by using the decryption functioniThe method comprises the following steps:
respectively generating random integer vectors b through the random libraryiRandom noise integer siAnd a random plaintext m;
the random integer vector biThe random noise integer siThe random plaintext m and the encryption side public key vector set pkiSubstituting into a decryption function to map the random plaintext m into a ciphertext ci。
In one embodiment of the invention, the ciphertext c is combinediSubstituting the encryption party private key set into an encryption party private key function to obtain a first decrypted plaintext miThe method comprises the following steps:
the ciphertext ciSubstituting the encryption party private key set into an encryption party private key function, and utilizing the encryption party private key function to carry out the ciphertext ciMapping to the first decrypted plaintext miThe set of encryptor private keys is equal to the set of encryptor large prime numbers pi。
In one embodiment of the invention, the ciphertext c is combinediSubstituting the decryption side private key into a decryption side private key function to obtain a second decryption plaintext m'iThe method comprises the following steps:
the ciphertext ciSubstituting the decryption party private key into a decryption party private key function, and utilizing the decryption party private key function to convert the ciphertext c into the ciphertext ciMapping to the second decrypted plaintext m'iThe decryptor private key is equal to the decryptor large prime number p.
In one embodiment of the invention, the maximum random integer q0Is a non-square integer and satisfies 2λ-rough。
In one embodiment of the invention, the set of decryptor public key elements δi,bThe expression of (a) is:
δi,b=[χi,b]p+ξi,b·p-ri,b;
wherein ξi,bIs a random integer, ri,bFor decryption side random noise, i is more than or equal to 1 and less than or equal to beta, b is more than or equal to 0 and less than or equal to 3, beta is a random integer, and i and b are parameter values.
The invention has the beneficial effects that:
1. the method and the device compress the size of the public key element, greatly reduce the storage space of the public key and improve the practicability of the scheme.
2. The method and the device can decrypt information of a plurality of encryption parties by using one key, thereby not only optimizing the problem of difficult key management, but also enabling a plurality of encryption parties to simultaneously transmit data and improving the efficiency of the algorithm.
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Detailed Description
The present invention will be described in further detail with reference to specific examples, but the embodiments of the present invention are not limited thereto.
Example one
Referring to fig. 1, fig. 1 is a diagram of steps of a method for compressing an integer many-to-one homomorphic encryption public key according to an embodiment of the present invention. The embodiment of the invention provides a method for compressing a homomorphic encryption public key of many-to-one on an integer, which comprises the following steps:
s1, substituting the security parameter lambda and the public key element of the decryptor into a public key function of the decryptor to generate a public key vector pk of the decryptor;
s2, carrying out replacement operation on the public key vector pk of the decryptor to obtain the replaced public key vector of the decryptor
The security parameter lambda and the replaced public key vector of the decryption party
Generating and substituting encryption party public key elements into an encryption party public key function to generate an encryption party public key vector set pk
i;
S3, collecting vector pk of the public key vector of the encryption partyiAnd substituting the decryption parameter into a decryption function, and mapping the random plaintext m into a ciphertext c by using the decryption functioni;
S4, converting the ciphertext ciSubstituting the encryption party private key set into an encryption party private key function to obtain a first decrypted plaintext mi;
S5, the ciphertext ciSubstituting the decryption side private key into a decryption side private key function to obtain a second decryption plaintext m'i。
The method obtains a decryption party public key vector pk through a security parameter lambda and a decryption party public key element, wherein the decryption party public key element comprises a random seed se and a decryption party non-interference public key integer x
0And decryptor public key element set delta
i,bAnd generating the decryption side public key vector pk into a replaced decryption side public key vector through a replacement operation
Further, the security parameter lambda and the replaced public key vector of the decryption party
Substituting the encryption party public key elements into an encryption party public key function to generate an encryption party public key vector set pk
iThe cipher side public key element comprises the integer set x of the rest public keys of the cipher side
i,v,bAnd the rest of the public key element set of the encryption party
The public key vector set pk of the encryption party
iSubstituting the decryption parameter into a decryption function to obtain a ciphertext c
iThe decryption parameter comprises randomInteger vector b
iRandom noise integer s
iAnd random plaintext m, ciphertext c
iSubstituting the encryption party private key set into the encryption party private key function to obtain a first decrypted plaintext m
iCiphertext c
iSubstituting the decryption side private key into a decryption side private key function to obtain a second decryption plaintext m'
iWhen the values of i are the same, the first decrypted plaintext m
iIs equal to the second decrypted plaintext m'
i
This embodiment takes the public key element size from the public key complexity O (λ) of the prior art DGHV scheme10) Compression to O (lambda)3) The public key storage space is greatly reduced, the practicability of the scheme is improved, one secret key decrypts information of a plurality of encryption parties, the problem of difficulty in managing a large number of secret keys is optimized, the plurality of encryption parties can transmit data simultaneously, and the algorithm efficiency is improved.
Example two
Referring to fig. 2, fig. 2 is a schematic diagram of a homomorphic encryption public key compression method for many-to-one over integers according to an embodiment of the present invention. The embodiment of the invention provides a method for compressing a homomorphic encryption public key of many-to-one integer, which substitutes a security parameter lambda and a public key element of a decryptor into a public key function of the decryptor to generate a public key vector pk of the decryptor, and comprises the following steps:
s11, generating a decryption side big prime number p through a random library, wherein the decryption side big prime number p is used as a decryption side private key;
s12, selecting a random seed se, and substituting the random seed se into the random library to generate a pseudo-random number generator f (se);
s13, generating the maximum random integer q through the random library0;
S14, according to the decryption square big prime number p and the maximum random integer q0Obtaining a clear public key integer x for the decryptor0;
S15, generating a pseudo-random integer set χ through the pseudo-random number generator f (se)i,b;
S16, according to the pseudo-random integer set χi,bObtaining a public key element set delta of a decryptori,b;
S17, using the random seed se and the non-interference public key integer x of the decryptor0And said set δ of public key elements of decryptori,bAnd substituting the public key function of the decryptor to generate a public key vector pk of the decryptor.
Further, the maximum random integer q0Is a non-square integer and satisfies 2λ-rough。
Further, the set δ of public key elements of decryptori,bThe expression of (a) is:
δi,b=[χi,b]p+ξi,b·p-ri,b;
wherein ξi,bIs a random integer, ri,bFor decryption side random noise, i is more than or equal to 1 and less than or equal to beta, b is more than or equal to 0 and less than or equal to 3, beta is a random integer, and i and b are parameter values.
In this embodiment, a large decrypting party prime number p with η bit length is generated by the random library as the private key sk of the decrypting party, and the large decrypting party prime number p belongs to [2 ]η-1,2η) I.e. p ∈ [2 ]η-1,2η) Substituting into a random library to generate a decryption side large prime number p with the length of eta bit, wherein the random library is random. Maximum random integer q0Is a non-square integer and satisfies 2λ-rough。
Randomly selecting one integer from 1-50 integers as a random seed se, substituting the random seed se into a random library to generate a pseudo-random number generator f (se), wherein the expression of the pseudo-random number generator is as follows: random (se), mixing q0∈[0,2γ/p) entering random library to generate maximum random integer q0Maximum random integer q0Is a non-square integer and satisfies 2λ-rough,2λThe term rough integer means that the integer does not include the ratio 2λSmall prime factors, i.e. largest random integers q0Greater than or equal to 2λMaking the decryptor have no interference public key integer x0=q0P, generating a pseudo-random integer set χ by a pseudo-random number generator f (se)i,bBy pseudo-random integer set χi,bAnd the number p of square prime numbersObtaining a public key element set delta of a decryptori,bSet of public key elements of decrypter deltai,bThe expression of (a) is:
δi,b=[χi,b]p+ξi,b·p-ri,b;
wherein ξi,bIs a random integer, ri,bFor decrypting square random noise, i is more than or equal to 1 and less than or equal to beta, b is more than or equal to 0 and less than or equal to 3, beta is a random integer, i and b are parameter values, r isi,bAnd xii,bCan be randomly generated by random library, ri,b∈(-2ρ,2ρ)。
Let decryption side public key integer set xi,b=χi,b-δi,bSet of public key integers x of decrypteri,bIs a public key basis quantity, a set of public key elements of a decryptor deltai,bIs the public key offset because of the decryptor public key integer set xi,bPublic key element set delta of decryption sidei,bThe invention has large memory occupation, and the public key element set delta of the decryptor is selected and stored in the inventioni,bThe size of the public key element is increased from O (lambda)10) Compression to O (lambda)3) The space complexity is reduced, the public key storage space is greatly reduced, and the practicability of the scheme is improved.
Using random seed se, decryption side non-interference public key integer x0And decryptor public key element set deltai,bSubstituting the public key function of the decryptor to generate a public key vector pk of the decryptor, wherein the expression of the public key vector set pk of the decryptor is as follows: pk ═ (se, x)0,(δi,b)1≤i≤β,0≤b≤3) I is more than or equal to 1 and less than or equal to beta, b is more than or equal to 0 and less than or equal to 3, beta is a random integer, and i and b are parameter values.
Performing a replacement operation on the decryptor public key vector pk to obtain a replaced decryptor public key vector
The security parameter lambda and the replaced public key vector of the decryption party
Substituting the encryption side public key element into the encryption side public key functionBecome the public key vector set pk of the encryption party
iThe method comprises the following steps:
s21, generating a large prime number set p of an encryption square through the random libraryiThe set of square large prime numbers piAs a set of encryption party private keys;
s22, randomly replacing the public key element set delta of the decryptor
i,bThe public key element sequence in (1) to obtain the replaced public key element set of the decryptor
S23, using the random seed se and the non-interference public key integer x of the decryptor
0And the permuted set of public key elements of the decryptor
Substituting the public key function of the decryption party to obtain a replaced public key vector of the decryption party
S24, generating the rest random integer set q of the encryption party through the random library
i,v,bThe rest noise set r of the encryption side
i,v,bBy said set of encrypter large primes p
iThe set q of the rest random integers of the encryption party
i,v,bThe set r of rest noise of the encryption side
i,v,bAnd the permuted set of public key elements of the decryptor
Obtaining the integer set x of the rest public keys of the encryption party
i,v,b;
S25, according to the other public key integer set x of the encryption side
i,v,bAnd the rest of the encryption side public key element set
Obtaining a public key vector set pk of an encryption party
i。
Will be provided with
Substituting random library to generate random eta
iBit-encrypted square large prime number set p
iI 1, …, n, set of cryptographic large primes p
iAs the set sk of private keys of the encryption party
iSet of public key elements of decrypter delta
i,bAfter each public key element in the decryption party public key element set is randomly replaced, a replaced decryption party public key element set is obtained
Using random seed se, decryption side non-interference public key integer x
0And permuted set of public key elements of decryptor
Substituting the public key function of the decryption party to obtain the public key vector of the decryption party
The expression is
Wherein, beta is a random integer, and i and b are parameter values.
Generation of encryptor maximum random integer q by random library
i,0And the rest random integer set q of the encryption party
i,v,bMaximum noise r on encryption side
i,0And the remaining noise set r of the encryption side
i,v,b,
Obtaining the integer set x of the rest public keys of the encryption party
i,v,bThe expression of (a) is:
wherein, χ
i,v,bFor the remaining pseudo-random set of integers, δ, of the encryption side
i,v,bV is more than or equal to 1 and less than or equal to beta for the other public key element sets of the encryption party
i,0≤b≤3。
Order addingSecret maximum non-interfering public key integer xi,0=piqi,0x0+2ri,0The random seed se and the decryption side have no interference public key integer x0The maximum public key integer x of the encryption sidei,0And the rest public key element set delta of the encryption partyi,v,bSubstituting the encryption side public key function to obtain an encryption side public key vector set pkiExpressed as pki=(se,x0,xi,0(δi,v,b)1≤i≤β,1≤v≤βi,0≤b≤3) Wherein, β and βiAnd i and b are random integers, i is 1, …, n is 1, … and 3.
The public key vector set pk of the encryption party is processediAnd substituting the decryption parameter into a decryption function, and mapping the random plaintext m into a ciphertext c by using the decryption functioniThe method comprises the following steps:
s31, respectively generating random integer vectors b through the random libraryiRandom noise integer siAnd a random plaintext m;
s32, converting the random integer vector biThe random noise integer siThe random plaintext m and the encryption side public key vector set pkiSubstituting into a decryption function to map the random plaintext m into a ciphertext ci
B is to
i,v∈[0,2
α) Substituting random library to generate random integer vector
Will be provided with
Substituting random library to generate random noise integer s
iSubstituting m E {0,1} into random library of python to generate random plaintext m, and substituting random integer vector b
iRandom noise integer s
iRandom plaintext m and encryption side public key vector set pk
iSubstituting into a decryption function to obtain a ciphertext c
iThe expression is
Is referred to as a brief introductionKey function c
i=E(pk
i,m
i),v
1、v
2、v
3And v
4For parameter values, β is a random integer.
The ciphertext ciSubstituting the encryption party private key set into an encryption party private key function to obtain a first decrypted plaintext miThe method comprises the following steps:
the ciphertext ciSubstituting the encryption party private key set into an encryption party private key function, and utilizing the encryption party private key function to carry out the ciphertext ciMapping to the first decrypted plaintext miThe set of encryptor private keys is equal to the set of encryptor large prime numbers pi。
The ciphertext ciSubstituting the encryption party private key set into an encryption party private key function to obtain a first decrypted plaintext miFirst decrypting plaintext miThe expression of (a) is: m isi←[cimodpi]2First decryption private key function mi=C(ski,ci) Wherein i is a parameter value, i is 1, …, n.
The ciphertext ciSubstituting the decryption side private key into a decryption side private key function to obtain a second decryption plaintext m'iThe method comprises the following steps:
the ciphertext ciSubstituting the decryption side private key into the decryption side private key function, and utilizing the decryption side private key function to carry out the cryptograph ciMapping to the second decrypted plaintext m'iThe decryptor private key is equal to the decryptor large prime number p.
The ciphertext ciSubstituting the decryption side private key into a decryption side private key function to obtain a second decryption plaintext m'iSecond decrypted plaintext m'iThe expression of (a) is: m'i←[cimodp]2Abbreviated as second decryption private key function m'i=C(sk,ci) Wherein i is a parameter value, i is 1, …, n.
When the value of i is the same, the first decrypted plaintext m can be obtained by the two methodsiAnd second decrypted plaintext m'iEquality, using one key to encrypt multiple party informationThe decryption optimizes the problem of difficult key management, and can ensure that a plurality of encryption parties transmit data simultaneously, thereby improving the efficiency of the algorithm and further proving the correctness of the scheme.
In summary, there are a decryptor and n encryptors in the present application, each encryptor encrypts its own ciphertext through its public key function and sends it to the decryptor, and after receiving the ciphertext, the decryptor decrypts it through its private key function to obtain the decrypted ciphertext finally. For example, the encryptor P1 passes through its own public key function E (PK)1,m1) After encryption, ciphertext c is obtained1Starting the ciphertext c1To the decryption side, the decryption side receives the ciphertext c1Private key function m of post-pass decryptor1=C(sk1,c1) Obtain the decrypted plaintext m1。
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention; thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.