Localization service method, device, computer equipment and medium for fully homomorphic algorithm

By setting up corresponding service interfaces on the server, localized homomorphic encryption services are implemented, which solves the problems of low computing efficiency and operation complexity of existing homomorphic encryption technologies, and improves the operation efficiency of homomorphic computing.

CN115242373BActive Publication Date: 2025-03-21SHENZHEN DIGITAL CERTIFICATE AUTHORITY CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210853887.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-12
Publication Date
2025-03-21
Estimated Expiration
2042-07-12

AI Technical Summary

Technical Problem

The existing homomorphic encryption technology has bottlenecks in computing efficiency and operational complexity, resulting in fewer applications of homomorphic computing.

Method used

By setting up a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface and a homomorphic decryption service interface on the server side, localized homomorphic encryption services are realized, user service requests are automatically processed, and operation complexity is reduced.

Benefits of technology

It effectively reduces the complexity of user operations, improves the operation efficiency of homomorphic computing, and realizes localized homomorphic encryption services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115242373B_ABST
    Figure CN115242373B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of artificial intelligence technology, and in particular, relates to a localized service method, device, equipment and medium of a fully homomorphic algorithm. The method is applied to a service end provided with a service interface, obtains N service requests, determines the service type of each service request, and calls the service interface of the corresponding service type, determines that the service interface whose operating environment meets the preset conditions is a serviceable interface, extracts the to-be-processed data in the service request corresponding to the serviceable interface, executes the corresponding fully homomorphic algorithm to convert the to-be-processed data, and feeds back the conversion result to the initiator of the service request corresponding to the serviceable interface, realizes localized homomorphic encryption service, and adopts the service interface method to directly extract the service request sent by the user, so as to automatically realize the calculation process of the corresponding service request, without the need for the user to operate in sequence to give the trigger calculation instruction, thereby effectively reducing the complexity of the user's operation and improving the user's operation efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application is applicable to the field of artificial intelligence technology, and in particular, relates to a localization service method, device, equipment and medium for a fully homomorphic algorithm. Background Art

[0002] Homomorphic encryption (HE) is a classic problem in the field of cryptography and a key technology for realizing data privacy computing. It has a wide range of application needs and some feasible application solutions in cloud computing, blockchain, privacy computing and other fields. HE refers to an encryption algorithm that satisfies the homomorphic operation property of ciphertext, that is, after the data is homomorphically encrypted, a specific calculation is performed on the ciphertext, and the ciphertext calculation result is equivalent to the plaintext directly performing the same calculation on the plaintext data after the corresponding homomorphic decryption, realizing the "calculable but invisible" data. For data security, HE is not like general encryption schemes that only focus on data storage security. Attackers cannot obtain any information from the ciphertext, and any modification of the encrypted data will cause decryption errors. Homomorphic encryption focuses on data processing security. It provides a function for processing encrypted data, and the original content cannot be known during the processing process. At the same time, the data can be decrypted after the operation to obtain the processed result. At present, the performance of traditional fully homomorphic encryption (FHE) is relatively low, such as the high expansion rate of computing data, the large size of keys and ciphertext data, resulting in extremely low computing efficiency, which in turn results in relatively few homomorphic applications. The main bottlenecks are data security, data type, calculation type, calculation accuracy, calculation depth, and calculation performance. The goal of the CKKS algorithm in the homomorphic algorithm is to perform approximate calculations, support homomorphic operations of floating-point addition and multiplication for real or complex numbers, and the calculation results obtained are approximate values, which are suitable for scenarios that do not require precise results such as machine learning model training. However, for client users, the process of implementing homomorphic calculations requires users to constantly interact with the end running the homomorphic algorithm, including triggering key generation, sending data, obtaining encryption and decryption data, and comparing calculation results. The operation process is relatively complicated, resulting in low efficiency of the entire calculation process. Therefore, how to reasonably configure the automation process to reduce the complexity of operations and improve the operational efficiency of homomorphic calculations has become an urgent problem to be solved. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a localized service method, apparatus, device and medium for a fully homomorphic algorithm to solve the problem of how to reasonably configure the automation process to reduce the operational complexity and improve the operational efficiency of homomorphic computing.

[0004] In a first aspect, an embodiment of the present application provides a localization service method of a fully homomorphic algorithm, the localization service method is applied to a server, the server is provided with a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface and a homomorphic decryption service interface, the localization service method includes:

[0005] Obtain N service requests, and determine the service type corresponding to each service request, where the service type includes key generation, homomorphic encryption, homomorphic computing, and homomorphic decryption, and N is an integer greater than zero;

[0006] According to the service type of each service request, call the service interface of the corresponding service type;

[0007] Detect whether the operating environment of the service interface corresponding to each service request meets the preset conditions, and determine that the service interface whose operating environment meets the preset conditions is a serviceable interface;

[0008] Extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, obtain the conversion result, and feed back the conversion result to the initiator of the service request corresponding to the serviceable interface.

[0009] In one embodiment, the homomorphic computing service interface includes a first addition sub-interface and a second addition sub-interface for addition computing, the first addition sub-interface is used to perform homomorphic addition of ciphertext and ciphertext, and the second addition sub-interface is used to perform homomorphic addition of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0010] If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request;

