WO2022068359A1 - Encryption method and apparatus for compressing ciphertext of information, and device and medium - Google Patents

Encryption method and apparatus for compressing ciphertext of information, and device and medium Download PDF

Info

Publication number
WO2022068359A1
WO2022068359A1 PCT/CN2021/109259 CN2021109259W WO2022068359A1 WO 2022068359 A1 WO2022068359 A1 WO 2022068359A1 CN 2021109259 W CN2021109259 W CN 2021109259W WO 2022068359 A1 WO2022068359 A1 WO 2022068359A1
Authority
WO
WIPO (PCT)
Prior art keywords
ciphertext
coordinate
information
target information
target
Prior art date
Application number
PCT/CN2021/109259
Other languages
French (fr)
Chinese (zh)
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 深圳壹账通智能科技有限公司
Publication of WO2022068359A1 publication Critical patent/WO2022068359A1/en

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
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the present application relates to the field of blockchain technology, and in particular, to an encryption method, device, device and medium for compressing ciphertext of information.
  • the Internet is further developing towards mobile, and emerging content such as social networks is also emerging, so that people can easily obtain the information they want.
  • emerging content such as social networks
  • Large-scale data has immeasurable value, and the relationship between data will play an important role in the operation and decision-making of companies.
  • the inventor realized that when big data is centrally processing and storing massive data, for example, when storing and managing the medical data of a large number of patients in a medical platform, the ciphertext corresponding to the user data is stored in the local database of the terminal, which is easy to use. It is tampered with by an illegal user, so that the target message cannot be obtained by decrypting the ciphertext of the target information. At the same time, the ciphertext corresponding to the user data is directly stored, which may easily cause the problem of insufficient storage space.
  • Embodiments of the present application provide an encryption method, device, device and medium for compressing ciphertext of information, which can improve the security of target information and save storage space.
  • an embodiment of the present application provides an encryption method for compressing ciphertext of information, and the method includes:
  • the compressed ciphertext corresponding to the target information is stored in the blockchain network.
  • an embodiment of the present application provides an encryption device for compressing ciphertext of information, the device comprising:
  • the first acquisition module is used to acquire the target function used to describe the information, and the target information to be processed;
  • a determination module for determining the coordinate information corresponding to the target information from the curve of the target function
  • an encryption module configured to encrypt the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information
  • a compression module configured to compress the ciphertext of the coordinate information corresponding to the target information, and obtain the compressed ciphertext corresponding to the target information
  • the storage module is used for storing the compressed ciphertext corresponding to the target information in the blockchain network.
  • an embodiment of the present application provides an electronic device, the device comprising: a processor adapted to implement one or more instructions; and,
  • a computer storage medium storing one or more instructions adapted to be loaded by the processor and perform the following steps:
  • the compressed ciphertext corresponding to the target information is stored in the blockchain network.
  • an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and performing the following steps :
  • the compressed ciphertext corresponding to the target information is stored in the blockchain network.
  • the storage space of the ciphertext of the target information pair can be reduced; storing the compressed ciphertext corresponding to the target information in the blockchain network can effectively avoid
  • the ciphertext of the target information is stored locally on the terminal, resulting in the ciphertext of the target information being tampered with, resulting in the inability to obtain the target message through decryption according to the ciphertext of the target information, thereby improving the security of the target information.
  • 1a is a schematic diagram of the architecture of an encryption system for compressing ciphertext of information provided by an embodiment of the present application
  • FIG. 1b is a schematic diagram of a data sharing system provided by an embodiment of the present application.
  • FIG. 1c is a schematic structural diagram of a blockchain block provided by an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of an encryption method for compressing ciphertext of information provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of a method for compressing ciphertext of coordinate information corresponding to target information provided by an embodiment of the present application
  • FIG. 4 is a schematic flowchart of another encryption method for compressing ciphertext of information provided by an embodiment of the present application
  • FIG. 5 is a schematic structural diagram of an encryption device for compressing ciphertext of information provided by an embodiment of the present application
  • FIG. 6 is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
  • This application may relate to the field of artificial intelligence technology, and may be applied to blockchain-based data encryption scenarios.
  • medical data can be stored in the blockchain.
  • the medical data can include personal health files, prescriptions, inspection reports and other data, and then the blockchain can be stored in the blockchain. encryption of medical data.
  • the blockchain involved in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission (P2P transmission), consensus mechanism, and encryption algorithm.
  • each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer and the application service layer; the blockchain can be composed of multiple serial transaction records (also known as blocks) that are connected and protected by cryptography.
  • the distributed ledger connected by the blockchain allows multiple parties to effectively record the transaction, and the transaction can be permanently checked (it cannot be tampered with).
  • the consensus mechanism refers to the mathematical algorithm that realizes the establishment of trust between different nodes and the acquisition of rights and interests in the blockchain network; that is to say, the consensus mechanism is a mathematical algorithm recognized by all network nodes of the blockchain.
  • FIG. 1a The schematic diagram of the system architecture includes a blockchain network and multiple terminals.
  • three terminals are taken as an example, namely a first terminal, a second terminal and a third terminal.
  • the first terminal, the second terminal and the third terminal can be used to obtain the ciphertext of the target information from the blockchain network, or store the ciphertext of the target information in the blockchain network.
  • the above-mentioned blockchain network may be the blockchain network 100 shown in FIG. 1b, and the blockchain network 100 refers to a system for data sharing between node devices and node devices. It includes multiple node devices 101, and the multiple node devices 101 may refer to each client in the blockchain network. Each node device 101 can receive data during normal operation, and maintain the shared data within the blockchain network based on the received transaction data. In order to ensure the information exchange in the blockchain network, there can be an information connection between each node device in the blockchain network, and the node devices can transmit information through the above information connection. Each node device in the blockchain network stores an identical blockchain.
  • the blockchain consists of multiple blocks, see Figure 1c, the blockchain consists of multiple blocks, the founding block includes the block header and the block body, and the block header stores the data feature value, version number, timestamp and Difficulty value, data is stored in the block body; the next block of the genesis block takes the genesis block as the parent block, the next block also includes the block header and the block body, and the block header stores the data of the current block.
  • the block data is associated, which ensures the security of the data in the block.
  • the node equipment, the first terminal, the second terminal and the third terminal in the blockchain network can be computer equipment, including mobile phones, tablet computers, notebook computers, PDAs, smart speakers, mobile Internet equipment (MID, mobile internet device), POS (Point Of Sales) machines, wearable devices (such as smart watches, smart bracelets, etc.), etc.; it can also be an independent server, or a server cluster composed of several servers, or a cloud A computing center; it can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and Cloud servers for basic cloud computing services such as big data and artificial intelligence platforms.
  • CDN Content Delivery Network
  • FIG. 2 is a schematic flowchart of an encryption method for compressing ciphertext of information provided by an embodiment of the present application.
  • the embodiment of the present application is performed by an electronic device.
  • the method includes steps S101-S105.
  • S101 Acquire an objective function for describing information and target information to be processed.
  • the objective function is used to describe the objective information, that is, the objective information is converted into coordinate information on the curve corresponding to the objective function.
  • the objective function can be an asymmetric elliptic curve algorithm, which is an encryption algorithm based on the mathematical theory of elliptic curves.
  • the target information may refer to transaction data, business data, etc. of an institution.
  • the curve corresponding to the objective function is obtained, and the target information is used as the first coordinate of the target point on the curve corresponding to the objective function, such as the X coordinate of the target point.
  • the second coordinate such as the Y coordinate, of the target point on the curve corresponding to the objective function is obtained.
  • the coordinate information of the target information pair is obtained according to the first coordinate and the second coordinate of the target point of the curve corresponding to the objective function.
  • the objective function may be a function algorithm corresponding to an elliptic curve, or a function corresponding to other curves. Obtain the line corresponding to the objective function curve.
  • the curve corresponding to the objective function can be prime256v1 curve, secp256r1 curve, nistp256 curve, secp256k1 curve, etc.
  • the target information can be used as the first coordinate of the target point on the curve corresponding to the target function; or,
  • the target information can be encoded according to the numerical conversion coding to obtain the target information of the numerical type, and the target information of the numerical type can be regarded as the first point of the target point on the curve corresponding to the target function. a coordinate.
  • the numeric conversion encoding includes: one-hot encoding (a non-numeric type is converted into a numeric type encoding), Label encoding (a non-numeric type is converted into a numeric type encoding), factorizing encoding (a non-numeric type conversion is performed) for numeric encoding) and so on.
  • the curve of the objective function can be the secp256k1 curve in the elliptic curve
  • the target information can be used as the X coordinate of the target point on the secp256k1 curve corresponding to the target function, and the corresponding Y coordinate can be obtained according to the X coordinate; further, according to the function expression of the secp256k1 curve and X coordinate, calculate and obtain the Y coordinate of the target point on the secp256k1 curve corresponding to the objective function; determine the X coordinate and Y coordinate of the target point as the coordinate information corresponding to the target information.
  • the target information is encoded according to one-hot encoding to obtain the target information of numerical type; the target information of this data type is used as the secp256r1 curve corresponding to the target function.
  • the X coordinate of the target point further, according to the function expression of the secp256r1 curve and the X coordinate, calculate the Y coordinate of the target point on the secp256r1 curve corresponding to the objective function; determine the X coordinate and Y coordinate of the target point as the target information Corresponding coordinate information, so as to improve the security of target information.
  • S103 Encrypt the coordinate information of the target information to obtain a ciphertext of the coordinate information corresponding to the target information.
  • the electronic device may use an encryption algorithm to encrypt the target information to obtain the ciphertext of the coordinate information corresponding to the target information.
  • the encryption algorithm may include but is not limited to RSA algorithm, Elgamal algorithm, knapsack algorithm, Rabin algorithm, D-H algorithm, ECC (elliptic curve encryption algorithm).
  • RSA algorithm, Elgamal algorithm, knapsack algorithm, Rabin algorithm, D-H algorithm are all asymmetric algorithms.
  • the ciphertext of the message obtain the user information of the target user corresponding to the target information.
  • the user information of the target user corresponding to the target information includes, but is not limited to, a user account, a user password, a user phone number, and the like.
  • the key corresponding to the target information is generated according to the user information of the target user, and the coordinate information corresponding to the target information is encrypted by using the key corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information.
  • user information corresponding to the target information may be acquired, a random number corresponding to the target information may be generated according to the user information corresponding to the target information, and a key corresponding to the target information may be generated according to the random number corresponding to the target information.
  • obtain the user account corresponding to the target information call the rand function in the C language, generate a random number corresponding to the target information according to the user account corresponding to the target information, and then perform a hash operation on the random number corresponding to the target information to obtain the corresponding random number of the target information.
  • This key is used to encrypt the target information to obtain the ciphertext of the coordinate information corresponding to the target information, which can increase the difficulty of decrypting the ciphertext of the target information, prevent the ciphertext of the target information from being cracked by illegal users, and improve the accuracy of the target information. safety.
  • the electronic device may acquire the terminal identifier of the terminal to which the target information belongs, and generate a private key corresponding to the terminal according to the terminal identifier of the terminal to which the target information belongs. Then, according to the private key and the key corresponding to the target information, the coordinate information corresponding to the target information is encrypted to obtain the ciphertext of the coordinate information corresponding to the target information.
  • the specific implementation of obtaining the ciphertext of the coordinate information corresponding to the target information includes: obtaining the base point coordinates of the curve of the target function; obtaining the product of the base point coordinates and the private key of the terminal to obtain candidate coordinates; The key encrypts the candidate coordinates to obtain the ciphertext of the candidate coordinates; fuses the coordinate information corresponding to the target information with the ciphertext of the corresponding candidate coordinates to obtain the ciphertext of the coordinate information corresponding to the target information.
  • the private key Q is obtained according to the block information of the target block for storing the compressed ciphertext corresponding to the target information.
  • the candidate coordinate H is encrypted according to the key K corresponding to the target information, and the ciphertext P1 of the candidate coordinate is obtained.
  • the coordinate information P2 (X1, Y1) corresponding to the target information is fused with the ciphertext P1 of the corresponding candidate coordinates to obtain the coordinate information corresponding to the target information.
  • the coordinate information corresponding to the target information is encrypted, and the ciphertext of the coordinate information corresponding to the target information is obtained.
  • the compressed ciphertext corresponding to the target information is stored in the blockchain network.
  • the coordinate information corresponding to the target information includes the first coordinate and the second coordinate.
  • the first coordinate corresponding to the target information and the second coordinate can be stored in the blockchain network.
  • the first coordinate and the second coordinate are compressed. After obtaining the compressed ciphertext of the first coordinate and the second coordinate corresponding to the target information, storing the compressed ciphertext of the first coordinate and the second coordinate corresponding to the target information in the blockchain network can reduce the number of node devices in the blockchain. storage pressure and save storage space.
  • the information stored on the blockchain network cannot be changed, so that the ciphertext of the target information is stored in the blockchain network, which can prevent the ciphertext of the target information from being tampered with by illegal users and improve the security of the target information.
  • FIG. 3 a schematic diagram of a method for compressing ciphertext of coordinate information corresponding to target information provided by an embodiment of the present application.
  • the ciphertext of coordinate information corresponding to target information The steps of performing the compression processing method include S21 to S23.
  • S21 Acquire a data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the sum of the byte length of the first coordinate and the byte length of the second coordinate.
  • the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate.
  • the ciphertexts with the second coordinates can be obtained from the ciphertexts of the multiple candidate second coordinates according to the preset length of the ciphertexts of the second coordinates.
  • the ciphertext of the candidate second coordinate whose content in the preset length of the text matches is taken as the ciphertext of the second coordinate.
  • the preset length of the ciphertext of the second coordinate may be half the length of the ciphertext of the second coordinate, or may be one third of the length of the ciphertext of the second coordinate, and so on.
  • the ciphertext whose length is the data interception length is continuously intercepted from the ciphertext of the coordinate information corresponding to the target information, and the intercepted ciphertext is determined as the compressed ciphertext corresponding to the target information.
  • the target information is used as the first coordinate of the target point on the curve corresponding to the target function
  • the ciphertext obtained by intercepting must include the ciphertext of the first coordinate, and may also include the ciphertext of the preset length of the second coordinate.
  • the purpose of continuous interception is to ensure that the intercepted ciphertext is continuous, so that the ciphertext of the target information can be accurately restored later.
  • the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate may be intercepted from the ciphertext of the coordinate information corresponding to the target information. Since the target information is used as the first coordinate of the target point on the curve corresponding to the target function in this embodiment, the ciphertext of the first coordinate is intercepted from the ciphertext of the coordinate information corresponding to the target information according to the data interception length. Since the second coordinate can be obtained according to the expression of the curve corresponding to the objective function and the first coordinate, only the lowest bit of the ciphertext of the second coordinate can be intercepted, so as to obtain the lowest bit of the ciphertext according to the second coordinate to the second coordinate of the target information.
  • the lowest digit of the ciphertext of the first coordinate and the ciphertext of the second coordinate is determined as the intercepted ciphertext. For example, after acquiring the ciphertext of the first coordinate and the ciphertext of the second coordinate corresponding to the target information, the ciphertext of the first coordinate and the ciphertext of the second coordinate are both 32 Bytes. According to the data interception length, continuously intercept the ciphertext of the first coordinate, and intercept the ciphertext of 1Byte length in the ciphertext of the second coordinate, and use the ciphertext of the first coordinate and the ciphertext of the second coordinate as the interception of 1Byte length. ciphertext.
  • the compressed ciphertext of the target information is obtained. In this way, the compressed ciphertext of the target information only needs to occupy 33 Bytes of storage space.
  • the compressed ciphertext corresponding to the local target information of the terminal may be deleted. Since the compressed ciphertext of the target information is stored in the target block in the blockchain network, when the target information needs to be obtained, the compressed ciphertext of the target information can be obtained in the target block in the blockchain network. After the compressed ciphertext is decompressed and decrypted, the target information can be obtained. At the same time, since the information stored on the blockchain network cannot be tampered with, the target information can be obtained according to the compressed ciphertext of the target information in the target block in the blockchain network. Deleting the compressed ciphertext corresponding to the local target information of the terminal can reduce the local storage pressure of the terminal and save storage space.
  • This embodiment may be applicable to scenarios such as medical informatization and electronic information file management in the field of digital medical care.
  • the above target information may refer to medical data of patients, such as medical images (link + access code), image annotation, prescription, diagnosis, treatment records, expense receipts, etc.
  • obtaining the coordinate information corresponding to the patient's medical data according to the objective function encrypting the coordinate information corresponding to the patient's medical data, and then using the data interception length to intercept the ciphertext corresponding to the patient's medical data to obtain the corresponding data of the patient's medical data.
  • Compressed ciphertext Compressed ciphertext.
  • the compressed ciphertext corresponding to the patient's medical data is stored in the blockchain network, which can reduce the storage space, improve the security of the patient's medical data, and realize the effective management of the patient's medical data.
  • the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information.
  • the ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained.
  • the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced.
  • FIG. 4 a schematic flowchart of another encryption method for compressing ciphertext of information provided by the present embodiment is shown in FIG. 4 .
  • the schematic flowchart includes steps S201-S209.
  • S203 Encrypt the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information.
  • the compressed ciphertext corresponding to the target information is stored in the blockchain network.
  • S207 Acquire the compressed ciphertext corresponding to the target information from the blockchain network according to the acquisition request.
  • the compressed ciphertext corresponding to the target information is acquired from the blockchain network for storing the target information according to the acquisition request.
  • the above-mentioned acquisition request includes the information identifier of the target information, and the corresponding relationship between the information identifier and the block is obtained from the local storage; the target block for storing the compressed ciphertext corresponding to the target information is determined according to the corresponding relationship; Obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
  • the corresponding relationship between the information identifier and the block is obtained from the local storage.
  • each information identifier has a corresponding storage block.
  • the target block for storing the compressed ciphertext of the target information is determined. From the information identifier of at least one candidate information in the target block in the blockchain network, the compressed ciphertext of the information matching the information identifier of the target information is obtained as the compressed ciphertext of the target information.
  • the target block used for storing the compressed ciphertext corresponding to the target information can be obtained; the relationship between the target block and the information identifier of the target information can be constructed. The corresponding relationship between the target block and the information identifier of the target information is stored in the local storage.
  • the block identifier of the target block used to store the compressed ciphertext of the target information can be obtained, and the relationship between the information identifier of the target information and the block identifier of the target block can be constructed. and store the correspondence between the information identifier of the target information and the block identifier of the target block in the local storage. In this way, when the compressed ciphertext of the target information needs to be obtained, the compressed ciphertext of the target information can be quickly obtained.
  • the compressed ciphertext of the target information is decompressed to obtain the ciphertext of the coordinate information corresponding to the target information.
  • the ciphertext of the target information is decrypted according to the key of the target information to obtain coordinate information corresponding to the target information, and the target information is determined according to the coordinate information corresponding to the target information.
  • the compressed ciphertext corresponding to the target information includes the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate, and the first coordinate and the second coordinate are coordinate information corresponding to the target information.
  • the candidate second coordinate corresponding to the ciphertext of the first coordinate can be obtained from the curve of the objective function; the candidate second coordinate whose lowest position in the candidate second coordinate is the same as the lowest position of the ciphertext of the second coordinate is used as the candidate second coordinate.
  • the ciphertext of the second coordinate; the ciphertext of the first coordinate and the ciphertext of the second coordinate are determined as the ciphertext of the coordinate information corresponding to the target information.
  • the ciphertext of the first coordinate of the target information and the lowest bit of the ciphertext of the second coordinate of the target information are obtained.
  • the first coordinate and the second coordinate are the coordinate information of the target information.
  • the key corresponding to the target information can be obtained, and the ciphertext of the first coordinate is decrypted according to the key corresponding to the target information to obtain the first coordinate.
  • a plurality of candidate second coordinates corresponding to the first coordinate are obtained. Decrypt the lowest bit of the ciphertext of the second coordinate to obtain the content of the lowest bit of the second coordinate.
  • the lowest bit of the multiple candidate second coordinates and the lowest bit of the second coordinate are used as the second coordinates, and the coordinate information corresponding to the target information is determined according to the first coordinates and the second coordinates.
  • the curve corresponding to the objective function is the secp256K1 curve
  • the first coordinate in the objective information is the X coordinate of the target point on the secp256K1 curve
  • the second coordinate in the objective information is the Y coordinate of the target point on the secp256K1 curve.
  • Decrypt the ciphertext of the first coordinate and after obtaining the first coordinate, obtain a plurality of candidate second coordinates according to the first coordinate and the expression of the secp256K1 curve.
  • the secp256K1 curve is an elliptic curve
  • multiple candidate Y coordinate values will be obtained. Therefore, according to the lowest bit of the ciphertext of the second coordinate, among the multiple candidate coordinates, determine the value of the second coordinate.
  • the content of the least significant bit is the same as the candidate Y coordinate as the second coordinate.
  • the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information.
  • the ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained.
  • the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced.
  • the compressed ciphertext corresponding to the target information in the blockchain network, which can effectively avoid storing the ciphertext of the target information locally in the terminal, resulting in the ciphertext of the target information being tampered with
  • the ciphertext of the target information is decrypted to obtain the target message, which improves the security of the target information.
  • the compressed ciphertext corresponding to the target information can be decompressed to obtain the ciphertext of the coordinate information corresponding to the target information; the ciphertext of the coordinate information corresponding to the target information can be decrypted to obtain the target information.
  • FIG. 5 is a schematic structural diagram of an encryption device for compressing ciphertext of information provided by an embodiment of the present application.
  • the device in the embodiment of the present application may be in the electronic device mentioned above.
  • the encryption device for compressing the ciphertext of information includes:
  • the first obtaining module 11 is used to obtain the target function for describing information and target information to be processed.
  • the determining module 12 is configured to determine the coordinate information corresponding to the target information from the curve of the target function.
  • the encryption module 13 is configured to encrypt the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information.
  • the encryption module 13 includes: a fourth acquisition unit, a generation unit, and an encryption unit.
  • a fourth obtaining unit configured to obtain the user information of the target user corresponding to the target information
  • a generating unit configured to generate a key corresponding to the target information according to the user information
  • the encryption unit is configured to encrypt the coordinate information corresponding to the target information by using the key corresponding to the target information, and obtain the ciphertext of the coordinate information corresponding to the target information.
  • the compression module 14 is configured to compress the ciphertext of the coordinate information corresponding to the target information, and obtain the compressed ciphertext corresponding to the target information.
  • the above-mentioned compression module 14 includes: a first obtaining unit, an intercepting unit, and a first determining unit.
  • a first obtaining unit configured to obtain a data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate the sum of the length and the byte length of the second coordinate;
  • An interception unit configured to continuously intercept the ciphertext whose length is the length of the data interception from the ciphertext of the coordinate information corresponding to the target information;
  • the first determining unit is configured to determine the intercepted ciphertext as the compressed ciphertext corresponding to the target information.
  • intercepting unit is specifically used for:
  • the ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate are determined as the ciphertext obtained by interception.
  • the storage module 15 is configured to store the compressed ciphertext corresponding to the target information in the blockchain network.
  • the coordinate information corresponding to the target information includes a first coordinate and a second coordinate
  • the device also includes:
  • a receiving module configured to receive an acquisition request for the target information
  • a second obtaining module configured to obtain the compressed ciphertext corresponding to the target information from the blockchain network according to the obtaining request
  • a decompression module configured to perform decompression processing on the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
  • the decryption module is configured to decrypt the ciphertext of the coordinate information corresponding to the target information, obtain the coordinate information corresponding to the target information, and determine the target information according to the coordinate information corresponding to the target information.
  • the compressed ciphertext corresponding to the target information includes the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate, and the first coordinate and the second coordinate correspond to the target information coordinate information;
  • the decompression module includes:
  • a second obtaining unit configured to obtain a candidate second coordinate corresponding to the ciphertext of the first coordinate from the curve of the objective function
  • a second determining unit configured to use the candidate second coordinate whose lowest bit is the same as the lowest bit of the ciphertext of the second coordinate as the ciphertext of the second coordinate;
  • the third determining unit is configured to determine the ciphertext of the first coordinate and the ciphertext of the second coordinate as the ciphertext of the coordinate information corresponding to the target information.
  • the acquisition request includes the information identifier of the target information
  • the second acquisition module includes:
  • the 4th determining unit is used to obtain the correspondence between the information identifier and the block from the local storage; According to the correspondence, determine the target block for storing the compressed ciphertext corresponding to the target information;
  • the third obtaining unit is configured to obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
  • the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information.
  • the ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained.
  • the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced.
  • the compressed ciphertext corresponding to the target information in the blockchain network, which can effectively avoid storing the ciphertext of the target information locally in the terminal, resulting in the ciphertext of the target information being tampered with
  • the ciphertext of the target information is decrypted to obtain the target message, which improves the security of the target information.
  • the compressed ciphertext corresponding to the target information can be decompressed to obtain the ciphertext of the coordinate information corresponding to the target information; the ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the target information.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • the electronic device may also be called a computer device, including a processor and a memory.
  • the electronic device may further include a network interface, and the processor is connected to the memory and the network interface.
  • the network interface may include at least one of an input device and an output device, or the electronic device may further include at least one of an input device and an output device.
  • the electronic device in this embodiment as shown in FIG. 6 may include: one or more processors 21 ; one or more input devices 22 , one or more output devices 23 and a memory 24 .
  • the above-mentioned processor 21 , input device 22 , output device 23 , and memory 24 are connected through a bus 25 .
  • the processor 21 can be a central processing unit (Central Processing Unit, CPU), and the processor can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC) ), off-the-shelf programmable gate array (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 the processor may be any conventional processor or the like.
  • the input device 22 may include a touch panel, a fingerprint sensor (used to collect the user's fingerprint information and fingerprint direction information), a microphone, etc.
  • the output device 23 may include a display (LCD, etc.), a speaker, etc., and the output device 23 may output corrections The processed data table.
  • the memory 24 may include read only memory and random access memory and provides instructions and data to the processor 21 .
  • a portion of the memory 24 may also include non-volatile random access memory, the memory 24 for storing a computer program including program instructions, and the processor 21 for executing the program instructions stored in the memory 24 for executing a
  • the compressed ciphertext corresponding to the target information is stored in the blockchain network.
  • the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
  • the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate and the second coordinate.
  • the intercepted ciphertext is determined as the compressed ciphertext corresponding to the target information.
  • the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
  • the ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate are determined as the ciphertext obtained by interception.
  • the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
  • the ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the coordinate information corresponding to the target information, and the target information is determined according to the coordinate information corresponding to the target information.
  • the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
  • the ciphertext of the first coordinate and the ciphertext of the second coordinate are determined as the ciphertext of the coordinate information corresponding to the target information.
  • the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
  • the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
  • the coordinate information corresponding to the target information is encrypted to obtain the ciphertext of the coordinate information corresponding to the target information.
  • the processor 21 , the input device 22 , and the output device 23 described in the embodiments of the present application can execute the implementations described in the embodiments of the encryption method for compressing the ciphertext of information provided in the embodiments of the present application, and can also execute The implementation manner of the electronic device described in the embodiments of the present application will not be repeated here.
  • the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information.
  • the ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained.
  • the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced.
  • the compressed ciphertext corresponding to the target information in the blockchain network, which can effectively avoid storing the ciphertext of the target information locally in the terminal, resulting in the ciphertext of the target information being tampered with
  • the ciphertext of the target information is decrypted to obtain the target message, which improves the security of the target information.
  • the compressed ciphertext corresponding to the target information can be decompressed to obtain the ciphertext of the coordinate information corresponding to the target information; the ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the target information.
  • Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program includes program instructions, and when the program instructions are executed by a processor, FIG. 2 and FIG. 2 are implemented. 4.
  • the storage medium involved in the present application may be a readable storage medium, and the storage medium involved in the present application, such as a computer-readable storage medium, may be non-volatile or volatile.
  • the computer-readable storage medium may be an internal storage unit of the electronic device described in any of the foregoing embodiments, such as a hard disk or a memory of the electronic device.
  • the computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk equipped on the electronic device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) ) card, Flash Card, etc.
  • the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device.
  • the computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device.
  • the computer-readable storage medium can also be used to temporarily store data that has been or will be output.
  • the disclosed electronic devices and methods may be implemented in other manners.
  • the device embodiments described above are illustrative, for example, the division of the units may be a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Accounting & Taxation (AREA)
  • Data Mining & Analysis (AREA)
  • Finance (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • Storage Device Security (AREA)

Abstract

An encryption method and apparatus for compressing ciphertext of information, and a device and a medium. The method comprises: acquiring a target function for describing information, and target information to be processed (S101); determining, from a curve of the target function, coordinate information corresponding to the target information (S102); encrypting the coordinate information of the target information, so as to obtain ciphertext of the coordinate information corresponding to the target information (S103); compressing the ciphertext of the coordinate information corresponding to the target information, so as to obtain compressed ciphertext corresponding to the target information (S104); and storing, in a blockchain network, the compressed ciphertext corresponding to the target information (S105).

Description

对信息的密文进行压缩的加密方法、装置、设备及介质Encryption method, device, device and medium for compressing ciphertext of information
本申请要求于2020年9月29日提交中国专利局、申请号为202011053192.4,发明名称为“对信息的密文进行压缩的加密方法、装置、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on September 29, 2020, with the application number of 202011053192.4 and the invention titled "Encryption Method, Apparatus, Equipment and Medium for Compressing Ciphertext of Information". The entire contents of this application are incorporated by reference.
技术领域technical field
本申请涉及区块链技术领域,尤其涉及一种对信息的密文进行压缩的加密方法、装置、设备及介质。The present application relates to the field of blockchain technology, and in particular, to an encryption method, device, device and medium for compressing ciphertext of information.
背景技术Background technique
目前,互联网正朝着移动化进一步发展,社交网络等新兴内容也在不断兴起,人们可以很方便的获取到想要的信息。然而,随着需求和业务的不断发展,所产生的数据也在呈几何式增长。大规模数据具有不可估量的价值,数据间的关系将在公司企业的运营、决策中发挥重要作用。发明人意识到,在大数据在集中处理和存储海量数据时,如,对医疗平台中大量患者的医疗数据进行存储和管理时,用户数据对应的密文被存储在终端本地的数据库中,容易被非法用户篡改,导致不能根据目标信息的密文解密得到目标消息。同时,将用户数据对应的密文直接存储,容易造成存储空间不足的问题。At present, the Internet is further developing towards mobile, and emerging content such as social networks is also emerging, so that people can easily obtain the information they want. However, as needs and businesses continue to evolve, so does the amount of data generated. Large-scale data has immeasurable value, and the relationship between data will play an important role in the operation and decision-making of companies. The inventor realized that when big data is centrally processing and storing massive data, for example, when storing and managing the medical data of a large number of patients in a medical platform, the ciphertext corresponding to the user data is stored in the local database of the terminal, which is easy to use. It is tampered with by an illegal user, so that the target message cannot be obtained by decrypting the ciphertext of the target information. At the same time, the ciphertext corresponding to the user data is directly stored, which may easily cause the problem of insufficient storage space.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种对信息的密文进行压缩的加密方法、装置、设备及介质,可以提高目标信息的安全性并节省存储空间。Embodiments of the present application provide an encryption method, device, device and medium for compressing ciphertext of information, which can improve the security of target information and save storage space.
第一方面,本申请实施例提供了一种对信息的密文进行压缩的加密方法,该方法包括:In a first aspect, an embodiment of the present application provides an encryption method for compressing ciphertext of information, and the method includes:
获取用于描述信息的目标函数,以及待处理的目标信息;Obtain the objective function used to describe the information, and the target information to be processed;
从所述目标函数的曲线上确定所述目标信息对应的坐标信息;Determine the coordinate information corresponding to the target information from the curve of the target function;
对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;Encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information;
将所述目标信息对应的压缩密文存储至区块链网络中。The compressed ciphertext corresponding to the target information is stored in the blockchain network.
第二方面,本申请实施例提供了一种对信息的密文进行压缩的加密装置,该装置包括:In the second aspect, an embodiment of the present application provides an encryption device for compressing ciphertext of information, the device comprising:
第一获取模块,用于获取用于描述信息的目标函数,以及待处理的目标信息;The first acquisition module is used to acquire the target function used to describe the information, and the target information to be processed;
确定模块,用于从所述目标函数的曲线上确定所述目标信息对应的坐标信息;A determination module, for determining the coordinate information corresponding to the target information from the curve of the target function;
加密模块,用于对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;an encryption module, configured to encrypt the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
压缩模块,用于对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;a compression module, configured to compress the ciphertext of the coordinate information corresponding to the target information, and obtain the compressed ciphertext corresponding to the target information;
存储模块,用于将所述目标信息对应的压缩密文存储至区块链网络中。The storage module is used for storing the compressed ciphertext corresponding to the target information in the blockchain network.
第三方面,本申请实施例提供了一种电子设备,该设备包括:处理器,适于实现一条或一条以上指令;以及,In a third aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor adapted to implement one or more instructions; and,
计算机存储介质,所述计算机存储介质存储有一条或一条以上指令,所述一条或一条以上指令适于由所述处理器加载并执行如下步骤:A computer storage medium storing one or more instructions adapted to be loaded by the processor and perform the following steps:
获取用于描述信息的目标函数,以及待处理的目标信息;Obtain the objective function used to describe the information, and the target information to be processed;
从所述目标函数的曲线上确定所述目标信息对应的坐标信息;Determine the coordinate information corresponding to the target information from the curve of the target function;
对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;Encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information;
将所述目标信息对应的压缩密文存储至区块链网络中。The compressed ciphertext corresponding to the target information is stored in the blockchain network.
第四方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质 存储有一条或一条以上指令,所述一条或一条以上指令适于由处理器加载并执行如下步骤:In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and performing the following steps :
获取用于描述信息的目标函数,以及待处理的目标信息;Obtain the objective function used to describe the information, and the target information to be processed;
从所述目标函数的曲线上确定所述目标信息对应的坐标信息;Determine the coordinate information corresponding to the target information from the curve of the target function;
对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;Encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information;
将所述目标信息对应的压缩密文存储至区块链网络中。The compressed ciphertext corresponding to the target information is stored in the blockchain network.
本申请实施例中,对目标信息对应的压缩密文进行存储时,可以降低目标信息对的密文的存储空间;将目标信息对应的压缩密文存储至区块链网络中,可有效避免将目标信息的密文存储至终端本地,导致目标信息的密文被篡改,导致不能根据目标信息的密文解密得到目标消息,提高目标信息的安全性。In the embodiment of the present application, when the compressed ciphertext corresponding to the target information is stored, the storage space of the ciphertext of the target information pair can be reduced; storing the compressed ciphertext corresponding to the target information in the blockchain network can effectively avoid The ciphertext of the target information is stored locally on the terminal, resulting in the ciphertext of the target information being tampered with, resulting in the inability to obtain the target message through decryption according to the ciphertext of the target information, thereby improving the security of the target information.
附图说明Description of drawings
为了更清楚地说明本申请实施例技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.
图1a是本申请实施例提供的一种对信息的密文进行压缩的加密系统的架构示意图;1a is a schematic diagram of the architecture of an encryption system for compressing ciphertext of information provided by an embodiment of the present application;
图1b是本申请实施例提供的一种数据共享系统的示意图;1b is a schematic diagram of a data sharing system provided by an embodiment of the present application;
图1c是本申请实施例提供的一种区链块的结构示意图;FIG. 1c is a schematic structural diagram of a blockchain block provided by an embodiment of the present application;
图2是本申请实施例提供的一种对信息的密文进行压缩的加密方法的流程示意图;2 is a schematic flowchart of an encryption method for compressing ciphertext of information provided by an embodiment of the present application;
图3是本申请实施例提供的一种对目标信息对应的坐标信息的密文进行压缩处理方法的示意图;3 is a schematic diagram of a method for compressing ciphertext of coordinate information corresponding to target information provided by an embodiment of the present application;
图4是本申请实施例提供的另一种对信息的密文进行压缩的加密方法的流程示意图;4 is a schematic flowchart of another encryption method for compressing ciphertext of information provided by an embodiment of the present application;
图5是本申请实施例提供的一种对信息的密文进行压缩的加密装置的结构示意图;5 is a schematic structural diagram of an encryption device for compressing ciphertext of information provided by an embodiment of the present application;
图6是本申请另一实施例提供的一种电子设备的结构示意图。FIG. 6 is a schematic structural diagram of an electronic device provided by another embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
本申请可涉及人工智能技术领域,并可应用于基于区块链的数据加密场景。例如,可具体应用于数字医疗中的医疗数据加密场景,如区块链中可以存储医疗数据,该医疗数据可以包括个人健康档案、处方、检查报告等数据,进而可实现对该区块链中的医疗数据的加密处理。This application may relate to the field of artificial intelligence technology, and may be applied to blockchain-based data encryption scenarios. For example, it can be specifically applied to medical data encryption scenarios in digital medicine. For example, medical data can be stored in the blockchain. The medical data can include personal health files, prescriptions, inspection reports and other data, and then the blockchain can be stored in the blockchain. encryption of medical data.
本申请所涉及的区块链是一种分布式数据存储、点对点传输(P2P传输)、共识机制、加密算法等计算机技术的新型应用模式,其本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层;区块链可由多个借由密码学串接并保护内容的串连交易记录(又称区块)构成,用区块链所串接的分布式账本能让多方有效纪录交易,且可永久查验此交易(不可篡改)。其中,共识机制是指区块链网络中实现不同节点之间建立信任、获取权益的数学算法;也就是说,共识机制是区块链各网络节点共同认可的一种数学算法。The blockchain involved in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission (P2P transmission), consensus mechanism, and encryption algorithm. Using cryptographic methods to associate the generated data blocks, each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer and the application service layer; the blockchain can be composed of multiple serial transaction records (also known as blocks) that are connected and protected by cryptography. The distributed ledger connected by the blockchain allows multiple parties to effectively record the transaction, and the transaction can be permanently checked (it cannot be tampered with). Among them, the consensus mechanism refers to the mathematical algorithm that realizes the establishment of trust between different nodes and the acquisition of rights and interests in the blockchain network; that is to say, the consensus mechanism is a mathematical algorithm recognized by all network nodes of the blockchain.
首先介绍本申请应用的对信息的密文进行压缩的加密系统的架构,如图1a所示。该系统架构示意图包括区块链网络及多个终端,图1a中以包括三个终端为例,分别为第一终端、第二终端和第三终端。其中,第一终端、第二终端和第三终端可用于从区块链网络获取目 标信息的密文,或者将目标信息的密文储存至区块链网络中。First, the architecture of the encryption system for compressing the ciphertext of information applied in this application is introduced, as shown in FIG. 1a. The schematic diagram of the system architecture includes a blockchain network and multiple terminals. In FIG. 1a, three terminals are taken as an example, namely a first terminal, a second terminal and a third terminal. Among them, the first terminal, the second terminal and the third terminal can be used to obtain the ciphertext of the target information from the blockchain network, or store the ciphertext of the target information in the blockchain network.
其中,上述区块链网络可以是如图1b所示的区块链网络100,区块链网络100是指用于进行节点设备与节点设备之间数据共享的系统,该区块链网络中可以包括多个节点设备101,多个节点设备101可以是指区块链网络中各个客户端。每个节点设备101在进行正常工作可以接收到数据,并基于接收到的交易数据维护该区块链网络内的共享数据。为了保证区块链网络内的信息互通,区块链网络中的每个节点设备之间可以存在信息连接,节点设备之间可以通过上述信息连接进行信息传输。区块链网络中的每个节点设备均存储一条相同的区块链。区块链由多个区块组成,参见图1c,区块链由多个区块组成,创始块中包括区块头和区块主体,区块头中存储有数据特征值、版本号、时间戳和难度值,区块主体中存储有数据;创始块的下一区块以创始块为父区块,下一区块中同样包括区块头和区块主体,区块头中存储有当前区块的数据特征值、父区块的区块头特征值、版本号、时间戳和难度值,并以此类推,使得区块链中每个区块中存储的区块数据均与父区块中存储的区块数据存在关联,保证了区块中数据的安全性。The above-mentioned blockchain network may be the blockchain network 100 shown in FIG. 1b, and the blockchain network 100 refers to a system for data sharing between node devices and node devices. It includes multiple node devices 101, and the multiple node devices 101 may refer to each client in the blockchain network. Each node device 101 can receive data during normal operation, and maintain the shared data within the blockchain network based on the received transaction data. In order to ensure the information exchange in the blockchain network, there can be an information connection between each node device in the blockchain network, and the node devices can transmit information through the above information connection. Each node device in the blockchain network stores an identical blockchain. The blockchain consists of multiple blocks, see Figure 1c, the blockchain consists of multiple blocks, the founding block includes the block header and the block body, and the block header stores the data feature value, version number, timestamp and Difficulty value, data is stored in the block body; the next block of the genesis block takes the genesis block as the parent block, the next block also includes the block header and the block body, and the block header stores the data of the current block The feature value, the feature value of the block header of the parent block, the version number, the timestamp and the difficulty value, and so on, so that the block data stored in each block in the blockchain is the same as the area stored in the parent block. The block data is associated, which ensures the security of the data in the block.
其中,区块链网络中的节点设备、第一终端、第二终端和第三终端可以为计算机设备,包括手机、平板电脑、笔记本电脑、掌上电脑、智能音响、移动互联网设备(MID,mobile internet device)、POS(Point Of Sales,销售点)机、可穿戴设备(例如智能手表、智能手环等)等;还可以是一台独立的服务器、或由若干台服务器组成的服务器集群、或云计算中心;还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、内容分发网络(Content Delivery Network,CDN)、以及大数据和人工智能平台等基础云计算服务的云服务器。Among them, the node equipment, the first terminal, the second terminal and the third terminal in the blockchain network can be computer equipment, including mobile phones, tablet computers, notebook computers, PDAs, smart speakers, mobile Internet equipment (MID, mobile internet device), POS (Point Of Sales) machines, wearable devices (such as smart watches, smart bracelets, etc.), etc.; it can also be an independent server, or a server cluster composed of several servers, or a cloud A computing center; it can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and Cloud servers for basic cloud computing services such as big data and artificial intelligence platforms.
请参见图2,为本申请实施例提供的一种对信息的密文进行压缩的加密方法的流程示意图,本申请实施例由电子设备来执行,该一种对信息的密文进行压缩的加密方法包括步骤S101~S105。Please refer to FIG. 2 , which is a schematic flowchart of an encryption method for compressing ciphertext of information provided by an embodiment of the present application. The embodiment of the present application is performed by an electronic device. The method includes steps S101-S105.
S101,获取用于描述信息的目标函数,以及待处理的目标信息。S101: Acquire an objective function for describing information and target information to be processed.
在本实施例中,目标函数用于描述目标信息,即将目标信息转化成目标函数对应的曲线上的坐标信息。目标函数可以一种非对称是椭圆曲线算法,椭圆曲线算法是基于椭圆曲线数学理论实现的加密算法。椭圆曲线算法的函数表达形式为Y^2=X^3+aX+b,对于椭圆曲线上的任一点坐标(X,Y)均满足Y^2=X^3+aX+b,即可以根据已知的X计算出对应的Y。因此,可以将目标信息转化为目标函数上的坐标信息,以此将目标信息存储至区块链网络中,提高目标信息的安全性。目标信息可以是指某机构的交易数据、营业数据等等。In this embodiment, the objective function is used to describe the objective information, that is, the objective information is converted into coordinate information on the curve corresponding to the objective function. The objective function can be an asymmetric elliptic curve algorithm, which is an encryption algorithm based on the mathematical theory of elliptic curves. The function expression form of the elliptic curve algorithm is Y^2=X^3+aX+b, and the coordinates (X, Y) of any point on the elliptic curve satisfy Y^2=X^3+aX+b, that is, according to A known X calculates the corresponding Y. Therefore, the target information can be converted into the coordinate information on the target function, so as to store the target information in the blockchain network and improve the security of the target information. The target information may refer to transaction data, business data, etc. of an institution.
S102,从目标函数的曲线上确定目标信息对应的坐标信息。S102: Determine the coordinate information corresponding to the target information from the curve of the target function.
获取目标函数对应的曲线,将目标信息作为目标函数对应的曲线上的目标点的第一坐标,如目标点的X坐标。根据该目标点的第一坐标以及目标函数对应的曲线的表达式,获得目标函数对应曲线上的目标点的第二坐标,如Y坐标。根据目标函数对应的曲线的目标点的第一坐标以及第二坐标,获得目标信息对的坐标信息。其中,目标函数可以是椭圆曲线对应的函数算法,也可以是其他曲线对应的函数。获取目标函数曲对应的线,目标函数对应的曲线可以是prime256v1曲线、secp256r1曲线、nistp256曲线、secp256k1曲线等等。将目标信息作为目标函数对应的曲线上的目标点的第一坐标,即当目标信息的数据类型为数值类型,可以将目标信息作为目标函数对应的曲线上的目标点的第一坐标;或者,当目标信息的数据类型为非数值类型,可以根据数值型转化编码对该目标信息进行编码,得到数值类型的目标信息,将该数值类型的目标信息作为目标函数对应的曲线上的目标点的第一坐标。具体的,数值型转化编码包括:one-hot编码(一种非数值型转化为数值型编码)、Label编码(一种非数值型转化为数值型编码)、factorizing编码(一种非数值型转化为数值型编码)等等。The curve corresponding to the objective function is obtained, and the target information is used as the first coordinate of the target point on the curve corresponding to the objective function, such as the X coordinate of the target point. According to the first coordinate of the target point and the expression of the curve corresponding to the objective function, the second coordinate, such as the Y coordinate, of the target point on the curve corresponding to the objective function is obtained. The coordinate information of the target information pair is obtained according to the first coordinate and the second coordinate of the target point of the curve corresponding to the objective function. The objective function may be a function algorithm corresponding to an elliptic curve, or a function corresponding to other curves. Obtain the line corresponding to the objective function curve. The curve corresponding to the objective function can be prime256v1 curve, secp256r1 curve, nistp256 curve, secp256k1 curve, etc. Taking the target information as the first coordinate of the target point on the curve corresponding to the target function, that is, when the data type of the target information is a numerical type, the target information can be used as the first coordinate of the target point on the curve corresponding to the target function; or, When the data type of the target information is a non-numeric type, the target information can be encoded according to the numerical conversion coding to obtain the target information of the numerical type, and the target information of the numerical type can be regarded as the first point of the target point on the curve corresponding to the target function. a coordinate. Specifically, the numeric conversion encoding includes: one-hot encoding (a non-numeric type is converted into a numeric type encoding), Label encoding (a non-numeric type is converted into a numeric type encoding), factorizing encoding (a non-numeric type conversion is performed) for numeric encoding) and so on.
例如,目标函数的曲线可以为椭圆曲线中的secp256k1曲线,椭圆曲线函数表达形式可以为Y^2=X^3+aX+b,对于椭圆曲线上的任一点坐标(X,Y)均满足Y^2=X^3+aX+b,即可以根据已知的X计算出对应的Y。因此,若目标信息的数据类型为数值类型,可以将目标信息作为目标函数对应的secp256k1曲线上的目标点的X坐标,并根据X坐标获得对应的Y坐标;进一步,根据secp256k1曲线的函数表达式以及X坐标,计算获得目标函数对应的secp256k1曲线上的目标点的Y坐标;将目标点的X坐标和Y坐标,确定为目标信息对应的坐标信息。若目标信息的数据类型为非数值类型,为字符串类型,则根据one-hot编码对目标信息进行编码,得到数值类型的目标信息;将该数据类型的目标信息作为目标函数对应的secp256r1曲线上的目标点的X坐标;进一步,根据secp256r1曲线的函数表达式以及X坐标,计算获得目标函数对应的secp256r1曲线上的目标点的Y坐标;将目标点的X坐标和Y坐标,确定为目标信息对应的坐标信息,以此提高目标信息的安全性。For example, the curve of the objective function can be the secp256k1 curve in the elliptic curve, the expression form of the elliptic curve function can be Y^2=X^3+aX+b, and the coordinates (X, Y) of any point on the elliptic curve satisfy Y ^2=X^3+aX+b, that is, the corresponding Y can be calculated according to the known X. Therefore, if the data type of the target information is a numerical type, the target information can be used as the X coordinate of the target point on the secp256k1 curve corresponding to the target function, and the corresponding Y coordinate can be obtained according to the X coordinate; further, according to the function expression of the secp256k1 curve and X coordinate, calculate and obtain the Y coordinate of the target point on the secp256k1 curve corresponding to the objective function; determine the X coordinate and Y coordinate of the target point as the coordinate information corresponding to the target information. If the data type of the target information is a non-numeric type and is a string type, the target information is encoded according to one-hot encoding to obtain the target information of numerical type; the target information of this data type is used as the secp256r1 curve corresponding to the target function. The X coordinate of the target point; further, according to the function expression of the secp256r1 curve and the X coordinate, calculate the Y coordinate of the target point on the secp256r1 curve corresponding to the objective function; determine the X coordinate and Y coordinate of the target point as the target information Corresponding coordinate information, so as to improve the security of target information.
S103,对目标信息的坐标信息进行加密,得到目标信息对应的坐标信息的密文。S103: Encrypt the coordinate information of the target information to obtain a ciphertext of the coordinate information corresponding to the target information.
在本申请实施例中,电子设备可以采用加密算法对目标信息进行加密,得到目标信息对应的坐标信息的密文,该加密算法可以包括但不限于RSA算法、Elgamal算法、背包算法、Rabin算法、D-H算法、ECC(椭圆曲线加密算法)。RSA算法、Elgamal算法、背包算法、Rabin算法、D-H算法均为一种非对称算法。In the embodiment of the present application, the electronic device may use an encryption algorithm to encrypt the target information to obtain the ciphertext of the coordinate information corresponding to the target information. The encryption algorithm may include but is not limited to RSA algorithm, Elgamal algorithm, knapsack algorithm, Rabin algorithm, D-H algorithm, ECC (elliptic curve encryption algorithm). RSA algorithm, Elgamal algorithm, knapsack algorithm, Rabin algorithm, D-H algorithm are all asymmetric algorithms.
可选的,获取目标信息对应的目标用户的用户信息;根据用户信息生成目标信息对应的密钥;采用目标信息对应的密钥,对目标信息对应的坐标信息进行加密,得到目标信息对应的坐标信息的密文。Optionally, obtain the user information of the target user corresponding to the target information; generate a key corresponding to the target information according to the user information; encrypt the coordinate information corresponding to the target information by using the key corresponding to the target information to obtain the coordinates corresponding to the target information The ciphertext of the message.
目标信息对应的目标用户的用户信息包括但不限于用户账号、用户密码、用户电话号码等等。根据目标用户的用户信息生成目标信息对应的密钥,并采用目标信息对应的密钥对目标信息对应的坐标信息进行加密,得到目标信息对应的坐标信息的密文。具体的,可以获取目标信息对应的用户信息,根据目标信息对应的用户信息生成目标信息对应的随机数,根据目标信息对应随机数生成目标信息对应的密钥。例如,获取目标信息对应的用户账号,调用C语言中的rand函数,根据目标信息对应的用户账号生成目标信息对应的随机数,然后目标信息对应的随机数进行哈希运算,获得目标信息对应的密钥。采用该密钥对目标信息进行加密,得到目标信息对应的坐标信息的密文,这样可以增加对目标信息的密文进行解密的难度,避免目标信息的密文被非法用户破解,提高目标信息的安全性。The user information of the target user corresponding to the target information includes, but is not limited to, a user account, a user password, a user phone number, and the like. The key corresponding to the target information is generated according to the user information of the target user, and the coordinate information corresponding to the target information is encrypted by using the key corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information. Specifically, user information corresponding to the target information may be acquired, a random number corresponding to the target information may be generated according to the user information corresponding to the target information, and a key corresponding to the target information may be generated according to the random number corresponding to the target information. For example, obtain the user account corresponding to the target information, call the rand function in the C language, generate a random number corresponding to the target information according to the user account corresponding to the target information, and then perform a hash operation on the random number corresponding to the target information to obtain the corresponding random number of the target information. key. This key is used to encrypt the target information to obtain the ciphertext of the coordinate information corresponding to the target information, which can increase the difficulty of decrypting the ciphertext of the target information, prevent the ciphertext of the target information from being cracked by illegal users, and improve the accuracy of the target information. safety.
可选的,电子设备可以获取目标信息所属的终端的终端标识,根据目标信息所属的终端的终端标识生成该终端对应的私钥。然后根据该私钥以及目标信息对应的密钥,对目标信息对应的坐标信息进行加密,得到目标信息对应的坐标信息的密文。其中,得到目标信息对应的坐标信息的密文的具体实现方式包括:获取目标函数的曲线的基点坐标;获取该基点坐标与该终端的私钥的乘积,得到候选坐标;根据目标信息对应的密钥对该候选坐标进行加密,得到该候选坐标的密文;对目标信息对应的坐标信息与对应的候选坐标的密文进行融合,得到目标信息对应的坐标信息的密文。Optionally, the electronic device may acquire the terminal identifier of the terminal to which the target information belongs, and generate a private key corresponding to the terminal according to the terminal identifier of the terminal to which the target information belongs. Then, according to the private key and the key corresponding to the target information, the coordinate information corresponding to the target information is encrypted to obtain the ciphertext of the coordinate information corresponding to the target information. The specific implementation of obtaining the ciphertext of the coordinate information corresponding to the target information includes: obtaining the base point coordinates of the curve of the target function; obtaining the product of the base point coordinates and the private key of the terminal to obtain candidate coordinates; The key encrypts the candidate coordinates to obtain the ciphertext of the candidate coordinates; fuses the coordinate information corresponding to the target information with the ciphertext of the corresponding candidate coordinates to obtain the ciphertext of the coordinate information corresponding to the target information.
例如,根据用于存储目标信息对应的压缩密文的目标区块的区块信息获得私钥Q。获取目标函数对应的曲线为secp256r1曲线,获取该secp256r1曲线的基点坐标G(Xg,Yg),将上述私钥Q与该基点坐标做乘积,获得候选坐标H,该候选坐标H=G*Q。根据目标信息对应的密钥K对候选坐标H进行加密,得到该候选坐标的密文P1,P可以等于目标信息对应的密钥K与候选坐标的乘积,即P1=K*H。得到目标信息对应的坐标信息为P2(X1,Y1)后,对该目标信息对应的坐标信息P2(X1,Y1)与对应的候选坐标的密文P1进行融合,得到该目标信息对应的坐标信息的密文C。例如,可以将目标信息对应的坐标信息P2(X1,Y1)与对应的候选坐标的密文P1相加,获得目标信息对应的坐标信息的密文C,即C=P2+P1。以此对目标信息对应的坐标信息进行加密,获得目标信息对应的坐标信息的 密文。For example, the private key Q is obtained according to the block information of the target block for storing the compressed ciphertext corresponding to the target information. Obtain the curve corresponding to the objective function as the secp256r1 curve, obtain the base point coordinate G(Xg, Yg) of the secp256r1 curve, and multiply the above-mentioned private key Q with the base point coordinate to obtain the candidate coordinate H, the candidate coordinate H=G*Q. The candidate coordinate H is encrypted according to the key K corresponding to the target information, and the ciphertext P1 of the candidate coordinate is obtained. P can be equal to the product of the key K corresponding to the target information and the candidate coordinate, that is, P1=K*H. After the coordinate information corresponding to the target information is obtained as P2 (X1, Y1), the coordinate information P2 (X1, Y1) corresponding to the target information is fused with the ciphertext P1 of the corresponding candidate coordinates to obtain the coordinate information corresponding to the target information. ciphertext C. For example, the coordinate information P2 (X1, Y1) corresponding to the target information can be added to the ciphertext P1 of the corresponding candidate coordinates to obtain the ciphertext C of the coordinate information corresponding to the target information, that is, C=P2+P1. In this way, the coordinate information corresponding to the target information is encrypted, and the ciphertext of the coordinate information corresponding to the target information is obtained.
S104,对目标信息对应的坐标信息的密文进行压缩处理,获得目标信息对应的压缩密文。S104, compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information.
S105,将目标信息对应的压缩密文存储至区块链网络中。S105, the compressed ciphertext corresponding to the target information is stored in the blockchain network.
在本申请实施例中,目标信息对应的坐标信息包括第一坐标和第二坐标,将目标信息对应的第一坐标以及第二坐标存储至区块链网络中时,可以对目标信息对应的第一坐标以及第二坐标进行压缩处理。获得目标信息对应的第一坐标以及第二坐标的压缩密文后,将目标信息对应的第一坐标以及第二坐标的压缩密文存储至区块链网络中,可以降低区块链中节点设备的存储压力,节省存储空间。同时,区块链网络上存储的信息不可更改,以此将目标信息的密文储存至区块链网络中,可以避免目标信息的密文被非法用户篡改,提高目标信息的安全性。In this embodiment of the present application, the coordinate information corresponding to the target information includes the first coordinate and the second coordinate. When the first coordinate and the second coordinate corresponding to the target information are stored in the blockchain network, the first coordinate corresponding to the target information and the second coordinate can be stored in the blockchain network. The first coordinate and the second coordinate are compressed. After obtaining the compressed ciphertext of the first coordinate and the second coordinate corresponding to the target information, storing the compressed ciphertext of the first coordinate and the second coordinate corresponding to the target information in the blockchain network can reduce the number of node devices in the blockchain. storage pressure and save storage space. At the same time, the information stored on the blockchain network cannot be changed, so that the ciphertext of the target information is stored in the blockchain network, which can prevent the ciphertext of the target information from being tampered with by illegal users and improve the security of the target information.
如图3所示,本申请实施例提供的一种对目标信息对应的坐标信息的密文进行压缩处理方法的示意图,如图3所述,该一种对目标信息对应的坐标信息的密文进行压缩处理方法的步骤包括S21~S23。As shown in FIG. 3 , a schematic diagram of a method for compressing ciphertext of coordinate information corresponding to target information provided by an embodiment of the present application. As shown in FIG. 3 , the ciphertext of coordinate information corresponding to target information The steps of performing the compression processing method include S21 to S23.
S21,获取数据截取长度,该数据截取长度大于第一坐标的字节长度,或者大于第二坐标的字节长度,且小于第一坐标的字节长度与第二坐标的字节长度之和。S21: Acquire a data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the sum of the byte length of the first coordinate and the byte length of the second coordinate.
获取数据截取长度,根据该数据截取长度对目标信息的密文进行截取,该数据截取长度大于第一坐标的字节长度,或者大于第二坐标的字节长度,且小于第一坐标的字节长度与第二坐标的字节长度之和。其中,由于第二坐标可以根据目标函数以及第一坐标得到,因此可以储存第二坐标的密文的预设长度,以便根据该第二坐标的密文的预设长度,获得第二坐标的密文。如根据目标函数以及第一坐标得到多个候选第二坐标的密文时,可以根据第二坐标的密文的预设长度,在多个候选第二坐标的密文中获得与第二坐标的密文的预设长度中的内容匹配的候选第二坐标的密文,作为第二坐标的密文。该第二坐标的密文的预设长度可以是第二坐标的密文的长度的一半,也可以是第二坐标的密文的长度的三分之一等等。Obtain the data interception length, and intercept the ciphertext of the target information according to the data interception length. The data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate. The sum of the length and the byte length of the second coordinate. Wherein, since the second coordinate can be obtained according to the objective function and the first coordinate, the preset length of the ciphertext of the second coordinate can be stored, so that the ciphertext of the second coordinate can be obtained according to the preset length of the ciphertext of the second coordinate arts. For example, when the ciphertexts of multiple candidate second coordinates are obtained according to the objective function and the first coordinates, the ciphertexts with the second coordinates can be obtained from the ciphertexts of the multiple candidate second coordinates according to the preset length of the ciphertexts of the second coordinates. The ciphertext of the candidate second coordinate whose content in the preset length of the text matches is taken as the ciphertext of the second coordinate. The preset length of the ciphertext of the second coordinate may be half the length of the ciphertext of the second coordinate, or may be one third of the length of the ciphertext of the second coordinate, and so on.
S22,从目标信息对应的坐标信息的密文中连续截取长度为数据截取长度的密文。S22: Continuously intercept the ciphertext whose length is the data interception length from the ciphertext of the coordinate information corresponding to the target information.
S23,将截取得到的密文确定为目标信息对应的压缩密文。S23: Determine the ciphertext obtained by interception as the compressed ciphertext corresponding to the target information.
根据数据截取长度,从目标信息对应的坐标信息的密文中连续截取长度为数据截取长度的密文,将截取得到的密文确定为目标信息对应的压缩密文。当然由于目标信息作为目标函数对应的曲线上的目标点的第一坐标,因此截取得到的密文中需包括第一坐标的密文,也可以包括第二坐标的预设长度的密文。连续截取是为了保证截取到的密文是连续的,以便后续准确的还原出目标信息的密文。According to the data interception length, the ciphertext whose length is the data interception length is continuously intercepted from the ciphertext of the coordinate information corresponding to the target information, and the intercepted ciphertext is determined as the compressed ciphertext corresponding to the target information. Of course, since the target information is used as the first coordinate of the target point on the curve corresponding to the target function, the ciphertext obtained by intercepting must include the ciphertext of the first coordinate, and may also include the ciphertext of the preset length of the second coordinate. The purpose of continuous interception is to ensure that the intercepted ciphertext is continuous, so that the ciphertext of the target information can be accurately restored later.
可选的,从目标信息对应的坐标信息的密文中截取第一坐标的密文,以及第二坐标的密文的最低位;将第一坐标的密文以及第二坐标的密文的最低位确定为截取得到的密文。Optionally, intercept the ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate from the ciphertext of the coordinate information corresponding to the target information; Determined to be the intercepted ciphertext.
其中,可以从目标信息对应的坐标信息的密文中截取第一坐标的密文,以及第二坐标的密文的最低位。由于本实施例中是将目标信息作为目标函数对应的曲线上的目标点的第一坐标,因此根据数据截取长度,从目标信息对应的坐标信息的密文中截取第一坐标的密文。由于可以根据目标函数对应的曲线的表达式,以及第一坐标,可以获得第二坐标,因此可以仅截取第二坐标的密文的最低位,以便根据第二坐标的密文的最低位,获取到目标信息的第二坐标。将第一坐标的密文以及第二坐标的密文的最低位确定为截取得到的密文。例如,获取目标信息对应的第一坐标的密文以及第二坐标的密文后,第一坐标的密文以及第二坐标的密文均为32Byte。根据数据截取长度,连续截取第一坐标的密文,以及截取第二坐标的密文中1Byte长度的密文,将第一坐标的密文以及第二坐标的密文中1Byte长度的密文作为截取到的密文。若不对目标信息的第一坐标的密文以及第二坐标的密文进行截 取的话,需要占用64Byte的存储空间来存储目标信息的密文,容易导致存储空间不足的问题。根据数据截取长度对目标信息的第一坐标的密文以及第二坐标的密文进行截取后,获得目标信息的压缩密文,这样存储目标信息的压缩密文只需要占用33Byte的存储空间,将目标信息的压缩密文存储至区块链网络时可以降低区块链网络中节点设备的存储压力,节省存储空间。Wherein, the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate may be intercepted from the ciphertext of the coordinate information corresponding to the target information. Since the target information is used as the first coordinate of the target point on the curve corresponding to the target function in this embodiment, the ciphertext of the first coordinate is intercepted from the ciphertext of the coordinate information corresponding to the target information according to the data interception length. Since the second coordinate can be obtained according to the expression of the curve corresponding to the objective function and the first coordinate, only the lowest bit of the ciphertext of the second coordinate can be intercepted, so as to obtain the lowest bit of the ciphertext according to the second coordinate to the second coordinate of the target information. The lowest digit of the ciphertext of the first coordinate and the ciphertext of the second coordinate is determined as the intercepted ciphertext. For example, after acquiring the ciphertext of the first coordinate and the ciphertext of the second coordinate corresponding to the target information, the ciphertext of the first coordinate and the ciphertext of the second coordinate are both 32 Bytes. According to the data interception length, continuously intercept the ciphertext of the first coordinate, and intercept the ciphertext of 1Byte length in the ciphertext of the second coordinate, and use the ciphertext of the first coordinate and the ciphertext of the second coordinate as the interception of 1Byte length. ciphertext. If the ciphertext of the first coordinate and the ciphertext of the second coordinate of the target information are not intercepted, a storage space of 64 Bytes is required to store the ciphertext of the target information, which easily leads to the problem of insufficient storage space. After intercepting the ciphertext of the first coordinate and the ciphertext of the second coordinate of the target information according to the data interception length, the compressed ciphertext of the target information is obtained. In this way, the compressed ciphertext of the target information only needs to occupy 33 Bytes of storage space. When the compressed ciphertext of the target information is stored in the blockchain network, the storage pressure of node devices in the blockchain network can be reduced and storage space can be saved.
可选的,在将目标信息的压缩密文存储至区块链网络中后,可以将终端本地的目标信息对应的压缩密文删除。由于目标信息的压缩密文存储至区块链网络中的目标区块后,需要获取目标信息时,可以在区块链网络中的目标区块中获取到目标信息的压缩密文,对目标信息的压缩密文进行解压缩以及解密以后就可以获得目标信息。同时由于区块链网络上存储的信息不可篡改,因此是可以根据区块链网络中的目标区块中目标信息的压缩密文得到目标信息。将终端本地的目标信息对应的压缩密文删除,可以降低终端本地的存储压力,节省存储空间。Optionally, after the compressed ciphertext of the target information is stored in the blockchain network, the compressed ciphertext corresponding to the local target information of the terminal may be deleted. Since the compressed ciphertext of the target information is stored in the target block in the blockchain network, when the target information needs to be obtained, the compressed ciphertext of the target information can be obtained in the target block in the blockchain network. After the compressed ciphertext is decompressed and decrypted, the target information can be obtained. At the same time, since the information stored on the blockchain network cannot be tampered with, the target information can be obtained according to the compressed ciphertext of the target information in the target block in the blockchain network. Deleting the compressed ciphertext corresponding to the local target information of the terminal can reduce the local storage pressure of the terminal and save storage space.
本实施例可以适用于数字医疗领域的医疗信息化、电子信息档案管理等场景,上述目标信息可以是指患者的医疗数据,如医疗影像(链接+访问码)、影像标注、药方、诊断、治疗记录、费用单据等。通过根据目标函数获取患者的医疗数据对应的坐标信息,对患者的医疗数据对应的坐标信息进行加密,再采用数据截取长度对患者的医疗数据对应的密文进行截取,获得患者的医疗数据对应的压缩密文。并将患者的医疗数据对应的压缩密文存储至区块链网络中,这样可以降低存储空间,且提高患者的医疗数据的安全性,实现对患者的医疗数据的有效管理。This embodiment may be applicable to scenarios such as medical informatization and electronic information file management in the field of digital medical care. The above target information may refer to medical data of patients, such as medical images (link + access code), image annotation, prescription, diagnosis, treatment records, expense receipts, etc. By obtaining the coordinate information corresponding to the patient's medical data according to the objective function, encrypting the coordinate information corresponding to the patient's medical data, and then using the data interception length to intercept the ciphertext corresponding to the patient's medical data to obtain the corresponding data of the patient's medical data. Compressed ciphertext. The compressed ciphertext corresponding to the patient's medical data is stored in the blockchain network, which can reduce the storage space, improve the security of the patient's medical data, and realize the effective management of the patient's medical data.
本申请实施例中,通过获取用于描述信息的目标函数,以及待处理的目标信息,从目标函数的曲线上确定目标信息对应的坐标信息;对目标信息的坐标信息进行加密,得到目标信息对应的坐标信息的密文;采用数据截取长度对目标信息对应的密文进行截取,获得目标信息对应的压缩密文,对目标信息对应的压缩密文进行存储时,可以降低目标信息对的密文的存储空间,节省存储空间;将目标信息对应的压缩密文存储至区块链网络中,可有效避免将目标信息的密文存储至终端本地,导致目标信息的密文被篡改,导致不能根据目标信息的密文解密得到目标消息,提高目标信息的安全性。In the embodiment of the present application, by acquiring the objective function for describing information and the target information to be processed, the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information. The ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained. When the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced. save storage space; store the compressed ciphertext corresponding to the target information in the blockchain network, which can effectively avoid storing the ciphertext of the target information locally in the terminal, resulting in the ciphertext of the target information being tampered with The ciphertext of the target information is decrypted to obtain the target message, which improves the security of the target information.
如图4所示,为本实施例提供的另一种对信息的密文进行压缩的加密方法的流程示意图,如图4所示,该另一种对信息的密文进行压缩的加密方法的流程示意图包括步骤S201-S209。As shown in FIG. 4 , a schematic flowchart of another encryption method for compressing ciphertext of information provided by the present embodiment is shown in FIG. 4 . The schematic flowchart includes steps S201-S209.
S201,获取用于描述信息的目标函数,以及待处理的目标信息。S201 , acquiring an objective function for describing information and target information to be processed.
S202,从目标函数的曲线上确定目标信息对应的坐标信息。S202: Determine the coordinate information corresponding to the target information from the curve of the target function.
S203,对目标信息的坐标信息进行加密,得到目标信息对应的坐标信息的密文。S203: Encrypt the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information.
S204,对目标信息对应的坐标信息的密文进行压缩处理,获得目标信息对应的压缩密文。S204 , compress the ciphertext of the coordinate information corresponding to the target information, and obtain the compressed ciphertext corresponding to the target information.
S205,将目标信息对应的压缩密文存储至区块链网络中。S205, the compressed ciphertext corresponding to the target information is stored in the blockchain network.
在本申请实施例中,步骤S201-S205的具体内容可以参看图2中所阐述的内容,在此不再累述。In this embodiment of the present application, for the specific content of steps S201-S205, reference may be made to the content described in FIG. 2, which is not repeated here.
S206,接收针对目标信息的获取请求。S206, receiving an acquisition request for target information.
S207,根据获取请求从区块链网络中获取目标信息对应的压缩密文。S207: Acquire the compressed ciphertext corresponding to the target information from the blockchain network according to the acquisition request.
当接收到针对目标信息的获取请求时,即接收到获取目标信息的明文内容的请求时,根据该获取请求从用于存储目标信息的区块链网络中,获取目标信息对应的压缩密文。When an acquisition request for the target information is received, that is, a request for acquiring the plaintext content of the target information is received, the compressed ciphertext corresponding to the target information is acquired from the blockchain network for storing the target information according to the acquisition request.
可选的,上述获取请求中包括目标信息的信息标识,从本地存储中获取信息标识与区块之间的对应关系;根据对应关系确定用于存储目标信息对应的压缩密文的目标区块;从区块链网络中的目标区块中获取目标信息对应的压缩密文。Optionally, the above-mentioned acquisition request includes the information identifier of the target information, and the corresponding relationship between the information identifier and the block is obtained from the local storage; the target block for storing the compressed ciphertext corresponding to the target information is determined according to the corresponding relationship; Obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
根据目标信息的信息标识,从本地存储中获取信息标识与区块之间的对应关系。其中,每一信息标识均有对应的存储区块。根据信息标识与区块之间的对应关系,确定用于存储目标信息的压缩密文的目标区块。从区块链网络中的目标区块中的至少一个候选信息的信息标识中,获取与目标信息的信息标识匹配的信息的压缩密文,作为目标信息的压缩密文。According to the information identifier of the target information, the corresponding relationship between the information identifier and the block is obtained from the local storage. Wherein, each information identifier has a corresponding storage block. According to the correspondence between the information identifier and the block, the target block for storing the compressed ciphertext of the target information is determined. From the information identifier of at least one candidate information in the target block in the blockchain network, the compressed ciphertext of the information matching the information identifier of the target information is obtained as the compressed ciphertext of the target information.
可选的,在将目标信息的压缩密文存储至区块链网络中时,可以获取用于储存目标信息对应的压缩密文的目标区块;构建目标区块与目标信息的信息标识之间的对应关系;将目标区块与目标信息的信息标识之间的对应关系储存至本地存储中。Optionally, when the compressed ciphertext of the target information is stored in the blockchain network, the target block used for storing the compressed ciphertext corresponding to the target information can be obtained; the relationship between the target block and the information identifier of the target information can be constructed. The corresponding relationship between the target block and the information identifier of the target information is stored in the local storage.
将目标信息的压缩密文存储至区块链网络时可以获取用于存储目标信息的压缩密文的目标区块的区块标识,构建目标信息的信息标识与目标区块的区块标识之间的对应关系,并将目标信息的信息标识与目标区块的区块标识之间的对应关系储存至本地存储中。这样在需要获取目标信息的压缩密文时,可以快速的获取到目标信息的压缩密文。When the compressed ciphertext of the target information is stored in the blockchain network, the block identifier of the target block used to store the compressed ciphertext of the target information can be obtained, and the relationship between the information identifier of the target information and the block identifier of the target block can be constructed. and store the correspondence between the information identifier of the target information and the block identifier of the target block in the local storage. In this way, when the compressed ciphertext of the target information needs to be obtained, the compressed ciphertext of the target information can be quickly obtained.
S208,对目标信息对应的压缩密文进行解压缩处理,得到目标信息对应的坐标信息的密文。S208 , decompress the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information.
S209,对目标信息对应的坐标信息的密文进行解密,得到目标信息对应的坐标信息,根据目标信息对应的坐标信息确定目标信息。S209 , decrypt the ciphertext of the coordinate information corresponding to the target information, obtain the coordinate information corresponding to the target information, and determine the target information according to the coordinate information corresponding to the target information.
获取目标信息的压缩密文后,对目标信息的压缩密文进行解压缩处理,得到目标信息对应的坐标信息的密文。在根据目标信息的密钥,对目标信息的密文进行解密,得到目标信息对应的坐标信息,根据目标信息对应的坐标信息确定目标信息。After the compressed ciphertext of the target information is obtained, the compressed ciphertext of the target information is decompressed to obtain the ciphertext of the coordinate information corresponding to the target information. The ciphertext of the target information is decrypted according to the key of the target information to obtain coordinate information corresponding to the target information, and the target information is determined according to the coordinate information corresponding to the target information.
可选的,目标信息对应的压缩密文包括第一坐标的密文以及第二坐标的密文的最低位,第一坐标和第二坐标为目标信息对应的坐标信息。可以从目标函数的曲线上获取第一坐标的密文对应候选第二坐标;将候选第二坐标中最低位与所述第二坐标的密文的最低位相同的候选第二坐标,作为所述第二坐标的密文;将第一坐标的密文以及第二坐标的密文确定为目标信息对应的坐标信息的密文。Optionally, the compressed ciphertext corresponding to the target information includes the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate, and the first coordinate and the second coordinate are coordinate information corresponding to the target information. The candidate second coordinate corresponding to the ciphertext of the first coordinate can be obtained from the curve of the objective function; the candidate second coordinate whose lowest position in the candidate second coordinate is the same as the lowest position of the ciphertext of the second coordinate is used as the candidate second coordinate. The ciphertext of the second coordinate; the ciphertext of the first coordinate and the ciphertext of the second coordinate are determined as the ciphertext of the coordinate information corresponding to the target information.
对目标信息的压缩密文进行解压缩处理后,获得目标信息的第一坐标的密文,以及第二坐标的密文的最低位,第一坐标以及第二坐标为目标信息的坐标信息。可以获取目标信息对应的密钥,根据目标信息对应的密钥对第一坐标的密文进行解密,获得第一坐标。根据目标函数对应的曲线的表达式以及第一坐标,获得第一坐标对应的多个候选第二坐标。对第二坐标的密文的最低位进行解密,获得第二坐标的最低位的内容,根据第二坐标的最低位的内容,在多个候选第二坐标中最低位与第二坐标最低位的内容相同的候选第二坐标,作为第二坐标,根据第一坐标以及第二坐标,确定目标信息对应坐标信息。例如,目标函数对应的曲线为secp256K1曲线,目标信息中第一坐标为secp256K1曲线上目标点的X坐标,目标信息中第二坐标为secp256K1曲线上目标点的Y坐标。对第一坐标的密文进行解密,得到第一坐标后,根据第一坐标以及secp256K1曲线的表达式,获得多个候选第二坐标。由于secp256K1曲线为椭圆曲线,根据一个X坐标求解时,会获得多个候选Y坐标的值,因此,可以根据第二坐标的密文的最低位,在多个候选坐标中,确定与第二坐标的最低位的内容相同的候选Y坐标,作为第二坐标。After decompressing the compressed ciphertext of the target information, the ciphertext of the first coordinate of the target information and the lowest bit of the ciphertext of the second coordinate of the target information are obtained. The first coordinate and the second coordinate are the coordinate information of the target information. The key corresponding to the target information can be obtained, and the ciphertext of the first coordinate is decrypted according to the key corresponding to the target information to obtain the first coordinate. According to the expression of the curve corresponding to the objective function and the first coordinate, a plurality of candidate second coordinates corresponding to the first coordinate are obtained. Decrypt the lowest bit of the ciphertext of the second coordinate to obtain the content of the lowest bit of the second coordinate. According to the content of the lowest bit of the second coordinate, the lowest bit of the multiple candidate second coordinates and the lowest bit of the second coordinate The candidate second coordinates with the same content are used as the second coordinates, and the coordinate information corresponding to the target information is determined according to the first coordinates and the second coordinates. For example, the curve corresponding to the objective function is the secp256K1 curve, the first coordinate in the objective information is the X coordinate of the target point on the secp256K1 curve, and the second coordinate in the objective information is the Y coordinate of the target point on the secp256K1 curve. Decrypt the ciphertext of the first coordinate, and after obtaining the first coordinate, obtain a plurality of candidate second coordinates according to the first coordinate and the expression of the secp256K1 curve. Since the secp256K1 curve is an elliptic curve, when solving according to one X coordinate, multiple candidate Y coordinate values will be obtained. Therefore, according to the lowest bit of the ciphertext of the second coordinate, among the multiple candidate coordinates, determine the value of the second coordinate. The content of the least significant bit is the same as the candidate Y coordinate as the second coordinate.
本申请实施例中,通过获取用于描述信息的目标函数,以及待处理的目标信息,从目标函数的曲线上确定目标信息对应的坐标信息;对目标信息的坐标信息进行加密,得到目标信息对应的坐标信息的密文;采用数据截取长度对目标信息对应的密文进行截取,获得目标信息对应的压缩密文,对目标信息对应的压缩密文进行存储时,可以降低目标信息对的密文的存储空间,节省存储空间;将目标信息对应的压缩密文存储至区块链网络中,可有效避免将目标信息的密文存储至终端本地,导致目标信息的密文被篡改,导致不能根据目标信息的密文解密得到目标消息,提高目标信息的安全性。在需要获取目标信息时,可以对目标信息对应的压缩密文进行解压缩处理,得到目标信息对应的坐标信息的密文;对 目标信息对应的坐标信息的密文进行解密,得到目标信息。In the embodiment of the present application, by acquiring the objective function for describing information and the target information to be processed, the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information. The ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained. When the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced. save storage space; store the compressed ciphertext corresponding to the target information in the blockchain network, which can effectively avoid storing the ciphertext of the target information locally in the terminal, resulting in the ciphertext of the target information being tampered with The ciphertext of the target information is decrypted to obtain the target message, which improves the security of the target information. When the target information needs to be obtained, the compressed ciphertext corresponding to the target information can be decompressed to obtain the ciphertext of the coordinate information corresponding to the target information; the ciphertext of the coordinate information corresponding to the target information can be decrypted to obtain the target information.
请参见图5,是本申请实施例提供的一种对信息的密文进行压缩的加密装置的结构示意图,本申请实施例的所述装置可以在上述提及的电子设备中。本实施例中,该对信息的密文进行压缩的加密装置包括:Please refer to FIG. 5 , which is a schematic structural diagram of an encryption device for compressing ciphertext of information provided by an embodiment of the present application. The device in the embodiment of the present application may be in the electronic device mentioned above. In this embodiment, the encryption device for compressing the ciphertext of information includes:
第一获取模块11,用于获取用于描述信息的目标函数,以及待处理的目标信息。The first obtaining module 11 is used to obtain the target function for describing information and target information to be processed.
确定模块12,用于从目标函数的曲线上确定目标信息对应的坐标信息。The determining module 12 is configured to determine the coordinate information corresponding to the target information from the curve of the target function.
加密模块13,用于对目标信息的坐标信息进行加密,得到目标信息对应的坐标信息的密文。The encryption module 13 is configured to encrypt the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information.
其中,所述加密模块13包括:第四获取单元、生成单元、加密单元。Wherein, the encryption module 13 includes: a fourth acquisition unit, a generation unit, and an encryption unit.
第四获取单元,用于获取所述目标信息对应的目标用户的用户信息;a fourth obtaining unit, configured to obtain the user information of the target user corresponding to the target information;
生成单元,用于根据所述用户信息生成所述目标信息对应的密钥;a generating unit, configured to generate a key corresponding to the target information according to the user information;
加密单元,用于采用所述目标信息对应的密钥,对所述目标信息对应的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文。The encryption unit is configured to encrypt the coordinate information corresponding to the target information by using the key corresponding to the target information, and obtain the ciphertext of the coordinate information corresponding to the target information.
压缩模块14,用于对目标信息对应的坐标信息的密文进行压缩处理,获得目标信息对应的压缩密文。The compression module 14 is configured to compress the ciphertext of the coordinate information corresponding to the target information, and obtain the compressed ciphertext corresponding to the target information.
上述压缩模块14包括:第一获取单元、截取单元、第一确定单元。The above-mentioned compression module 14 includes: a first obtaining unit, an intercepting unit, and a first determining unit.
第一获取单元,用于获取数据截取长度,所述数据截取长度大于所述第一坐标的字节长度,或者大于所述第二坐标的字节长度,且小于所述第一坐标的字节长度与所述第二坐标的字节长度之和;a first obtaining unit, configured to obtain a data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate the sum of the length and the byte length of the second coordinate;
截取单元,用于从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文;An interception unit, configured to continuously intercept the ciphertext whose length is the length of the data interception from the ciphertext of the coordinate information corresponding to the target information;
第一确定单元,用于将截取得到的密文确定为所述目标信息对应的压缩密文。The first determining unit is configured to determine the intercepted ciphertext as the compressed ciphertext corresponding to the target information.
其中,所述截取单元具体用于:Wherein, the intercepting unit is specifically used for:
从所述目标信息对应的坐标信息的密文中截取所述第一坐标的密文,以及所述第二坐标的密文的最低位;Intercept the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate from the ciphertext of the coordinate information corresponding to the target information;
将所述第一坐标的密文以及所述第二坐标的密文的最低位确定为所述截取得到的密文。The ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate are determined as the ciphertext obtained by interception.
存储模块15,用于将所述目标信息对应的压缩密文存储至区块链网络中。The storage module 15 is configured to store the compressed ciphertext corresponding to the target information in the blockchain network.
其中,所述目标信息对应的坐标信息包括第一坐标和第二坐标;Wherein, the coordinate information corresponding to the target information includes a first coordinate and a second coordinate;
其中,所述装置还包括:Wherein, the device also includes:
接收模块,用于接收针对所述目标信息的获取请求;a receiving module, configured to receive an acquisition request for the target information;
第二获取模块,用于根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文;a second obtaining module, configured to obtain the compressed ciphertext corresponding to the target information from the blockchain network according to the obtaining request;
解压缩模块,用于对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的坐标信息的密文;a decompression module, configured to perform decompression processing on the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
解密模块,用于对所述目标信息对应的坐标信息的密文进行解密,得到所述目标信息对应的坐标信息,根据所述目标信息对应的坐标信息确定所述目标信息。The decryption module is configured to decrypt the ciphertext of the coordinate information corresponding to the target information, obtain the coordinate information corresponding to the target information, and determine the target information according to the coordinate information corresponding to the target information.
其中,所述目标信息对应的压缩密文包括所述第一坐标的密文以及所述第二坐标的密文的最低位,所述第一坐标和所述第二坐标为所述目标信息对应的坐标信息;The compressed ciphertext corresponding to the target information includes the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate, and the first coordinate and the second coordinate correspond to the target information coordinate information;
所述解压缩模块包括:The decompression module includes:
第二获取单元,用于从所述目标函数的曲线上获取所述第一坐标的密文对应候选第二坐标;a second obtaining unit, configured to obtain a candidate second coordinate corresponding to the ciphertext of the first coordinate from the curve of the objective function;
第二确定单元,用于将所述候选第二坐标中最低位与所述第二坐标的密文的最低位相同的候选第二坐标,作为所述第二坐标的密文;a second determining unit, configured to use the candidate second coordinate whose lowest bit is the same as the lowest bit of the ciphertext of the second coordinate as the ciphertext of the second coordinate;
第三确定单元,用于将所述第一坐标的密文以及所述第二坐标的密文确定为所述目标 信息对应的坐标信息的密文。The third determining unit is configured to determine the ciphertext of the first coordinate and the ciphertext of the second coordinate as the ciphertext of the coordinate information corresponding to the target information.
其中,所述获取请求中包括所述目标信息的信息标识,所述第二获取模块包括:Wherein, the acquisition request includes the information identifier of the target information, and the second acquisition module includes:
第四确定单元,用于从本地存储中获取信息标识与区块之间的对应关系;根据所述对应关系确定用于存储所述目标信息对应的压缩密文的目标区块;The 4th determining unit is used to obtain the correspondence between the information identifier and the block from the local storage; According to the correspondence, determine the target block for storing the compressed ciphertext corresponding to the target information;
第三获取单元,用于从所述区块链网络中的目标区块中获取所述目标信息对应的压缩密文。The third obtaining unit is configured to obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
本申请实施例中,通过获取用于描述信息的目标函数,以及待处理的目标信息,从目标函数的曲线上确定目标信息对应的坐标信息;对目标信息的坐标信息进行加密,得到目标信息对应的坐标信息的密文;采用数据截取长度对目标信息对应的密文进行截取,获得目标信息对应的压缩密文,对目标信息对应的压缩密文进行存储时,可以降低目标信息对的密文的存储空间,节省存储空间;将目标信息对应的压缩密文存储至区块链网络中,可有效避免将目标信息的密文存储至终端本地,导致目标信息的密文被篡改,导致不能根据目标信息的密文解密得到目标消息,提高目标信息的安全性。在需要获取目标信息时,可以对目标信息对应的压缩密文进行解压缩处理,得到目标信息对应的坐标信息的密文;对目标信息对应的坐标信息的密文进行解密,得到目标信息。In the embodiment of the present application, by acquiring the objective function for describing information and the target information to be processed, the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information. The ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained. When the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced. save storage space; store the compressed ciphertext corresponding to the target information in the blockchain network, which can effectively avoid storing the ciphertext of the target information locally in the terminal, resulting in the ciphertext of the target information being tampered with The ciphertext of the target information is decrypted to obtain the target message, which improves the security of the target information. When the target information needs to be obtained, the compressed ciphertext corresponding to the target information can be decompressed to obtain the ciphertext of the coordinate information corresponding to the target information; the ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the target information.
请参见图6,是本申请实施例提供的一种电子设备的结构示意图,该电子设备还可以叫做计算机设备,包括处理器和存储器。可选的,该电子设备还可以包括网络接口,处理器与存储器、网络接口相连。进一步可选的,该网络接口可以包括输入装置和输出装置中的至少一种,或者,该电子设备还可包括输入装置和输出装置中的至少一种。例如,如图6所示的本实施例中的电子设备可以包括:一个或多个处理器21;一个或多个输入装置22,一个或多个输出装置23和存储器24。上述处理器21、输入装置22、输出装置23和存储器24通过总线25连接。Please refer to FIG. 6 , which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device may also be called a computer device, including a processor and a memory. Optionally, the electronic device may further include a network interface, and the processor is connected to the memory and the network interface. Further optionally, the network interface may include at least one of an input device and an output device, or the electronic device may further include at least one of an input device and an output device. For example, the electronic device in this embodiment as shown in FIG. 6 may include: one or more processors 21 ; one or more input devices 22 , one or more output devices 23 and a memory 24 . The above-mentioned processor 21 , input device 22 , output device 23 , and memory 24 are connected through a bus 25 .
所处理器21可以是中央处理单元(Central Processing Unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate ArraY,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The processor 21 can be a central processing unit (Central Processing Unit, CPU), and the processor can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuit (Application Specific Integrated Circuit, ASIC) ), off-the-shelf programmable gate array (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 the processor may be any conventional processor or the like.
输入装置22可以包括触控板、指纹采传感器(用于采集用户的指纹信息和指纹的方向信息)、麦克风等,输出装置23可以包括显示器(LCD等)、扬声器等,输出装置23可以输出校正处理后的数据表。The input device 22 may include a touch panel, a fingerprint sensor (used to collect the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 23 may include a display (LCD, etc.), a speaker, etc., and the output device 23 may output corrections The processed data table.
该存储器24可以包括只读存储器和随机存取存储器,并向处理器21提供指令和数据。存储器24的一部分还可以包括非易失性随机存取存储器,存储器24用于存储计算机程序,所述计算机程序包括程序指令,处理器21用于执行存储器24存储的程序指令,以用于执行一种对信息的密文进行压缩的加密方法,即用于执行以下操作:The memory 24 may include read only memory and random access memory and provides instructions and data to the processor 21 . A portion of the memory 24 may also include non-volatile random access memory, the memory 24 for storing a computer program including program instructions, and the processor 21 for executing the program instructions stored in the memory 24 for executing a An encryption method that compresses the ciphertext of information, that is, is used to perform the following operations:
获取用于描述信息的目标函数,以及待处理的目标信息;Obtain the objective function used to describe the information, and the target information to be processed;
从所述目标函数的曲线上确定所述目标信息对应的坐标信息;Determine the coordinate information corresponding to the target information from the curve of the target function;
对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;Encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information;
将所述目标信息对应的压缩密文存储至区块链网络中。The compressed ciphertext corresponding to the target information is stored in the blockchain network.
可选的,处理器21用于执行存储器24存储的程序指令,用于执行以下操作:Optionally, the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
获取数据截取长度,所述数据截取长度大于所述第一坐标的字节长度,或者大于所述第二坐标的字节长度,且小于所述第一坐标的字节长度与所述第二坐标的字节长度之和;Obtain the data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate and the second coordinate The sum of the byte lengths of ;
从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文;Continuously intercept the ciphertext whose length is the length of the data interception from the ciphertext of the coordinate information corresponding to the target information;
将截取得到的密文确定为所述目标信息对应的压缩密文。The intercepted ciphertext is determined as the compressed ciphertext corresponding to the target information.
可选的,处理器21用于执行存储器24存储的程序指令,用于执行以下操作:Optionally, the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
从所述目标信息对应的坐标信息的密文中截取所述第一坐标的密文,以及所述第二坐标的密文的最低位;Intercept the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate from the ciphertext of the coordinate information corresponding to the target information;
将所述第一坐标的密文以及所述第二坐标的密文的最低位确定为所述截取得到的密文。The ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate are determined as the ciphertext obtained by interception.
可选的,处理器21用于执行存储器24存储的程序指令,用于执行以下操作:Optionally, the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
接收针对所述目标信息的获取请求;receiving an acquisition request for the target information;
根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文;Obtain the compressed ciphertext corresponding to the target information from the blockchain network according to the obtaining request;
对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的坐标信息的密文;Decompressing the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
对所述目标信息对应的坐标信息的密文进行解密,得到所述目标信息对应的坐标信息,根据所述目标信息对应的坐标信息确定所述目标信息。The ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the coordinate information corresponding to the target information, and the target information is determined according to the coordinate information corresponding to the target information.
可选的,处理器21用于执行存储器24存储的程序指令,用于执行以下操作:Optionally, the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
从所述目标函数的曲线上获取所述第一坐标的密文对应候选第二坐标;Obtain a candidate second coordinate corresponding to the ciphertext of the first coordinate from the curve of the objective function;
将所述候选第二坐标中最低位与所述第二坐标的密文的最低位相同的候选第二坐标,作为所述第二坐标的密文;Taking the candidate second coordinate whose lowest bit is the same as the lowest bit of the ciphertext of the second coordinate in the candidate second coordinate as the ciphertext of the second coordinate;
将所述第一坐标的密文以及所述第二坐标的密文确定为所述目标信息对应的坐标信息的密文。The ciphertext of the first coordinate and the ciphertext of the second coordinate are determined as the ciphertext of the coordinate information corresponding to the target information.
可选的,处理器21用于执行存储器24存储的程序指令,用于执行以下操作:Optionally, the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
从本地存储中获取信息标识与区块之间的对应关系;根据所述对应关系确定用于存储所述目标信息对应的压缩密文的目标区块;Obtain the correspondence between the information identifier and the block from the local storage; determine the target block for storing the compressed ciphertext corresponding to the target information according to the correspondence;
从所述区块链网络中的目标区块中获取所述目标信息对应的压缩密文。Obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
可选的,处理器21用于执行存储器24存储的程序指令,用于执行以下操作:Optionally, the processor 21 is configured to execute the program instructions stored in the memory 24 to perform the following operations:
获取所述目标信息对应的目标用户的用户信息;obtaining the user information of the target user corresponding to the target information;
根据所述用户信息生成所述目标信息对应的密钥;Generate a key corresponding to the target information according to the user information;
采用所述目标信息对应的密钥,对所述目标信息对应的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文。Using the key corresponding to the target information, the coordinate information corresponding to the target information is encrypted to obtain the ciphertext of the coordinate information corresponding to the target information.
本申请实施例中所描述的处理器21、输入装置22、输出装置23可执行本申请实施例提供的对信息的密文进行压缩的加密方法的实施例中所描述的实现方式,也可执行本申请实施例所描述的电子设备的实现方式,在此不再赘述。The processor 21 , the input device 22 , and the output device 23 described in the embodiments of the present application can execute the implementations described in the embodiments of the encryption method for compressing the ciphertext of information provided in the embodiments of the present application, and can also execute The implementation manner of the electronic device described in the embodiments of the present application will not be repeated here.
本申请实施例中,通过获取用于描述信息的目标函数,以及待处理的目标信息,从目标函数的曲线上确定目标信息对应的坐标信息;对目标信息的坐标信息进行加密,得到目标信息对应的坐标信息的密文;采用数据截取长度对目标信息对应的密文进行截取,获得目标信息对应的压缩密文,对目标信息对应的压缩密文进行存储时,可以降低目标信息对的密文的存储空间,节省存储空间;将目标信息对应的压缩密文存储至区块链网络中,可有效避免将目标信息的密文存储至终端本地,导致目标信息的密文被篡改,导致不能根据目标信息的密文解密得到目标消息,提高目标信息的安全性。在需要获取目标信息时,可以对目标信息对应的压缩密文进行解压缩处理,得到目标信息对应的坐标信息的密文;对目标信息对应的坐标信息的密文进行解密,得到目标信息。In the embodiment of the present application, by acquiring the objective function used to describe the information and the target information to be processed, the coordinate information corresponding to the target information is determined from the curve of the objective function; the coordinate information of the target information is encrypted to obtain the corresponding coordinate information of the target information. The ciphertext of the coordinate information; the ciphertext corresponding to the target information is intercepted by the data interception length, and the compressed ciphertext corresponding to the target information is obtained. When the compressed ciphertext corresponding to the target information is stored, the ciphertext of the target information pair can be reduced. save storage space; store the compressed ciphertext corresponding to the target information in the blockchain network, which can effectively avoid storing the ciphertext of the target information locally in the terminal, resulting in the ciphertext of the target information being tampered with The ciphertext of the target information is decrypted to obtain the target message, which improves the security of the target information. When the target information needs to be obtained, the compressed ciphertext corresponding to the target information can be decompressed to obtain the ciphertext of the coordinate information corresponding to the target information; the ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the target information.
本申请实施例中还提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令被处理器执行时实现如图2及图4实施例中所示的对信息的密文进行压缩的加密方法。Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program includes program instructions, and when the program instructions are executed by a processor, FIG. 2 and FIG. 2 are implemented. 4. The encryption method for compressing the ciphertext of information shown in the embodiment.
可选的,本申请涉及的存储介质可以为可读存储介质,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。Optionally, the storage medium involved in the present application may be a readable storage medium, and the storage medium involved in the present application, such as a computer-readable storage medium, may be non-volatile or volatile.
所述计算机可读存储介质可以是前述任一实施例所述的电子设备的内部存储单元,例如电子设备的硬盘或内存。所述计算机可读存储介质也可以是所述电子设备的外部存储设备,例如所述电子设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述计算机可读存储介质还可以既包括所述电子设备的内部存储单元也包括外部存储设备。所述计算机可读存储介质用于存储所述计算机程序以及所述电子设备所需的其他程序和数据。所述计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。The computer-readable storage medium may be an internal storage unit of the electronic device described in any of the foregoing embodiments, such as a hard disk or a memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk equipped on the electronic device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) ) card, Flash Card, etc. Further, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been or will be output.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,上述描述的电子设备和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. Interchangeability, the above description has generally described the components and steps of each example in terms of function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application. Those skilled in the art can clearly understand that, for the convenience and brevity of description, for the specific working process of the electronic device and unit described above, reference may be made to the corresponding process in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的电子设备和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例是示意性的,例如,所述单元的划分,可以为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。In the several embodiments provided in this application, it should be understood that the disclosed electronic devices and methods may be implemented in other manners. For example, the device embodiments described above are illustrative, for example, the division of the units may be a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到各种等效的修改或替换,这些修改或替换都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalents within the technical scope disclosed in the present application. Modifications or substitutions shall be covered by the protection scope of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种对信息的密文进行压缩的加密方法,包括:An encryption method for compressing ciphertext of information, comprising:
    获取用于描述信息的目标函数,以及待处理的目标信息;Obtain the objective function used to describe the information, and the target information to be processed;
    从所述目标函数的曲线上确定所述目标信息对应的坐标信息;Determine the coordinate information corresponding to the target information from the curve of the target function;
    对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;Encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
    对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information;
    将所述目标信息对应的压缩密文存储至区块链网络中。The compressed ciphertext corresponding to the target information is stored in the blockchain network.
  2. 根据权利要求1所述的方法,其中,所述目标信息对应的坐标信息包括第一坐标和第二坐标;所述对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文,包括:The method according to claim 1, wherein the coordinate information corresponding to the target information includes a first coordinate and a second coordinate; the ciphertext of the coordinate information corresponding to the target information is compressed to obtain the target The compressed ciphertext corresponding to the information, including:
    获取数据截取长度,所述数据截取长度大于所述第一坐标的字节长度,或者大于所述第二坐标的字节长度,且小于所述第一坐标的字节长度与所述第二坐标的字节长度之和;Obtain the data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate and the second coordinate The sum of the byte lengths of ;
    从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文;Continuously intercept the ciphertext whose length is the length of the data interception from the ciphertext of the coordinate information corresponding to the target information;
    将截取得到的密文确定为所述目标信息对应的压缩密文。The intercepted ciphertext is determined as the compressed ciphertext corresponding to the target information.
  3. 根据权利要求2所述的方法,其中,所述从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文,包括:The method according to claim 2, wherein the continuously intercepting the ciphertext whose length is the data interception length from the ciphertext of the coordinate information corresponding to the target information comprises:
    从所述目标信息对应的坐标信息的密文中截取所述第一坐标的密文,以及所述第二坐标的密文的最低位;Intercept the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate from the ciphertext of the coordinate information corresponding to the target information;
    将所述第一坐标的密文以及所述第二坐标的密文的最低位确定为所述截取得到的密文。The ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate are determined as the ciphertext obtained by interception.
  4. 根据权利要求3所述的方法,其中,所述方法还包括:The method of claim 3, wherein the method further comprises:
    接收针对所述目标信息的获取请求;receiving an acquisition request for the target information;
    根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文;Obtain the compressed ciphertext corresponding to the target information from the blockchain network according to the obtaining request;
    对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的坐标信息的密文;Decompressing the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
    对所述目标信息对应的坐标信息的密文进行解密,得到所述目标信息对应的坐标信息,根据所述目标信息对应的坐标信息确定所述目标信息。The ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the coordinate information corresponding to the target information, and the target information is determined according to the coordinate information corresponding to the target information.
  5. 根据权利要求4所述的方法,其中,所述目标信息对应的压缩密文包括所述第一坐标的密文以及所述第二坐标的密文的最低位,所述第一坐标和所述第二坐标为所述目标信息对应的坐标信息;The method according to claim 4, wherein the compressed ciphertext corresponding to the target information comprises the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate, the first coordinate and the ciphertext of the second coordinate The second coordinate is the coordinate information corresponding to the target information;
    所述对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的坐标信息的密文,包括:Decompressing the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information, including:
    从所述目标函数的曲线上获取所述第一坐标的密文对应候选第二坐标;Obtain a candidate second coordinate corresponding to the ciphertext of the first coordinate from the curve of the objective function;
    将所述候选第二坐标中最低位与所述第二坐标的密文的最低位相同的候选第二坐标,作为所述第二坐标的密文;Taking the candidate second coordinate whose lowest bit is the same as the lowest bit of the ciphertext of the second coordinate in the candidate second coordinate as the ciphertext of the second coordinate;
    将所述第一坐标的密文以及所述第二坐标的密文确定为所述目标信息对应的坐标信息的密文。The ciphertext of the first coordinate and the ciphertext of the second coordinate are determined as the ciphertext of the coordinate information corresponding to the target information.
  6. 根据权利要求4所述的方法,其中,所述获取请求中包括所述目标信息的信息标识,所述根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文,包括:The method according to claim 4, wherein the acquisition request includes an information identifier of the target information, and the compressed ciphertext corresponding to the target information is acquired from the blockchain network according to the acquisition request ,include:
    从本地存储中获取信息标识与区块之间的对应关系;根据所述对应关系确定用于存储所述目标信息对应的压缩密文的目标区块;Obtain the correspondence between the information identifier and the block from the local storage; determine the target block for storing the compressed ciphertext corresponding to the target information according to the correspondence;
    从所述区块链网络中的目标区块中获取所述目标信息对应的压缩密文。Obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
  7. 根据权利要求1所述的方法,其中,所述对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文,包括:The method according to claim 1, wherein the encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information, comprising:
    获取所述目标信息对应的目标用户的用户信息;obtaining the user information of the target user corresponding to the target information;
    根据所述用户信息生成所述目标信息对应的密钥;Generate a key corresponding to the target information according to the user information;
    采用所述目标信息对应的密钥,对所述目标信息对应的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文。Using the key corresponding to the target information, the coordinate information corresponding to the target information is encrypted to obtain the ciphertext of the coordinate information corresponding to the target information.
  8. 一种对信息的密文进行压缩的加密装置,包括:An encryption device for compressing ciphertext of information, comprising:
    第一获取模块,用于获取用于描述信息的目标函数,以及待处理的目标信息;The first acquisition module is used to acquire the target function used to describe the information, and the target information to be processed;
    确定模块,用于从所述目标函数的曲线上确定所述目标信息对应的坐标信息;A determination module, for determining the coordinate information corresponding to the target information from the curve of the target function;
    加密模块,用于对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;an encryption module, configured to encrypt the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
    压缩模块,用于对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;a compression module, configured to compress the ciphertext of the coordinate information corresponding to the target information, and obtain the compressed ciphertext corresponding to the target information;
    存储模块,用于将所述目标信息对应的压缩密文存储至区块链网络中。The storage module is used for storing the compressed ciphertext corresponding to the target information in the blockchain network.
  9. 一种计算机设备,包括:处理器、存储器以及网络接口;A computer device, comprising: a processor, a memory and a network interface;
    所述处理器与存储器、网络接口相连,其中,网络接口用于提供数据通信功能,所述存储器用于存储程序代码,所述处理器用于调用所述程序代码,以执行以下方法:The processor is connected to a memory and a network interface, wherein the network interface is used to provide a data communication function, the memory is used to store program codes, and the processor is used to call the program codes to execute the following methods:
    获取用于描述信息的目标函数,以及待处理的目标信息;Obtain the objective function used to describe the information, and the target information to be processed;
    从所述目标函数的曲线上确定所述目标信息对应的坐标信息;Determine the coordinate information corresponding to the target information from the curve of the target function;
    对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;Encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
    对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information;
    将所述目标信息对应的压缩密文存储至区块链网络中。The compressed ciphertext corresponding to the target information is stored in the blockchain network.
  10. 根据权利要求9所述的计算机设备,其中,所述目标信息对应的坐标信息包括第一坐标和第二坐标;执行所述对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文,包括:The computer device according to claim 9, wherein the coordinate information corresponding to the target information includes a first coordinate and a second coordinate; performing the compression process on the ciphertext of the coordinate information corresponding to the target information to obtain the obtained The compressed ciphertext corresponding to the target information, including:
    获取数据截取长度,所述数据截取长度大于所述第一坐标的字节长度,或者大于所述第二坐标的字节长度,且小于所述第一坐标的字节长度与所述第二坐标的字节长度之和;Obtain the data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate and the second coordinate The sum of the byte lengths of ;
    从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文;Continuously intercept the ciphertext whose length is the length of the data interception from the ciphertext of the coordinate information corresponding to the target information;
    将截取得到的密文确定为所述目标信息对应的压缩密文。The intercepted ciphertext is determined as the compressed ciphertext corresponding to the target information.
  11. 根据权利要求10所述的计算机设备,其中,执行所述从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文,包括:The computer device according to claim 10, wherein performing the continuous interception of the ciphertext whose length is the data interception length from the ciphertext of the coordinate information corresponding to the target information comprises:
    从所述目标信息对应的坐标信息的密文中截取所述第一坐标的密文,以及所述第二坐标的密文的最低位;Intercept the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate from the ciphertext of the coordinate information corresponding to the target information;
    将所述第一坐标的密文以及所述第二坐标的密文的最低位确定为所述截取得到的密文。The ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate are determined as the ciphertext obtained by interception.
  12. 根据权利要求11所述的计算机设备,其中,所述处理器还用于执行:The computer device of claim 11, wherein the processor is further configured to perform:
    接收针对所述目标信息的获取请求;receiving an acquisition request for the target information;
    根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文;Obtain the compressed ciphertext corresponding to the target information from the blockchain network according to the obtaining request;
    对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的坐标信息的密文;Decompressing the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
    对所述目标信息对应的坐标信息的密文进行解密,得到所述目标信息对应的坐标信息,根据所述目标信息对应的坐标信息确定所述目标信息。The ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the coordinate information corresponding to the target information, and the target information is determined according to the coordinate information corresponding to the target information.
  13. 根据权利要求12所述的计算机设备,其中,所述目标信息对应的压缩密文包括所述第一坐标的密文以及所述第二坐标的密文的最低位,所述第一坐标和所述第二坐标为所述目标信息对应的坐标信息;The computer device according to claim 12, wherein the compressed ciphertext corresponding to the target information comprises the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate, the first coordinate and the The second coordinate is the coordinate information corresponding to the target information;
    执行所述对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的 坐标信息的密文,包括:Execute the described decompression process to the compressed ciphertext corresponding to the target information, obtain the ciphertext of the coordinate information corresponding to the target information, including:
    从所述目标函数的曲线上获取所述第一坐标的密文对应候选第二坐标;Obtain a candidate second coordinate corresponding to the ciphertext of the first coordinate from the curve of the objective function;
    将所述候选第二坐标中最低位与所述第二坐标的密文的最低位相同的候选第二坐标,作为所述第二坐标的密文;Using the candidate second coordinate whose lowest bit is the same as the lowest bit of the ciphertext of the second coordinate in the candidate second coordinate as the ciphertext of the second coordinate;
    将所述第一坐标的密文以及所述第二坐标的密文确定为所述目标信息对应的坐标信息的密文。The ciphertext of the first coordinate and the ciphertext of the second coordinate are determined as the ciphertext of the coordinate information corresponding to the target information.
  14. 根据权利要求12所述的计算机设备,其中,所述获取请求中包括所述目标信息的信息标识,执行所述根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文,包括:The computer device according to claim 12, wherein the obtaining request includes an information identifier of the target information, and performing the compression corresponding to obtaining the target information from the blockchain network according to the obtaining request Ciphertext, including:
    从本地存储中获取信息标识与区块之间的对应关系;根据所述对应关系确定用于存储所述目标信息对应的压缩密文的目标区块;Obtain the correspondence between the information identifier and the block from the local storage; determine the target block for storing the compressed ciphertext corresponding to the target information according to the correspondence;
    从所述区块链网络中的目标区块中获取所述目标信息对应的压缩密文。Obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时,执行以下方法:A computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, the computer program includes program instructions, and the program instructions, when executed by a processor, perform the following method:
    获取用于描述信息的目标函数,以及待处理的目标信息;Obtain the objective function used to describe the information, and the target information to be processed;
    从所述目标函数的曲线上确定所述目标信息对应的坐标信息;Determine the coordinate information corresponding to the target information from the curve of the target function;
    对所述目标信息的坐标信息进行加密,得到所述目标信息对应的坐标信息的密文;Encrypting the coordinate information of the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
    对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文;compressing the ciphertext of the coordinate information corresponding to the target information to obtain the compressed ciphertext corresponding to the target information;
    将所述目标信息对应的压缩密文存储至区块链网络中。The compressed ciphertext corresponding to the target information is stored in the blockchain network.
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述目标信息对应的坐标信息包括第一坐标和第二坐标;执行所述对所述目标信息对应的坐标信息的密文进行压缩处理,获得所述目标信息对应的压缩密文,包括:The computer-readable storage medium according to claim 15, wherein the coordinate information corresponding to the target information includes a first coordinate and a second coordinate; and performing the compression process on the ciphertext of the coordinate information corresponding to the target information , obtain the compressed ciphertext corresponding to the target information, including:
    获取数据截取长度,所述数据截取长度大于所述第一坐标的字节长度,或者大于所述第二坐标的字节长度,且小于所述第一坐标的字节长度与所述第二坐标的字节长度之和;Obtain the data interception length, where the data interception length is greater than the byte length of the first coordinate, or greater than the byte length of the second coordinate, and less than the byte length of the first coordinate and the second coordinate The sum of the byte lengths of ;
    从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文;Continuously intercept the ciphertext whose length is the length of the data interception from the ciphertext of the coordinate information corresponding to the target information;
    将截取得到的密文确定为所述目标信息对应的压缩密文。The intercepted ciphertext is determined as the compressed ciphertext corresponding to the target information.
  17. 根据权利要求16所述的计算机可读存储介质,其中,执行所述从所述目标信息对应的坐标信息的密文中连续截取长度为所述数据截取长度的密文,包括:The computer-readable storage medium according to claim 16, wherein performing the continuously intercepting the ciphertext whose length is the data interception length from the ciphertext of the coordinate information corresponding to the target information comprises:
    从所述目标信息对应的坐标信息的密文中截取所述第一坐标的密文,以及所述第二坐标的密文的最低位;Intercept the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate from the ciphertext of the coordinate information corresponding to the target information;
    将所述第一坐标的密文以及所述第二坐标的密文的最低位确定为所述截取得到的密文。The ciphertext of the first coordinate and the lowest digit of the ciphertext of the second coordinate are determined as the ciphertext obtained by interception.
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述程序指令当被处理器执行时,还用于执行:The computer-readable storage medium of claim 17, wherein the program instructions, when executed by the processor, are further configured to perform:
    接收针对所述目标信息的获取请求;receiving an acquisition request for the target information;
    根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文;Obtain the compressed ciphertext corresponding to the target information from the blockchain network according to the obtaining request;
    对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的坐标信息的密文;Decompressing the compressed ciphertext corresponding to the target information to obtain the ciphertext of the coordinate information corresponding to the target information;
    对所述目标信息对应的坐标信息的密文进行解密,得到所述目标信息对应的坐标信息,根据所述目标信息对应的坐标信息确定所述目标信息。The ciphertext of the coordinate information corresponding to the target information is decrypted to obtain the coordinate information corresponding to the target information, and the target information is determined according to the coordinate information corresponding to the target information.
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述目标信息对应的压缩密文包括所述第一坐标的密文以及所述第二坐标的密文的最低位,所述第一坐标和所述第二坐标为所述目标信息对应的坐标信息;The computer-readable storage medium according to claim 18, wherein the compressed ciphertext corresponding to the target information comprises the ciphertext of the first coordinate and the lowest bit of the ciphertext of the second coordinate, the first coordinate The coordinates and the second coordinates are the coordinate information corresponding to the target information;
    执行所述对所述目标信息对应的压缩密文进行解压缩处理,得到所述目标信息对应的 坐标信息的密文,包括:Execute the described decompression process to the compressed ciphertext corresponding to the target information, obtain the ciphertext of the coordinate information corresponding to the target information, including:
    从所述目标函数的曲线上获取所述第一坐标的密文对应候选第二坐标;Obtain a candidate second coordinate corresponding to the ciphertext of the first coordinate from the curve of the objective function;
    将所述候选第二坐标中最低位与所述第二坐标的密文的最低位相同的候选第二坐标,作为所述第二坐标的密文;Using the candidate second coordinate whose lowest bit is the same as the lowest bit of the ciphertext of the second coordinate in the candidate second coordinate as the ciphertext of the second coordinate;
    将所述第一坐标的密文以及所述第二坐标的密文确定为所述目标信息对应的坐标信息的密文。The ciphertext of the first coordinate and the ciphertext of the second coordinate are determined as the ciphertext of the coordinate information corresponding to the target information.
  20. 根据权利要求18所述的计算机可读存储介质,其中,所述获取请求中包括所述目标信息的信息标识,执行所述根据所述获取请求从所述区块链网络中获取所述目标信息对应的压缩密文,包括:The computer-readable storage medium according to claim 18, wherein the obtaining request includes an information identifier of the target information, and executing the obtaining of the target information from the blockchain network according to the obtaining request The corresponding compressed ciphertext, including:
    从本地存储中获取信息标识与区块之间的对应关系;根据所述对应关系确定用于存储所述目标信息对应的压缩密文的目标区块;Obtain the correspondence between the information identifier and the block from the local storage; determine the target block for storing the compressed ciphertext corresponding to the target information according to the correspondence;
    从所述区块链网络中的目标区块中获取所述目标信息对应的压缩密文。Obtain the compressed ciphertext corresponding to the target information from the target block in the blockchain network.
