CN115834025A - Data encryption method, equipment and storage medium for automobile diagnosis platform - Google Patents

Data encryption method, equipment and storage medium for automobile diagnosis platform Download PDF

Info

Publication number
CN115834025A
CN115834025A CN202211438766.9A CN202211438766A CN115834025A CN 115834025 A CN115834025 A CN 115834025A CN 202211438766 A CN202211438766 A CN 202211438766A CN 115834025 A CN115834025 A CN 115834025A
Authority
CN
China
Prior art keywords
encrypted
array
byte
offset
character
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211438766.9A
Other languages
Chinese (zh)
Inventor
陈大专
于冰亮
张彦杰
姚峰军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Yixiong Info Tech Co ltd
Original Assignee
Beijing Yixiong Info Tech Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Yixiong Info Tech Co ltd filed Critical Beijing Yixiong Info Tech Co ltd
Priority to CN202211438766.9A priority Critical patent/CN115834025A/en
Publication of CN115834025A publication Critical patent/CN115834025A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Storage Device Security (AREA)

Abstract

The invention discloses a data encryption method, equipment and a storage medium for an automobile diagnosis platform, wherein the method comprises the following steps: acquiring a byte array to be encrypted, and scrambling the sequence of the byte array to be encrypted to obtain the byte array to be encrypted with a scrambled sequence; converting the byte arrays to be encrypted in the disordered sequence into preset system character strings in sequence; carrying out offset encryption on all characters in the preset system character string one by one according to a preset offset to obtain an encrypted preset system character string; taking two characters of the encrypted preset system character string as a byte to generate an encrypted byte array; and assembling the identification code ciphertext and the encrypted byte array to generate a ciphertext byte array. Through the processing scheme disclosed by the invention, the encryption efficiency can be improved while the data encryption safety is improved.

Description

