CN112084523A - Text encryption method and device, terminal equipment and storage medium - Google Patents

Text encryption method and device, terminal equipment and storage medium Download PDF

Info

Publication number
CN112084523A
CN112084523A CN202011057738.3A CN202011057738A CN112084523A CN 112084523 A CN112084523 A CN 112084523A CN 202011057738 A CN202011057738 A CN 202011057738A CN 112084523 A CN112084523 A CN 112084523A
Authority
CN
China
Prior art keywords
text
processed
data
text data
encryption
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011057738.3A
Other languages
Chinese (zh)
Inventor
贾牧
谢丹力
陆陈一帆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
OneConnect Financial Technology Co Ltd Shanghai
Original Assignee
OneConnect Financial Technology Co Ltd Shanghai
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 OneConnect Financial Technology Co Ltd Shanghai filed Critical OneConnect Financial Technology Co Ltd Shanghai
Priority to CN202011057738.3A priority Critical patent/CN112084523A/en
Publication of CN112084523A publication Critical patent/CN112084523A/en
Pending legal-status Critical Current

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
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6209Protecting access to data via a platform, e.g. using keys or access control rules to a single file or object, e.g. in a secure envelope, encrypted and accessed using a key, or with access control rules appended to the object itself

Abstract

The application discloses a text encryption method and device, terminal equipment and a storage medium, which are suitable for an elliptic curve encryption algorithm and digital medical treatment, and the method comprises the following steps: acquiring a text to be processed and a text generation parameter; generating target text data according to the text to be processed and the text generation parameters; determining mapping text data of the target text data according to the target text data and a preset mapping relation; and determining the text data encryption parameter, and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter. By the method and the device, the success rate of text encryption can be improved.

Description

Text encryption method and device, terminal equipment and storage medium
Technical Field
The present application relates to the field of information security technologies, and in particular, to a text encryption method and apparatus, a terminal device, and a storage medium.
Background
At present, an elliptic curve cryptography algorithm based on the difficulty of discrete logarithm of an elliptic curve in a finite field is widely applied to the field of digital medical encryption due to the advantages of high safety, small calculated amount, small hardware implementation scale and the like. In the prior art, a text encryption scheme mainly uses an elliptic curve cryptographic algorithm to directly encrypt a text to obtain ciphertext data of the text, and the scheme has the characteristic that the size of the text exceeds a prime field at the bottom of the elliptic curve, or the text cannot be mapped onto the elliptic curve in a decompression process, so that the encryption process cannot be continued, and the success rate of text encryption is low.
Disclosure of Invention
The application provides a text encryption method and device, terminal equipment and a storage medium, which can improve the success rate of text encryption and have simple operation and high applicability.
In a first aspect, the present application provides a text encryption method, including:
acquiring a text to be processed and a text generation parameter;
generating target text data according to the text to be processed and the text generation parameters;
determining mapping text data of the target text data according to the target text data and a preset mapping relation;
and determining a text data encryption parameter, and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter.
With reference to the first aspect, in a possible implementation manner, the preset mapping relationship includes a preset elliptic curve;
the determining of the mapping text data of the target text data according to the target text data and a preset mapping relationship includes:
determining an abscissa of the preset elliptic curve input corresponding to the target text data based on the target text data, and determining an ordinate corresponding to the abscissa as an ordinate corresponding to the mapped text data based on the preset elliptic curve;
and determining curve coordinate data corresponding to the abscissa and the ordinate as mapping text data of the target text data.
With reference to the first aspect, in a possible implementation manner, the text data encryption parameter includes an encryption key of the text to be processed and an encryption key of the preset elliptic curve;
the determining the text data encryption parameter includes:
determining an encryption key of the text to be processed according to the text to be processed or the text generation parameter;
and acquiring an encryption key of the preset elliptic curve, and determining the encryption key of the text to be processed and the encryption key of the preset elliptic curve as the text data encryption parameters.
With reference to the first aspect, in one possible implementation manner, the generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter includes:
determining encrypted data according to the encryption key of the text to be processed and the encryption key of the preset elliptic curve;
and generating ciphertext data of the target text data according to the encrypted data and the mapping text data.
With reference to the first aspect, in a possible implementation manner, the determining an encryption key of the to-be-processed text according to the to-be-processed text includes:
determining attribute information of the text to be processed, and performing hash calculation on the attribute information of the text to be processed to obtain a root key of the text to be processed;
performing hash calculation on the root key of the text to be processed to obtain an encryption key of the text to be processed;
the attribute information of the text to be processed comprises text length or text generation time.
With reference to the first aspect, in a possible implementation manner, the determining an encryption key of the text to be processed according to the text generation parameter includes:
performing hash calculation on the text generation parameters to obtain a root key of the text to be processed;
and performing hash calculation on the root key of the text to be processed to obtain the encryption key of the text to be processed.
With reference to the first aspect, in one possible implementation manner, the text generation parameter is a random number, and the random number is an integer greater than or equal to 0 and less than or equal to 128.
In a second aspect, the present application provides a text encryption apparatus, comprising:
the acquisition module is used for acquiring the text to be processed and the text generation parameters; the text generation parameter is a random number, and the random number is an integer which is greater than or equal to 0 and less than or equal to 128;
the target text generation module is used for generating target text data according to the text to be processed and the text generation parameters;
the mapping text determining module is used for determining the mapping text data of the target text data according to the target text data and a preset mapping relation;
and the determining and generating module is used for determining a text data encryption parameter and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter.
With reference to the second aspect, in a possible implementation manner, the preset mapping relationship includes a preset elliptic curve;
the mapping text determination module includes:
a coordinate determining unit, configured to determine, based on the target text data, an abscissa of the input preset elliptic curve corresponding to the target text data, and determine, based on the preset elliptic curve, an ordinate corresponding to the abscissa as a ordinate corresponding to the mapped text data;
and a mapped text determining unit configured to determine curve coordinate data corresponding to the abscissa and the ordinate as mapped text data of the target text data.
With reference to the second aspect, in a possible implementation manner, the text data encryption parameter includes an encryption key of the text to be processed and an encryption key of the preset elliptic curve;
the determination generation module includes:
a text key determining unit, configured to determine an encryption key of the to-be-processed text according to the to-be-processed text or the text generation parameter;
and the acquisition determining unit is used for acquiring the encryption key of the preset elliptic curve and determining the encryption key of the text to be processed and the encryption key of the preset elliptic curve as the text data encryption parameters.
With reference to the second aspect, in one possible implementation, the determining and generating module includes:
the encrypted data determining unit is used for determining encrypted data according to the encryption key of the text to be processed and the encryption key of the preset elliptic curve;
and a ciphertext data generation unit configured to generate ciphertext data of the target text data according to the encrypted data and the mapping text data.
With reference to the second aspect, in a possible implementation manner, the text key determining unit includes: the first text key determines a subunit.
The first text key determining subunit is configured to determine attribute information of the to-be-processed text, and perform hash calculation on the attribute information of the to-be-processed text to obtain a root key of the to-be-processed text; and performing hash calculation on the root key of the text to be processed to obtain the encryption key of the text to be processed, wherein the attribute information of the text to be processed comprises the text length or the text generation time.
With reference to the second aspect, in a possible implementation manner, the text key determining unit includes: the second text key determines the subunit.
The second text key determining subunit is configured to perform hash calculation on the text generation parameter to obtain a root key of the to-be-processed text; and performing hash calculation on the root key of the text to be processed to obtain the encryption key of the text to be processed.
In a third aspect, the present application provides a terminal device, including a processor, a memory and a transceiver, where the processor, the memory and the transceiver are connected to each other, where the memory is used to store a computer program that supports the text encryption device to execute the text encryption method, and the computer program includes program instructions; the processor is configured to invoke the program instructions to perform the text encryption method as described above in the first aspect of the present application.
In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, the computer program comprising program instructions; the program instructions described above, when executed by a processor, cause the processor to perform a text encryption method as described above in the first aspect of the present application.
In the application, a text encryption device acquires a text to be processed and a text generation parameter; generating target text data according to the text to be processed and the text generation parameters; determining mapping text data of the target text data according to the target text data and a preset mapping relation; and determining the text data encryption parameter, and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter. By the method and the device, the success rate of text encryption can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a block link point system architecture diagram provided herein;
FIG. 2 is a flow chart of a text encryption method provided in the present application;
FIG. 3 is another schematic flow chart of a text encryption method provided herein;
FIG. 4 is a schematic structural diagram of a text encryption device provided in the present application;
fig. 5 is a schematic structural diagram of a terminal device provided in the present application.
Detailed Description
The technical solutions in the present application will be described clearly and completely with reference to the accompanying drawings in the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
At present, an elliptic curve cryptography algorithm based on the difficulty of discrete logarithm of an elliptic curve in a finite field is widely applied to the field of encryption due to the advantages of high safety, small calculated amount, small hardware implementation scale and the like. Generally, in the process of encrypting a text, an elliptic curve cryptographic algorithm is mainly used for directly encrypting the text to obtain ciphertext data of the text, and the scheme has the characteristic that the size of the text exceeds a prime field at the bottom of the elliptic curve, or the text cannot be mapped onto the elliptic curve in the process of decompressing, so that the encryption process cannot be continued, and the success rate of encrypting the text is low. The text encryption method can generate target text data according to a text to be processed and text generation parameters, map the target text data onto a preset elliptic curve to obtain mapped text data, and generate ciphertext data of the target text data according to the mapped text data and the text encryption data, so that the success rate of text encryption is improved.
The text encryption method provided by the present application is applicable to a blockchain node system, which includes a text encryption device and a blockchain network, please refer to fig. 1, which is a schematic diagram of an architecture of the blockchain node system provided by the present application. As shown in fig. 1, the architecture diagram includes a text encryption apparatus 100 and a blockchain network 101, wherein the blockchain network 101 includes a plurality of common nodes. The text encryption apparatus 100 may be a computer device, including a tablet computer, a notebook computer, a handheld computer, a Mobile Internet Device (MID), a Point Of Sale (POS), and the like.
In the text encryption method provided by the present application, the text encryption device 100 may obtain a text to be processed and a text generation parameter, where the text generation parameter may be binary data with a byte length of 1 and a highest order of 0. The text encryption device 100 may use the text generation parameter as the highest byte of the target text data, splice the highest byte with the text to be processed to generate the target text data, input the target text data as the target text data into an abscissa corresponding to a preset elliptic curve, and determine an ordinate corresponding to the abscissa based on the preset elliptic curve to be used as an ordinate corresponding to the mapped text data. Further, the text encryption device 100 may determine the curve coordinate data corresponding to the abscissa and the ordinate as the mapped text data of the target text data, determine the text data encryption parameter, and generate the ciphertext data of the target text data from the mapped text data and the text data encryption parameter. Then, the text encryption apparatus 100 may send the ciphertext data of the target text data to the consensus node in the blockchain network 101, where the consensus node performs consensus verification on the ciphertext data of the target text data after receiving the ciphertext data of the target text data, and returns a consensus confirmation message to the text encryption apparatus when the consensus verification passes. The text encryption apparatus 100 may further add a block of ciphertext data including the target text data to the blockchain network 101 in a case where it is confirmed that the ratio of the number of received consensus confirmation messages to the number of consensus nodes reaches a preset consensus ratio.
The text encryption method provided by the application can be applied to the encryption scene of the electronic information file in digital medical treatment, wherein the electronic information file can comprise the medical record of a patient, the basic information of a doctor and the like.
For convenience of description, the text encryption method provided in the present application will be exemplified below with reference to fig. 2 to 3, taking a text encryption device as an execution subject.
Referring to fig. 2, a flow chart of the text encryption method provided in the present application is shown. As shown in fig. 2, the method provided by the present application may include the following steps:
s101, obtaining a text to be processed and a text generation parameter.
In some possible embodiments, the text generation parameter is a random number, and the random number is an integer greater than or equal to 0 and less than or equal to 128. It is to be understood that the text generation parameter may be binary data having a byte length of 1 and a most significant bit of 0.
In some possible embodiments, the text encryption apparatus obtains a text to be processed from a preset text set, and obtains a text generation parameter from a preset random number set, where a byte length of each text in the preset text set is less than or equal to a preset byte length, and the preset byte lengths correspond to preset elliptic curves one to one, that is, the preset byte length is a difference between the length of the preset elliptic curve and 1. Illustratively, if the predetermined elliptic curve is secp256r1, and the length of the curve is 32, the predetermined byte length is 31 bytes.
And S102, generating target text data according to the text to be processed and the text generation parameters.
In some possible embodiments, the text encryption device may encode the text to be processed to obtain binary encoded data. Illustratively, the length of coded data obtained by coding an english character is 8 bits, the length of coded data obtained by coding a chinese character is 16 bits, and the text encryption device can code chinese and english included in the text to be processed to obtain binary coded data with a certain length. The text encryption device can take the text generation parameter as the highest byte of the target text data, and splice the highest byte with the coded data obtained by the text coding to be processed to obtain the target text data in a binary form.
It should be noted that, in the process of generating the target text data, only the highest bit of the text generation parameter needs to be ensured as the highest bit of the target text data, and a specific implementation manner of splicing data of other bits in the text generation parameter with encoded data obtained from the text to be processed is not limited here.
S103, determining the mapping text data of the target text data according to the target text data and the preset mapping relation.
In some possible embodiments, the predetermined mapping relationship includes a predetermined elliptic curve. The text encryption device can determine the abscissa of an input preset elliptic curve corresponding to the target text data based on the target text data, and determine the ordinate corresponding to the abscissa as the ordinate corresponding to the mapping text data based on the preset elliptic curve; and determining curve coordinate data corresponding to the abscissa and the ordinate as mapping text data of the target text data.
Specifically, the text encryption device converts the target text data in binary form into text data in decimal form, determines the text data in decimal form as the abscissa m of the input preset elliptic curve (such as secp256r1) corresponding to the target text data, and substitutes x-m into the expression y of the binary cubic equation of the preset elliptic curve2=x3+ a x + b, where a and b are constants, and two ordinates N corresponding to the abscissa M are calculated1And N2. Then, the ordinate N with the lowest order being 1 is set1As the ordinate corresponding to the mapped text data, and the abscissa M and the ordinate N1Corresponding curve coordinate data (M, N) is determined as mapping text data of the target text data, wherein M is a binary representation of M, and N is N1In binary representation. It can be understood that the binary representation form corresponding to the point on the preset elliptic curve to which the target text data is mapped is the mapping text data of the target text data.
And S104, determining the text data encryption parameters, and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameters.
In some possible embodiments, the text data encryption parameter includes an encryption key of the text to be processed and an encryption key of the preset elliptic curve, and the text encryption device may determine the encryption key of the text to be processed according to the text to be processed or the text generation parameter. The text encryption device can also obtain an encryption key of the preset elliptic curve, and determine the encryption key of the text to be processed and the encryption key of the preset elliptic curve as the text data encryption parameters.
In some feasible embodiments, the text encryption device determines attribute information of a text to be processed, and performs hash calculation on the attribute information of the text to be processed to obtain a root key of the text to be processed; and carrying out Hash calculation on the root key of the text to be processed to obtain an encryption key of the text to be processed. Here, the attribute information of the text to be processed may include text length information of the text to be processed, text generation time information, and the like, and may be specifically determined according to an actual application scenario, which is not limited herein.
For example, the text encryption device determines that the text length l of the text to be processed is l, performs hash calculation on the text length l of the text to be processed to obtain a root key K-hash 1 of the text to be processed, and performs hash calculation on the root key hash1 to obtain an encryption key K-hash 2 of the text to be processed.
Optionally, the text encryption device may also perform hash calculation on the text generation parameter to obtain a root key of the text to be processed, and perform hash calculation on the root key of the text to be processed to obtain an encryption key of the text to be processed.
For example, the text encryption device performs hash calculation on the text generation parameter r to obtain a root key K-hash 3 of the text to be processed, and performs hash calculation on the root key hash3 to obtain an encryption key K-hash 4 of the text to be processed.
In some possible embodiments, the text encryption device obtains an encryption key of a preset elliptic curve, and determines the encryption key of the text to be processed and the encryption key of the preset elliptic curve as the text data encryption parameters. Here, the encryption key of the preset Elliptic Curve may be a public key H of the preset Elliptic Curve, where H is a fixed value generated by an Elliptic Curve Digital Signature Algorithm (ECDSA) regardless of a base point G on the preset Elliptic Curve.
In some possible embodiments, the text encryption device obtains a public key H of a preset elliptic curve in the blockchain network according to a curve identifier (such as a curve expression) of the preset elliptic curve, and determines an encryption key k of the text to be processed and the public key H of the preset elliptic curve as the text data encryption parameters. And then, the text encryption device can generate ciphertext data of the target text data according to the mapping text data and the text data encryption parameter.
In some possible embodiments, the text encryption device calculates a product between an encryption key k of the text to be processed and a public key H of a preset elliptic curve, and determines a sum between the product and the mapped text data as ciphertext data of the target text data.
Further, since the ciphertext data of the target text data is represented by coordinates in binary form, and the length of the elliptic curve secp256r1 is 32 bytes long, the data lengths of the abscissa and the ordinate in the ciphertext data of the target text data are both 32 bytes long, and the data length of the ciphertext data of the target text data is 64 bytes long. In order to save storage space, the text encryption device splices the lowest bit of the ordinate in the ciphertext data of the target text data as the lowest bit of the compressed ciphertext data of the target text data with the abscissa in the ciphertext data of the target text data to obtain the compressed ciphertext data of the target text data, wherein the data length of the compressed ciphertext data is 33 bytes, so that the storage space is effectively saved.
In the application, since the byte length of the text to be processed is less than or equal to the preset byte length (for example, the difference between the length of the preset elliptic curve and 1), and the length of the text generation parameter is one byte length and the highest bit is 0, it is ensured that the length of the generated target text data is less than or equal to the length of the preset elliptic curve, and further, the legality of mapping the target text data onto the preset elliptic curve as the abscissa is ensured, so that the success rate of acquiring the ordinate in the mapped text data is improved, that is, the success rate of text encryption is improved.
Please refer to fig. 3, which is a flowchart illustrating a text encryption method according to the present application. As shown in fig. 3, the method provided by the present application may include the following steps:
s201, obtaining a text to be processed and a text generation parameter.
And S202, generating target text data according to the text to be processed and the text generation parameters.
S203, determining the mapping text data of the target text data according to the target text data and the preset mapping relation.
And S204, determining text data encryption parameters, wherein the text data encryption parameters comprise an encryption key of a text to be processed and an encryption key of a preset elliptic curve.
In some possible embodiments, the implementation manners performed in the steps S201 to S204 may refer to the implementation manners provided in the steps S101 to S104 in the embodiment shown in fig. 2, and are not described herein again.
It should be noted that, if the mapping text data of the target text data cannot be determined in step S203, the process returns to step S201 to obtain the text generation parameters again, and then step S202 to step S203 are executed until the mapping text data of the target text data is obtained.
S205, determining the encrypted data according to the encryption key of the text to be processed and the encryption key of the preset elliptic curve.
In some possible embodiments, the text encryption device may calculate a product between an encryption key of the text to be processed and an encryption key of a preset elliptic curve, and determine the product as the encrypted data.
And S206, generating ciphertext data of the target text data according to the encrypted data and the mapping text data.
In some possible embodiments, the text encryption device calculates a sum between the encrypted data and the mapped text data to obtain ciphertext data of the target text data.
In the application, the byte length of the text to be processed is less than or equal to the preset byte length (the difference between the length of the preset elliptic curve and 1), and the text generation parameter is a random number with the length of one byte and the highest bit of 0, so that not only is the safety of the text to be processed improved, but also the length of the generated target text data is ensured to be less than or equal to the length of the preset elliptic curve, and further the legality of mapping the target text data onto the preset elliptic curve as the abscissa is ensured, so that the success rate of acquiring the ordinate in the mapped text data is improved, namely the success rate of text encryption is improved.
Based on the description of the above method embodiment, the present application also provides a text encryption apparatus, which may be a computer program (including a program code) running in a terminal device. Please refer to fig. 4, which is a schematic structural diagram of a text encryption apparatus provided in the present application. As shown in fig. 4, the text encryption device 4 may include: an acquisition module 41, a target text generation module 42, a mapping text determination module 43, and a determination generation module 44.
An obtaining module 41, configured to obtain a text to be processed and a text generation parameter; the text generation parameter is a random number, and the random number is an integer which is greater than or equal to 0 and less than or equal to 128;
a target text generation module 42, configured to generate target text data according to the to-be-processed text and the text generation parameter;
a mapping text determining module 43, configured to determine mapping text data of the target text data according to the target text data and a preset mapping relationship;
and a determining and generating module 44, configured to determine a text data encryption parameter, and generate ciphertext data of the target text data according to the mapping text data and the text data encryption parameter.
In some possible embodiments, the preset mapping relationship includes a preset elliptic curve;
the mapping text determining module 43 includes:
a coordinate determining unit 431, configured to determine, based on the target text data, an abscissa of the input preset elliptic curve corresponding to the target text data, and determine, based on the preset elliptic curve, an ordinate corresponding to the abscissa as a ordinate corresponding to the mapped text data;
a mapped text determining unit 432, configured to determine curve coordinate data corresponding to the abscissa and the ordinate as mapped text data of the target text data.
In some possible embodiments, the text data encryption parameter includes an encryption key of the text to be processed and an encryption key of the preset elliptic curve;
the determination generating module 44 includes:
a text key determining unit 441, configured to determine an encryption key of the to-be-processed text according to the to-be-processed text or the text generation parameter;
the obtaining and determining unit 442 is configured to obtain an encryption key of the preset elliptic curve, and determine the encryption key of the to-be-processed text and the encryption key of the preset elliptic curve as the text data encryption parameters.
In some possible embodiments, the determination generation module 44 includes:
an encrypted data determining unit 443 configured to determine encrypted data according to the encryption key of the text to be processed and the encryption key of the preset elliptic curve;
a ciphertext data generating unit 444, configured to generate ciphertext data of the target text data according to the encrypted data and the mapping text data.
In some possible embodiments, the text key determining unit 441 includes: the first text key determining sub-unit 4411.
The first text key determining subunit 4411 is configured to determine attribute information of the to-be-processed text, and perform hash calculation on the attribute information of the to-be-processed text to obtain a root key of the to-be-processed text; and performing hash calculation on the root key of the text to be processed to obtain the encryption key of the text to be processed, wherein the attribute information of the text to be processed comprises the text length or the text generation time.
In some possible embodiments, the text key determining unit 441 includes: the second text key determining sub-unit 4412.
The second text key determining subunit 4412 is configured to perform hash calculation on the text generation parameter to obtain a root key of the to-be-processed text; and performing hash calculation on the root key of the text to be processed to obtain the encryption key of the text to be processed.
It will be appreciated that the text encryption means 4 is arranged to implement the steps performed by the text encryption means in the embodiments of figures 2 and 3. As to the specific implementation manner and corresponding advantageous effects of the functional blocks included in the text encryption apparatus 4 of fig. 4, reference may be made to the specific description of the embodiments of fig. 2 and fig. 3, which is not repeated herein.
The text encryption apparatus 4 in the embodiment shown in fig. 4 can be implemented by the terminal device 500 shown in fig. 5, and the text encryption apparatus can be operated in the terminal device. Please refer to fig. 5, which is a schematic structural diagram of a terminal device provided in the present application. As shown in fig. 5, the terminal device 500 may include: one or more processors 501, memory 502, and transceiver 503. The processor 501, memory 502, and transceiver 503 are connected by a bus 504. The transceiver 503 is configured to receive or transmit data, and the memory 502 is configured to store a computer program, where the computer program includes program instructions; the processor 501 is configured to execute the program instructions stored in the memory 502, and perform the following operations:
acquiring a text to be processed and a text generation parameter;
generating target text data according to the text to be processed and the text generation parameters;
determining mapping text data of the target text data according to the target text data and a preset mapping relation;
and determining a text data encryption parameter, and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter.
In some possible embodiments, the preset mapping relationship includes a preset elliptic curve;
the processor 501 determines mapping text data of the target text data according to the target text data and a preset mapping relationship, and specifically performs the following operations:
determining an abscissa of the preset elliptic curve input corresponding to the target text data based on the target text data, and determining an ordinate corresponding to the abscissa as an ordinate corresponding to the mapped text data based on the preset elliptic curve;
and determining curve coordinate data corresponding to the abscissa and the ordinate as mapping text data of the target text data.
In some possible embodiments, the text data encryption parameter includes an encryption key of the text to be processed and an encryption key of the preset elliptic curve;
the processor 701 determines the text data encryption parameter, and specifically performs the following operations:
determining an encryption key of the text to be processed according to the text to be processed or the text generation parameter;
and acquiring an encryption key of the preset elliptic curve, and determining the encryption key of the text to be processed and the encryption key of the preset elliptic curve as the text data encryption parameters.
In some possible embodiments, the processor 701 generates ciphertext data of the target text data according to the mapping text data and the text data encryption parameter, and specifically performs the following operations:
determining encrypted data according to the encryption key of the text to be processed and the encryption key of the preset elliptic curve;
and generating ciphertext data of the target text data according to the encrypted data and the mapping text data.
In some possible embodiments, the processor 701 determines an encryption key of the text to be processed according to the text to be processed, and specifically performs the following operations:
determining attribute information of the text to be processed, and performing hash calculation on the attribute information of the text to be processed to obtain a root key of the text to be processed;
and performing hash calculation on the root key of the text to be processed to obtain the encryption key of the text to be processed, wherein the attribute information of the text to be processed comprises the text length or the text generation time.
In some possible embodiments, the processor 701 determines the encryption key of the text to be processed according to the text generation parameter, and specifically performs the following operations:
performing hash calculation on the text generation parameters to obtain a root key of the text to be processed;
and performing hash calculation on the root key of the text to be processed to obtain the encryption key of the text to be processed.
In some possible embodiments, the text generation parameter is a random number, and the random number is an integer greater than or equal to 0 and less than or equal to 128.
Further, here, it is to be noted that: the present application further provides a computer-readable storage medium, and the computer-readable storage medium stores the computer program executed by the text encryption device 4 mentioned above, and the computer program includes program instructions, and when the processor executes the program instructions, the description of the text encryption response method in the embodiment corresponding to fig. 2 or fig. 3 can be executed, so that details will not be repeated here. In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in embodiments of the computer-readable storage medium referred to in the present application, reference is made to the description of embodiments of the method of the present application. As an example, program instructions may be deployed to be executed on one computing device or on multiple computing devices at one site or distributed across multiple sites and interconnected by a communication network, which may comprise a block chain system.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The method and the related device provided by the application are described by referring to the method flow chart and/or the structure schematic diagram provided by the application, and each flow and/or block of the method flow chart and/or the structure schematic diagram and the combination of the flow and/or block in the flow chart and/or the block diagram can be realized by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block or blocks.
The above disclosure is only for the purpose of illustrating the preferred embodiments of the present application and is not to be construed as limiting the scope of the present application, so that the present application is not limited thereto, and all equivalent variations and modifications can be made to the present application.

