CN119155016B - A method and system for encrypting e-commerce store data - Google Patents
A method and system for encrypting e-commerce store dataInfo
- Publication number
- CN119155016B CN119155016B CN202411129792.2A CN202411129792A CN119155016B CN 119155016 B CN119155016 B CN 119155016B CN 202411129792 A CN202411129792 A CN 202411129792A CN 119155016 B CN119155016 B CN 119155016B
- Authority
- CN
- China
- Prior art keywords
- data
- encrypted
- encryption
- bit
- module
- 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.)
- Active
Links
Abstract
The invention relates to the field of data encryption and discloses an electronic shop data encryption method which comprises the steps of obtaining data information of data to be encrypted, recoding characters in sensitive fields in the data to be encrypted by using integers from 0 to 63, representing each recoded character by using a 6-bit binary system to obtain recoded data of the sensitive fields, encrypting 64-bit and multiple data blocks by adopting an AIFT-3 DES encryption algorithm to obtain the encrypted 64-bit and multiple data blocks, outputting the encrypted data, storing the encrypted data and limiting access rights of the encrypted data. By the technical scheme provided by the invention, the length of the encrypted sensitive field is unchanged, and the safety of data is ensured.
Description
Technical Field
The invention relates to the field of data encryption, in particular to a method and a system for encrypting data of an electronic shop.
Background
Some 3DES is a symmetric key encryption block cipher, which is equivalent to applying a triple Data Encryption Standard (DES) algorithm to each data block. To improve security, the algorithm groups the 24-byte KEY with a length of 8 bytes, the first eight bytes being KEY1, the middle 8 bytes being KEY2, and the last 8 bytes being KEY3. During encryption, the KEY1 is used for carrying out DES encryption on the plaintext data block 1 to obtain C1, the KEY2 is used for carrying out DES decryption on the C1 to obtain C2, and the KEY3 is used for carrying out DES encryption on the C2 to obtain C3. The decryption flow is reversed.
Whereas the conventional 3DES algorithm encrypts a block with 64 bits, if the data length is not a multiple of 64 bits, padding is required to fill the data length by a multiple of 64. If the size of the input data is not a multiple of 64 bits, it is necessary to fill the data length with a multiple of 64 bits. This increases the length of the encrypted data, which tends to impact overall efficiency and integrity.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides an encryption method for data of an electronic shop, which comprises the following steps:
Step one, acquiring data information of data to be encrypted, if the length of the data to be encrypted is not smaller than a set length threshold value, entering a step two, otherwise, filling the data length of the data to be encrypted to the set length threshold value, and entering the step two;
recoding characters in a sensitive field in the data to be encrypted by using an integer from 0to 63, and representing each recoded character by using a 6-bit binary system to obtain recoded data of the sensitive field;
If the binary data exceeding 64 bits and multiples thereof exist in the data recoded by the sensitive field, splitting the data into 64 bits and multiples thereof, carrying out 3DES encryption on the 64 bits and multiples thereof, reserving redundant binary data, entering a step four, if the binary data does not exist, encrypting the 64 bits and multiples thereof by adopting an AIFT_3DES encryption algorithm to obtain the 64 bits and multiples thereof after encryption, and entering a step six;
Combining the obtained encrypted 64-bit data block and the multiple thereof with binary data exceeding the multiple of 64 bits to obtain combined data, and recompiling the combined data by taking 6 bits as one byte;
Step five, shifting the last 6 bytes of the combined recompiled data to obtain encrypted data of the combined data;
And step six, outputting the encrypted data, storing the encrypted data and limiting the access authority of the encrypted data.
Further, the sensitive field is a preset field, including uppercase english letters and numbers.
Further, the method further comprises the step of filling the data to be encrypted to a length of 11 bytes if the data to be encrypted is smaller than 11 bytes.
Further, the step of combining the obtained encrypted 64-bit and multiple thereof data block with binary data exceeding the multiple of 64 bits to obtain combined data, and recompiling the combined data with 6 bits as one byte includes:
Coding according to the characters of 0-63, compiling into characters with every 6 bits binary data, wherein the characters comprise capital letters, numbers and special characters.
Further, the shifting operation for the last 6 bytes of the data recompiled after merging includes:
After all binary data are converted into characters, the last six characters are shifted, namely, the shifting is carried out according to character codes of 0-63, a mapping relation exists between the characters and the character codes, each character is represented by one of numbers of 0-63, and the shifting means that the number is subjected to addition and subtraction operation.
Further, the storing the encrypted data and limiting the access rights of the encrypted data includes:
the user and rights management functions of MySQL are used to restrict the tables or fields that the user can access while restricting the user from viewing only the data.
The data encryption system of the electronic shop comprises a data server, a data input module, a data filling module, a data processing module, a data encryption module and a data communication module;
the data processing module is connected with the data input module, the data filling module, the data encryption module and the data processing module in sequence;
the data input module is used for receiving data to be encrypted;
the data filling module is used for filling data of the data to be encrypted, the length of which is smaller than a set length threshold value;
The data encryption module is used for encrypting data;
The data server is used for storing the encrypted data.
The beneficial effects of the invention are as follows:
The AIFT_3DES encryption algorithm combines character encoding and 3DES algorithm to encrypt sensitive fields in the data of the electronic shop. The method effectively reduces the length of data in the encryption process by compressing the character code from 8 bits to 6 bits, avoids data filling, and improves encryption efficiency and security.
2. The length of data encryption is unchanged, and the AIFT-3 DES algorithm ensures that the length of the encrypted data is unchanged for the case that the length of input data is more than 11 bytes. For data with the length less than 11 bytes, filling is carried out to 11 bytes, then encryption is carried out, the minimum length requirement of a 3DES algorithm is met, and the consistency and the integrity of the encrypted data are ensured.
Drawings
FIG. 1 is a flow chart of an electronic store data encryption method;
FIG. 2 is a schematic diagram of an implementation of an electronic store data encryption method;
Fig. 3 is a schematic diagram of an electronic store data encryption system.
Detailed Description
The technical solution of the present invention will be described in further detail with reference to the accompanying drawings, but the scope of the present invention is not limited to the following description.
The features and capabilities of the present invention are described in further detail below in connection with the examples.
As shown in fig. 1, an electronic shop data encryption method includes the following steps:
Step one, acquiring data information of data to be encrypted, if the length of the data to be encrypted is not smaller than a set length threshold value, entering a step two, otherwise, filling the data length of the data to be encrypted to the set length threshold value, and entering the step two;
recoding characters in a sensitive field in the data to be encrypted by using an integer from 0to 63, and representing each recoded character by using a 6-bit binary system to obtain recoded data of the sensitive field;
If the binary data exceeding 64 bits and multiples thereof exist in the data recoded by the sensitive field, splitting the data into 64 bits and multiples thereof, carrying out 3DES encryption on the 64 bits and multiples thereof, reserving redundant binary data, entering a step four, if the binary data does not exist, encrypting the 64 bits and multiples thereof by adopting an AIFT_3DES encryption algorithm to obtain the 64 bits and multiples thereof after encryption, and entering a step six;
Combining the obtained encrypted 64-bit data block and the multiple thereof with binary data exceeding the multiple of 64 bits to obtain combined data, and recompiling the combined data by taking 6 bits as one byte;
Step five, shifting the last 6 bytes of the combined recompiled data to obtain encrypted data of the combined data;
And step six, outputting the encrypted data, storing the encrypted data and limiting the access authority of the encrypted data.
The sensitive fields are preset fields, and comprise capital English letters and numbers.
And if the data to be encrypted is smaller than 11 bytes, filling the data to be encrypted to a length of 11 bytes.
Combining the obtained encrypted 64-bit data block and multiple thereof with binary data exceeding the multiple of 64 bits to obtain combined data, and recompiling the combined data by taking 6 bits as one byte, wherein the method comprises the following steps:
Coding according to the characters of 0-63, compiling into characters with every 6 bits binary data, wherein the characters comprise capital letters, numbers and special characters.
The shift operation for the last 6 bytes of the combined recompiled data comprises the following steps:
After all binary data are converted into characters, the last six characters are shifted, namely, the shifting is carried out according to character codes of 0-63, a mapping relation exists between the characters and the character codes, each character is represented by one of numbers of 0-63, and the shifting means that the number is subjected to addition and subtraction operation.
The data storage of the encrypted data and the limitation of the access authority of the encrypted data comprise:
the user and rights management functions of MySQL are used to restrict the tables or fields that the user can access while restricting the user from viewing only the data.
As shown in fig. 3, an electronic shop data encryption system, to which the electronic shop data encryption method is applied, includes a data server, a data input module, a data filling module, a data processing module, a data encryption module and a data communication module;
the data processing module is connected with the data input module, the data filling module, the data encryption module and the data processing module in sequence;
the data input module is used for receiving data to be encrypted;
the data filling module is used for filling data of the data to be encrypted, the length of which is smaller than a set length threshold value;
The data encryption module is used for encrypting data;
The data server is used for storing the encrypted data.
Specifically, as shown in FIG. 2, the character recoding is that first, we find that the sensitive fields in the API store data are all capital English letters and numbers. The integers 0 to 63 are used to recode uppercase english alphabets, numbers and special characters. By representing these characters in a 6-bit binary system, the compression of ASCII code from an 8-bit binary system to a 6-bit binary system is achieved.
The AIFT 3DES encryption algorithm then shortens the number of bits per byte by character re-encoding so that when the 3DES algorithm is used, the number of bytes encrypted is increased, effectively reducing binary data by more than a multiple of 64 bits. And (3) data exceeding the multiple of 64 bits are not processed firstly, after the data blocks of the previous 64 bits and the multiple thereof are encrypted, the data blocks are combined together, then the data blocks are compiled by taking 6 bits as 1 byte, the last 6 bytes are shifted, the influence of unencrypted data is reduced, and finally the encrypted data is obtained.
Because encryption is performed on blocks of data that are 64 and multiples thereof, there may be excess binary data that is not encrypted. After converting all binary data into characters (bytes), the last six bits of characters (bytes) are shifted, i.e., according to the character codes of 0-63. The characters and the character codes have a mapping relation, each character is represented by one of numbers 0-63, and the shift refers to adding and subtracting the number.
Let a be represented by the number 10, shifted by +9 to become the number 19, and 19 represents the character J, which is changed by shifting a to J. The purpose of this shift is to encrypt the extra binary data that was not previously encrypted. And finally obtaining the data encrypted by all data at the binary data layer.
The encrypted data is binary data and therefore needs to be recompiled. The compiling is according to the character codes of 0-63 which we set up by himself, compiling into characters with every 6 bits of binary data, these characters include capital letters, numbers and special characters.
Therefore, for data with the input data length of more than 11 bytes, no data is added in the whole process, and the encrypted length is unchanged. For data with input data less than 11 bytes, the data is filled to 11 bytes, the length of the data is 11 bytes, the 11 bytes are just 66 bits, and the minimum length 64-bit requirement of the 3DES is met).
Store authorization data, namely, an electronic commerce performs store authorization through a Tolo electronic commerce platform to generate store authorization data, and the store authorization data is taken to an access token, wherein the store authorization data has a plurality of data about the privacy of the electronic commerce, and only specific personnel have access to the electronic commerce.
The user and rights management functions using MySQL restrict which users can access which tables or fields. Meanwhile, the user is limited to only take the data to view, and the data can not be added or deleted. The adding and deleting rights only have the right of the personnel of the encryption group to add and delete the data.
And (3) encrypting the data, namely transferring the store data to a new server, and encrypting the privacy information of the store data according to an AIFT_3DES algorithm in the transferring process to obtain encrypted data.
The following are two specific examples of the encryption method for data of the electronic shop:
Embodiment one:
And in the scene, the user information database of a certain e-commerce platform needs to be encrypted so as to protect the privacy security of the user.
The implementation steps are as follows:
Data preprocessing, namely checking each record in a user information database and determining the length of each record. For records with a length of less than 11 bytes, padding is performed using a preset pad character (e.g. "x") until 11 bytes are reached.
Sensitive fields recode-identifying sensitive fields in the user information such as name, phone number, email box, etc. The characters in these sensitive fields are recoded using an integer from 0 to 63 and each coded character is converted into a 6-bit binary representation.
And (3) data splitting and encryption, namely checking the recoded binary data, and splitting the recoded binary data into 64-bit data blocks and residual data if the data blocks with more than 64 bits exist. The 64-bit data block is encrypted by using a 3DES encryption algorithm, and the rest data is reserved without encryption.
And merging and recompilation of the data, namely merging the encrypted data block with the rest data. The combined data is recompiled in 6 bits as one byte and converted into printable characters (including capital letters, numbers and special characters).
Data shift operation the shift operation is performed on the last 6 bytes of the recompiled data, specifically the 1-plus-the-1 operation is performed on the character encoding of each byte (modulo 64).
And storing the encrypted user information in a database. The user and rights management functions using MySQL restrict access to the encrypted user information table only to specific users.
Embodiment two:
In the scene, a certain electronic shop needs to encrypt order data so as to ensure the security of order information.
The implementation steps are as follows:
And data preprocessing, namely checking each order record in the order database and determining the length of each order record. For records with a length less than a set threshold (e.g., 16 bytes), padding is performed using a preset padding rule (e.g., repeating the last character).
Sensitive fields recoding-identifying sensitive fields in order data, such as buyer name, buyer address, commodity name, etc. The characters in these sensitive fields are recoded using an integer from 0 to 63 and each coded character is converted into a 6-bit binary representation.
Data splitting and encryption, namely checking the recoded binary data, and splitting the recoded binary data into 64-bit data blocks if the data blocks with more than 64 bits exist. All 64-bit data blocks are encrypted using the AIFT 3DES encryption algorithm.
And merging and recompilation of data, namely merging the encrypted data blocks. The combined data is recompiled in 6 bits as one byte and converted into printable characters in ASCII character set.
Data shift operation the shift operation is performed on the last 6 bytes of the recompiled data, specifically the 1-reduction operation is performed on the character encoding of each byte (modulo 64).
Data storage and authority limitation, namely storing the encrypted order data in a database. Using the rights management function of MySQL, only order handlers and store administrators are restricted from accessing the encrypted order data table and only data viewing operations can be performed.
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411129792.2A CN119155016B (en) | 2024-08-16 | A method and system for encrypting e-commerce store data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202411129792.2A CN119155016B (en) | 2024-08-16 | A method and system for encrypting e-commerce store data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN119155016A CN119155016A (en) | 2024-12-17 |
CN119155016B true CN119155016B (en) | 2025-09-30 |
Family
ID=
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109271797A (en) * | 2018-09-12 | 2019-01-25 | 郑州云海信息技术有限公司 | A kind of method and system improving the safety of database sensitive information |
CN113285764A (en) * | 2021-05-19 | 2021-08-20 | 大连理工大学 | Three-dimensional blue-green two-dimensional code close-range safe communication method based on underwater image enhancement technology |
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109271797A (en) * | 2018-09-12 | 2019-01-25 | 郑州云海信息技术有限公司 | A kind of method and system improving the safety of database sensitive information |
CN113285764A (en) * | 2021-05-19 | 2021-08-20 | 大连理工大学 | Three-dimensional blue-green two-dimensional code close-range safe communication method based on underwater image enhancement technology |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8208627B2 (en) | Format-preserving cryptographic systems | |
US9489521B2 (en) | Format preserving encryption methods for data strings with constraints | |
US11488134B2 (en) | Format-preserving cryptographic systems | |
US8958562B2 (en) | Format-preserving cryptographic systems | |
US7864952B2 (en) | Data processing systems with format-preserving encryption and decryption engines | |
US8855296B2 (en) | Data processing systems with format-preserving encryption and decryption engines | |
US8600048B1 (en) | Format-translating encryption systems | |
CN110365468B (en) | Anonymization processing method, device, equipment and storage medium | |
CN109547201B (en) | Encryption method of root key, computer readable storage medium and terminal equipment | |
CN111314069A (en) | Block chain-based shaking system and method, electronic device and storage medium | |
CN117708847A (en) | 3C product leasing platform data processing method based on data compression and encryption | |
CA2363687A1 (en) | Anonymization method | |
GB2479074A (en) | A key server selects policy rules to apply to a key request based on an identifier included in the request | |
JP2024508565A (en) | Protection of databases, data transmission, and files without the use of encryption | |
CN119155016B (en) | A method and system for encrypting e-commerce store data | |
CN1918844B (en) | Secret information management scheme based on secret sharing scheme | |
US20240338478A1 (en) | Protecting membership for secure computation and communication | |
US10853502B1 (en) | Systems and methods for reducing computational difficulty of cryptographic operations | |
CN119155016A (en) | Method and system for encrypting data of electronic shop | |
JP2005167794A (en) | Secret information storage method and apparatus, secret information restoration method and apparatus, secret information storage program, and secret information restoration program. | |
CN119740213B (en) | A secure access method for storage device, electronic device and storage medium | |
US11989325B1 (en) | Protecting membership in a secure multi-party computation and/or communication | |
CN119598500A (en) | Encryption method, device and electronic device for retaining original format of Chinese character data | |
CN116484407A (en) | Data security protection method and device, electronic equipment and storage medium | |
CN120301694A (en) | Retail credit full-stage data flow risk control system based on microservices |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |