WO2022094829A1 - 数据安全比较协议实现方法、***、电子装置及存储介质 - Google Patents

数据安全比较协议实现方法、***、电子装置及存储介质 Download PDF

Info

Publication number
WO2022094829A1
WO2022094829A1 PCT/CN2020/126648 CN2020126648W WO2022094829A1 WO 2022094829 A1 WO2022094829 A1 WO 2022094829A1 CN 2020126648 W CN2020126648 W CN 2020126648W WO 2022094829 A1 WO2022094829 A1 WO 2022094829A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
ciphertext
comparison result
cloud
user
Prior art date
Application number
PCT/CN2020/126648
Other languages
English (en)
French (fr)
Inventor
刘宏伟
赵威
张鹏
孙小强
Original Assignee
深圳技术大学
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 深圳技术大学 filed Critical 深圳技术大学
Priority to PCT/CN2020/126648 priority Critical patent/WO2022094829A1/zh
Publication of WO2022094829A1 publication Critical patent/WO2022094829A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data

Definitions

  • the invention relates to the technical field of data security, and in particular, to a method, system, electronic device and storage medium for implementing a data security comparison protocol.
  • Machine learning is to obtain hidden, effective and understandable knowledge from massive data. It is widely used in artificial intelligence, disease diagnosis, gene sequencing, crime prediction, etc. field.
  • the CZW-type multi-key fully homomorphic encryption scheme cannot determine the numerical value of different data only on the premise that the public information of user data is known.
  • the main purpose of the present invention is to provide a data security comparison protocol implementation method, system, electronic device and storage medium, aiming to solve the problem that the multi-key fully homomorphic encryption scheme in the prior art cannot only disclose information on known user data. Next, the technical problem of judging the numerical size of different data.
  • a first aspect of the present invention provides a method for implementing a data security comparison protocol, which includes: obtaining public parameters of an operating system where machine learning is located, and obtaining a user's public key and private key; using the public parameters and the The public key encrypts the first plaintext data and the second plaintext data of the user data to obtain the first ciphertext data and the second ciphertext data; uploading the first ciphertext data and the second ciphertext data to the cloud server; obtain the cloud ciphertext comparison result of the first ciphertext data and the second ciphertext data output by the cloud server; calculate the client ciphertext comparison result according to the comparison result; compare according to the cloud ciphertext The size of the first plaintext data and the second plaintext data are compared between the result and the user end ciphertext comparison result.
  • calculating the comparison result of the client ciphertext according to the comparison result includes: decrypting the cloud ciphertext comparison result using the private key; expanding the bits of the encrypted cloud ciphertext comparison result, if the first If the bit component is 0, the result of the user-side ciphertext comparison is 0. If If the bit component is 1, the result of the ciphertext comparison at the user end is 1.
  • comparing the size of the data according to the cloud ciphertext comparison result and the client ciphertext comparison result includes: if the cloud ciphertext comparison result and the client ciphertext comparison result are both 0 or both are 1, then it is determined that the first plaintext data is less than or equal to the second plaintext data; if one of the cloud ciphertext comparison result and the client ciphertext comparison result is 0 and the other is 1, then it is determined that the first plaintext data is equal to or less than the second plaintext data.
  • One plaintext data is greater than or equal to the second plaintext data.
  • the method further includes: if the user data comes from different users, obtaining the public key and private key of the different users respectively, and encrypting the user's plaintext data according to the public key and public parameters corresponding to the user.
  • a second aspect of the present invention provides a method for implementing a data security comparison protocol, comprising: obtaining the first ciphertext data and the second ciphertext data and the user's public key by encrypting the first plaintext data and the second plaintext data; Encrypt the plaintext space modulus on the basis of the key to obtain the encrypted space modulus; randomly select one of 0 and 1 as a bit, and use the encrypted space modulus, the first ciphertext data and the second ciphertext data for calculation , obtain the cloud ciphertext comparison result; send the cloud ciphertext comparison result to the client.
  • the calculation using the encrypted space modulus, the first ciphertext data and the second ciphertext data to obtain a cloud ciphertext comparison result includes: if the bit is 0, then using the encrypted space modulus + all The first ciphertext data-the second ciphertext data, the corresponding cloud ciphertext comparison result is obtained; if the bit is 1, the encrypted space modulus+the second ciphertext data-the first ciphertext data is used. The ciphertext data is obtained, and the corresponding cloud ciphertext comparison result is obtained.
  • the method further includes: if the user data comes from different users, performing extended encryption on the encrypted space modulus of the first ciphertext data and the second ciphertext data.
  • the cloud ciphertext comparison result is calculated on the cloud server, and the client ciphertext comparison result is calculated on the user end.
  • the security of the data is guaranteed, and when the user data is ciphertext data, the two data are compared to determine the numerical value of the data.
  • a third aspect of the present invention provides a data security comparison protocol implementation system, comprising: a data acquisition module for acquiring public parameters of an operating system where machine learning is located, and for acquiring a user's public key and private key; a public key encryption module for The first plaintext data and the second plaintext data of the user data are encrypted using the public parameters and the public key to obtain the first ciphertext data and the second ciphertext data; an uploading module is used to encrypt the first ciphertext data and the second ciphertext data; The data and the second ciphertext data are uploaded to the cloud server; the cloud computing module is used to calculate the cloud ciphertext comparison result according to the first ciphertext data and the second ciphertext data; the client computing module is used for receiving the cloud ciphertext comparison result, and calculating the client ciphertext comparison result according to the cloud ciphertext comparison result; the comparison module is configured to compare the cloud ciphertext comparison result and the client ciphertext comparison result according to the cloud ciphertext comparison
  • the data security comparison protocol implementation system calculates the cloud ciphertext comparison result on the cloud server and calculates the client ciphertext comparison result on the user end, all of which are based on ciphertext data and do not involve plaintext data.
  • the security of the data is guaranteed, and when the user data is ciphertext data, the two data are compared to determine the numerical value of the data.
  • a fourth aspect of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, when the processor executes the computer program, the above-mentioned computer program is implemented Any one of the data security comparison protocol implementation methods.
  • a fifth aspect of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements any one of the data security comparison protocol implementation methods described above.
  • FIG. 1 is a flowchart of a method for implementing a data security comparison protocol applied to a client according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for implementing a data security comparison protocol applied to a cloud server according to an embodiment of the present invention
  • FIG. 3 is a schematic structural block diagram of a data security comparison protocol implementation system according to an embodiment of the present invention.
  • FIG. 4 is a schematic block diagram of the structure of an electronic device according to an embodiment of the present invention.
  • FIG. 1 is a method for implementing a data security comparison protocol, which is applied to a client, including: S11, obtaining public parameters of the operating system where the machine learning is located, and obtaining the public key and private key of the user; S12, using the public parameters and the public key is the first plaintext data and the second plaintext data of the user data to be encrypted to obtain the first ciphertext data and the second ciphertext data; S13, upload the first ciphertext data and the second ciphertext data to the cloud server S14, obtain the cloud ciphertext comparison result to the first ciphertext data and the second ciphertext data output by the cloud server; S15, calculate the client ciphertext comparison result according to the comparison result; S16, according to the cloud ciphertext comparison result and the user The end-ciphertext comparison result compares the sizes of the first plaintext data and the second plaintext data.
  • the method for implementing a data security comparison protocol provided by this embodiment, by computing the cloud ciphertext comparison result on the cloud server and computing the client ciphertext comparison result on the client side, all are calculated based on the ciphertext data and do not involve plaintext data, Therefore, the security of the data is guaranteed, and when the user data is ciphertext data, the two data are compared to determine the numerical value of the data.
  • calculating the ciphertext comparison result of the client side according to the comparison result includes: decrypting the cloud ciphertext comparison result using a private key; expanding the bits of the encrypted cloud ciphertext comparison result. If the bit component is 0, the ciphertext comparison result at the user end is 0. If If the bit component is 1, the result of the ciphertext comparison at the user end is 1.
  • comparing the size of the data according to the cloud ciphertext comparison result and the client ciphertext comparison result includes: if the cloud ciphertext comparison result and the client ciphertext comparison result are both 0 or both are 1, then determining The first plaintext data is less than or equal to the second plaintext data; if one of the cloud ciphertext comparison result and the client ciphertext comparison result is 0 and the other is 1, it is determined that the first plaintext data is greater than or equal to the second plaintext data.
  • the method further includes: if the user data comes from different users, obtaining public keys and private keys of different users respectively, and encrypting the user's plaintext data according to the public keys and public parameters corresponding to the users.
  • the encrypted data of different users can be used in subsequent steps to realize the communication between different users. data security comparison.
  • an embodiment of the present application further provides a method for implementing a data security comparison protocol, which is applied to a cloud server, and includes: S21 .
  • the second ciphertext data the user's public key
  • S22 encrypt the plaintext space modulus on the basis of the public key to obtain the encrypted space modulus
  • S23 randomly select one of 0 and 1 as a bit, and use the encrypted space modulus Calculate the number, the first ciphertext data, and the second ciphertext data to obtain a cloud ciphertext comparison result
  • S24 send the cloud ciphertext comparison result to the client.
  • using the encrypted spatial modulus, the first ciphertext data, and the second ciphertext data to perform calculation, and obtaining the cloud ciphertext comparison result includes: if the bit is 0, then using the encrypted spatial modulus + the first ciphertext Data - the second ciphertext data to obtain the corresponding cloud ciphertext comparison result; if the bit is 1, use the encrypted space modulus + the second ciphertext data - the first ciphertext data to obtain the corresponding cloud ciphertext comparison result.
  • the method further includes: if the user data comes from different users, performing extended encryption on the encrypted space modulus of the first ciphertext data and the second ciphertext data.
  • encrypted data of different users can be used to realize data security comparison between different users.
  • the client is based on the CZW-type multi-key fully homomorphic encryption scheme, uses the CZW.Setup algorithm to output the public parameters of the operating system, runs the CZW.KGen algorithm to output the user's public key and private key, and specifically defines the user U 1 , U
  • the public and private key pairs of 2 are Run the CZW.Enc algorithm to calculate the ciphertext corresponding to the plaintext. Assuming that the plaintext data ⁇ 1 and ⁇ 2 come from the user terminals U 1 and U 2 respectively, the public keys of U 1 and U 2 are used respectively. Encrypt to obtain the first ciphertext and the second ciphertext d 1 , d 2 .
  • the cloud server is still based on the CZW-type multi-key fully homomorphic encryption scheme.
  • the cloud server runs the algorithm CZW.Enc in the public key.
  • encrypt the plaintext space modulus p and output the encrypted space modulus c(p);
  • the security comparison of the user's data can be performed by removing the step of extending the first ciphertext data and the second ciphertext data in the cloud server in the above process.
  • an embodiment of the present application also provides a data security comparison protocol implementation system, including: a data acquisition module 1, a public key encryption module 2, an upload module 3, a cloud computing module 4, a client computing module 5, and a comparison module 6;
  • the data acquisition module 1 is used to acquire the public parameters of the operating system where the machine learning is located, and to acquire the public key and private key of the user;
  • the public key encryption module 2 is used to use the public parameters and the public key as the first plaintext data and the public key of the user data.
  • the second plaintext data is encrypted to obtain the first ciphertext data and the second ciphertext data;
  • the uploading module 3 is used for uploading the first ciphertext data and the second ciphertext data to the cloud server;
  • the cloud computing module 4 For calculating the cloud ciphertext comparison result according to the first ciphertext data and the second ciphertext data;
  • the client computing module 5 is used to receive the cloud ciphertext comparison result, and calculate the client ciphertext comparison result according to the cloud ciphertext comparison result;
  • the comparison module 6 is configured to compare the sizes of the first plaintext data and the second plaintext data according to the cloud ciphertext comparison result and the client ciphertext comparison result.
  • the cloud ciphertext comparison result is calculated on the cloud server, and the client ciphertext comparison result is calculated on the user end, all of which are calculated based on ciphertext data and do not involve plaintext data. Therefore, the security of the data is guaranteed, and when the user data is ciphertext data, the two user data are compared to determine the numerical value of the data.
  • the cloud computing module 4 includes: a first data acquisition unit, a plaintext space modulus encryption unit, a cloud ciphertext calculation and comparison unit, and a cloud ciphertext transmission unit;
  • the first data acquisition unit is configured to acquire data according to the first plaintext
  • the data and the second plaintext data are encrypted to obtain the first ciphertext data, the second ciphertext data, and the user's public key;
  • the plaintext space modulus encryption unit is used to encrypt the plaintext space modulus on the basis of the public key to obtain the encrypted Spatial modulus;
  • the cloud ciphertext calculation and comparison unit randomly selects one of 0 and 1 as a bit, and uses the encrypted spatial modulus, the first ciphertext data and the second ciphertext data for calculation, and obtains the cloud ciphertext comparison result;
  • the text sending unit sends the cloud cipher text comparison result to the client.
  • the cloud ciphertext calculation and comparison unit includes: a judging subunit for judging whether the value of the bit is 0 or 1; a comparison subunit for using the encrypted space modulus + the first Ciphertext data - second ciphertext data to obtain the corresponding cloud ciphertext comparison result; when the bit is 1, use the encrypted space modulus + second ciphertext data - first ciphertext data to obtain the corresponding cloud ciphertext compare results.
  • the cloud ciphertext computing and comparing unit further includes: an extended encryption subunit, configured to perform extended encryption on the encrypted space modulus of the first ciphertext data and the second ciphertext data if the user data comes from different users.
  • the client computing module 5 includes: a cloud comparison result acquisition unit, a decryption unit, and a comparison unit, the cloud comparison result acquisition unit is used to acquire the cloud ciphertext comparison result from the cloud server; the decryption unit is used to decrypt using a private key Cloud ciphertext comparison result; the comparison unit is used to expand the bits of the encrypted cloud ciphertext comparison result. If the bit component is 0, the result of the user-side ciphertext comparison is 0. If If the bit component is 1, the result of the ciphertext comparison at the user end is 1.
  • the comparison module 6 includes: an identification unit and a judgment unit; the identification unit is used to identify whether the cloud ciphertext comparison result and the client ciphertext comparison result are 1 or 0; the judgment unit is used for comparing the cloud ciphertext result When the comparison results of the cloud ciphertext and the client ciphertext are both 0 or 1, it is determined that the first plaintext data is less than or equal to the second plaintext data; one of the cloud ciphertext comparison result and the client ciphertext comparison result is 0, and the other When one is 1, it is determined that the first plaintext data is greater than or equal to the second plaintext data.
  • an embodiment of the present application provides an electronic device, please refer to 4, the electronic device includes: a memory 601, a processor 602, and a computer program stored in the memory 601 and executable on the processor 602, and the processor 602 executes the computer program , implement the data security comparison protocol implementation method described above.
  • the electronic device further includes: at least one input device 603 and at least one output device 604.
  • the above-mentioned memory 601 , processor 602 , input device 603 and output device 604 are connected through a bus 605 .
  • the input device 603 may specifically be a camera, a touch panel, a physical button, a mouse, or the like.
  • the output device 604 may specifically be a display screen.
  • the memory 601 may be a high-speed random access memory (RAM, Random Access Memory) memory, or may be a non-volatile memory (non-volatile memory), such as a disk memory.
  • RAM Random Access Memory
  • non-volatile memory such as a disk memory.
  • Memory 601 is used to store a set of executable program codes, and processor 602 is coupled to memory 601 .
  • an embodiment of the present application further provides a computer-readable storage medium, which may be provided in the electronic device in each of the foregoing embodiments, and the computer-readable storage medium may be the foregoing memory 601.
  • a computer program is stored on the computer-readable storage medium, and when the program is executed by the processor 602, the implementation method of the data security comparison protocol described in the foregoing embodiment is implemented.
  • the computer-storable medium may also be a U disk, a removable hard disk, a read-only memory 601 (ROM, Read-Only Memory), a RAM, a magnetic disk or an optical disk and other mediums that can store program codes.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • the disclosed apparatus and method may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative.
  • the division of the modules is only a logical function division. In actual implementation, there may be other division methods.
  • multiple modules or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or modules, and may be in electrical, mechanical or other forms.
  • modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically alone, or two or more modules may be integrated into one module.
  • the above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules.
  • the integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may be stored in a computer-readable storage medium.
  • the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

一种数据安全比较协议实现方法、***、电子装置及存储介质,所述方法包括:获取机器学习所在操作***的公共参数,并获取用户的公钥及私钥(S11);使用公共参数及公钥为用户数据的第一明文数据及第二明文数据进行加密,得到第一密文数据及第二密文数据(S12);将第一密文数据及第二密文数据上传至云服务器(S13);获取云服务器输出的对第一密文数据及第二密文数据的云密文比较结果(S14);根据比较结果计算用户端密文比较结果(S15);根据云密文比较结果及用户端密文比较结果对第一明文数据及第二明文数据的大小进行比较(S16);通过对密文数据进行计算,且不涉及明文数据,保障了数据的安全性,且对两个密文数据进行了比较,判断出了数据的数值大小。

Description

数据安全比较协议实现方法、***、电子装置及存储介质 技术领域
本发明涉及数据安全技术领域,尤其涉及一种数据安全比较协议实现方法、***、电子装置及存储介质。
背景技术
随着互联网技术的发展,机器学习具有了长足的进步,机器学习是从海量数据中获取隐藏的、有效的、可理解的知识,被广泛应用于人工智能、疾病诊断、基因测序、犯罪预测等领域。
但是,机器学习需要使用大量的数据进行计算,这些数据的使用,给数据的隐私保护带来了巨大挑战,因此就需要研究如何限定第三方在对用户数据进行机器学习的同时不窥探用户数据隐私。现有的常用做法,是使用同态加密来保护机器学习中的隐私数据,文献“Chen L,Zhang Z,Wang X,et al.Batched Multi-hop Multi-key FHE from Ring-LWE with Compact Ciphertext Extension[C].Theory of Cryptography Conference,2017:597-627”公开了一种CZW型的多密钥全同态加密方案。
但是CZW型的多密钥全同态加密方案不能仅在已知用户数据***息的前提下,判断不同数据的数值大小。
发明内容
本发明的主要目的在于提供一种数据安全比较协议实现方法、***、电子装置及存储介质,旨在解决现有技术中多密钥全同态加密方案不能仅在已知用户数据***息的前提下,判断不同数据的数值大小的技术问题。
为实现上述目的,本发明第一方面提供一种数据安全比较协议实现方法,包括:获取机器学习所在操作***的公共参数,并获取用户的公钥及私钥;使 用所述公共参数及所述公钥为用户数据的第一明文数据及第二明文数据进行加密,得到第一密文数据及第二密文数据;将所述第一密文数据及所述第二密文数据上传至云服务器;获取云服务器输出的对所述第一密文数据及所述第二密文数据的云密文比较结果;根据所述比较结果计算用户端密文比较结果;根据所述云密文比较结果及所述用户端密文比较结果对第一明文数据及第二明文数据的大小进行比较。
进一步地,根据所述比较结果计算用户端密文比较结果包括:使用所述私钥解密所述云密文比较结果;将加密后的云密文比较结果的比特展开,若展开后第
Figure PCTCN2020126648-appb-000001
位分量为0,则使得用户端密文比较结果为0,若
Figure PCTCN2020126648-appb-000002
位分量为1,则使得用户端密文比较结果为1。
进一步地,所述根据所述云密文比较结果及所述用户端密文比较结果对数据的大小进行比较包括:若所述云密文比较结果及所述用户端密文比较结果均为0或均为1,则判定第一明文数据小于或等于第二明文数据;若所述云密文比较结果及所述用户端密文比较结果的其中一个为0,另一个为1,则判定第一明文数据大于或等于第二明文数据。
进一步地,所述方法还包括:若所述用户数据来自不同用户,则分别获取不同用户的公钥及私钥,并根据用户对应的公钥及公共参数为该用户的明文数据进行加密。
本发明第二方面提供一种数据安全比较协议实现方法,包括:获取根据第一明文数据及第二明文数据进行加密得到第一密文数据及第二密文数据、用户的公钥;在公钥的基础上对明文空间模数进行加密,得到加密空间模数;在0和1内随机选择一个作为比特,使用所述加密空间模数、第一密文数据及第二密文数据进行计算,得到云密文比较结果;将所述云密文比较结果发送至用户端。
进一步地,所述使用所述加密空间模数、第一密文数据及第二密文数据进 行计算,得到云密文比较结果包括:若比特为0,则使用所述加密空间模数+所述第一密文数据-所述第二密文数据,得到对应的云密文对比结果;若比特为1,则使用所述加密空间模数+所述第二密文数据-所述第一密文数据,得到对应的云密文对比结果。
进一步地,所述方法还包括:若所述用户数据来自不同用户,则对所述第一密文数据、所述第二密文数据所述加密空间模数进行扩展加密。
本发明提供的数据安全比较协议实现方法,通过在云服务器计算云密文比较结果,以及在用户端计算用户端密文比较结果,全部是基于密文数据进行计算的,不涉及明文数据,因此保障了数据的安全性,且在用户数据为密文数据的情况下,对两个数据进行了比较,判断出了数据的数值大小。
本发明第三方面提供一种数据安全比较协议实现***,包括:数据获取模块,用于获取机器学习所在操作***的公共参数,并获取用户的公钥及私钥;公钥加密模块,用于使用所述公共参数及所述公钥为用户数据的第一明文数据及第二明文数据进行加密,得到第一密文数据及第二密文数据;上传模块,用于将所述第一密文数据及所述第二密文数据上传至云服务器;云计算模块,用于根据所述第一密文数据及所述第二密文数据计算云密文比较结果;用户端计算模块,用于接收所述云密文比较结果,并根据所述云密文比较结果计算用户端密文比较结果;比较模块,用于根据所述云密文比较结果及所述用户端密文比较结果对第一密文数据及第二密文数据的大小进行比较。
本发明提供的数据安全比较协议实现***,通过在云服务器计算云密文比较结果,以及在用户端计算用户端密文比较结果,全部是基于密文数据进行计算的,不涉及明文数据,因此保障了数据的安全性,且在用户数据为密文数据的情况下,对两个数据进行了比较,判断出了数据的数值大小。
本发明第四方面提供一种电子装置,包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机 程序时,实现上述中的任意一项所述数据安全比较协议实现方法。
本发明第五方面提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时,实现上述中的任意一项所述数据安全比较协议实现方法。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例应用于客户端的数据安全比较协议实现方法的流程图;
图2为本发明实施例应用于云服务器的数据安全比较协议实现方法的流程图;
图3为本发明实施例数据安全比较协议实现***的结构示意框图;
图4为本发明实施例电子装置的结构示意框图。
具体实施方式
为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而非全部实施例。基于本发明中的实施例,本领域技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
请参阅图1,为一种数据安全比较协议实现方法,其应用于客户端,包括:S11、获取机器学习所在操作***的公共参数,并获取用户的公钥及私钥;S12、使用公共参数及公钥为用户数据的第一明文数据及第二明文数据进行加密,得到第一密文数据及第二密文数据;S13、将第一密文数据及第二密文数据上传至云服务器;S14、获取云服务器输出的对第一密文数据及第二密文数据的云密 文比较结果;S15、根据比较结果计算用户端密文比较结果;S16、根据云密文比较结果及用户端密文比较结果对第一明文数据及第二明文数据的大小进行比较。
本实施例提供的数据安全比较协议实现方法,通过在云服务器计算云密文比较结果,以及在用户端计算用户端密文比较结果,全部是基于密文数据进行计算的,不涉及明文数据,因此保障了数据的安全性,且在用户数据为密文数据的情况下,对两个数据进行了比较,判断出了数据的数值大小。
在一个实施例中,根据比较结果计算用户端密文比较结果包括:使用私钥解密云密文比较结果;将加密后的云密文比较结果的比特展开,若展开后第
Figure PCTCN2020126648-appb-000003
位分量为0,则使得用户端密文比较结果为0,若
Figure PCTCN2020126648-appb-000004
位分量为1,则使得用户端密文比较结果为1。
在一个实施例中,根据云密文比较结果及用户端密文比较结果对数据的大小进行比较包括:若云密文比较结果及用户端密文比较结果均为0或均为1,则判定第一明文数据小于或等于第二明文数据;若云密文比较结果及用户端密文比较结果的其中一个为0,另一个为1,则判定第一明文数据大于或等于第二明文数据。
在一个实施例中,方法还包括:若用户数据来自不同用户,则分别获取不同用户的公钥及私钥,并根据用户对应的公钥及公共参数为该用户的明文数据进行加密。
通过获取不同用户的公钥及私钥,并根据用户对应的公钥及公共参数为该用户的明文数据进行加密后,能够在后续的步骤中,使用不同用户的加密数据,实现不同用户之间的数据安全比较。
请参阅图2,本申请实施例还提供一种数据安全比较协议实现方法,其应用于云服务器,包括:S21、获取根据第一明文数据及第二明文数据进行加密得到第一密文数据及第二密文数据、用户的公钥;S22、在公钥的基础上对明文空 间模数进行加密,得到加密空间模数;S23、在0和1内随机选择一个作为比特,使用加密空间模数、第一密文数据及第二密文数据进行计算,得到云密文比较结果;S24、将云密文比较结果发送至用户端。
在一个实施例中,使用加密空间模数、第一密文数据及第二密文数据进行计算,得到云密文比较结果包括:若比特为0,则使用加密空间模数+第一密文数据-第二密文数据,得到对应的云密文对比结果;若比特为1,则使用加密空间模数+第二密文数据-第一密文数据,得到对应的云密文对比结果。
在一个实施例中,方法还包括:若用户数据来自不同用户,则对第一密文数据、第二密文数据加密空间模数进行扩展加密。
通过对第一密文数据、第二密文数据加密空间模数进行扩展加密,能够在后续的步骤中,使用不同用户的加密数据,实现不同用户之间的数据安全比较。
在上述实施例中,云服务器及用户端的交互实现过程总体为:
客户端以CZW型的多密钥全同态加密方案为基础,使用CZW.Setup算法输出操作***的公共参数,运行CZW.KGen算法输出用户公钥及私钥,特别地定义用户U 1,U 2的公私钥对分别为
Figure PCTCN2020126648-appb-000005
运行CZW.Enc算法计算明文所对应的密文,假定明文数据μ 12分别来自用户端U 1,U 2,则分别使用U 1,U 2的公钥
Figure PCTCN2020126648-appb-000006
加密,得到第一密文及第二密文d 1,d 2
云服务器依然以CZW型的多密钥全同态加密方案为基础,云服务器运行算法CZW.Enc在公钥
Figure PCTCN2020126648-appb-000007
下对明文空间模数p加密,输出加密空间模数c(p);随后云服务器运行算法CZW.CTExt扩展d 1,d 2,c(p)为
Figure PCTCN2020126648-appb-000008
随后云服务器随机选取比特b∈{0,1},若b=0,则计算
Figure PCTCN2020126648-appb-000009
若b=1,则计算
Figure PCTCN2020126648-appb-000010
Figure PCTCN2020126648-appb-000011
并在计算后将云密文对比结果
Figure PCTCN2020126648-appb-000012
发送给用户端U 1,U 2
用户端U 1,U 2收到云密文对比结果
Figure PCTCN2020126648-appb-000013
后,利用各自私钥
Figure PCTCN2020126648-appb-000014
调用算法CZW.Dec,解密后执行同态加法得对应的明文
Figure PCTCN2020126648-appb-000015
Figure PCTCN2020126648-appb-000016
并将其比特展开。若h比特展开后的第
Figure PCTCN2020126648-appb-000017
位分量为0, 则令v=0;若h比特展开后的第
Figure PCTCN2020126648-appb-000018
位分量为1,则令v=1,并将v的值发送给云服务器。
云服务器根据上述步骤中b的取值以及v的值,确定明文距离μ 12的大小。若b=0,v=0或b=1,v=1,判定μ 1≤μ 2;若b=0,v=1或b=1,v=0,判定μ 1≥μ 2
若数据来自同一用户,对该用户的数据的安全比较,则去除上述过程中的云服务器内为第一密文数据及第二密文数据扩展的步骤即可。
请参阅图3,本申请实施例还提供一种数据安全比较协议实现***,包括:数据获取模块1、公钥加密模块2、上传模块3、云计算模块4、用户端计算模块5及比较模块6;数据获取模块1用于获取机器学习所在操作***的公共参数,并获取用户的公钥及私钥;公钥加密模块2用于使用公共参数及公钥为用户数据的第一明文数据及第二明文数据进行加密,得到第一密文数据及第二密文数据;上传模块3,上传模块3用于将第一密文数据及第二密文数据上传至云服务器;云计算模块4用于根据第一密文数据及第二密文数据计算云密文比较结果;用户端计算模块5用于接收云密文比较结果,并根据云密文比较结果计算用户端密文比较结果;比较模块6用于根据云密文比较结果及用户端密文比较结果对第一明文数据及第二明文数据的大小进行比较。
本实施例提供的数据安全比较协议实现***,通过在云服务器计算云密文比较结果,以及在用户端计算用户端密文比较结果,全部是基于密文数据进行计算的,不涉及明文数据,因此保障了数据的安全性,且在用户数据为密文数据的情况下,对两个用户数据进行了比较,判断出了数据的数值大小。
在一个实施例中,云计算模块4包括:第一数据获取单元、明文空间模数加密单元、云密文计算比较单元及云密文发送单元;第一数据获取单元用于获取根据第一明文数据及第二明文数据进行加密得到第一密文数据及第二密文数据、用户的公钥;明文空间模数加密单元用于在公钥的基础上对明文空间模数 进行加密,得到加密空间模数;云密文计算比较单元在0和1内随机选择一个作为比特,使用加密空间模数、第一密文数据及第二密文数据进行计算,得到云密文比较结果;云密文发送单元将云密文比较结果发送至用户端。
在一个实施例中,云密文计算比较单元包括:判断子单元,用于判断比特的值是否为0或1;对比子单元,用于在比特为0时,使用加密空间模数+第一密文数据-第二密文数据,得到对应的云密文对比结果;在比特为1时,则使用加密空间模数+第二密文数据-第一密文数据,得到对应的云密文对比结果。
在一个实施例中,云密文计算比较单元还包括:扩展加密子单元,用于若用户数据来自不同用户,则对第一密文数据、第二密文数据加密空间模数进行扩展加密。
在一个实施例中,用户端计算模块5包括:云比较结果获取单元、解密单元及比较单元,云比较结果获取单元用于从云服务器获取云密文比较结果;解密单元用于使用私钥解密云密文比较结果;比较单元用于将加密后的云密文比较结果的比特展开,若展开后第
Figure PCTCN2020126648-appb-000019
位分量为0,则使得用户端密文比较结果为0,若
Figure PCTCN2020126648-appb-000020
位分量为1,则使得用户端密文比较结果为1。
在一个实施例中,比较模块6包括:识别单元及判断单元;识别单元用于识别云密文比较结果及用户端密文比较结果是否为1或0;判断单元用于在云密文比较结果及用户端密文比较结果均为0或均为1时,则判定第一明文数据小于或等于第二明文数据;在云密文比较结果及用户端密文比较结果的其中一个为0,另一个为1时,则判定第一明文数据大于或等于第二明文数据。
本申请实施例提供一种电子装置,请参阅4,该电子装置包括:存储器601、处理器602及存储在存储器601上并可在处理器602上运行的计算机程序,处理器602执行该计算机程序时,实现前述中描述的数据安全比较协议实现方法。
进一步的,该电子装置还包括:至少一个输入设备603以及至少一个输出 设备604。
上述存储器601、处理器602、输入设备603以及输出设备604,通过总线605连接。
其中,输入设备603具体可为摄像头、触控面板、物理按键或者鼠标等等。输出设备604具体可为显示屏。
存储器601可以是高速随机存取记忆体(RAM,Random Access Memory)存储器,也可为非不稳定的存储器(non-volatile memory),例如磁盘存储器。存储器601用于存储一组可执行程序代码,处理器602与存储器601耦合。
进一步的,本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质可以是设置于上述各实施例中的电子装置中,该计算机可读存储介质可以是前述中的存储器601。该计算机可读存储介质上存储有计算机程序,该程序被处理器602执行时实现前述实施例中描述的数据安全比较协议实现方法。
进一步的,该计算机可存储介质还可以是U盘、移动硬盘、只读存储器601(ROM,Read-Only Memory)、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者 也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。
所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本发明所必须的。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。
以上为对本发明所提供的一种数据安全比较协议实现方法、***、电子装置及存储介质的描述,对于本领域的技术人员,依据本发明实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上,本说明书内容不应理解为 对本发明的限制。