Claims (10)

1. A method for encrypting text, comprising:
acquiring a text to be processed and a text generation parameter;
generating target text data according to the text to be processed and the text generation parameters;
determining mapping text data of the target text data according to the target text data and a preset mapping relation;
and determining a text data encryption parameter, and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter.
2. The method of claim 1, wherein the predetermined mapping comprises a predetermined elliptic curve;
the determining the mapping text data of the target text data according to the target text data and a preset mapping relation comprises:
determining an abscissa of the preset elliptic curve input corresponding to the target text data based on the target text data, and determining an ordinate corresponding to the abscissa as an ordinate corresponding to the mapping text data based on the preset elliptic curve;
and determining curve coordinate data corresponding to the abscissa and the ordinate as mapping text data of the target text data.
3. The method according to claim 2, wherein the text data encryption parameters comprise an encryption key of the text to be processed and an encryption key of the preset elliptic curve;
the determining of the text data encryption parameter comprises:
determining an encryption key of the text to be processed according to the text to be processed or the text generation parameter;
and acquiring the encryption key of the preset elliptic curve, and determining the encryption key of the text to be processed and the encryption key of the preset elliptic curve as the text data encryption parameters.
4. The method of claim 3, wherein generating ciphertext data of the target text data according to the mapped text data and the text data encryption parameter comprises:
determining encrypted data according to the encryption key of the text to be processed and the encryption key of the preset elliptic curve;
and generating ciphertext data of the target text data according to the encrypted data and the mapping text data.
5. The method according to claim 3, wherein the determining an encryption key of the text to be processed according to the text to be processed comprises:
determining attribute information of the text to be processed, and performing hash calculation on the attribute information of the text to be processed to obtain a root key of the text to be processed;
performing hash calculation on the root key of the text to be processed to obtain an encryption key of the text to be processed;
wherein the attribute information of the text to be processed comprises the length of the text or the generation time of the text.
6. The method according to claim 3, wherein the determining an encryption key of the text to be processed according to the text generation parameter comprises:
performing hash calculation on the text generation parameters to obtain a root key of the text to be processed;
and carrying out Hash calculation on the root key of the text to be processed to obtain an encryption key of the text to be processed.
7. The method of any one of claims 1-6, wherein the text generation parameter is a random number, and wherein the random number is an integer greater than or equal to 0 and less than or equal to 128.
8. A text encryption apparatus, comprising:
the acquisition module is used for acquiring the text to be processed and the text generation parameters;
the target text generation module is used for generating target text data according to the text to be processed and the text generation parameters;
the mapping text determining module is used for determining the mapping text data of the target text data according to the target text data and a preset mapping relation;
and the determining and generating module is used for determining a text data encryption parameter and generating ciphertext data of the target text data according to the mapping text data and the text data encryption parameter.
9. A terminal device comprising a processor, a memory and a transceiver, the processor, the memory and the transceiver being interconnected, wherein the transceiver is configured to receive or transmit data, the memory is configured to store program code, and the processor is configured to invoke the program code to perform a text encryption method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which is executed by a processor to implement the text encryption method of any one of claims 1 to 7.
CN202011057738.3A 2020-09-29 2020-09-29 Text encryption method and device, terminal equipment and storage medium Pending CN112084523A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011057738.3A CN112084523A (en) 2020-09-29 2020-09-29 Text encryption method and device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011057738.3A CN112084523A (en) 2020-09-29 2020-09-29 Text encryption method and device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112084523A true CN112084523A (en) 2020-12-15