[0011] When it is detected that the calculation method of the homomorphic calculation in the service request is addition calculation, detecting the format of the data to be processed in the service request;

[0012] If the format of the data to be processed in the service request is ciphertext, the first addition sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second addition sub-interface is called.

[0013] In one embodiment, the homomorphic computing service interface includes a first subtraction subinterface and a second subtraction subinterface for subtraction calculation, the first subtraction subinterface is used to perform homomorphic subtraction between ciphertext and ciphertext, and the second subtraction subinterface is used to perform homomorphic subtraction between ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0014] If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request;

[0015] When detecting that the calculation method of the homomorphic calculation in the service request is a subtraction calculation, detecting the format of the data to be processed in the service request;

[0016] If the format of the data to be processed in the service request is ciphertext, the first subtraction sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second subtraction sub-interface is called.

[0017] In one embodiment, the homomorphic computing service interface includes a first multiplication sub-interface and a second multiplication sub-interface for multiplication calculation, the first multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and ciphertext, and the second multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0018] If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request;

[0019] When detecting that the calculation method of the homomorphic calculation in the service request is multiplication calculation, detecting the format of the data to be processed in the service request;

[0020] If the format of the data to be processed in the service request is ciphertext, the first multiplication sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second multiplication sub-interface is called.

[0021] In one embodiment, a rescaling service interface is further provided in the server, and if the first multiplication sub-interface or the second multiplication sub-interface is the serviceable interface, executing the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed includes:

[0022] Using the first multiplication sub-interface or the second multiplication sub-interface, perform a multiplication calculation on the data to be processed to obtain a multiplication calculation result;

[0023] Before the multiplication result is calculated again using the first multiplication sub-interface or the second multiplication sub-interface, the rescaling service interface is called to rescale the multiplication settlement result, and the result of the rescaling calculation is used to update the multiplication result.

[0024] In one embodiment, the homomorphic computing service interface includes a first division sub-interface and a second division sub-interface for division calculation, the first division sub-interface is used to perform homomorphic division of ciphertext and ciphertext, and the second division sub-interface is used to perform homomorphic division of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0025] If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request;

[0026] When detecting that the calculation method of the homomorphic calculation in the service request is a division calculation, detecting the format of the data to be processed in the service request;

[0027] If the format of the data to be processed in the service request is ciphertext, the first division sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second division sub-interface is called.

[0028] In one embodiment, the server is further provided with an initialization service interface. If the serviceable interface is a key generation service interface, the data to be processed in the service request corresponding to the serviceable interface is extracted, and the corresponding fully homomorphic algorithm is executed in the serviceable interface to convert the data to be processed, and before obtaining the conversion result, it also includes:

[0029] Calling the initialization service interface to generate initialization parameters, and using the initialization parameters as to-be-processed data for a service request corresponding to the key generation service interface;

[0030] Extracting the data to be processed in the service request corresponding to the serviceable interface, executing the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, and obtaining the conversion result includes:

[0031] Initializing the key generation algorithm corresponding to the key generation service interface according to the initialization parameters to obtain an initialized key generation algorithm;

[0032] The initialized key generation algorithm is run to generate a key.

[0033] In a second aspect, an embodiment of the present application provides a localized service device for a fully homomorphic algorithm, the localized service device is applied to a server, the server is provided with a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface and a homomorphic decryption service interface, and the localized service device includes:

[0034] A service type determination module, used to obtain N service requests and determine the service type corresponding to each service request, wherein the service types include key generation, homomorphic encryption, homomorphic computing and homomorphic decryption, and N is an integer greater than zero;

[0035] A service interface calling module is used to call the service interface of the corresponding service type according to the service type of each service request;

[0036] An available interface determination module is used to detect whether the operating environment of the service interface corresponding to each service request meets the preset conditions, and determine that the service interface whose operating environment meets the preset conditions is a serviceable interface;

[0037] A service execution module is used to extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, obtain the conversion result, and feed back the conversion result to the initiator of the service request corresponding to the serviceable interface.

[0038] In one embodiment, the homomorphic computing service interface includes a first addition sub-interface and a second addition sub-interface for addition computing, the first addition sub-interface is used to perform homomorphic addition of ciphertext and ciphertext, and the second addition sub-interface is used to perform homomorphic addition of ciphertext and plaintext, and the service interface calling module includes:

[0039] A first method detection unit, configured to detect a computing method of homomorphic computing in the service request if a service request of a service type of homomorphic computing exists in the N service requests;

[0040] A first format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is addition calculation;

[0041] The addition interface calling unit is used to call the first addition sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second addition sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0042] In one embodiment, the homomorphic computing service interface includes a first subtraction sub-interface and a second subtraction sub-interface for subtraction computing, the first subtraction sub-interface is used to perform homomorphic subtraction between ciphertext and ciphertext, and the second subtraction sub-interface is used to perform homomorphic subtraction between ciphertext and plaintext, and the service interface calling module includes:

[0043] A second method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests;

[0044] A second format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a subtraction calculation;

[0045] The subtraction interface calling unit is used to call the first subtraction sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second subtraction sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0046] In one embodiment, the homomorphic computing service interface includes a first multiplication sub-interface and a second multiplication sub-interface for multiplication computing, the first multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and ciphertext, and the second multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and plaintext, and the service interface calling module includes:

[0047] A third method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests;

[0048] A third format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is multiplication calculation;

[0049] The multiplication interface calling unit is used to call the first multiplication sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second multiplication sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0050] In one embodiment, the server is further provided with a rescaling service interface. If the first multiplication sub-interface or the second multiplication sub-interface is the serviceable interface, the service execution module includes:

[0051] A single multiplication calculation unit, used to use the first multiplication sub-interface or the second multiplication sub-interface to perform a multiplication calculation on the data to be processed to obtain a single multiplication calculation result;

[0052] An updating unit is used to call the rescaling service interface to perform a rescaling calculation on the multiplication settlement result before the multiplication calculation result is calculated again using the first multiplication sub-interface or the second multiplication sub-interface, and use the result of the rescaling calculation to update the multiplication calculation result.

[0053] In one embodiment, the homomorphic computing service interface includes a first division sub-interface and a second division sub-interface for division calculation, the first division sub-interface is used to perform homomorphic division of ciphertext and ciphertext, and the second division sub-interface is used to perform homomorphic division of ciphertext and plaintext, and the service interface calling module includes:

[0054] a fourth method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests;

[0055] a fourth format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a division calculation;

[0056] The division interface calling unit is used to call the first division sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second division sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0057] In one embodiment, the server is further provided with an initialization service interface. If the serviceable interface is a key generation service interface, the localization service device further includes:

[0058] An interface initialization module is used to extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, and before obtaining the conversion result, call the initialization service interface to generate initialization parameters, and use the initialization parameters as the data to be processed of the service request corresponding to the key generation service interface;

[0059] The service execution module includes:

[0060] An initialization unit, configured to initialize the key generation algorithm corresponding to the key generation service interface according to the initialization parameters to obtain an initialized key generation algorithm;

[0061] The key generation unit is used to run the initialized key generation algorithm to generate a key.

[0062] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the localization service method as described in the first aspect when executing the computer program.

[0063] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the localization service method as described in the first aspect is implemented.

[0064] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the method of the present application is applied to a server, wherein the server is provided with a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface and a homomorphic decryption service interface, wherein the method obtains N service requests, determines the service type corresponding to each service request, wherein the service type includes key generation, homomorphic encryption, homomorphic computing and homomorphic decryption, and N is an integer greater than zero, and calls the service interface of the corresponding service type according to the service type of each service request, detects whether the operating environment of the service interface corresponding to each service request meets the preset conditions, determines that the service interface whose operating environment meets the preset conditions is a serviceable interface, extracts the to-be-processed data in the service request corresponding to the serviceable interface, executes the corresponding fully homomorphic algorithm in the serviceable interface to convert the to-be-processed data, obtains the conversion result, and feeds back the conversion result to the initiator of the service request corresponding to the serviceable interface, thereby realizing localized homomorphic encryption service, and adopts the above-mentioned service interface to directly extract the service request sent by the user, so as to automatically realize the calculation process of the corresponding service request, without the need for the user to operate in sequence to give the trigger calculation instruction, thereby effectively reducing the complexity of the user operation and improving the user's operation efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0066] Figure 1 This is a schematic diagram of an application environment of a localization service method of a fully homomorphic algorithm provided in Example 1 of the present application;

[0067] Figure 2 It is a flowchart of a localization service method of a fully homomorphic algorithm provided in Example 2 of the present application;

[0068] Figure 3 It is a structural diagram of a localization service device of a fully homomorphic algorithm provided in Example 3 of the present application;

[0069] Figure 4 It is a structural diagram of a computer device provided in Example 4 of the present application. DETAILED DESCRIPTION

[0070] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0071] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0072] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0073] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0074] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0075] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0076] It should be understood that the size of the serial numbers of the steps in the following embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0077] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.

[0078] A localization service method of a fully homomorphic algorithm provided in the first embodiment of the present application can be applied in the following aspects: Figure 1 In an application environment, a client communicates with a server. The client includes but is not limited to a PDA, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud computer device, a personal digital assistant (PDA), and other computer devices. The server can be implemented by an independent server or a server cluster consisting of multiple servers.

[0079] See also Figure 2 , is a flow chart of a localization service method of a fully homomorphic algorithm provided in Embodiment 2 of the present application. The localization service method is applied to Figure 1 The server in the application is equipped with a fully homomorphic algorithm in the computer device corresponding to the server, which can be used for key generation, plaintext encryption, ciphertext decryption, encryption calculation and other service functions. The above service functions are encapsulated as corresponding service interfaces in the server, and the corresponding functions can be realized by calling the interface to execute the algorithm. The server is connected to the client to obtain the service request sent by the client, including the parameters and data in the service request. The server of this application is equipped with a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface and a homomorphic decryption service interface. Figure 2 As shown, the localization service method of the fully homomorphic algorithm may include the following steps:

[0080] Step S201: Obtain N service requests and determine the service type corresponding to each service request.

[0081] In this application, service types include key generation, homomorphic encryption, homomorphic computing and homomorphic decryption, and N is an integer greater than 0. A service request may refer to an instruction sent by a client used by a user, etc., and may vary according to the encapsulation format of the interface. For example, if the interface is encapsulated in Hypertext Transfer Protocol (HTTP), the corresponding service request may be a request in a format recognizable by HTTP, such as a service request in POST format.

[0082] The service request varies according to the service type. When the service types include key generation, homomorphic encryption, homomorphic computing and homomorphic decryption, the service request may include a request for a key generation service, a request for a data encryption service, a request for a data computing service, and a request for a data decryption service. Accordingly, depending on the fully homomorphic algorithm, service requests for other service types may also be set.

[0083] The service type is specified as a parameter in the service request. Each service type has a different corresponding parameter. Therefore, when a service request is obtained, a unique service type can be determined through the corresponding parameter.

[0084] In one embodiment, the fully homomorphic algorithm adopts the CKKS algorithm, which consists of the following seven parts: initialization (Setup), key generation (Key Generation), encryption (Encryption), decryption (Decryption), addition (Addition), multiplication (Multiplication) and rescaling (Rescaling), etc. Correspondingly, the service type is also the above 7 types, and the service request is set according to the above 7 types.

[0085] Step S202: according to the service type of each service request, call the service interface of the corresponding service type.

[0086] In the present application, after determining the service type of each service request, a service interface corresponding to the service type is called to perform the next step.

[0087] There is no limit to the number of service requests in this process, and each service request can call the service through the corresponding service interface. For example, the interface encapsulated by HTTP can support multi-threading, which helps to improve concurrency and support multiple service requests at the same time. Even for the same type of service requests, the corresponding service interface can be called at the same time for service.

[0088] Optionally, the homomorphic computing service interface includes a first addition sub-interface and a second addition sub-interface for addition computing, the first addition sub-interface is used to perform homomorphic addition of ciphertext and ciphertext, and the second addition sub-interface is used to perform homomorphic addition of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0089] If there is a service request whose service type is homomorphic computing among the N service requests, then detect the calculation method of homomorphic computing in the service request;

[0090] When it is detected that the calculation method of the homomorphic calculation in the service request is addition calculation, the format of the data to be processed in the service request is detected;

[0091] If the format of the data to be processed in the service request is ciphertext, the first addition sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second addition sub-interface is called.

[0092] Among them, homomorphic computing includes addition computing, and for homomorphic computing services, ciphertext can be added to ciphertext, and ciphertext can also be added to plaintext. Therefore, correspondingly, two addition sub-interfaces need to be set for addition, namely the first addition sub-interface and the second addition sub-interface.

[0093] The determination of the interface requires the detection of the calculation method in the service request to determine whether to use the addition interface for service, and the detection of the format of the data to be processed to determine which addition interface to use for service. When the file formats in the data to be processed are all ciphertext, the first addition sub-interface is used for calculation service; when the file formats in the data to be processed are both plaintext and ciphertext, the second addition sub-interface is used for calculation service.

[0094] Optionally, the homomorphic computing service interface includes a first subtraction subinterface and a second subtraction subinterface for subtraction computing, the first subtraction subinterface is used to perform homomorphic subtraction between ciphertext and ciphertext, and the second subtraction subinterface is used to perform homomorphic subtraction between ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0095] If there is a service request whose service type is homomorphic computing among the N service requests, then detect the calculation method of homomorphic computing in the service request;

[0096] When it is detected that the calculation method of the homomorphic calculation in the service request is a subtraction calculation, detecting the format of the data to be processed in the service request;

[0097] If the format of the data to be processed in the service request is ciphertext, the first subtraction sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second subtraction sub-interface is called.

[0098] Among them, subtraction calculation is included in homomorphic computing, and for homomorphic computing services, ciphertext can be added to ciphertext, and ciphertext can also be added to plaintext. Therefore, two subtraction sub-interfaces need to be set up for subtraction, namely the first subtraction sub-interface and the second subtraction sub-interface.

[0099] The determination of the interface requires the detection of the calculation method in the service request to determine whether to use the subtraction interface for service, and the detection of the format of the data to be processed to determine which subtraction interface to use for service. When the file formats in the data to be processed are all ciphertext, the first subtraction sub-interface is used for calculation service; when the file formats in the data to be processed are both plaintext and ciphertext, the second subtraction sub-interface is used for calculation service.

[0100] Optionally, the homomorphic computing service interface includes a first multiplication sub-interface and a second multiplication sub-interface for multiplication computing, the first multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and ciphertext, and the second multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0101] If there is a service request whose service type is homomorphic computing among the N service requests, then detect the calculation method of homomorphic computing in the service request;

[0102] When it is detected that the calculation method of the homomorphic calculation in the service request is multiplication calculation, detecting the format of the data to be processed in the service request;

[0103] If the format of the data to be processed in the service request is ciphertext, the first multiplication sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second multiplication sub-interface is called.

[0104] Among them, homomorphic computing includes multiplication computing, and for homomorphic computing services, ciphertext can be added to ciphertext, and ciphertext can also be added to plaintext. Therefore, two multiplication sub-interfaces need to be set for multiplication, namely the first multiplication sub-interface and the second multiplication sub-interface.

[0105] The determination of the interface requires the detection of the calculation method in the service request to determine whether to use the multiplication interface for service, and the detection of the format of the data to be processed to determine which multiplication interface to use for service. When the file format in the data to be processed is all ciphertext, the first multiplication sub-interface is used for calculation service. When the file format in the data to be processed is both plaintext and ciphertext, the second multiplication sub-interface is used for calculation service.

[0106] Optionally, a rescaling service interface is further provided in the server. If the first multiplication sub-interface or the second multiplication sub-interface is a serviceable interface, executing a corresponding fully homomorphic algorithm in the serviceable interface to convert the processed data includes:

[0107] Using the first multiplication sub-interface or the second multiplication sub-interface, a multiplication calculation is performed on the data to be processed to obtain a multiplication calculation result;

[0108] Before a multiplication calculation result is calculated again using the first multiplication sub-interface or the second multiplication sub-interface, the rescaling service interface is called to rescale the multiplication settlement result, and the result of the rescaling calculation is used to update the multiplication calculation result.

[0109] Among them, the rescaling technology can solve the problems caused by scale growth and errors. The rescaling function is encapsulated in the interface and can be used in subsequent multiplication or division calculations to reduce the expansion rate of the calculation, thereby reducing the possibility of calculation bottlenecks.

[0110] Rescaling is applied in continuous multiplication or division operations. After a multiplication or division operation, the rescaling service interface needs to be used to perform rescaling calculations and update the result of the previous multiplication or division operation.

[0111] Optionally, the homomorphic computing service interface includes a first division sub-interface and a second division sub-interface for division calculation, the first division sub-interface is used to perform homomorphic division of ciphertext and ciphertext, and the second division sub-interface is used to perform homomorphic division of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes:

[0112] If there is a service request whose service type is homomorphic computing among the N service requests, then detect the calculation method of homomorphic computing in the service request;

[0113] When it is detected that the calculation method of the homomorphic calculation in the service request is a division calculation, the format of the data to be processed in the service request is detected;

[0114] If the format of the data to be processed in the service request is ciphertext, the first division sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second division sub-interface is called.

[0115] Among them, the homomorphic computing includes division computing, and for the homomorphic computing service, ciphertext can be added to ciphertext, and ciphertext can also be added to plaintext. Therefore, two division sub-interfaces need to be set for the division, namely the first division sub-interface and the second division sub-interface.

[0116] The determination of the interface requires the detection of the calculation method in the service request to determine whether to use the division interface for service, and the detection of the format of the data to be processed to determine which division interface to use for service. When the file format in the data to be processed is all ciphertext, the first division sub-interface is used for calculation service; when the file format in the data to be processed is both plaintext and ciphertext, the second division sub-interface is used for calculation service.

[0117] Step S203, detecting whether the operating environment of the service interface corresponding to each service request meets the preset conditions, and determining that the service interface whose operating environment meets the preset conditions is a serviceable interface.

[0118] In this application, the operating environment may refer to the memory environment, storage environment, system environment, etc. of the server where the service interface is located, and the operating environment where the service interface is located may refer to the current environment of the server where the service interface is located, such as memory capacity, number of threads, etc. The preset condition may refer to the condition that can support the execution of the service interface, and may include a memory capacity threshold, a thread number threshold, etc.

[0119] For example, when the preset condition is a memory capacity threshold, if the remaining memory capacity in the operating environment where the service interface is located is greater than the memory capacity threshold, it is determined that the preset condition is met. For another example, when the preset condition is a thread number threshold, if the number of idle threads in the operating environment where the service interface is located is greater than the thread number threshold, it is determined that the preset condition is met.

[0120] Each service interface requires different memory capacity and number of threads, so it is necessary to determine whether the service interface is available. If available, it is a serviceable interface.

[0121] Step S204, extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, obtain the conversion result, and feed back the conversion result to the initiator of the service request corresponding to the serviceable interface.

[0122] In this application, the data to be processed is the data carried in the service request sent by the user of the client, including parameters, file data, etc.

[0123] The serviceable interface that executes the corresponding fully homomorphic algorithm may refer to the algorithm of the corresponding service interface, that is, the key generation service interface executes the key generation algorithm, the homomorphic encryption service interface executes the encryption algorithm, the homomorphic computing service interface executes calculation algorithms such as addition, subtraction, multiplication and division, and the homomorphic decryption service interface executes the decryption algorithm.

[0124] In a complete service of a fully homomorphic algorithm, the user sends a key generation request to the server to obtain the key, then uses the key and the data to be encrypted to send an encryption request to obtain the ciphertext, then uses the ciphertext and / or plaintext to send a calculation request to obtain the encrypted calculation result, then uses the calculation result to send a decryption request to obtain the decrypted calculation result. In the above process, the user can generate a service request, and then the server implements the continuous process through different interfaces.

[0125] Optionally, an initialization service interface is further provided in the server. If the serviceable interface is a key generation service interface, the data to be processed in the service request corresponding to the serviceable interface is extracted, and the corresponding fully homomorphic algorithm is executed in the serviceable interface to convert the data to be processed. Before obtaining the conversion result, the following is also included:

[0126] Calling the initialization service interface, generating initialization parameters, and using the initialization parameters as the to-be-processed data of the service request corresponding to the key generation service interface;

[0127] Extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to transform the data to be processed, and obtain the transformation results including:

[0128] Initialize the key generation algorithm corresponding to the key generation service interface according to the initialization parameters to obtain the initialized key generation algorithm;

[0129] Run the initialized key generation algorithm to generate a key.

[0130] Among them, initialization is a more important function in the fully homomorphic algorithm, which can be used to set the parameters of the service to ensure that the service can follow the demand. Call the initialization service interface to generate initialization parameters, and put the initialization parameters into the pending data of the service request for subsequent key generation services, so that the key generation can be carried out randomly while ensuring that the keys are different.

[0131] The embodiment of the present application is applied to a server, and a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface, and a homomorphic decryption service interface are provided in the server. The method obtains N service requests, determines the service type corresponding to each service request, and the service types include key generation, homomorphic encryption, homomorphic computing, and homomorphic decryption, where N is an integer greater than zero. According to the service type of each service request, the service interface of the corresponding service type is called, and it is detected whether the operating environment of the service interface corresponding to each service request meets the preset conditions. The service interface whose operating environment meets the preset conditions is determined to be a serviceable interface, and the to-be-processed data in the service request corresponding to the serviceable interface is extracted. The corresponding fully homomorphic algorithm is executed in the serviceable interface to convert the to-be-processed data to obtain the conversion result, and the conversion result is fed back to the initiator of the service request corresponding to the serviceable interface, so as to realize localized homomorphic encryption service. By adopting the above-mentioned service interface, the service request sent by the user can be directly extracted, and the calculation process of the corresponding service request can be automatically realized, without the need for the user to operate in sequence to give trigger calculation instructions, thereby effectively reducing the complexity of user operations and improving user operation efficiency.

[0132] Corresponding to the localization service method of the fully homomorphic algorithm in the above embodiment, Figure 3 The structural block diagram of the localization service device of the fully homomorphic algorithm provided in the third embodiment of the present application is shown. The localization service device is applied to Figure 1 In the server, the computer device corresponding to the server is provided with a fully homomorphic algorithm, which can be used for key generation, plaintext encryption, ciphertext decryption, encryption calculation and other service functions. The above service functions are encapsulated as corresponding service interfaces in the server, and the corresponding functions can be realized by calling the interface to execute the algorithm. The server is connected to the client to obtain the service request sent by the client, including the parameters and data in the service request. The server of this application is provided with a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface and a homomorphic decryption service interface. For ease of explanation, only the parts related to the embodiments of the present application are shown.

[0133] See also Figure 3 , the localization service device comprises:

[0134] A service type determination module 31 is used to obtain N service requests and determine the service type corresponding to each service request, where the service types include key generation, homomorphic encryption, homomorphic computing, and homomorphic decryption, and N is an integer greater than zero;

[0135] A service interface calling module 32, used to call a service interface of a corresponding service type according to the service type of each service request;

[0136] An available interface determination module 33 is used to detect whether the operating environment of the service interface corresponding to each service request meets the preset conditions, and determine that the service interface whose operating environment meets the preset conditions is a serviceable interface;

[0137] The service execution module 34 is used to extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to transform the data to be processed, obtain the transformation result, and feed back the transformation result to the initiator of the service request corresponding to the serviceable interface.

[0138] Optionally, the homomorphic computing service interface includes a first addition sub-interface and a second addition sub-interface for addition computing, the first addition sub-interface is used to perform homomorphic addition of ciphertext and ciphertext, and the second addition sub-interface is used to perform homomorphic addition of ciphertext and plaintext, and the above service interface calling module 32 includes:

[0139] A first method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests;

[0140] A first format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is addition calculation;

[0141] The addition interface calling unit is used to call the first addition sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second addition sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0142] Optionally, the homomorphic computing service interface includes a first subtraction sub-interface and a second subtraction sub-interface for subtraction computing, the first subtraction sub-interface is used to perform homomorphic subtraction between ciphertext and ciphertext, and the second subtraction sub-interface is used to perform homomorphic subtraction between ciphertext and plaintext, and the above service interface calling module 32 includes:

[0143] A second method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests;

[0144] A second format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a subtraction calculation;

[0145] The subtraction interface calling unit is used to call the first subtraction sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second subtraction sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0146] Optionally, the homomorphic computing service interface includes a first multiplication sub-interface and a second multiplication sub-interface for multiplication computing, the first multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and ciphertext, and the second multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and plaintext, and the above service interface calling module 32 includes:

[0147] A third method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests;

[0148] A third format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a multiplication calculation;

[0149] The multiplication interface calling unit is used to call the first multiplication sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second multiplication sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0150] Optionally, a rescaling service interface is further provided in the server. If the first multiplication sub-interface or the second multiplication sub-interface is a serviceable interface, the service execution module 44 includes:

[0151] A single multiplication calculation unit, used to use the first multiplication sub-interface or the second multiplication sub-interface to perform a multiplication calculation on the data to be processed to obtain a single multiplication calculation result;

[0152] The updating unit is used to call the rescaling service interface to rescale the multiplication settlement result before the multiplication calculation result is calculated again using the first multiplication sub-interface or the second multiplication sub-interface, and use the result of the rescaling calculation to update the multiplication calculation result.

[0153] Optionally, the homomorphic computing service interface includes a first division sub-interface and a second division sub-interface for division computing, the first division sub-interface is used to perform homomorphic division between ciphertext and ciphertext, and the second division sub-interface is used to perform homomorphic division between ciphertext and plaintext, and the above service interface calling module 32 includes:

[0154] a fourth method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests;

[0155] a fourth format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a division calculation;

[0156] The division interface calling unit is used to call the first division sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second division sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

[0157] Optionally, an initialization service interface is further provided in the server. If the serviceable interface is a key generation service interface, the localization service device further includes:

[0158] An interface initialization module is used to extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, and before obtaining the conversion result, call the initialization service interface to generate initialization parameters, and use the initialization parameters as the data to be processed of the service request corresponding to the key generation service interface;

[0159] The service execution module 34 includes:

[0160] The initialization unit is used to initialize the key generation algorithm corresponding to the key generation service interface according to the initialization parameters to obtain the initialized key generation algorithm;

[0161] The key generation unit is used to run the initialized key generation algorithm to generate a key.

[0162] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0163] Figure 4 This is a schematic diagram of the structure of a computer device provided in Example 4 of the present application. Figure 4 As shown, the computer device of this embodiment includes: at least one processor ( Figure 4 Only one is shown), a memory, and a computer program stored in the memory and executable on at least one processor, wherein when the processor executes the computer program, the steps in any of the above-mentioned localization service method embodiments of the fully homomorphic algorithm are implemented.

[0164] The computer device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that Figure 4 This is merely an example of a computer device and does not constitute a limitation on the computer device. The computer device may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, it may also include a network interface, a display screen, and an input device.

[0165] The processor may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0166] The memory includes a readable storage medium, an internal memory, etc., wherein the internal memory may be the memory of a computer device, and the internal memory provides an environment for the operation of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments may also be an external storage device of a computer device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on a computer device. Further, the memory may also include both an internal storage unit of a computer device and an external storage device. The memory is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs, etc. The memory may also be used to temporarily store data that has been output or is to be output.

[0167] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiment when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, USB flash drive, mobile hard disk, magnetic disk or optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0168] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a computer device, the computer device can implement the steps in the above-mentioned method embodiment when executing the computer program product.

[0169] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0170] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0171] In the embodiments provided in the present application, it should be understood that the disclosed devices / computer equipment and methods can be implemented in other ways. For example, the device / computer equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0172] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0173] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A localization service method of a fully homomorphic algorithm, characterized in that: The localized service method is applied to a server, and a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface, and a homomorphic decryption service interface are provided in the server. The localized service method includes: Obtain N service requests, and determine the service type corresponding to each service request, where the service type includes key generation, homomorphic encryption, homomorphic computing, and homomorphic decryption, and N is an integer greater than zero; According to the service type of each service request, call the service interface of the corresponding service type; Detect whether the operating environment of the service interface corresponding to each service request meets the preset conditions, and determine that the service interface whose operating environment meets the preset conditions is a serviceable interface; Extracting the data to be processed in the service request corresponding to the serviceable interface, executing the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, obtaining a conversion result, and feeding back the conversion result to the initiator of the service request corresponding to the serviceable interface; The homomorphic computing service interface includes a first addition sub-interface and a second addition sub-interface for addition computing, wherein the first addition sub-interface is used to perform homomorphic addition of ciphertext and ciphertext, and the second addition sub-interface is used to perform homomorphic addition of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes: If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request; When it is detected that the calculation method of the homomorphic calculation in the service request is addition calculation, detecting the format of the data to be processed in the service request; If the format of the data to be processed in the service request is ciphertext, the first addition sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second addition sub-interface is called; or the homomorphic computing service interface includes a first subtraction sub-interface and a second subtraction sub-interface for subtraction calculation, the first subtraction sub-interface is used to perform homomorphic subtraction of ciphertext and ciphertext, and the second subtraction sub-interface is used to perform homomorphic subtraction of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes: If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request; When detecting that the calculation method of the homomorphic calculation in the service request is a subtraction calculation, detecting the format of the data to be processed in the service request; If the format of the data to be processed in the service request is ciphertext, the first subtraction sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second subtraction sub-interface is called; or the homomorphic computing service interface includes a first multiplication sub-interface and a second multiplication sub-interface for multiplication calculation, the first multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and ciphertext, and the second multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes: If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request; When detecting that the calculation method of the homomorphic calculation in the service request is multiplication calculation, detecting the format of the data to be processed in the service request; If the format of the data to be processed in the service request is ciphertext, calling the first multiplication sub-interface; or if the format of the data to be processed in the service request is ciphertext and plaintext, calling the second multiplication sub-interface; or The homomorphic computing service interface includes a first division sub-interface and a second division sub-interface for division computing, wherein the first division sub-interface is used to perform homomorphic division between ciphertext and ciphertext, and the second division sub-interface is used to perform homomorphic division between ciphertext and plaintext. According to the service type of each service request, calling the service interface of the corresponding service type includes: If there is a service request whose service type is homomorphic computing among the N service requests, detecting a calculation method of the homomorphic computing in the service request; When detecting that the calculation method of the homomorphic calculation in the service request is a division calculation, detecting the format of the data to be processed in the service request; If the format of the data to be processed in the service request is ciphertext, the first division sub-interface is called; or if the format of the data to be processed in the service request is ciphertext and plaintext, the second division sub-interface is called.

2. The localization service method according to claim 1, characterized in that: The server is also provided with a rescaling service interface. If the first multiplication sub-interface or the second multiplication sub-interface is the serviceable interface, executing a corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed includes: Using the first multiplication sub-interface or the second multiplication sub-interface, perform a multiplication calculation on the data to be processed to obtain a multiplication calculation result; Before the multiplication result is calculated again using the first multiplication sub-interface or the second multiplication sub-interface, the rescaling service interface is called to rescale the multiplication settlement result, and the result of the rescaling calculation is used to update the multiplication result.

3. The localization service method according to any one of claims 1 to 2, characterized in that: The server is also provided with an initialization service interface. If the serviceable interface is a key generation service interface, the data to be processed in the service request corresponding to the serviceable interface is extracted, and the corresponding fully homomorphic algorithm is executed in the serviceable interface to convert the data to be processed. Before obtaining the conversion result, the following is also included: Calling the initialization service interface to generate initialization parameters, and using the initialization parameters as to-be-processed data for a service request corresponding to the key generation service interface; Extracting the data to be processed in the service request corresponding to the serviceable interface, executing the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, and obtaining the conversion result includes: Initializing the key generation algorithm corresponding to the key generation service interface according to the initialization parameters to obtain an initialized key generation algorithm; The initialized key generation algorithm is run to generate a key.

4. A localization service device for a fully homomorphic algorithm, characterized in that: The localized service device is applied to the server side, and the server side is provided with a key generation service interface, a homomorphic encryption service interface, a homomorphic computing service interface and a homomorphic decryption service interface, and the localized service device includes: A service type determination module, used to obtain N service requests and determine the service type corresponding to each service request, wherein the service types include key generation, homomorphic encryption, homomorphic computing and homomorphic decryption, and N is an integer greater than zero; A service interface calling module is used to call the service interface of the corresponding service type according to the service type of each service request; An available interface determination module is used to detect whether the operating environment of the service interface corresponding to each service request meets the preset conditions, and determine that the service interface whose operating environment meets the preset conditions is a serviceable interface; A service execution module is used to extract the data to be processed in the service request corresponding to the serviceable interface, execute the corresponding fully homomorphic algorithm in the serviceable interface to convert the data to be processed, obtain a conversion result, and feed back the conversion result to the initiator of the service request corresponding to the serviceable interface; The homomorphic computing service interface includes a first addition sub-interface and a second addition sub-interface for addition computing, wherein the first addition sub-interface is used to perform homomorphic addition of ciphertext and ciphertext, and the second addition sub-interface is used to perform homomorphic addition of ciphertext and plaintext, and the service interface calling module includes: A first method detection unit, configured to detect a computing method of homomorphic computing in the service request if a service request of a service type of homomorphic computing exists in the N service requests; A first format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is addition calculation; An addition interface calling unit, configured to call the first addition sub-interface if the format of the data to be processed in the service request is ciphertext; or call the second addition sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext; or The homomorphic computing service interface includes a first subtraction sub-interface and a second subtraction sub-interface for subtraction computing, wherein the first subtraction sub-interface is used to perform homomorphic subtraction between ciphertext and ciphertext, and the second subtraction sub-interface is used to perform homomorphic subtraction between ciphertext and plaintext, and the service interface calling module includes: A second method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests; A second format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a subtraction calculation; A subtraction interface calling unit, configured to call the first subtraction sub-interface if the format of the data to be processed in the service request is ciphertext; or call the second subtraction sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext; or The homomorphic computing service interface includes a first multiplication sub-interface and a second multiplication sub-interface for multiplication computing, wherein the first multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and ciphertext, and the second multiplication sub-interface is used to perform homomorphic multiplication of ciphertext and plaintext, and the service interface calling module includes: A third method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests; A third format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a multiplication calculation; A multiplication interface calling unit, configured to call a first multiplication sub-interface if the format of the data to be processed in the service request is ciphertext; or call a second multiplication sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext; or The homomorphic computing service interface includes a first division sub-interface and a second division sub-interface for division computing, wherein the first division sub-interface is used to perform homomorphic division between ciphertext and ciphertext, and the second division sub-interface is used to perform homomorphic division between ciphertext and plaintext, and the service interface calling module includes: a fourth method detection unit, configured to detect a calculation method of homomorphic computing in the service request if there is a service request whose service type is homomorphic computing in the N service requests; a fourth format detection unit, configured to detect the format of the data to be processed in the service request when detecting that the calculation method of the homomorphic calculation in the service request is a division calculation; The division interface calling unit is used to call the first division sub-interface if the format of the data to be processed in the service request is ciphertext; or to call the second division sub-interface if the format of the data to be processed in the service request is ciphertext and plaintext.

5. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, and the processor implements the localization service method according to any one of claims 1 to 3 when executing the computer program.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the localization service method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Quasi-fully homomorphic ciphertext data operation method and system

    CN107592195A

  • Database ciphertext retrieval system and method based on bidirectional security index

    CN112800088A