Data processing method and device, electronic equipment and storage medium
By generating and using key factors and key arrays for encryption and decryption at the data sending and receiving ends, the existing encryption and decryption technology has been solved for a long time in large-scale and efficient data transmission and insufficient security in key transmission, and efficient and secure data transmission is achieved.
Patent Information
- Application Number
- CN202411917789.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-05-06
AI Technical Summary
The existing encryption and decryption technology takes a long time in large-scale and efficient data transmission, and the symmetric encryption keys are easily intercepted during transmission, increasing the risk of data security.
The data sender determines the unique identification information and custom strings, generates a key factor and forms a key array, encrypts the data according to the subscript value of the key array, and sends the encrypted data, unique identification information, custom string and subscript value to the data receiving end. The receiving end generates the key factor based on the same information and decrypts the data.
The optimization of the key generation algorithm is realized, which avoids the high time-consuming problem of asymmetric encryption and improves the security and efficiency of data transmission.
Smart Images

Figure CN119945668A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of encryption and decryption, and in particular to a data processing method and device, electronic equipment, and storage medium. Background Art
[0002] With the rapid development of Internet of Things technology and the Internet, the number of mobile terminals and smart devices connected to the network has increased sharply, the amount of data transmission has continued to increase, and users' requirements for data security have also increased.
[0003] In network communications, encryption technology is usually used to encrypt and protect data in order to ensure the security of data during transmission. Common methods generally include symmetric encryption, asymmetric encryption, and a combination of SSL protocol and digital certificates.
[0004] However, the complexity of asymmetric encryption often results in a time-consuming encryption and decryption process, which cannot meet the needs of large-scale and efficient data transmission. Symmetric encryption requires the transmission of keys, which can be easily intercepted during transmission and cannot effectively prevent the leakage of keys during transmission or storage, increasing data security risks. Summary of the invention
[0005] In view of the above problems, a data processing method and device, electronic device, and storage medium are proposed to overcome the above problems or at least partially solve the above problems, including:
[0006] A data processing method, applied to a data sending end, comprising:
[0007] Determine the unique identification information of the data sending end through the data sending end, and determine a custom character string;
[0008] Generate a key factor according to the unique identification information and the custom string through the data sending end, and generate a key array according to the key factor;
[0009] Determining the subscript value of the key in the key array through the data sending end, and encrypting the data to be encrypted according to the key array in response to the data encryption requirement;
[0010] The encrypted data, the unique identification information, the custom string and the subscript value are sent to the data receiving end through the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value.
[0011] Optionally, the determining the unique identification information of the data sending end through the data sending end includes:
[0012] The physical address and hardware identification of the data sending end are obtained through the data sending end, and the unique identification information is determined according to the physical address and / or the hardware identification.
[0013] Optionally, determining the subscript value of the key in the key array by the data sending end includes:
[0014] The length information of the key array is determined by the data sending end, and the subscript value of the key in the key array is determined according to the length information.
[0015] Optionally, encrypting the data to be encrypted according to the key array in response to the data encryption requirement includes:
[0016] Determining the target data corresponding to the data encryption requirement through the data sending end, and determining the target key in the key array;
[0017] The target data is encrypted by the data sending end according to the target key.
[0018] Optionally, the generating a key factor by the data sending end according to the unique identification information and the custom character string includes:
[0019] The unique identification information and the custom character string are concatenated and combined by the data sending end to generate the key factor.
[0020] Optionally, generating a key array according to the key factor includes:
[0021] The key factor is intercepted by the data sending end to obtain a dynamic array;
[0022] The key array is generated according to a preset key value length rule, a preset key array length rule and the dynamic array.
[0023] A data processing method, applied to a data receiving end, comprising:
[0024] The encrypted data, unique identification information, custom string and subscript value sent by the data sending end are received by the data receiving end, and the key factor is determined according to the unique identification information and the custom string; wherein the data sending end is used to determine the unique identification information of the data sending end, and determine the custom string; the data sending end is also used to generate the key factor according to the unique identification information and the custom string, and generate a key array according to the key factor; the data sending end is also used to determine the subscript value of the key in the key array, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement; the data sending end is also used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end;
[0025] The encrypted data is decrypted by the data receiving end according to the key factor and the subscript value.
[0026] Optionally, decrypting the encrypted data according to the key factor and the subscript value by the data receiving end includes:
[0027] The data receiving end generates the key array according to the key factor, and decrypts the encrypted data according to the key array and the subscript value.
[0028] A data processing device, applied to a data sending end, comprising:
[0029] A unique identification information determination module, used to determine the unique identification information of the data sending end through the data sending end, and determine a custom character string;
[0030] A key array generation module, used to generate a key factor according to the unique identification information and the custom string through the data sending end, and generate a key array according to the key factor;
[0031] A data encryption module, used to determine the subscript value of the key in the key array through the data sending end, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement;
[0032] A data sending module, used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end through the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value.
[0033] A data processing device, applied to a data receiving end, comprising:
[0034] A data receiving module, used for receiving the encrypted data, unique identification information, custom string and subscript value sent by the data sending end through the data receiving end, and determining the key factor according to the unique identification information and the custom string; wherein the data sending end is used to determine the unique identification information of the data sending end, and determine the custom string; the data sending end is also used to generate the key factor according to the unique identification information and the custom string, and generate a key array according to the key factor; the data sending end is also used to determine the subscript value of the key in the key array, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement; the data sending end is also used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end;
[0035] A data decryption module is used to decrypt the encrypted data according to the key factor and the subscript value through the data receiving end.
[0036] An electronic device comprises a processor, a memory and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the data processing method as described above when executed by the processor.
[0037] A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the data processing method as described above is implemented.
[0038] A computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements the data processing method as described above.
[0039] The embodiments of the present invention have the following advantages:
[0040] The present invention provides a data processing method, which is applied to a data sending end, wherein the unique identification information of the data sending end is determined by the data sending end, and a custom string is determined; then, a key factor is generated by the data sending end according to the unique identification information and the custom string, and a key array is generated according to the key factor; thereby, the subscript value of the key in the key array is determined by the data sending end, and the encrypted data is encrypted according to the key array in response to the data encryption requirement; and then, the encrypted data, the unique identification information, the custom string and the subscript value are sent to the data receiving end by the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; and the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value. The optimization of the key generation algorithm is realized, and the key itself does not need to be carried during the encrypted data transmission process, which avoids the high time-consuming problem caused by the complex asymmetric encryption algorithm, improves the security of data transmission, and improves the efficiency of data transmission and encryption and decryption. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solution of the present invention, the accompanying drawings required for use in the description of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0042] Figure 1 is a flowchart of steps of a data processing method provided by some embodiments of the present invention;
[0043] Figure 2 It is a schematic diagram of the overall execution flow of the encryption process of the present invention provided by some embodiments of the present invention;
[0044] Figure 3 It is a schematic diagram of the overall execution flow of the decryption process of the present invention provided by some embodiments of the present invention;
[0045] Figure 4 is a flowchart of steps of a data processing method provided by some embodiments of the present invention;
[0046] Figure 5 is a schematic diagram of the structure of a data processing device provided by some embodiments of the present invention;
[0047] Figure 6 It is a structural schematic diagram of a data processing device provided by some embodiments of the present invention. DETAILED DESCRIPTION
[0048] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0049] In the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with basically the same functions and effects. This is only for the purpose of clearly describing the technical solutions of the embodiments of the present application, and shall not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features.
[0050] In the embodiments of the present application, the terms "upper", "lower", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present application.
[0051] With the rapid development of Internet of Things technology and the Internet, the number of mobile terminals and smart devices connected to the network has increased sharply, the amount of data transmission has continued to increase, and users' requirements for data security have also increased.
[0052] In network communications, encryption technology is usually used to encrypt and protect data in order to ensure the security of data during transmission. Common methods generally include symmetric encryption, asymmetric encryption, and a combination of SSL protocol and digital certificates.
[0053] However, the complexity of asymmetric encryption often results in a time-consuming encryption and decryption process, which cannot meet the needs of large-scale and efficient data transmission. Symmetric encryption requires the transmission of keys, which can be easily intercepted during transmission and cannot effectively prevent the leakage of keys during transmission or storage, increasing data security risks. If certificates are used, CA certification must be applied for, which poses a risk of not being able to be updated regularly.
[0054] In order to solve the above problems, the present invention improves the data processing method in the related art based on the core technical concept of optimizing the key generation algorithm and avoiding carrying the key itself during the encrypted data transmission process. The present invention will be described in detail below with reference to the accompanying drawings:
[0055] Reference Figure 1 , shows a flowchart of a data processing method provided by some embodiments of the present invention, which is applied to a data sending end and may specifically include the following steps:
[0056] Step 101, determining the unique identification information of the data sending end through the data sending end, and determining a custom character string;
[0057] In a specific implementation, the HID (Hardware ID) and MAC (Media Access Control) address (also called physical address) of the data sending device can be obtained, and the unique identification information of the data sending end can be further determined based on the HID and / or MAC. At the same time, a custom string can be determined for use in the key array generation process in subsequent steps. The custom string can be a string composed of random characters or specified by the user. The specific selection can be based on actual needs.
[0058] In some embodiments of the present invention, determining the unique identification information of the data sending end through the data sending end includes:
[0059] The physical address and hardware identification of the data sending end are obtained through the data sending end, and the unique identification information is determined according to the physical address and / or the hardware identification.
[0060] In a specific implementation, the HID and MAC address (also called physical address) of the data sending device can be obtained, and the unique identification information of the data sending end can be further determined based on the HID and / or MAC. At the same time, a custom string can be determined for use in the key array generation process in subsequent steps.
[0061] Step 102, generating a key factor according to the unique identification information and the custom string by the data sending end, and generating a key array according to the key factor;
[0062] In the specific implementation, Figure 2 As shown, the unique identification information and the custom string can be concatenated and combined to generate a key factor, and then the key factor can be intercepted to obtain a dynamic array; and the key array is obtained according to the preset key value length rule, the preset key array length rule and the dynamic array;
[0063] In one example, taking the MAC address as the unique identification information of the data sender, the actual generation process of the key array and the overall process of selecting the target key in the key array to implement data encryption can be the following example steps:
[0064] 1. Generate a key factor using the MAC address and a specified string:
[0065] String mac="8661700400356641";
[0066] Stringmixed="!@#$^&*()_+######abcdefghijklmmopqrstuvwxyz01234567890";
[0068] / / Composition key factors;
[0069] String compl=mac+mixed+mac;
[0070] / / Generate random array values;
[0071] The key factor is intercepted every two digits to generate a dynamic array (that is, the key factor is intercepted according to a fixed rule to generate a dynamic array);
[0072] String[]string=stringTokenInit(compl){
[0073] String in[]=new String[imei.length() / 2];
[0074] String regex = "(.{2})";
[0075] imei=imei.replaceAll(regex,"$1");
[0076] String strings[]=imei.split("");
[0077] Result result=new Result(in,strings);
[0078] return result;}
[0079] The result is: [86,61,70,04,00,35,66,41,! @,#$,^&,*(,)_,+#,##,##,#a,bc,de,fg,hi,jk,lm,mo,pq,rs,tu,vw,xy,z0,12,34,56,78,90,86,61,70,04,00,35,66,41]
[0080] Regenerate the value of the key group according to the result;
[0081] 2. Determine the length of the generated key value according to the preset key value length rule;
[0082] 3. Determine the length of the generated key array according to the preset key array length rule;
[0083] 4. Get the random number of the data subscript;
[0084] 4.1 Calculate the length of the key array and obtain the value, ensuring that the obtained value does not exceed the length of the key array;
[0085] Integer index=new Random().nextInt(arraysLength);
[0086] The index value is the subscript value of the key array;
[0087] 5. According to the subscript value, output the value of the specified key group subscript;
[0088] / / 5.1 forms a key array;
[0089] for(int i=0; i <arraysLength;a++,i++){keyStrsLengths[i]=getString(string,a);};
[0090] / / 5.2 Get the value corresponding to the specified index (subscript) as the key;
[0091] return new String[]{keyStrsLengths[index],String.valueOf(index)}.
[0092] In some embodiments of the present invention, the step of generating a key factor by the data sending end according to the unique identification information and the custom string includes:
[0093] The unique identification information and the custom character string are concatenated and combined by the data sending end to generate the key factor.
[0094] In practical applications, the unique identification information and the custom string can be concatenated to obtain the key factor; in an example, taking the MAC address as the unique identification information of the data sending end, the actual generation process of the key factor can be the following example steps:
[0095] Generate a key factor using the MAC address and a specified string:
[0096] String mac="8661700400356641";
[0097] Stringmixed="!@#$^&*()_+######abcdefghijklmmopqrstuvwxyz01234567890";
[0099] / / Composition key factors;
[0100] String compl=mac+mixed+mac.
[0101] In some embodiments of the present invention, generating a key array according to the key factor includes:
[0102] The key factor is intercepted by the data sending end to obtain a dynamic array;
[0103] The key array is generated according to a preset key value length rule, a preset key array length rule and the dynamic array.
[0104] In practical applications, the key factors can be intercepted to obtain a dynamic array; and a subset can be extracted from the dynamic array according to a preset key value length rule and a preset key array length rule to obtain a key array.
[0105] In one example, taking the MAC address as the unique identification information of the data sending end, the actual generation process of the key array can be the following example steps:
[0106] 1. Generate a key factor using the MAC address and a specified string:
[0107] String mac="8661700400356641";
[0108] Stringmixed="!@#$^&*()_+######abcdefghijklmmopqrstuvwxyz01234567890";
[0110] / / Composition key factors;
[0111] String compl=mac+mixed+mac;
[0112] / / Generate random array values;
[0113] The key factor is intercepted every two digits to generate a dynamic array (that is, the key factor is intercepted according to a fixed rule to generate a dynamic array);
[0114] String[]string=stringTokenInit(compl){
[0115] String in[]=new String[imei.length() / 2];
[0116] String regex = "(.{2})";
[0117] imei=imei.replaceAll(regex,"$1");
[0118] String strings[]=imei.split("");
[0119] Result result=new Result(in,strings);
[0120] return result;}
[0121] The result is: [86,61,70,04,00,35,66,41,! @,#$,^&,*(,)_,+#,##,##,#a,bc,de,fg,hi,jk,lm,mo,pq,rs,tu,vw,xy,z0,12,34,56,78,90,86,61,70,04,00,35,66,41]
[0122] Regenerate the value of the key group according to the result;
[0123] 2. Determine the length of the generated key value according to the preset key value length rule;
[0124] 3. Determine the length of the generated key array according to the preset key array length rule;
[0125] 4. Get the random number of the data subscript;
[0126] 4.1 Calculate the length of the key array and obtain the value, ensuring that the obtained value does not exceed the length of the key array;
[0127] Integer index=new Random().nextInt(arraysLength);
[0128] The index value is the subscript value of the key array;
[0129] 5. According to the subscript value, output the value of the specified key group subscript;
[0130] / / 5.1 forms a key array;
[0131] for(int i=0; i <arraysLength;a++,i++){keyStrsLengths[i]=getString(string,a);}。
[0132] Furthermore, in order to increase security, multi-level random operations can be introduced in the process of generating keys to generate elements in the key array. For example, multiple mixing of random factors can be used to randomly shuffle the input data multiple times, and different step lengths can be used through multi-level interception and combination to split and recombine the data. Interference elements can be randomly inserted to increase complexity by inserting pseudo-random numbers or special characters. Weighted elements can be randomly selected according to weight rules. Timestamps or random seeds combined with timestamps can be introduced to ensure that the keys generated each time are different. Multiple hash algorithms can be used to increase data randomness and unpredictability, etc.
[0133] Step 103, determining the subscript value of the key in the key array through the data sending end, and encrypting the data to be encrypted according to the key array in response to the data encryption requirement;
[0134] In the specific implementation, Figure 2 As shown, data can be encrypted by a random key value, that is, after the key array is generated, a corresponding subscript value can be added to each key in the key array according to the overall length of the key array (the length can be represented as the number of keys in the key array), and a key can be selected from the key array as the encryption key of the target data corresponding to the data encryption requirement through a secure random selection process in the key array in response to the data encryption requirement. This process should ensure that the probability of each key being selected is equal to avoid potential bias attacks.
[0135] In one example, a key can be selected from a key array as the encryption key for target data corresponding to the data encryption requirement by randomly selecting a subscript value in the key array, that is, as described in the previous steps, the value corresponding to the specified index (subscript) in the key array can be obtained as the key.
[0136] In some embodiments of the present invention, determining the subscript value of the key in the key array by the data sending end includes:
[0137] The length information of the key array is determined by the data sending end, and the subscript value of the key in the key array is determined according to the length information.
[0138] In practical applications, after the key array is generated, a corresponding subscript value can be added to each key in the key array according to the overall length of the key array (the length can be represented by the number of keys in the key array) to prevent the subscript value from exceeding the length limit of the key array.
[0139] In one example, taking the MAC address as the unique identification information of the data sending end, the process of determining the subscript value of the key in the key array can be the following example steps:
[0140] 1. Generate a key factor using the MAC address and a specified string:
[0141] String mac="8661700400356641";
[0142] Stringmixed="!@#$^&*()_+######abcdefghijklmmopqrstuvwxyz01234567890";
[0144] / / Composition key factors;
[0145] String compl=mac+mixed+mac;
[0146] / / Generate random array values;
[0147] The key factor is intercepted every two digits to generate a dynamic array (that is, the key factor is intercepted according to a fixed rule to generate a dynamic array);
[0148] String[]string=stringTokenInit(compl){
[0149] String in[]=new String[imei.length() / 2];
[0150] String regex = "(.{2})";
[0151] imei=imei.replaceAll(regex,"$1");
[0152] String strings[]=imei.split("");
[0153] Result result=new Result(in,strings);
[0154] return result;}
[0155] The result is: [86,61,70,04,00,35,66,41,! @,#$,^&,*(,)_,+#,##,##,#a,bc,de,fg,hi,jk,lm,mo,pq,rs,tu,vw,xy,z0,12,34,56,78,90,86,61,70,04,00,35,66,41]
[0156] Regenerate the value of the key group according to the result;
[0157] 2. Determine the length of the generated key value according to the preset key value length rule;
[0158] 3. Determine the length of the generated key array according to the preset key array length rule;
[0159] 4. Get the random number of the data subscript;
[0160] 4.1 Calculate the length of the key array and obtain the value, ensuring that the obtained value does not exceed the length of the key array;
[0161] Integer index=new Random().nextInt(arraysLength);
[0162] The index value is the subscript value of the key array.
[0163] That is to say, the subscript generation can be based on the length value of the generated key array. For example, if the length idex of the key array is 16, 16 can be used as a parameter when generating the subscript value, and an integer within the range of 16 can be generated as the key subscript. For example, the generated value is 2, then 2 is the subscript value of the key in the array, and the key value is the value with subscript 2 in the key array.
[0164] In some embodiments of the present invention, encrypting the data to be encrypted according to the key array in response to the data encryption requirement includes:
[0165] Determining the target data corresponding to the data encryption requirement through the data sending end, and determining the target key in the key array;
[0166] The target data is encrypted by the data sending end according to the target key.
[0167] In practical applications, the target data corresponding to the data encryption requirement can be determined, and the target key can be determined in the key array. Through a secure random selection process, a key is selected from the key array as the target key of the target data corresponding to the data encryption requirement. This process should ensure that the probability of each key being selected is equal to avoid potential bias attacks.
[0168] In one example, a key can be selected from a key array as a target key for target data corresponding to a data encryption requirement by randomly selecting a subscript value in the key array. That is, as described in the aforementioned steps, a value corresponding to a randomly specified index (subscript) in the key array can be obtained as the target key.
[0169] In one example, taking the MAC address as the unique identification information of the data sender as an example, the actual generation process of the key array and the overall process of randomly selecting the target key in the key array to implement data encryption can be the following example steps:
[0170] 1. Generate a key factor using the MAC address and a specified string:
[0171] String mac="8661700400356641";
[0172] Stringmixed="!@#$^&*()_+######abcdefghijklmmopqrstuvwxyz01234567890";
[0174] / / Composition key factors;
[0175] String compl=mac+mixed+mac;
[0176] / / Generate random array values;
[0177] The key factor is intercepted every two digits to generate a dynamic array (that is, the key factor is intercepted according to a fixed rule to generate a dynamic array);
[0178] String[]string=stringTokenInit(compl){
[0179] String in[]=new String[imei.length() / 2];
[0180] String regex = "(.{2})";
[0181] imei=imei.replaceAll(regex,"$1");
[0182] String strings[]=imei.split("");
[0183] Result result=new Result(in,strings);
[0184] return result;}
[0185] The result is: [86,61,70,04,00,35,66,41,! @,#$,^&,*(,)_,+#,##,##,#a,bc,de,fg,hi,jk,lm,mo,pq,rs,tu,vw,xy,z0,12,34,56,78,90,86,61,70,04,00,35,66,41]
[0186] Regenerate the value of the key group according to the result;
[0187] 2. Determine the length of the generated key value according to the preset key value length rule;
[0188] 3. Determine the length of the generated key array according to the preset key array length rule;
[0189] 4. Get the random number of the data subscript;
[0190] 4.1 Calculate the length of the key array and obtain the value, ensuring that the obtained value does not exceed the length of the key array;
[0191] Integer index=new Random().nextInt(arraysLength);
[0192] The index value is the subscript value of the key array;
[0193] 5. According to the subscript value, output the value of the specified key group subscript;
[0194] / / 5.1 forms a key array;
[0195] for(int i=0; i <arraysLength;a++,i++){keyStrsLengths[i]=getString(string,a);};
[0196] / / 5.2 Get the value corresponding to the randomly specified index (subscript) as the key;
[0197] return new String[]{keyStrsLengths[index],String.valueOf(index)}.
[0198] Step 104, sending the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end through the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value.
[0199] In practical applications, such as Figure 2 As shown in , after the encryption is completed, the encrypted data, unique identification information, custom string and index value can be sent to the data receiving end through the data sending end, and as Figure 3 As shown, after receiving the relevant data, the data receiving end can determine the key factor according to the unique identification information and the custom string according to the same process, and further decrypt the encrypted data according to the key factor and the subscript value. For example, after generating a key array according to the key factor according to the same process, the target key can be determined one by one in the key array through the correspondence between the subscript value and the key to decrypt the encrypted data and obtain the plaintext for subsequent business processing.
[0200] It should be emphasized that in order to maintain the security of the system, the key array can be updated regularly, replacing the old keys and ensuring that the new keys are also randomly generated.
[0201] Reference Figure 4 , shows a flowchart of a data processing method provided by some embodiments of the present invention, which is applied to a data receiving end and may specifically include the following steps:
[0202] Step 401, receiving the encrypted data, unique identification information, custom string and subscript value sent by the data sending end through the data receiving end, and determining the key factor according to the unique identification information and the custom string; wherein the data sending end is used to determine the unique identification information of the data sending end, and determine the custom string; the data sending end is also used to generate the key factor according to the unique identification information and the custom string, and generate a key array according to the key factor; the data sending end is also used to determine the subscript value of the key in the key array, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement; the data sending end is also used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end;
[0203] In a specific implementation, the data sender can obtain the HID and MAC address (also known as the physical address) of the data sender device, and can further determine the unique identification information of the data sender based on the HID and / or MAC, and can also determine a custom string for use in the key array generation process in subsequent steps.
[0204] Furthermore, the data sending end can combine the unique identification information with the custom string to generate a key factor, and then intercept the key factor to obtain a dynamic array; and obtain the key array according to the preset key value length rule, the preset key array length rule and the dynamic array;
[0205] In one example, taking the MAC address as the unique identification information of the data sender, the actual generation process of the key array and the overall process of selecting the target key in the key array to implement data encryption can be the following example steps:
[0206] 1. Generate a key factor using the MAC address and a specified string:
[0207] String mac="8661700400356641";
[0208] Stringmixed="!@#$^&*()_+######abcdefghijklmmopqrstuvwxyz01234567890";
[0210] / / Composition key factors;
[0211] String compl=mac+mixed+mac;
[0212] / / Generate random array values;
[0213] The key factor is intercepted every two digits to generate a dynamic array (that is, the key factor is intercepted according to a fixed rule to generate a dynamic array);
[0214] String[]string=stringTokenInit(compl){
[0215] String in[]=new String[imei.length() / 2];
[0216] String regex = "(.{2})";
[0217] imei=imei.replaceAll(regex,"$1");
[0218] String strings[]=imei.split("");
[0219] Result result=new Result(in,strings);
[0220] return result;}
[0221] The result is: [86,61,70,04,00,35,66,41,! @,#$,^&,*(,)_,+#,##,##,#a,bc,de,fg,hi,jk,lm,mo,pq,rs,tu,vw,xy,z0,12,34,56,78,90,86,61,70,04,00,35,66,41]
[0222] Regenerate the value of the key group according to the result;
[0223] 2. Determine the length of the generated key value according to the preset key value length rule;
[0224] 3. Determine the length of the generated key array according to the preset key array length rule;
[0225] 4. Get the random number of the data subscript;
[0226] 4.1 Calculate the length of the key array and obtain the value, ensuring that the obtained value does not exceed the length of the key array;
[0227] Integer index=new Random().nextInt(arraysLength);
[0228] The index value is the subscript value of the key array;
[0229] 5. According to the subscript value, output the value of the specified key group subscript;
[0230] / / 5.1 forms a key array;
[0231] for(int i=0; i <arraysLength;a++,i++){keyStrsLengths[i]=getString(string,a);};
[0232] / / 5.2 Get the value corresponding to the specified index (subscript) as the key;
[0233] return new String[]{keyStrsLengths[index],String.valueOf(index)}.
[0234] Furthermore, the data sender can encrypt the data by using a random key value, that is, after generating the key array, a corresponding subscript value can be added to each key in the key array according to the overall length of the key array (the length can be represented as the number of keys in the key array), and a key can be selected from the key array as the encryption key of the target data corresponding to the data encryption requirement through a secure random selection process in the key array in response to the data encryption requirement. This process should ensure that the probability of each key being selected is equal to avoid potential bias attacks.
[0235] In one example, a key can be selected from a key array as the encryption key for target data corresponding to the data encryption requirement by randomly selecting a subscript value in the key array, that is, as described in the previous steps, the value corresponding to the specified index (subscript) in the key array can be obtained as the key.
[0236] Furthermore, after the encryption is completed, the encrypted data, unique identification information, custom string and index value can be sent to the data receiving end through the data sending end, and Figure 3 As shown, after receiving the relevant data, the data receiving end can determine the key factor according to the unique identification information and the custom string according to the same process, and further decrypt the encrypted data according to the key factor and the subscript value. For example, after generating a key array according to the key factor according to the same process, the target key can be determined one by one in the key array through the correspondence between the subscript value and the key to decrypt the encrypted data and obtain the plaintext for subsequent business processing.
[0237] Step 402: Decrypt the encrypted data according to the key factor and the index value by the data receiving end.
[0238] In practical applications, as mentioned above, after receiving the relevant data, the data receiving end can determine the key factor according to the unique identification information and the custom string according to the same process (the key factor is the same key factor as the key factor generated by the data sending end), and further decrypt the encrypted data according to the key factor and the subscript value. For example, after generating a key array according to the key factor according to the same process, the target key can be determined one by one in the key array through the correspondence between the subscript value and the key to decrypt the encrypted data and obtain the plaintext for subsequent business processing.
[0239] In some embodiments of the present invention, decrypting the encrypted data by the data receiving end according to the key factor and the subscript value includes:
[0240] The data receiving end generates the key array according to the key factor, and decrypts the encrypted data according to the key array and the subscript value.
[0241] In a specific implementation, after receiving the relevant data, the data receiving end can determine the key factor according to the unique identification information and the custom string according to the same process (the key factor is the same key factor as the key factor generated by the data sending end), and further decrypt the encrypted data according to the key factor and the index value. For example, after generating a key array according to the key factor according to the same process, the target key can be determined one by one in the key array through the correspondence between the subscript value and the key to decrypt the encrypted data and obtain the plaintext for subsequent business processing. It should be emphasized that when the data sending end sends the encrypted data, unique identification information, custom string and subscript value to the data receiving end, the sent subscript value can carry the association relationship with the target key used for the encrypted data, so that the subsequent decryption process can directly determine the subscript value associated with the encrypted data according to the encrypted data, and determine the target key associated with the encrypted data in the key array generated by the data receiving end according to the subscript value for decryption processing.
[0242] The present invention provides a data processing method, which is applied to a data sending end, wherein the unique identification information of the data sending end is determined by the data sending end, and a custom string is determined; then, a key factor is generated by the data sending end according to the unique identification information and the custom string, and a key array is generated according to the key factor; thereby, the subscript value of the key in the key array is determined by the data sending end, and the encrypted data is encrypted according to the key array in response to the data encryption requirement; and then, the encrypted data, the unique identification information, the custom string and the subscript value are sent to the data receiving end by the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; and the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value. The optimization of the key generation algorithm is realized, and the key itself does not need to be carried during the encrypted data transmission process, which avoids the high time-consuming problem caused by the complex asymmetric encryption algorithm, improves the security of data transmission, and improves the efficiency of data transmission and encryption and decryption.
[0243] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0244] Reference Figure 5 , shows a schematic diagram of the structure of a data processing device provided by some embodiments of the present invention; applied to a data sending end, it may specifically include the following modules:
[0245] A unique identification information determination module 501 is used to determine the unique identification information of the data sending end through the data sending end, and determine a custom character string;
[0246] A key array generation module 502, configured to generate a key factor according to the unique identification information and the custom string through the data sending end, and generate a key array according to the key factor;
[0247] A data encryption module 503, configured to determine the subscript value of the key in the key array through the data sending end, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement;
[0248] The data sending module 504 is used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end through the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value.
[0249] In some embodiments of the present invention, the unique identification information determination module 501 includes:
[0250] The unique identification information determination submodule is used to obtain the physical address and hardware identification of the data sending end through the data sending end, and determine the unique identification information according to the physical address and / or the hardware identification.
[0251] In some embodiments of the present invention, the data encryption module 503 includes:
[0252] The subscript value determination submodule is used to determine the length information of the key array through the data sending end, and determine the subscript value of the key in the key array according to the length information.
[0253] In some embodiments of the present invention, the data encryption module 503 includes:
[0254] A target key determination submodule, used to determine the target data corresponding to the data encryption requirement through the data sending end, and determine the target key in the key array;
[0255] The data encryption submodule is used to encrypt the target data according to the target key through the data sending end.
[0256] In some embodiments of the present invention, the key array generation module 502 includes:
[0257] The key factor generation submodule is used to generate the key factor by combining the unique identification information with the custom character string through the data sending end.
[0258] In some embodiments of the present invention, the key array generation module 502 includes:
[0259] An interception processing submodule, used for intercepting the key factor through the data sending end to obtain a dynamic array;
[0260] The key array generation submodule is used to generate the key array according to the preset key value length rule, the preset key array length rule and the dynamic array.
[0261] Reference Figure 6 , shows a schematic diagram of the structure of a data processing device provided by some embodiments of the present invention; applied to a data receiving end, it may specifically include the following modules:
[0262] The data receiving module 601 is used to receive the encrypted data, unique identification information, custom string and subscript value sent by the data sending end through the data receiving end, and determine the key factor according to the unique identification information and the custom string; wherein the data sending end is used to determine the unique identification information of the data sending end, and determine the custom string; the data sending end is also used to generate the key factor according to the unique identification information and the custom string, and generate a key array according to the key factor; the data sending end is also used to determine the subscript value of the key in the key array, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement; the data sending end is also used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end;
[0263] The data decryption module 602 is used to decrypt the encrypted data according to the key factor and the subscript value through the data receiving end.
[0264] In some embodiments of the present invention, the data decryption module 602 includes:
[0265] The data decryption submodule is used to generate the key array according to the key factor through the data receiving end, and decrypt the encrypted data according to the key array and the subscript value.
[0266] Some embodiments of the present invention further provide an electronic device, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, and the computer program implements the above data processing method when executed by the processor.
[0267] Some embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above data processing method is implemented.
[0268] Some embodiments of the present invention further provide a computer program product, including a computer program, which implements the above data processing method when executed by a processor.
[0269] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0270] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0271] Those skilled in the art will appreciate that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0272] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0273] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0274] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0275] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0276] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the above elements.
[0277] The above provides a detailed introduction to a data processing method and device, an electronic device, and a storage medium. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A data processing method, characterized in that: Applied to a data sending end, the method comprises: Determine the unique identification information of the data sending end through the data sending end, and determine a custom character string; Generate a key factor according to the unique identification information and the custom string through the data sending end, and generate a key array according to the key factor; Determining the subscript value of the key in the key array through the data sending end, and encrypting the data to be encrypted according to the key array in response to the data encryption requirement; The encrypted data, the unique identification information, the custom string and the subscript value are sent to the data receiving end through the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value.
2. The method according to claim 1, characterized in that The determining the unique identification information of the data sending end through the data sending end includes: The physical address and hardware identification of the data sending end are obtained through the data sending end, and the unique identification information is determined according to the physical address and / or the hardware identification.
3. The method according to claim 1, characterized in that The determining, by the data sending end, the subscript value of the key in the key array comprises: The length information of the key array is determined by the data sending end, and the subscript value of the key in the key array is determined according to the length information.
4. The method according to claim 1, characterized in that The step of encrypting the data to be encrypted according to the key array in response to the data encryption requirement comprises: Determining the target data corresponding to the data encryption requirement through the data sending end, and determining the target key in the key array; The target data is encrypted by the data sending end according to the target key.
5. The method according to claim 1, characterized in that: The step of generating a key factor by the data sending end according to the unique identification information and the custom character string includes: The unique identification information and the custom character string are concatenated and combined by the data sending end to generate the key factor.
6. The method according to any one of claims 1 to 5, characterized in that: The step of generating a key array according to the key factor comprises: The key factor is intercepted by the data sending end to obtain a dynamic array; The key array is generated according to a preset key value length rule, a preset key array length rule and the dynamic array.
7. A data processing method, characterized in that: Applied to a data receiving end, the method comprises: The encrypted data, unique identification information, custom string and subscript value sent by the data sending end are received by the data receiving end, and the key factor is determined according to the unique identification information and the custom string; wherein the data sending end is used to determine the unique identification information of the data sending end, and determine the custom string; the data sending end is also used to generate the key factor according to the unique identification information and the custom string, and generate a key array according to the key factor; the data sending end is also used to determine the subscript value of the key in the key array, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement; the data sending end is also used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end; The encrypted data is decrypted by the data receiving end according to the key factor and the subscript value.
8. The method according to claim 7, characterized in that The decrypting the encrypted data according to the key factor and the subscript value by the data receiving end includes: The data receiving end generates the key array according to the key factor, and decrypts the encrypted data according to the key array and the subscript value.
9. A data processing device, characterized in that: Applied to a data sending end, the device comprises: A unique identification information determination module, used to determine the unique identification information of the data sending end through the data sending end, and determine a custom character string; A key array generation module, used to generate a key factor according to the unique identification information and the custom string through the data sending end, and generate a key array according to the key factor; A data encryption module, used to determine the subscript value of the key in the key array through the data sending end, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement; A data sending module, used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end through the data sending end; wherein the data receiving end is used to receive the encrypted data, the unique identification information, the custom string and the subscript value, and determine the key factor according to the unique identification information and the custom string; the data receiving end is also used to decrypt the encrypted data according to the key factor and the subscript value.
10. A data processing device, characterized in that: Applied to a data receiving end, the device comprises: A data receiving module, used for receiving the encrypted data, unique identification information, custom string and subscript value sent by the data sending end through the data receiving end, and determining the key factor according to the unique identification information and the custom string; wherein the data sending end is used to determine the unique identification information of the data sending end, and determine the custom string; the data sending end is also used to generate the key factor according to the unique identification information and the custom string, and generate a key array according to the key factor; the data sending end is also used to determine the subscript value of the key in the key array, and encrypt the data to be encrypted according to the key array in response to the data encryption requirement; the data sending end is also used to send the encrypted data, the unique identification information, the custom string and the subscript value to the data receiving end; A data decryption module is used to decrypt the encrypted data according to the key factor and the subscript value through the data receiving end.
11. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the data processing method according to any one of claims 1 to 6 or 7 to 8 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the data processing method according to any one of claims 1 to 6 or 7 to 8 is implemented.
13. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the data processing method according to any one of claims 1 to 6 or 7 to 8.