Family

ID=73730075

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011057738.3A Pending CN112084523A (en) 2020-09-29 2020-09-29 Text encryption method and device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112084523A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277266A (en) * 2022-09-29 2022-11-01 南京银铂科技有限公司 Laboratory data encryption method, device, terminal and medium

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001285277A (en) * 2000-04-03 2001-10-12 Toshiba Information Systems (Japan) Corp Encryption generator, electronic device using encryption generating program, storage medium, and encrypted text decoder
US20060165231A1 (en) * 2002-10-26 2006-07-27 The Additional Director (Ipr) Defence Research & Development Organisation Method of elliptic curve encryption
JP2013156348A (en) * 2012-01-27 2013-08-15 Fujitsu Ltd Encryption key generation method, encryption key generation device and encryption key generation program
CN104641592A (en) * 2012-02-10 2015-05-20 联英私人公司 Method and system for a certificate-less authentication encryption (CLAE)
CN107483212A (en) * 2017-08-15 2017-12-15 武汉信安珞珈科技有限公司 A kind of method of both sides' cooperation generation digital signature
CN110417726A (en) * 2019-05-27 2019-11-05 腾讯科技(深圳)有限公司 A kind of key management method and relevant device
CN110502602A (en) * 2019-08-14 2019-11-26 平安科技(深圳)有限公司 Date storage method, device, equipment and computer storage medium
CN110839026A (en) * 2019-11-12 2020-02-25 深圳市网心科技有限公司 Data processing method based on block chain and related equipment
CN111191255A (en) * 2019-08-08 2020-05-22 腾讯科技(深圳)有限公司 Information encryption processing method, server, terminal, device and storage medium
CN111222155A (en) * 2020-01-08 2020-06-02 湖南智慧政务区块链科技有限公司 Method and system for combining re-encryption and block link

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001285277A (en) * 2000-04-03 2001-10-12 Toshiba Information Systems (Japan) Corp Encryption generator, electronic device using encryption generating program, storage medium, and encrypted text decoder
US20060165231A1 (en) * 2002-10-26 2006-07-27 The Additional Director (Ipr) Defence Research & Development Organisation Method of elliptic curve encryption
JP2013156348A (en) * 2012-01-27 2013-08-15 Fujitsu Ltd Encryption key generation method, encryption key generation device and encryption key generation program
CN104641592A (en) * 2012-02-10 2015-05-20 联英私人公司 Method and system for a certificate-less authentication encryption (CLAE)
CN107483212A (en) * 2017-08-15 2017-12-15 武汉信安珞珈科技有限公司 A kind of method of both sides' cooperation generation digital signature
CN110417726A (en) * 2019-05-27 2019-11-05 腾讯科技(深圳)有限公司 A kind of key management method and relevant device
CN111191255A (en) * 2019-08-08 2020-05-22 腾讯科技(深圳)有限公司 Information encryption processing method, server, terminal, device and storage medium
CN110502602A (en) * 2019-08-14 2019-11-26 平安科技(深圳)有限公司 Date storage method, device, equipment and computer storage medium
CN110839026A (en) * 2019-11-12 2020-02-25 深圳市网心科技有限公司 Data processing method based on block chain and related equipment
CN111222155A (en) * 2020-01-08 2020-06-02 湖南智慧政务区块链科技有限公司 Method and system for combining re-encryption and block link

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
GHANMY NABIL ELECTRICAL ENGINEERING DEPARTMENT OF NATIONAL SCHOOL OF ENGINEERS OF SFAX, ELECTRONIC AND INFORMATION TECHNOLOGY LABO: "Hardware implementation of elliptic curve digital signature algorithm (ECDSA) on Koblitz curves", 2012 8TH INTERNATIONAL SYMPOSIUM ON COMMUNICATION SYSTEMS, NETWORKS & DIGITAL SIGNAL PROCESSING (CSNDSP), pages 1 - 6 *
周海波: "网络安全维护中应用加密机的相关技术研究", 数字技术与应用, no. 10, pages 180 - 182 *
胡越梅;: "一个ECC签密方案的设计分析", 枣庄学院学报, no. 02, pages 47 - 50 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277266A (en) * 2022-09-29 2022-11-01 南京银铂科技有限公司 Laboratory data encryption method, device, terminal and medium