PCT/CN2021/109259 2020-09-29 2021-07-29 Encryption method and apparatus for compressing ciphertext of information, and device and medium WO2022068359A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011053192.4A CN112131591A (en) 2020-09-29 2020-09-29 Encryption method, device, equipment and medium for compressing ciphertext of information
CN202011053192.4 2020-09-29

Publications (1)

Publication Number Publication Date
WO2022068359A1 true WO2022068359A1 (en) 2022-04-07

Family

ID=73843142

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/109259 WO2022068359A1 (en) 2020-09-29 2021-07-29 Encryption method and apparatus for compressing ciphertext of information, and device and medium

Country Status (2)

Country Link
CN (1) CN112131591A (en)
WO (1) WO2022068359A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112131591A (en) * 2020-09-29 2020-12-25 深圳壹账通智能科技有限公司 Encryption method, device, equipment and medium for compressing ciphertext of information
CN113468583A (en) * 2021-07-26 2021-10-01 华链时代(北京)科技有限公司 Encrypted data processing method and device based on block chain and electronic equipment

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023892A (en) * 2012-12-03 2013-04-03 江苏乐买到网络科技有限公司 Network information processing system
CN108830600A (en) * 2018-06-19 2018-11-16 方欣科技有限公司 A kind of electronic invoice system and implementation method based on block chain
CN108964916A (en) * 2018-08-03 2018-12-07 元科技控股有限公司 Signature generating method, generating means, signature verification method and verifying device
CN109347878A (en) * 2018-11-30 2019-02-15 西安电子科技大学 The data verification of decentralization and data safety transaction system and method
CN109948357A (en) * 2018-11-15 2019-06-28 陕西医链区块链集团有限公司 System for connecting medical block chain and Internet of things
CN110602083A (en) * 2019-09-10 2019-12-20 上海黔易数据科技有限公司 Secure transmission and storage method of digital identity authentication data
WO2020034151A1 (en) * 2018-08-16 2020-02-20 区链通网络有限公司 Block chain inter-node communication method and apparatus, and storage medium and block chain system
CN110830235A (en) * 2019-11-08 2020-02-21 华侨大学 Intelligent vehicle networking trusted data encryption method and system based on block chain
CN110839026A (en) * 2019-11-12 2020-02-25 深圳市网心科技有限公司 Data processing method based on block chain and related equipment
CN111079162A (en) * 2019-12-13 2020-04-28 山东众阳健康科技集团有限公司 Data encryption method, data decryption method and data encryption system based on block chain
CN111079171A (en) * 2019-11-11 2020-04-28 重庆邮电大学 Block chain-based medical data privacy protection method and storage medium
CN112131591A (en) * 2020-09-29 2020-12-25 深圳壹账通智能科技有限公司 Encryption method, device, equipment and medium for compressing ciphertext of information

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10084600B1 (en) * 2018-04-16 2018-09-25 Xage Security, Inc. Decentralized information protection for confidentiality and tamper-proofing on distributed database
CN110888938A (en) * 2019-09-02 2020-03-17 腾讯科技(深圳)有限公司 Student identity information processing method and device based on block chain network

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103023892A (en) * 2012-12-03 2013-04-03 江苏乐买到网络科技有限公司 Network information processing system
CN108830600A (en) * 2018-06-19 2018-11-16 方欣科技有限公司 A kind of electronic invoice system and implementation method based on block chain
CN108964916A (en) * 2018-08-03 2018-12-07 元科技控股有限公司 Signature generating method, generating means, signature verification method and verifying device
WO2020034151A1 (en) * 2018-08-16 2020-02-20 区链通网络有限公司 Block chain inter-node communication method and apparatus, and storage medium and block chain system
CN109948357A (en) * 2018-11-15 2019-06-28 陕西医链区块链集团有限公司 System for connecting medical block chain and Internet of things
CN109347878A (en) * 2018-11-30 2019-02-15 西安电子科技大学 The data verification of decentralization and data safety transaction system and method
CN110602083A (en) * 2019-09-10 2019-12-20 上海黔易数据科技有限公司 Secure transmission and storage method of digital identity authentication data
CN110830235A (en) * 2019-11-08 2020-02-21 华侨大学 Intelligent vehicle networking trusted data encryption method and system based on block chain
CN111079171A (en) * 2019-11-11 2020-04-28 重庆邮电大学 Block chain-based medical data privacy protection method and storage medium
CN110839026A (en) * 2019-11-12 2020-02-25 深圳市网心科技有限公司 Data processing method based on block chain and related equipment
CN111079162A (en) * 2019-12-13 2020-04-28 山东众阳健康科技集团有限公司 Data encryption method, data decryption method and data encryption system based on block chain
CN112131591A (en) * 2020-09-29 2020-12-25 深圳壹账通智能科技有限公司 Encryption method, device, equipment and medium for compressing ciphertext of information

Also Published As

Publication number Publication date
CN112131591A (en) 2020-12-25

Similar Documents

Publication Publication Date Title
WO2021238527A1 (en) Digital signature generation method and apparatus, computer device, and storage medium
US10903976B2 (en) End-to-end secure operations using a query matrix
CN109150499B (en) Method and device for dynamically encrypting data, computer equipment and storage medium
Bhatia et al. Towards a secure incremental proxy re‐encryption for e‐healthcare data sharing in mobile cloud computing
US20180212753A1 (en) End-To-End Secure Operations Using a Query Vector
US20150149763A1 (en) Server-Aided Private Set Intersection (PSI) with Data Transfer
TW498233B (en) Method of authenticating anonymous users while reducing potential for ""middleman"" fraud
WO2022068355A1 (en) Encryption method and apparatus based on feature of information, device, and storage medium
CN111294203B (en) Information transmission method
WO2022068358A1 (en) Encryption method and apparatus for generating keys on basis of attributes of information, and device
WO2022068359A1 (en) Encryption method and apparatus for compressing ciphertext of information, and device and medium
US11411742B2 (en) Private set calculation using private intersection and calculation, and applications thereof
CN113691502A (en) Communication method, communication device, gateway server, client and storage medium
WO2022068360A1 (en) Shared root key-based information processing method and apparatus, and device and medium
CN112202554B (en) Information processing method, device and equipment for generating key based on attribute of information
WO2022068236A1 (en) Method and apparatus for processing information on basis of features of information, and device and medium
WO2020215685A1 (en) Block chain-based information processing and acquisition methods and apparatus, device, and medium
WO2022068356A1 (en) Blockchain-based information encryption method and apparatus, device and medium
WO2022068362A1 (en) Block chain-based information processing method and apparatus, device, and medium
TW202232913A (en) Generating shared keys
KR20210036700A (en) Blockchain system for supporting change of plain text data included in transaction
CN114039785A (en) Data encryption, decryption and processing method, device, equipment and storage medium
WO2022068234A1 (en) Encryption method and apparatus based on shared root key, device and medium
WO2022068235A1 (en) Information processing method and apparatus for generating random number on the basis of attribute of information, and device
CN113726772A (en) Method, device, equipment and storage medium for realizing on-line inquiry session

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: 21874021

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 03/07/2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21874021

Country of ref document: EP

Kind code of ref document: A1