Claims (10)

  1. 一种数据安全比较协议实现方法,其特征在于,包括:
    获取机器学习所在操作***的公共参数,并获取用户的公钥及私钥;
    使用所述公共参数及所述公钥为用户数据的第一明文数据及第二明文数据进行加密,得到第一密文数据及第二密文数据;
    将所述第一密文数据及所述第二密文数据上传至云服务器;
    获取云服务器输出的对所述第一密文数据及所述第二密文数据的云密文比较结果;
    根据所述比较结果计算用户端密文比较结果;
    根据所述云密文比较结果及所述用户端密文比较结果对第一明文数据及第二明文数据的大小进行比较。
  2. 根据权利要求1所述的数据安全比较协议实现方法,其特征在于,
    所述根据所述比较结果计算用户端密文比较结果包括:
    使用所述私钥解密所述云密文比较结果;
    将加密后的云密文比较结果的比特展开,若展开后第
    Figure PCTCN2020126648-appb-100001
    位分量为0,则使得用户端密文比较结果为0,若
    Figure PCTCN2020126648-appb-100002
    位分量为1,则使得用户端密文比较结果为1。
  3. 根据权利要求2所述的数据安全比较协议实现方法,其特征在于,
    所述根据所述云密文比较结果及所述用户端密文比较结果对数据的大小进行比较包括:
    若所述云密文比较结果及所述用户端密文比较结果均为0或均为1,则判定第一明文数据小于或等于第二明文数据;
    若所述云密文比较结果及所述用户端密文比较结果的其中一个为0,另一个为1,则判定第一明文数据大于或等于第二明文数据。
  4. 根据权利要求1所述的数据安全比较协议实现方法,其特征在于,
    所述方法还包括:
    若所述用户数据来自不同用户,则分别获取不同用户的公钥及私钥,并根据用户对应的公钥及公共参数为该用户的明文数据进行加密。
  5. 一种数据安全比较协议实现方法,其特征在于,包括:
    获取根据第一明文数据及第二明文数据进行加密得到第一密文数据及第二密文数据、用户的公钥;
    在公钥的基础上对明文空间模数进行加密,得到加密空间模数;
    在0和1内随机选择一个作为比特,使用所述加密空间模数、第一密文数据及第二密文数据进行计算,得到云密文比较结果;
    将所述云密文比较结果发送至用户端。
  6. 根据权利要求5所述的数据安全比较协议实现方法,其特征在于,
    使用所述加密空间模数、第一密文数据及第二密文数据进行计算,得到云密文比较结果包括:
    若比特为0,则使用所述加密空间模数+所述第一密文数据-所述第二密文数据,得到对应的云密文对比结果;
    若比特为1,则使用所述加密空间模数+所述第二密文数据-所述第一密文数据,得到对应的云密文对比结果。
  7. 根据权利要求5所述的数据安全比较协议实现方法,其特征在于,
    所述方法还包括:
    若所述用户数据来自不同用户,则对所述第一密文数据、所述第二密文数据所述加密空间模数进行扩展加密。
  8. 一种数据安全比较协议实现***,其特征在于,包括:
    数据获取模块,用于获取机器学习所在操作***的公共参数,并获取用户的公钥及私钥;
    公钥加密模块,用于使用所述公共参数及所述公钥为用户数据的第一明文数据及第二明文数据进行加密,得到第一密文数据及第二密文数据;
    上传模块,用于将所述第一密文数据及所述第二密文数据上传至云服务器;
    云计算模块,用于根据所述第一密文数据及所述第二密文数据计算云密文比较结果;
    用户端计算模块,用于接收所述云密文比较结果,并根据所述云密文比较结果计算用户端密文比较结果;
    比较模块,用于根据所述云密文比较结果及所述用户端密文比较结果对第一明文数据及第二明文数据的大小进行比较。
  9. 一种电子装置,包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时,实现权利要求1至7中的任意一项所述方法。
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时,实现权利要求1至7中的任意一项所述方法。
PCT/CN2020/126648 2020-11-05 2020-11-05 数据安全比较协议实现方法、***、电子装置及存储介质 WO2022094829A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/126648 WO2022094829A1 (zh) 2020-11-05 2020-11-05 数据安全比较协议实现方法、***、电子装置及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/126648 WO2022094829A1 (zh) 2020-11-05 2020-11-05 数据安全比较协议实现方法、***、电子装置及存储介质