Similar Documents

Publication Publication Date Title
JP6720424B1 (en) Key sharing device and method
CN103427997B (en) A kind of method generating digital signature and device
JP2020530577A (en) Devices and methods for performing approximate operations on ciphertext
KR101594553B1 (en) Method of generating a cryptographic key, network and computer program therefor
EP2882132A1 (en) Shared secret key generation device, encryption device, decryption device, shared secret key generation method, encryption method, decryption method, and program
US9172530B2 (en) Apparatus and method for generating secret key for ID-based encryption system and recording medium having program recorded thereon for causing computer to execute the method
CN112560091B (en) Digital signature method, signature information verification method, related device and electronic equipment
CN104126284A (en) Generating digital signatures
CN105721156A (en) General Encoding Functions For Modular Exponentiation Encryption Schemes
WO2015156020A1 (en) Information processing device, program, and storage medium
CN115795513A (en) File encryption method, file decryption method, file encryption device, file decryption device and equipment
CN112084523A (en) Text encryption method and device, terminal equipment and storage medium
JP2023520776A (en) Method and system for compression encryption
US11431476B2 (en) Install time creation of forward error correction data and integrity checksums
CN112202555A (en) Information processing method, device and equipment for generating random number based on attribute of information
JP2022045614A (en) Arithmetic device
CN111967026A (en) Method and device for encrypting and decrypting redemption code and computer equipment
CN114221753B (en) Key data processing method and electronic equipment
CN116170180A (en) Encryption method, encryption device, storage medium and electronic equipment
CN109905241B (en) Short Chinese character encoding and decoding method of elliptic curve public key
CN111931204A (en) Encryption and de-duplication storage method and terminal equipment for distributed system
CN112800476A (en) Data desensitization method and device and electronic equipment
CN116484443B (en) Trusted security storage method and device based on hong Monte-go system
CN116318738B (en) Signature method, signature system, electronic equipment and storage medium
CN112925853B (en) Trusted data exchange method and device based on block chain, terminal equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
CB02 Change of applicant information

Address after: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant after: ONECONNECT FINANCIAL TECHNOLOGY Co.,Ltd. (SHANGHAI)

Address before: Room 201, Building A, No. 1 Qianwan Road, Qianhaisheng Cooperation Zone, Shenzhen City, Guangdong Province, 518000

Applicant before: ONECONNECT FINANCIAL TECHNOLOGY Co.,Ltd. (SHANGHAI)

CB02 Change of applicant information
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination