A method and system for encrypting e-commerce store data
The AIFT_3DES algorithm is used to re-encode and encrypt sensitive fields of e-commerce store data, solving the padding problem of the 3DES algorithm when the data length is not a multiple of 64 bits, ensuring that the encrypted data length remains unchanged and security is improved.
Patent Information
- Application Number
- CN202411129792.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-08-16
AI Technical Summary
The existing 3DES algorithm requires padding when the data length is not a multiple of 64 bits, which increases the length of the encrypted data and affects efficiency and integrity.
The AIFT_3DES algorithm is used to re-encode sensitive fields, compressing characters from 8 bits to 6 bits, and encrypting them in combination with the 3DES algorithm. Data blocks of 64 bits and multiples thereof are encrypted, and shift operations are performed after merging to ensure that the length of the encrypted data remains unchanged.
It effectively reduces the length of data during the encryption process, improves encryption efficiency and security, and ensures the consistency and integrity of encrypted data.
Smart Images

Figure CN119155016B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data encryption, and in particular to a method and system for encrypting e-commerce store data. Background Art
[0002] The existing 3DES is a symmetric key block cipher, equivalent to applying the Data Encryption Standard (DES) algorithm three times to each data block. To improve security, the algorithm groups the 24-byte key into 8-byte segments: the first eight bytes are KEY1, the middle eight bytes are KEY2, and the last eight bytes are KEY3. During encryption, plaintext data block 1 is DES-encrypted using KEY1 to obtain C1. C1 is then DES-decrypted using KEY2 to obtain C2. C2 is then DES-encrypted using KEY3 to obtain C3. The decryption process is the reverse.
[0003] The traditional 3DES algorithm encrypts data in 64-bit blocks. If the length of the data is not a multiple of 64 bits, padding is required to increase the data length to a multiple of 64. This increases the length of the encrypted data, which can easily affect overall efficiency and integrity. Summary of the Invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide an e-commerce store data encryption method, comprising the following steps:
[0005] Step 1: Obtain data information of the data to be encrypted. If the length of the data to be encrypted is not less than the set length threshold, proceed to step 2. Otherwise, fill the data length of the data to be encrypted to the set length threshold and proceed to step 2.
[0006] Step 2: Re-encode the characters in the sensitive field of the data to be encrypted using integers from 0 to 63, and represent each re-encoded character with 6-bit binary to obtain the re-encoded data of the sensitive field;
[0007] Step 3: If there is more than 64 bits of binary data in the re-encoded data of the sensitive field, split the data into 64-bit and multiples of data blocks and the remaining binary data, perform 3DES encryption on the 64-bit and multiples of data blocks, retain the excess binary data, and proceed to step 4. If there is no such data, encrypt the 64-bit and multiples of data blocks using the AIFT_3DES encryption algorithm to obtain the encrypted 64-bit and multiples of data blocks, and proceed to step 6.
[0008] Step 4: Merge the encrypted 64-bit data block and its multiples with the binary data exceeding the multiple of 64 bits to obtain merged data, and recompile the merged data with 6 bits as one byte;
[0009] Step 5: Shift the last 6 bytes of the merged and recompiled data to obtain the encrypted data of the merged data;
[0010] Step 6: Output the encrypted data, store the encrypted data and restrict access rights to the encrypted data.
[0011] Furthermore, the sensitive fields are preset fields, including uppercase English letters and numbers.
[0012] Furthermore, if the data to be encrypted is less than 11 bytes, the data to be encrypted is padded to a length of 11 bytes.
[0013] Furthermore, the encrypted 64-bit data block and its multiples are merged with the binary data exceeding the multiple of 64 bits to obtain merged data, and the merged data is recompiled with 6 bits as one byte, including:
[0014] According to the set character code 0-63, every 6 bits of binary data are compiled into characters, and the characters include uppercase letters, numbers and special characters.
[0015] Furthermore, the shift operation on the last 6 bytes of the merged and recompiled data includes:
[0016] After all binary data is converted into characters, the last six characters are shifted, that is, they are shifted according to the character code of 0-63. There is a mapping relationship between characters and character codes. Each character is represented by a number from 0-63. The shift refers to adding or subtracting the number.
[0017] Furthermore, the step of storing the encrypted data and restricting access rights to the encrypted data includes:
[0018] Use MySQL's user and permission management functions to limit the tables or fields that users can access; at the same time, restrict users to only viewing data.
[0019] An e-commerce store data encryption system, applying the e-commerce store data encryption method, 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;
[0020] The data input module, data filling module, data encryption module and data processing module are connected in sequence; the data communication module is connected to the data processing module; the data server is in communication connection with the communication module;
[0021] The data input module is used to receive data to be encrypted;
[0022] The data filling module is used to fill in the data to be encrypted whose length is less than a set length threshold;
[0023] The data encryption module is used to encrypt data;
[0024] The data server is used to store the encrypted data.
[0025] The beneficial effects of the present invention are:
[0026] The AIFT_3DES encryption algorithm combines character encoding with the 3DES algorithm to encrypt sensitive fields in e-commerce store data. This method compresses character encoding from 8 bits to 6 bits, effectively reducing the length of the data during encryption, avoiding data padding, and improving encryption efficiency and security.
[0027] 2. Encrypted data length remains unchanged: The AIFT_3DES algorithm ensures that the encrypted data length remains unchanged when the input data length is greater than 11 bytes. Data less than 11 bytes is padded to 11 bytes before encryption to meet the minimum length requirement of the 3DES algorithm, ensuring the consistency and integrity of the encrypted data. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a flowchart of an e-commerce store data encryption method;
[0029] Figure 2 This is a schematic diagram of an implementation method for e-commerce store data encryption;
[0030] Figure 3 This is a schematic diagram of the principles of an e-commerce store data encryption system. DETAILED DESCRIPTION
[0031] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings, but the protection scope of the present invention is not limited to the following.
[0032] The features and performance of the present invention are further described in detail below with reference to the embodiments.
[0033] like Figure 1 As shown, a method for encrypting e-commerce store data includes the following steps:
[0034] Step 1: Obtain data information of the data to be encrypted. If the length of the data to be encrypted is not less than the set length threshold, proceed to step 2. Otherwise, fill the data length of the data to be encrypted to the set length threshold and proceed to step 2.
[0035] Step 2: Re-encode the characters in the sensitive field of the data to be encrypted using integers from 0 to 63, and represent each re-encoded character with 6-bit binary to obtain the re-encoded data of the sensitive field;
[0036] Step 3: If there is more than 64 bits of binary data in the re-encoded data of the sensitive field, split the data into 64-bit and multiples of data blocks and the remaining binary data, perform 3DES encryption on the 64-bit and multiples of data blocks, retain the excess binary data, and proceed to step 4. If there is no such data, encrypt the 64-bit and multiples of data blocks using the AIFT_3DES encryption algorithm to obtain the encrypted 64-bit and multiples of data blocks, and proceed to step 6.
[0037] Step 4: Merge the encrypted 64-bit data block and its multiples with the binary data exceeding the multiple of 64 bits to obtain merged data, and recompile the merged data with 6 bits as one byte;
[0038] Step 5: Shift the last 6 bytes of the merged and recompiled data to obtain the encrypted data of the merged data;
[0039] Step 6: Output the encrypted data, store the encrypted data and restrict access rights to the encrypted data.
[0040] The sensitive fields are preset fields, including uppercase English letters and numbers.
[0041] The method further includes padding the data to be encrypted to a length of 11 bytes if the data to be encrypted is less than 11 bytes.
[0042] The method of merging the encrypted 64-bit data block and its multiples with the binary data exceeding the multiple of 64 bits to obtain merged data, and recompiling the merged data with 6 bits as one byte, comprises:
[0043] According to the set character code 0-63, every 6 bits of binary data are compiled into characters, and the characters include uppercase letters, numbers and special characters.
[0044] The shift operation on the last 6 bytes of the merged and recompiled data comprises:
[0045] After all binary data is converted into characters, the last six characters are shifted, that is, they are shifted according to the character code of 0-63. There is a mapping relationship between characters and character codes. Each character is represented by a number from 0-63. The shift refers to adding or subtracting the number.
[0046] The storing of encrypted data and restricting access rights to the encrypted data include:
[0047] Use MySQL's user and permission management functions to limit the tables or fields that users can access; at the same time, restrict users to only viewing data.
[0048] like Figure 3 As shown, an e-commerce store data encryption system, applying the e-commerce store data encryption method, 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;
[0049] The data input module, data filling module, data encryption module and data processing module are connected in sequence; the data communication module is connected to the data processing module; the data server is in communication connection with the communication module;
[0050] The data input module is used to receive data to be encrypted;
[0051] The data filling module is used to fill in the data to be encrypted whose length is less than a set length threshold;
[0052] The data encryption module is used to encrypt data;
[0053] The data server is used to store the encrypted data.
[0054] Specifically, such as Figure 2 As shown, character re-encoding: First, we discovered that sensitive fields in the API store data consisted entirely of uppercase English letters and numbers. Therefore, we used integers from 0 to 63 to re-encode uppercase English letters, numbers, and special characters. By representing these characters with 6 bits, we compressed the ASCII code from 8 bits to 6 bits.
[0055] The AIFT_3DES encryption algorithm then re-encodes characters to shorten the number of bits per byte. This increases the number of bytes encrypted when using the 3DES algorithm, effectively reducing the amount of binary data exceeding 64 bits. Data exceeding 64 bits is not processed initially. After the first 64 bits and their multiples are encrypted, they are combined and recompiled using 6 bits per byte. The last 6 bytes are then shifted to reduce the impact of unencrypted data, resulting in the encrypted data.
[0056] Because encryption is performed on data blocks of 64 or multiples thereof, there may be excess binary data that remains unencrypted. Therefore, after converting all binary data into characters (bytes), the last six characters (bytes) are shifted, i.e., shifted according to the character code 0-63. There is a mapping between characters and character codes, with each character being represented by a number from 0-63. Shifting refers to adding or subtracting this number.
[0057] Assume that A is represented by the number 10. Shifting it by +9 creates the number 19, which represents the character J. The purpose of this shift is to encrypt any excess binary data that was previously unencrypted. The result is data in which all data is encrypted at the binary level.
[0058] The encrypted data is binary data, so it needs to be compiled again. The compilation is based on the character encoding we set 0-63, and every 6 bits of binary data are compiled into characters. These characters include uppercase letters, numbers and special characters.
[0059] Therefore, for input data longer than 11 bytes, no data is added during the encryption process, and the encrypted length remains unchanged. (*For input data less than 11 bytes, it is padded to a length of 11 bytes, which is exactly 66 bits, meeting the minimum length requirement of 64 bits for 3DES).
[0060] Store authorization data: E-commerce companies use the Tolo e-commerce platform to authorize stores, generate store authorization data, and obtain access tokens. The store authorization data here contains a lot of data about e-commerce privacy, and only specific personnel have the right to access it.
[0061] Use MySQL's user and permission management features to restrict which users can access which tables or fields. Also, restrict users to viewing data, preventing them from adding, deleting, or modifying data. Only members of the encryption group have the ability to add, delete, or modify data.
[0062] Encrypted data: Migrate store data to the new server. During the migration process, encrypt the privacy information of the store data according to the AIFT_3DES algorithm to obtain encrypted data.
[0063] The following are two specific examples of e-commerce store data encryption methods:
[0064] Example 1:
[0065] Scenario: The user information database of an e-commerce platform needs to be encrypted to protect user privacy.
[0066] Implementation steps:
[0067] Data preprocessing: Check each record in the user information database to determine its length. For records with a length less than 11 bytes, use a preset padding character (such as "*") to fill it until it reaches 11 bytes.
[0068] Sensitive field re-encoding: Identify sensitive fields in user information, such as name, phone number, email address, etc. Re-encode the characters in these sensitive fields using integers from 0 to 63, and convert each encoded character into a 6-bit binary representation.
[0069] Data Splitting and Encryption: Check the re-encoded binary data. If there are data blocks exceeding 64 bits, split them into 64-bit blocks and the remaining data. Encrypt the 64-bit blocks using the 3DES encryption algorithm; the remaining data remains unencrypted.
[0070] Data merging and recompilation: Merge the encrypted data block with the remaining data. Recompilate the merged data into 6-bit bytes and convert them into printable characters (including uppercase letters, numbers, and special characters).
[0071] Data shift operation: perform a shift operation on the last 6 bytes of the recompiled data, specifically adding 1 to the character code of each byte (modulo 64).
[0072] Data storage and permission restrictions: Encrypted user information is stored in the database. Utilize MySQL's user and permission management features to restrict access to the encrypted user information table to specific users.
[0073] Example 2:
[0074] Scenario: An e-commerce store needs to encrypt order data to ensure the security of order information.
[0075] Implementation steps:
[0076] Data preprocessing: Check each order record in the order database to determine its length. For records whose length is less than a set threshold (such as 16 bytes), fill them with pre-set padding rules (such as repeating the last character).
[0077] Sensitive field recoding: Identify sensitive fields in order data, such as buyer name, buyer address, product name, etc. Recode the characters in these sensitive fields using integers from 0 to 63, and convert each encoded character into a 6-bit binary representation.
[0078] Data Splitting and Encryption: Check the re-encoded binary data. If there are data blocks exceeding 64 bits, split them into 64-bit blocks. Encrypt all 64-bit blocks using the AIFT_3DES encryption algorithm.
[0079] Data merging and recompilation: Merge the encrypted data blocks. Recompile the merged data with 6 bits as one byte and convert it into printable characters in the ASCII character set.
[0080] Data shift operation: perform a shift operation on the last 6 bytes of the recompiled data, specifically, perform a subtraction operation (modulo 64) on the character code of each byte.
[0081] Data storage and permission restrictions: Encrypted order data is stored in the database. Using MySQL's permission management function, only order processing personnel and store administrators can access the encrypted order data table, and they can only view the data.
Claims
1. A method for encrypting data of an e-commerce store, characterized in that: The steps include: Step 1: Obtain data information of the data to be encrypted. If the length of the data to be encrypted is not less than the set length threshold, proceed to step 2. Otherwise, fill the data length of the data to be encrypted to the set length threshold and proceed to step 2. Step 2: Re-encode the characters in the sensitive field of the data to be encrypted using integers from 0 to 63, and represent each re-encoded character with 6-bit binary to obtain the re-encoded data of the sensitive field; Step 3: If there is more than 64 bits of binary data in the re-encoded data of the sensitive field, split the data into 64-bit and multiples of data blocks and the remaining binary data, perform 3DES encryption on the 64-bit and multiples of data blocks, retain the excess binary data, and proceed to step 4. If there is no such data, encrypt the 64-bit and multiples of data blocks using the AIFT_3DES encryption algorithm to obtain the encrypted 64-bit and multiples of data blocks, and proceed to step 6. Step 4: Merge the encrypted 64-bit data block and its multiples with the binary data exceeding the multiple of 64 bits to obtain merged data, and recompile the merged data with 6 bits as one byte; Step 5: Shift the last 6 bytes of the merged and recompiled data to obtain the encrypted data of the merged data; Step 6: Output the encrypted data, store the encrypted data and restrict access rights to the encrypted data.
2. The method for encrypting data of an e-commerce store according to claim 1, characterized in that: The sensitive fields are preset fields, including uppercase English letters and numbers.
3. The method for encrypting data of an e-commerce store according to claim 2, characterized in that: The method further includes padding the data to be encrypted to a length of 11 bytes if the data to be encrypted is less than 11 bytes.
4. The method for encrypting data of an e-commerce store according to claim 3, characterized in that: The method of merging the encrypted 64-bit data block and its multiples with the binary data exceeding the multiple of 64 bits to obtain merged data, and recompiling the merged data with 6 bits as one byte, comprises: According to the set character code 0-63, every 6 bits of binary data are compiled into characters, and the characters include uppercase letters, numbers and special characters.
5. The method for encrypting data of an e-commerce store according to claim 4, characterized in that: The shift operation on the last 6 bytes of the merged and recompiled data comprises: After all binary data is converted into characters, the last six characters are shifted, that is, they are shifted according to the character code of 0-63. There is a mapping relationship between characters and character codes. Each character is represented by a number from 0-63. The shift refers to adding or subtracting the number.
6. The method for encrypting data of an e-commerce store according to claim 5, characterized in that: The storing of encrypted data and restricting access rights to the encrypted data include: Use MySQL's user and permission management functions to limit the tables or fields that users can access; at the same time, restrict users to only viewing data.
7. An e-commerce store data encryption system, characterized in that: An e-commerce store data encryption method according to any one of claims 1 to 6 is applied, comprising 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 input module, data filling module, data encryption module and data processing module are connected in sequence; the data communication module is connected to the data processing module; the data server is in communication connection with the communication module; The data input module is used to receive data to be encrypted; The data filling module is used to fill in the data to be encrypted whose length is less than a set length threshold; The data encryption module is used to encrypt data; The data server is used to store the encrypted data.