Publications (1)

Publication Number Publication Date
WO2022094829A1 true WO2022094829A1 (zh) 2022-05-12

Family

ID=81456867

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/126648 WO2022094829A1 (zh) 2020-11-05 2020-11-05 数据安全比较协议实现方法、***、电子装置及存储介质

Country Status (1)

Country Link
WO (1) WO2022094829A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106022360A (zh) * 2016-05-11 2016-10-12 蒋林智 一种统计学习中基于密文的数据二分类方法
CN109246098A (zh) * 2018-08-31 2019-01-18 桂林电子科技大学 一种支持备份服务器同步密文比较的方法
CN110309674A (zh) * 2019-07-04 2019-10-08 浙江理工大学 一种基于全同态加密的排序方法
CN110445797A (zh) * 2019-08-15 2019-11-12 湖北工业大学 一种具有隐私保护的两方多维数据比较方法和***
US20200280430A1 (en) * 2019-02-28 2020-09-03 Sap Se Efficient Cloud-Based Secure Computation of the Median Using Homomorphic Encryption

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106022360A (zh) * 2016-05-11 2016-10-12 蒋林智 一种统计学习中基于密文的数据二分类方法
CN109246098A (zh) * 2018-08-31 2019-01-18 桂林电子科技大学 一种支持备份服务器同步密文比较的方法
US20200280430A1 (en) * 2019-02-28 2020-09-03 Sap Se Efficient Cloud-Based Secure Computation of the Median Using Homomorphic Encryption
CN110309674A (zh) * 2019-07-04 2019-10-08 浙江理工大学 一种基于全同态加密的排序方法
CN110445797A (zh) * 2019-08-15 2019-11-12 湖北工业大学 一种具有隐私保护的两方多维数据比较方法和***

Similar Documents

Publication Publication Date Title
CN111049650B (zh) 一种基于sm2算法的协同解密方法及装置、***、介质
CN107145791B (zh) 一种具有隐私保护的K-means聚类方法及***
CN111130803B (zh) 数字签名的方法、***及装置
CN111162906B (zh) 一种基于茫然传输算法的协同秘密分享方法及装置、***、介质
CN111162894B (zh) 具有隐私保护的外包云存储医疗数据聚合的统计分析方法
WO2022155811A1 (zh) 多接收者代理重加密方法、***、电子装置及存储介质
WO2016088453A1 (ja) 暗号化装置、復号装置、暗号処理システム、暗号化方法、復号方法、暗号化プログラム、及び復号プログラム
Mewada et al. Classification of efficient symmetric key cryptography algorithms
CN104158880A (zh) 一种用户端云数据共享解决方法
Agrawal et al. Elliptic curve cryptography with hill cipher generation for secure text cryptosystem
Abdul Hussien et al. [Retracted] A Secure Environment Using a New Lightweight AES Encryption Algorithm for E‐Commerce Websites
WO2024109149A1 (zh) 一种隐私保护的主成分分析方法及***
WO2020018454A1 (en) Cryptography operations for secure post-quantum communications
Khatarkar et al. A survey and performance analysis of various RSA based encryption techniques
CN114039785A (zh) 数据加密、解密、处理方法、装置、设备和存储介质
CN111555880A (zh) 数据碰撞方法、装置、存储介质及电子设备
Olumide et al. A hybrid encryption model for secure cloud computing
CN110198216B (zh) 一种保护隐私的增量真值发现方法、装置、计算机设备及存储介质
US11101981B2 (en) Generating a pseudorandom number based on a portion of shares used in a cryptographic operation
CN113098675A (zh) 基于多项式完全同态的二进制数据加密***及方法
WO2020042023A1 (zh) 一种即时通信的数据加密方法及装置
CN113556225A (zh) 一种基于哈希及密钥交换的高效psi方法
US20170302444A1 (en) System and methods for keyed communications channel encryption and decryption
WO2022094829A1 (zh) 数据安全比较协议实现方法、***、电子装置及存储介质
CN113761570B (zh) 一种面向隐私求交的数据交互方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20960291

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20960291

Country of ref document: EP

Kind code of ref document: A1