Data encryption method, equipment and storage medium for automobile diagnosis platform
Technical Field
The invention relates to the technical field of data encryption, in particular to a data encryption method, data encryption equipment and a data encryption storage medium for an automobile diagnosis platform.
Background
With the rapid development of the automobile diagnosis technology, the working efficiency of automobile maintenance personnel is greatly improved by means of an automobile diagnosis instrument, but meanwhile, various valuable information on the diagnosis instrument also has a leakage risk, and how to protect the data safety of the diagnosis instrument is a crucial difficult problem.
In the field of data security of diagnostic instruments, it is a common security means to encrypt data by using a key encryption algorithm. Common key encryption algorithms include symmetric encryption and asymmetric encryption.
(1) The symmetric encryption algorithm adopts single key encryption, in the communication process, a data sender divides original data into blocks with fixed size, and the blocks are encrypted one by one through the key and the encryption algorithm and then sent to a receiver. And after receiving the encrypted message, the receiver decrypts the combination by using the same key in combination with a decryption algorithm to obtain the original data.
(2) The asymmetric encryption algorithm adopts two different passwords of a public key and a private key for encryption and decryption. The public key and the private key exist in pairs, the public key is extracted from the private key to be published to all, if the public key is used for encrypting data, only the corresponding private key (which cannot be published) can be decrypted, and vice versa.
Although the above data encryption method can ensure the security of the user data to a certain extent, it is found that there are some disadvantages in the method in actual use, and the disadvantages can be summarized as follows because the best use effect cannot be achieved:
(1) The disadvantages of symmetric encryption algorithms: the security is poor, the encryption and decryption algorithms are public, and therefore, the secure transmission of the key becomes a crucial thing in the process. And the key is usually transferred to the other party in a physical way through two-party negotiation, or transferred to the other party by using a third-party platform, and once the key is leaked in the process, a person who is not happy can intercept and decrypt the content of encrypted transmission by combining a corresponding algorithm.
(2) The disadvantages of asymmetric encryption algorithms: the algorithm is very complex, resulting in a long time for encrypting a large amount of data, which is only suitable for encrypting a small amount of data. And because more additional information can be added in the encryption process, the encrypted message is longer, data fragmentation is easily caused, and network transmission is not facilitated.
Therefore, it is obvious that the above conventional data encryption method still has inconvenience and disadvantages in use, and further improvement is urgently needed. How to create a new data encryption method becomes an object of great improvement in the industry.
Disclosure of Invention
In view of the above, embodiments of the present disclosure provide a data encryption method for an automobile diagnosis platform, which at least partially solves the problems in the prior art.
In a first aspect, an embodiment of the present disclosure provides a data encryption method for an automobile diagnosis platform, where the method includes the following steps:
generating a first encryption coding character array, wherein the first encryption coding character array comprises a preset Z 1 The method comprises the following steps of grouping preset characters with subscripts, wherein the characters only comprise capital letters and numbers, and the subscripts are 0 to Z 1 -an integer of 1;
selecting a first random number S 1 Wherein said S 1 Less than Z 1
Obtaining an identification code, wherein the identification code is the subscript S in the first encryption coding character array 1 The character of (a);
obtaining identification code ciphertext, and converting the first random number S 1 Is added with a preset first offset P of the identification code 1 Obtaining the subscript S of the offset identification code 1 +P 1 (ii) a Searching the subscript S in the first encryption coding character array 1 +P 1 The characters of (2) are used as identification code ciphertext; wherein the first offset P 1 Is 0 to Z 1 An integer of (d);
generating a second encryption coding character array and a third encryption coding character array, wherein the second encryption coding character array and the third encryption coding character array contain preset Z 2 Set of predetermined characters with subscripts, said subscripts being0 to Z 2 -an integer of 1;
the first random number S 1 Divided by Z 2 Taking the remainder as a second offset P 2
Acquiring a byte array to be encrypted, and scrambling the sequence of the byte array to be encrypted to obtain the byte array to be encrypted with a scrambled sequence; converting the byte arrays to be encrypted in the disordered sequence into Z sequence 2 Carrying out a character string;
according to the second offset P 2 Introduction of said Z into 2 All characters in the binary character string are subjected to offset encryption one by one to obtain encrypted Z 2 Carrying out a character string; and the encrypted Z is 2 The binary system character string takes two characters as a byte to generate an encrypted byte array;
and assembling the identification code ciphertext and the encrypted byte array to generate a ciphertext byte array.
According to a specific implementation manner of the embodiment of the present disclosure, the scrambling of the sequence of the byte arrays to be encrypted includes the following steps: acquiring a byte array to be encrypted, and calculating the length L of the byte array to be encrypted, wherein when L is greater than P 2 Then, the positive sequence P of the byte array to be encrypted is calculated 2 Moving bytes to the last of the array to be encrypted, and reversing the L-P of the array to be encrypted 2 Moving bytes to the forefront of the array to be encrypted to generate a disordered array of bytes to be encrypted; and when the length of the byte array to be encrypted is less than or equal to P 2 And taking the array to be encrypted as the byte array to be encrypted in a disordered sequence.
According to a specific implementation manner of the embodiment of the present disclosure, the second offset P is set 2 Introduction of said Z into 2 All characters in the binary character string are subjected to offset encryption one by one, and the method comprises the following steps:
when the Nth character is offset encrypted, when N is less than P 2 Then, the second encryption coding character array is used as an encryption coding table; and, when N is greater than or equal to P 2 Then, the third encrypted code character array is used asEncrypting the coding table;
finding the subscript N of N in the encryption coding table Subscript Is a reaction of N Subscript +P 2 The value of (a) is used as the identifier subscript after the offset; wherein when N is Subscript +P 2 Greater than Z 1 -1, resetting the offset ID subscript to N Subscript +P 2 -Z 2
And finding out the character with the subscript of the identifier after the offset as the ciphertext of the Nth character in the encryption coding table.
According to a specific implementation manner of the embodiment of the disclosure, the byte arrays to be encrypted with the disordered sequence are converted into Z bytes in sequence 2 The method for carrying out the binary character string comprises the following steps: each byte is converted into two characters, less than two characters are supplemented with 0 in the front.
According to a specific implementation manner of the embodiment of the disclosure, the first random number S is used 1 Is added with a preset first offset P of the identification code 1 Obtaining the subscript S of the offset identification code 1 +P 1 The method further comprises, when said S is 1 +P 1 Greater than Z 1 1, the said S 1 +P 1 Reset to S 1 +P 1 -Z 1
According to a specific implementation manner of the embodiment of the present disclosure, the subscripted preset character type and the preset Z are included in the second encrypted code character array and the third encrypted code character array 2 Is correlated.
According to a specific implementation manner of the embodiment of the present disclosure, the identification code is one byte.
In a second aspect, an embodiment of the present disclosure further provides a data decryption method for an automobile diagnosis platform, where the data decryption method is used to decrypt the data encryption method for the automobile diagnosis platform in the first aspect or any implementation manner of the first aspect, and the method includes the following steps:
obtaining the identification code ciphertext in the ciphertext byte array, and obtaining the identification code ciphertext by using the identification code ciphertextSubtracting the first offset P of the identification code from the identification code ciphertext subscript 1 To obtain a first random number S 1
The first random number S 1 Divided by Z 2 And taking the remainder as the second offset P 2
Converting the ciphertext byte array into the encrypted Z 2 Carrying out a character string;
according to the second offset P 2 The encrypted Z 2 All characters in the binary character string are subjected to offset decryption one by one to obtain the Z 2 Carrying out a character string;
the Z is 2 The binary system character string takes two characters as a byte to obtain the byte array to be encrypted in the disordered sequence;
calculating the length L of the byte array to be encrypted in the disordered sequence, wherein when L is greater than P 2 Then, the length of the front end of the byte array to be encrypted in the disorderly sequence is set to be L-P 2 Moving the bytes with the length to the last of the byte array to be encrypted in the disorganized sequence, and simultaneously, moving the back end P of the byte array to be encrypted in the disorganized sequence 2 Putting bytes to the forefront of the byte array to be encrypted in the disordered sequence to obtain the byte array to be encrypted; and when the length of the byte array to be encrypted is less than or equal to P 2 And then, the byte array to be encrypted in the disordered sequence is the array to be encrypted.
In a third aspect, an embodiment of the present disclosure further provides an electronic device, where the electronic device includes:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor, and the instructions, when executed by the at least one processor, cause the at least one processor to perform the data encryption method of the automotive diagnostic platform of any one of the foregoing first aspect or any implementation manner of the first aspect.
In a fourth aspect, the disclosed embodiments also provide a non-transitory computer-readable storage medium storing computer instructions that, when executed by at least one processor, cause the at least one processor to perform the data encryption method of the automotive diagnostic platform of the first aspect or any implementation manner of the first aspect.
In a fifth aspect, the present disclosure also provides a computer program product, where the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, when executed by a computer, cause the computer to execute the data encryption method of the automobile diagnosis platform in the foregoing first aspect or any implementation manner of the first aspect.
The data encryption method for the automobile diagnosis platform in the embodiment of the disclosure can improve the data encryption security and the encryption efficiency.
Drawings
The foregoing is only an overview of the technical solutions of the present invention, and in order to make the technical solutions of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and the detailed description.
Fig. 1 is a schematic flow chart of a data encryption method for an automobile diagnosis platform according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of an electronic device provided in an embodiment of the disclosure.
Detailed Description
The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
The embodiments of the present disclosure are described below with specific examples, and other advantages and effects of the present disclosure will be readily apparent to those skilled in the art from the disclosure in the specification. It is to be understood that the described embodiments are merely illustrative of some, and not restrictive, of the embodiments of the disclosure. The disclosure may be embodied or carried out in various other specific embodiments, and various modifications and changes may be made in the details within the description without departing from the spirit of the disclosure. It is to be noted that the features in the following embodiments and examples may be combined with each other without conflict. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
It is noted that various aspects of the embodiments are described below within the scope of the appended claims. It should be apparent that the aspects described herein may be embodied in a wide variety of forms and that any specific structure and/or function described herein is merely illustrative. Based on the disclosure, one skilled in the art should appreciate that one aspect described herein may be implemented independently of any other aspects and that two or more of these aspects may be combined in various ways. For example, an apparatus may be implemented and/or a method practiced using any number of the aspects set forth herein. Additionally, such an apparatus may be implemented and/or such a method may be practiced using other structure and/or functionality in addition to one or more of the aspects set forth herein.
It should be noted that the drawings provided in the following embodiments are only for illustrating the basic idea of the present disclosure, and the drawings only show the components related to the present disclosure rather than the number, shape and size of the components in actual implementation, and the type, amount and ratio of the components in actual implementation may be changed arbitrarily, and the layout of the components may be more complicated.
In addition, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects may be practiced without these specific details.
The data encryption method of the automobile diagnosis platform is used for encrypting the communication data between the automobile diagnosis platform and the server, such as user names and passwords during login, authority data issued from the server during user menu authority updating, special inspection authority data issued from the server during user special inspection authority updating, client information such as user id and flat mac address which need to be uploaded when the client accesses the server, and can improve the data encryption safety and the encryption efficiency.
Fig. 1 is a schematic diagram of a data encryption method flow of an automobile diagnosis platform according to an embodiment of the present disclosure.
As shown in fig. 1, in step S110, a first encrypted code character array is generated, where the first encrypted code character array includes a preset Z 1 The method comprises the following steps of grouping preset characters with subscripts, wherein the characters only comprise capital letters and numbers, and the subscripts are 0 to Z 1 -an integer of 1.
For example, a length ENC _ KEY _ MAXCOUNT =36 (or called Z) is generated in advance 1 = 36) encryption code character array g _ cArrayEncrypt1 (or first encryption code character array), where the characters in the array only contain capital letters and numbers, and the subscript is an integer of [0, 36), as shown in table g _ cArrayEncrypt1.
g_cArrayEncrypt1:
Figure BDA0003947609750000071
More specifically, it next goes to step S120.
At step S120, a first random number S is selected 1 Wherein said S 1 Less than Z 1
For example, an integer between 0 and 36 is randomly generated, and the value thereof ranges from S 1 = [0, 36) (= [0, 36))) including 0 but not 36, e.g. select S 1 =5。
It next goes to step S130.
At step S130, an identification code is obtained, where the identification code is the index S in the first encrypted code character array 1 The character (c).
For example, a character with subscript 5 is found in the table g _ cArrayEncrypt1 as an identifier, i.e.: the identification code = g _ cArrayEncrypt1[ rand ] =2.
It next goes to step S140.
In the step ofS140, obtaining identification code ciphertext and combining the first random number S 1 Is added with a preset first offset P of the identification code 1 Obtaining the subscript S of the offset identification code 1 +P 1 (ii) a Searching the subscript S in the first encryption coding character array 1 +P 1 The character of (a) is used as an identification code ciphertext.
In the embodiment of the present invention, the method further includes, when the S is 1 +P 1 Greater than Z 1 1, said S is 1 +P 1 Reset to S 1 +P 1 -Z 1
For example, the identification code encryption comprises the following steps:
(1) Fix the first OFFSET KEY _ OFFSET to 9 (or P) 1 = 9), the encryption code array is fixed to g _ cArrayEncrypt1.
(2) Will rand (first random number S) 1 ) + KEY _ OFFSET (first OFFSET P) 1 ) As the offset identifier index new _ index, i.e. the value of
new_index=rand+KEY_OFFSET=5+9=14。
Comparing whether the value of the new _ index is greater than ENC _ KEY _ MAXCLONT-1, and when the value of the new _ index is greater than ENC _ KEY _ MAXCLONT-1, resetting the new _ index as: rand + KEY _ OFFSET-ENC _ KEY _ MAXCLONT.
As the data is brought in, 14 is less than 36-1, so the index of the identification code after offset is 14.
(3) Finding characters with the index of new _ index in the encryption array g _ cArrayEncrypt1 as an identification code ciphertext encrypt Key, namely:
the identifier ciphertext encryptKey = g _ cArrayEncrypt1[ new _ index ].
Looking up the encryption array g _ cArrayEncrypt1, the character corresponding to the identifier subscript 14 is J.
It then goes to step S150.
In step S150, a second encrypted code character array and a third encrypted code character array are generated, where the second encrypted code character array and the third encrypted code character array include a preset Z 2 Set of predetermined characters with subscripts, said subscripts being0 to Z 2 -an integer of 1.
In this embodiment of the present invention, the subscripted preset character type and the preset Z included in the second encrypted code character array and the third encrypted code character array 2 Is related to the value of, for example, when Z 2 When the number is 16, in the case of hexadecimal, the preset characters are letters A-F and numbers, and the length of the second encrypted coding character array and the third encrypted coding character array is 16; when Z is 2 When the number is 10, when a decimal system is adopted, the preset characters are 9 numbers of 0-9, and the length of the second encryption coding character array and the third encryption coding character array is 10; when Z is 2 When the number is 8, an 8-system is adopted, the preset characters are 7 numbers of 0-7, the length of the second encryption coding character array and the third encryption coding character array is 8, and the like.
For example, two lengths ENC _ MAXCOUNT =16 (or called Z) are generated in advance 2 = 16) encryption code character arrays g _ cArrayEncrypt2 (or called second encryption code character array) and g _ cArrayEncrypt3 (or called third encryption code character array), which are shown in tables g _ cArrayEncrypt2 and g _ cArrayEncrypt 3.
g_cArrayEncrypt2:
Subscript 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Character(s) 3 4 F 6 1 E 2 D A 0 B C 5 8 9 7
g_cArrayEncrypt3:
Subscript 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Character(s) C 3 4 F 6 1 E 2 D A 0 B 5 8 9 7
It next goes to step S160.
At step S160, the first random number S 1 Divided by Z 2 Taking the remainder as a second offset P 2
For example, by using rand (or first random number S) 1 ) Divided by the length ENC _ MAXCLONT (or called Z) of the second and third encryption code word arrays 2 ) The remainder is taken as offset (or called second offset P) 2 ) The value of (a) is: offset = rand/ENC _ MAXCOUNT.
The second offset P is known by the data 2 Is 5.
It then goes to step S170.
In step S170, a byte array to be encrypted is obtained, and the order of the byte array to be encrypted is scrambled, so as to obtain a byte array to be encrypted, which is scrambled in order; converting the byte arrays to be encrypted in the disordered sequence into Z sequence 2 And carrying out a binary character string.
In the embodiment of the invention, the method for disturbing the sequence of the byte arrays to be encrypted comprises the following steps: obtaining a byte array to be encrypted, and calculating the length L of the byte array to be encrypted, wherein when L is greater than P 2 Then, the P of the byte array to be encrypted is in positive sequence 2 Moving bytes to the end of the array to be encrypted, and reversing the sequence of the array to be encrypted 2 Moving the bytes to the forefront of the array to be encrypted to generate a disordered array of bytes to be encrypted; and when the length of the byte array to be encrypted is less than or equal to P 2 And when the byte array to be encrypted is used as the byte array to be encrypted, the byte array to be encrypted is in a disordered sequence, and the invention is not limited herein.
For example, scrambling the order of byte arrays to be encrypted [ ] contentBytes comprises the following steps: calculating to obtain the length (or called L) of the byte array to be encrypted, if the length is greater than the value of the second offset, putting the front offset byte in the byte [ ] contentBytes of the byte array to be encrypted to the last of the byte array to be encrypted, putting the rear length-offset byte of the byte array to be encrypted to the forefront of the byte array to be encrypted, and generating the ordered array to be encrypted, otherwise, not changing the order of the byte array to be encrypted.
Byte array contentBytes to be encrypted:
Figure BDA0003947609750000101
and taking the length of the byte array to be encrypted as L =15, leading the data to be known, wherein 15 is larger than 5 of the second offset, putting the first 5 bytes in the byte array to be encrypted to the last of the byte array to be encrypted, and then putting the last 11 bytes of the byte array to be encrypted to the forefront of the byte array to be encrypted to generate the disordered array contents bytes to be encrypted.
The array to be encrypted in a disordered sequence:
Figure BDA0003947609750000111
from the example of step S150, Z is 2 When =16, Z 2 The system is hexadecimal, the array to be encrypted in a disordered sequence is converted into a hexadecimal character string contentHexs, each byte is converted into two characters, and the front part of each byte is supplemented with 0.
Hexadecimal character string contentHexs:
Figure BDA0003947609750000112
next, it goes to step S180.
At step S180, according to the second offset P 2 Introduction of said Z into 2 All characters in the binary character string are subjected to offset encryption one by one to obtain encrypted Z 2 Carrying out a character string; and the encrypted Z is 2 The binary character string takes two characters as a byte to generate an encrypted byte array.
In the embodiment of the invention, according to the second offset P 2 A reaction of said Z 2 All characters in the binary character string are subjected to offset encryption one by one, and the method comprises the following steps:
when the Nth character is offset encrypted, when N is less than P 2 Then, the second encryption coding character array is used as an encryption coding table; and, when N is greater than or equal to P 2 Then, the third encryption coding character array is used as an encryption coding table;
finding the subscript N of N in the encryption coding table Subscript Is a reaction of N Subscript +P 2 The value of (a) is used as the identifier subscript after the offset; wherein when N is Subscript +P 2 Greater than Z 1 Resetting the offset ID subscript to N at-1% Subscript +P 2 -Z 2
And finding out the character with the subscript of the identifier after the offset as the ciphertext of the Nth character in the encryption coding table.
For example, encrypting the byte array bytes [ ] contentBytes to be encrypted according to the second offset to obtain the encrypted byte array bytes [ ] encryptContentBytes includes the following steps:
(1) According to the second offset, offset-encrypting all the characters in the hexadecimal character string contentHexs one by one to obtain an encrypted hexadecimal character string encryptContentHexs, for example: when the nth character is encrypted, the second encryption code character array g _ cArrayEncrypt2 is used as the encryption code table g _ cArrayEncrypt when N < offset, and the third encryption code character array g _ cArrayEncrypt3 is used as the encryption code table g _ cArrayEncrypt when N > = offset.
Finding the index of the Nth character in the encryption coding table g _ cArrayEncrypt, and taking the value of index + offset as the offset index of the new _ index of the identification code, namely
new _ index = index + offset, and when the value of new _ index is greater than ENC _ MAXCOUNT-1, the new _ index is reset to: index + offset-ENC _ MAXCOUNT, and find the character with index new _ index as the ciphertext of the nth character in the encryption coding table g _ cArrayEncrypt, that is: the ciphertext of the nth character = g _ cArrayEncrypt [ new _ index ], so far the encryption of the nth character is finished.
For example, according to the second offset =5, offset-encrypting all the characters in the hexadecimal string content hexs = "05060708090A0B0C0D0E0F0001020304" one by one yields the encrypted hexadecimal string encryptContentHexs, for example: for example, when the first character 0 is encrypted, the index of character 0 is found to be 9 in g _ ca rray encrypt2, index + offset =9+5=14 is used as the ciphertext index after offset, and the character 9 with the index of 14 is found in the encryption coding table g _ ca rray encrypt as the ciphertext of the current plaintext character 0.
By analogy, the total encrypted hexadecimal string encryptconthenxs is "949a96747F797C71787B7D7770757E72", which is not described in detail herein.
(2) And converting the encrypted hexadecimal character string encryptcontentHexs into an encrypted byte array encryptcontentBytes by taking two characters as one byte.
The encrypted byte array encrypt contentbytes:
Figure BDA0003947609750000131
next, it goes to step S190.
At step S190, the identification code ciphertext and the encrypted byte array are assembled to generate a ciphertext byte array.
More specifically, the ciphertext byte array = identification code ciphertext (1 bit) + encrypted byte array, where the identification code is a byte generated automatically, and the encrypted byte array is obtained by encrypting the byte array byte [ ] content bytes to be encrypted, which is sent in by the user.
In the embodiment of the present invention, the identification code ciphertext may be located in the first byte in the ciphertext byte array, or may be located in other positions agreed in the ciphertext byte array, and herein, the present invention is not limited thereto.
For example, the identification code ciphertext is J, and the corresponding hexadecimal number is 4A, so the whole ciphertext byte array after assembly is as follows:
Figure BDA0003947609750000132
in the embodiment of the invention, the first random number, the first encryption code character array, the second encryption code character array and the third encryption code character array are data agreed by an encryption party and a decryption party in advance.
In the embodiment of the invention, the decryption method corresponding to the data encryption method of the automobile diagnosis platform specifically comprises the following decryption steps:
obtaining the identification code ciphertext in the ciphertext byte array by subtracting the identification code ciphertext subscript from a first offset P of the identification code 1 Obtaining the first random number S 1
The first random number S 1 Divided by Z 2 And taking a remainder, the remainder being the second offset P 2
Will be described inConverting the encrypted byte array into the encrypted Z 2 And carrying out a binary character string.
According to the second offset P 2 The encrypted Z is 2 All characters in the binary character string are subjected to offset decryption one by one to obtain the Z 2 And carrying out a binary character string.
The Z is 2 The binary system character string takes two characters as a byte to obtain the byte array to be encrypted in the disorderly sequence.
Calculating the length L of the byte array to be encrypted in the disorganized sequence, wherein when L is larger than P 2 Then, the length of the front end of the byte array to be encrypted in the disorderly sequence is set to be L-P 2 Moving the bytes with the length to the last of the byte array to be encrypted in the disorganized sequence, and simultaneously, moving the back end P of the byte array to be encrypted in the disorganized sequence 2 Putting bytes to the forefront of the byte array to be encrypted in the disordered sequence to obtain the byte array to be encrypted; and when the length of the byte array to be encrypted is less than or equal to P 2 And then, the byte array to be encrypted in the disordered sequence is the array to be encrypted.
For example, decryption includes the steps of:
ciphertext tuple:
Figure BDA0003947609750000141
(1) Obtaining a first random number rand from the ciphertext byte array: the identification code ciphertext byte 4A is obtained from the first bit of the ciphertext byte array, and is converted into a decimal character J, the subscript of the byte is found to be 14 in the first encryption code character array g _ cArrayEncrypt1, and since the offset of the identification code is 9, the subscript (or the offset identification code subscript) new _ index =15-9=5 of the plaintext, that is, the value of the first random number is 5.
(2) Calculating a second offset amount offset: the first random number 5 is divided by the length 16 of the second and third encryption code word arrays and the remainder is taken, i.e. the value of the second offset, i.e.: offset =5.
(3) And decrypting the encrypted byte array.
a) The cipher text byte groups except the identification code are sequentially converted into an upper-case hexadecimal character string encryptconthenxs, each byte is converted into two characters, and the front complement of the two characters is less than 0, so that a 16-system character string '949A 96747F797C71787B7D7770757E 72' is obtained.
b) Since the second offset is 5, the first 5 bits of the 16-ary string have g _ cArrayEncrypt2 as the decryption code table, and the rest have g _ cArrayEncrypt3 as the decryption code table. For example, when decrypting the first character 9, the index of the character '9' is found to be 14 in the coding table g _ ca rray encrypt2, because the ciphertext index is: plaintext index + offset so the plaintext index is: ciphertext subscript-offset =14-5=9, a character with subscript 9 of 0, which is a plaintext corresponding to the ciphertext character 9, is found in the encoding table g _ ca rray encrypt2, until the decryption of the first character 9 is completed, and so on, the whole decrypted hexadecimal character string is "05060708090A0B0C0D0E0F0001020304", which is not described herein again.
c) The decrypted hexadecimal character '05060708090A 0B0C0D0E0F 0001020304' is converted into the decrypted hexadecimal byte array contentBytes by taking two characters as one byte. Decrypted hexadecimal byte array contentBytes:
Figure BDA0003947609750000151
and converting the decrypted hexadecimal byte array contentBytes into a decrypted decimal byte array.
Decrypted decimal byte array:
Figure BDA0003947609750000161
d) Reducing the byte array sequence: and calculating to obtain the length 16 of the decrypted decimal byte array content bytes which is more than 5, then placing the first 11 bytes in the decrypted decimal byte array content bytes to the last of the decrypted byte array, placing the last 5 bytes of the decrypted decimal byte array to the forefront of the decrypted byte array, generating a decimal byte array with the order of the reduced byte array, and ending the decryption.
Reducing the decimal byte array of the byte array sequence:
Figure BDA0003947609750000162
referring to fig. 2, an embodiment of the present disclosure also provides an electronic device 20, which includes:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the data encryption method of the vehicle diagnostic platform in the above method embodiment.
The disclosed embodiments also provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the data encryption method of the automotive diagnostic platform in the foregoing method embodiments.
The disclosed embodiments also provide a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, cause the computer to perform the data encryption method of the automotive diagnostic platform in the aforementioned method embodiments.
Referring now to FIG. 2, a schematic diagram of an electronic device 20 suitable for use in implementing embodiments of the present disclosure is shown. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 2 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 2, the electronic device 20 may include a processing apparatus (e.g., a central processing unit, a graphics processor, etc.) 201 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 202 or a program loaded from a storage apparatus 208 into a Random Access Memory (RAM) 203. In the RAM203, various programs and data necessary for the operation of the electronic apparatus 20 are also stored. The processing device 201, the ROM202, and the RAM203 are connected to each other via a bus 204. An input/output (I/O) interface 205 is also connected to bus 204.
Generally, the following devices may be connected to the I/O interface 205: input devices 206 including, for example, touch screens, touch pads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 207 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, or the like; storage 208 including, for example, magnetic tape, hard disk, etc.; and a communication device 209. The communication means 209 may allow the electronic device 20 to communicate wirelessly or by wire with other devices to exchange data. While the figures illustrate an electronic device 20 having various means, it is understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be alternatively implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 209, or installed from the storage means 208, or installed from the ROM 202. The computer program, when executed by the processing device 201, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring at least two internet protocol addresses; sending a node evaluation request comprising the at least two internet protocol addresses to node evaluation equipment, wherein the node evaluation equipment selects the internet protocol addresses from the at least two internet protocol addresses and returns the internet protocol addresses; receiving an internet protocol address returned by the node evaluation equipment; wherein the obtained internet protocol address indicates an edge node in the content distribution network.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a node evaluation request comprising at least two internet protocol addresses; selecting an internet protocol address from the at least two internet protocol addresses; returning the selected internet protocol address; wherein the received internet protocol address indicates an edge node in the content distribution network.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof.
The above description is only for the specific embodiments of the present disclosure, but the scope of the present disclosure is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present disclosure should be covered within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A data encryption method for an automobile diagnosis platform is characterized by comprising the following steps:
generating a first encrypted coding character array, wherein the first encrypted coding character array comprises a preset Z 1 The method comprises the following steps of grouping preset characters with subscripts, wherein the characters only comprise capital letters and numbers, and the subscripts are 0 to Z 1 -an integer of 1;
selecting a first random number S 1 Wherein said S 1 Less than Z 1
Obtaining an identification code, wherein the identification code is the subscript S in the first encryption coding character array 1 The character (c);
obtaining identification code ciphertext, and converting the first random number S 1 Is added with a preset first offset P of the identification code 1 Obtaining the subscript S of the offset identification code 1 +P 1 (ii) a Searching the subscript S in the first encryption coding character array 1 +P 1 The characters of (2) are used as identification code ciphertext; wherein the first offset P 1 Is 0 to Z 1 An integer of (d);
generating a second encryption coding character array and a third encryption coding character array, wherein the second encryption coding character array and the third encryption coding character array contain preset Z 2 A predetermined character having a subscript of 0 to Z 2 -an integer of 1;
the first random number S 1 Divided by Z 2 Taking the remainder as a second offset P 2
Acquiring a byte array to be encrypted, and scrambling the sequence of the byte array to be encrypted to obtain the byte array to be encrypted with a scrambled sequence; converting the byte arrays to be encrypted in the disordered sequence into Z sequence 2 Carrying out a character string;
according to the second offset P 2 A reaction of said Z 2 All characters in the binary character string are subjected to offset encryption one by one to obtain encrypted Z 2 Carrying out a character string; and the encrypted Z is 2 The binary system character string takes two characters as a byte to generate an encrypted byte array;
and assembling the identification code ciphertext and the encrypted byte array to generate a ciphertext byte array.
2. The data encryption method for the vehicle diagnosis platform according to claim 1, wherein the scrambling sequence of the byte arrays to be encrypted comprisesThe following steps: acquiring a byte array to be encrypted, and calculating the length L of the byte array to be encrypted, wherein when L is greater than P 2 Then, the P of the byte array to be encrypted is in positive sequence 2 Moving bytes to the last of the array to be encrypted, and reversing the L-P of the array to be encrypted 2 Moving bytes to the forefront of the array to be encrypted to generate a disordered array of bytes to be encrypted; and when the length of the byte array to be encrypted is less than or equal to P 2 And taking the array to be encrypted as the byte array to be encrypted in a disordered sequence.
3. The data encryption method for vehicle diagnostic platform according to claim 1, wherein said second offset P is based on 2 Introduction of said Z into 2 All characters in the binary character string are subjected to offset encryption one by one, and the method comprises the following steps:
when the Nth character is offset encrypted, when N is less than P 2 Then, the second encryption coding character array is used as an encryption coding table; and, when N is greater than or equal to P 2 Taking the third encrypted coding character array as an encrypted coding table;
finding the subscript N of N in the encryption coding table Subscript Is a reaction of N Subscript +P 2 The value of (a) is used as the identifier subscript after the offset; wherein when N is Subscript +P 2 Greater than Z 1 -1, resetting the offset ID subscript to N Subscript +P 2 -Z 2
And finding out the character with the subscript of the identifier after the offset as the ciphertext of the Nth character in the encryption coding table.
4. The data encryption method for the vehicle diagnosis platform according to claim 1, wherein the scrambled byte arrays to be encrypted are sequentially converted into Z 2 The method for carrying out the binary character string comprises the following steps: each byte is converted into two characters, less than two characters are supplemented with 0 in the front.
5. The data encryption method for the vehicle diagnosis platform according to claim 1, wherein the first random number S is generated 1 Is added with a preset first offset P of the identification code 1 Obtaining the offset subscript S of the identification code 1 +P 1 The method further comprises, when said S is 1 +P 1 Greater than Z 1 1, the said S 1 +P 1 Reset to S 1 +P 1 -Z 1
6. The data encryption method for vehicle diagnostic platform of claim 1, wherein the subscripted preset character type and the preset Z are included in the second encrypted code character array and the third encrypted code character array 2 Is correlated.
7. The data encryption method for the vehicle diagnosis platform according to any one of claims 1 to 6, wherein the identification code is one byte.
8. A data decryption method of an automobile diagnosis platform, wherein the data decryption method of the automobile diagnosis platform is used for decrypting the data encryption method of the automobile diagnosis platform according to any one of claims 1 to 7, and the method comprises the following steps:
obtaining an identification code ciphertext in a ciphertext byte array, and subtracting a first offset P of the identification code from an identification code ciphertext subscript 1 To obtain a first random number S 1
The first random number S 1 Divided by Z 2 And taking the remainder as the second offset P 2
Converting the ciphertext byte array into the encrypted Z 2 Carrying out a character string;
according to the second offset P 2 The encrypted Z is 2 All characters in the binary character string are subjected to offset decryption one by one to obtain the Z 2 Carrying out a character string;
the Z is 2 The binary system character string takes two characters as a byte to obtain the byte array to be encrypted in the disordered sequence;
calculating the length L of the byte array to be encrypted in the disordered sequence, wherein when L is greater than P 2 Then, the length of the front end of the byte array to be encrypted in the disorderly sequence is set to be L-P 2 Moving the bytes with the length to the end of the byte array to be encrypted in the disorganized sequence, and meanwhile, moving the back end P of the byte array to be encrypted in the disorganized sequence 2 Putting bytes in the forefront of the disordered byte array to be encrypted to obtain the byte array to be encrypted; and when the length of the byte array to be encrypted is less than or equal to P 2 And then, the byte array to be encrypted in the disordered sequence is the array to be encrypted.
9. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor, the instructions, when executed by the at least one processor, cause the at least one processor to perform the data encryption method of the automotive diagnostic platform of any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions which, when executed by at least one processor, cause the at least one processor to perform the data encryption method of the automotive diagnostic platform of any one of claims 1 to 7.
CN202211438766.9A 2022-11-17 2022-11-17 Data encryption method, equipment and storage medium for automobile diagnosis platform Pending CN115834025A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211438766.9A CN115834025A (en) 2022-11-17 2022-11-17 Data encryption method, equipment and storage medium for automobile diagnosis platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211438766.9A CN115834025A (en) 2022-11-17 2022-11-17 Data encryption method, equipment and storage medium for automobile diagnosis platform

Publications (1)

Publication Number Publication Date
CN115834025A true CN115834025A (en) 2023-03-21

Family

ID=85528711

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211438766.9A Pending CN115834025A (en) 2022-11-17 2022-11-17 Data encryption method, equipment and storage medium for automobile diagnosis platform

Country Status (1)

Country Link
CN (1) CN115834025A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116260659A (en) * 2023-05-15 2023-06-13 典基网络科技(上海)有限公司 Method for processing packet loss of ipsec data packet

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116260659A (en) * 2023-05-15 2023-06-13 典基网络科技(上海)有限公司 Method for processing packet loss of ipsec data packet
CN116260659B (en) * 2023-05-15 2023-07-11 典基网络科技(上海)有限公司 Method for processing packet loss of ipsec data packet

Similar Documents

Publication Publication Date Title
CN111177801B (en) Signature method and device of electronic document, storage medium and electronic equipment
CN107612683B (en) Encryption and decryption method, device, system, equipment and storage medium
CN110516462B (en) Method and apparatus for encrypting data
CN112149168B (en) File data encryption method and device and electronic equipment
CN109495266B (en) Data encryption method and device based on random number
CN111245811A (en) Information encryption method and device and electronic equipment
CN112019323B (en) Data encryption and decryption methods and devices, storage medium and electronic equipment
CN111555880A (en) Data collision method and device, storage medium and electronic equipment
CN115834025A (en) Data encryption method, equipment and storage medium for automobile diagnosis platform
CN113946847A (en) Digital encryption and decryption method and device, terminal equipment and storage medium
CN113704789A (en) Vehicle-mounted communication safety processing method, device, equipment and storage medium
CN112019328B (en) Encryption method, device, equipment and storage medium of IP address
CN111130791B (en) Data signature method, electronic device and computer readable storage medium
CN116010678B (en) Method, device and equipment for inquiring trace
CN117134914A (en) One-time-pad random key stream encryption algorithm and system based on hardware characteristics
CN112399027B (en) Picture encryption and decryption method and device, storage medium and electronic equipment
CN115632782B (en) Random number generation method, system and equipment based on SM4 counter mode
CN112329044A (en) Information acquisition method and device, electronic equipment and computer readable medium
CN115277064B (en) Data encryption and data decryption methods and devices, electronic equipment and medium
US11165758B2 (en) Keystream generation using media data
CN112236974A (en) Decryption device, encryption device, and encryption system
CN115766244A (en) Internet of vehicles information encryption method and device, computer equipment and storage medium
CN114491421A (en) File encryption method, file processing method, file encryption device, file processing device, readable medium and electronic equipment
CN108985109A (en) A kind of date storage method and device
CN114726611A (en) Multiparty privacy set intersection method, system and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination