Disclosure of Invention
The technical problem to be solved by the invention is as follows: aiming at the problem that data transmission in the power industry is difficult to realize in remote areas, the data acquisition terminal and the corresponding data transmission method are provided, wherein the Beidou can be used for transmitting power data without 4G communication signals.
The technical scheme of the invention is as follows:
the utility model provides a tower footing safety monitoring terminal based on big dipper communication and 4G communication, includes microprocessor, microprocessor treater respectively with 4G module, big dipper communication module, human-computer interaction module, sensor module communication connection.
The microprocessor module collects sensor data, compresses and encrypts the data and sends the data through the 4G module or the Beidou module.
The sensor module comprises a displacement signal acquisition module, a settlement signal acquisition module, a stress signal acquisition module and an osmotic pressure signal acquisition module, each sensing signal is transmitted to the data packaging module, the communication control module selects 4G communication or Beidou communication, and if the 4G communication is selected, the packaged data is transmitted through the 4G communication data encryption module, the 4G communication data control frame insertion module and the TCP packaging module in sequence and then is subjected to 4G communication transmission; if Beidou communication is selected, the packed data sequentially pass through the Beidou communication data encryption module, the Beidou communication data subpackaging module and the Beidou communication data control word inserting module and then are transmitted in the Beidou communication mode.
The data packing module packs the data into a 4G communication available data packet and a Beidou communication available data packet, and packs the received displacement data, settlement data, stress data and osmotic pressure data into a 4G data packet and a BD data packet;
the 4G communication data encryption module encrypts the obtained 4G data packet to obtain an encrypted 4G data packet, wherein the encrypted 4G data packet changes original information data by using a symmetric encryption algorithm, and a plaintext is changed into a ciphertext;
the 4G communication data control frame inserting module adds a 4G communication message control frame to an encrypted 4G data packet to form a 4G communication message, wherein the 4G communication message is formed by inserting a 2-byte fixed frame header and a 4-byte load length before the encrypted 4G data packet;
the TCP data packaging module packages the received 4G communication message into a standard TCP communication message frame and sends the standard TCP communication message frame to the Internet for transmission;
the Beidou communication data encryption module encrypts the acquired BD data packet into an encrypted BD data packet, and changes original information data into a ciphertext from a plaintext by using a symmetric encryption algorithm;
the Beidou communication data packet module divides the received encrypted BD data packets into encrypted BD data packet groups with the size of 200 bytes, and each encrypted BD data packet group comprises a plurality of encrypted packets;
the Beidou communication data control word insertion module inserts control words into a plurality of encrypted packets in the encrypted BD data packet group to form a plurality of BD communication messages, and the BD communication messages are transmitted to a Beidou network;
the communication control module selects 4G communication or Beidou communication according to a control signal, the control signal is from a preset program design, and the program can judge whether the current 4G network is normal.
The 4G data packets are ASCII character strings with the size of less than 1500 bytes and meeting JSON standard, and the BD data packets are 16-system byte streams represented by the ASCII character strings with the size of less than 1500 bytes.
The tower footing safety monitoring terminal is adopted for data transmission, 4G communication is selected firstly during data transmission, and if the transmission of the 4G communication fails, Beidou communication is selected for transmission.
Encrypting each byte in the Beidou short message plaintext by using a sequence cipher algorithm, wherein the encrypting step comprises the following steps: obtaining a Beidou short message plaintext PT; acquiring a key stream KS according to a sequence cipher algorithm; extracting a sub-key KS from a stream of keys KSiTaking out the plaintext character PT from the short message plaintext PTi(ii) a Using PTiAnd KSiGenerating encrypted ciphertext CTi(ii) a Judging CTiIf it belongs to encrypted valid character, otherwise, the PT is reusediAnd KSiGenerating a new encrypted ciphertext CTi(ii) a All PTiAll encrypted are obtained by CTiAnd forming an encrypted ciphertext CT.
PTi is encrypted using the following encryption loop:
(1) obtaining a divisor K, wherein the divisor K meets 1< (256/K) <96 and is an integer, and when K meets (256/K) <96, the smaller the K, the better the K is;
(2) performing operation on the sub-key KSi to obtain an encrypted sub-key NKSi, wherein the NKSi and the KSi are integers, and the operation is performed by dividing the KSi by a divisor K;
(3) the method comprises the steps of generating a tentative encrypted character TCTi by using an acquired ith bit encryption sub-key NKSi and an ith bit Beidou short message plaintext character PTi, and specifically, adding the I code value of the ith bit encryption sub-key NKSi and the I code value of the ith bit character PTi of the Beidou short message plaintext to obtain an encrypted ASCII code value TCTiA, if the TCTiA is larger than C96A, the TCTiA is KSi + PTiA-C96A + C1A-1, and if the value of the TCTiA is smaller than or equal to C96A, the TCTiA uses the result value, a query code table acquires the tentative encrypted character TCTi according to the TCTiA value, wherein a subscript A represents that the parameter is the ASCII code value of the character;
(4) judging whether the temporary encryption character TCTi belongs to the effective character set of the Beidou short message, namely the TCTi meets the condition that the TCTi belongs to the C and
(5) if the tentative cryptographic character TCTi satisfies TCTi ∈ C and
judging that the character is an encrypted character CTi of the ith plaintext character PTi of the Beidou short message plaintext;
(6) if the tentative crypt character TCTi does not satisfy TCTi ∈ C and
adding NKSi to the ASCII code value TCTiA of the temporary encrypted character TCTi to obtain a new value, and assigning the new value to TCTiA if TCTiA is not the same>At C96A, TCTiA is TCTiA-C96A + C1A-1, and if the value of TCTiA is less than or equal to C96A, TCTiA uses the result value to obtain a new tentative encrypted character TCTi by querying an ASCII code table for new TACiA, and then step (4) is repeated.
The CTi is decrypted using the following encryption loop: obtaining a Beidou short message secret CT; acquiring a key stream KS according to a sequence cipher algorithm, taking a sub-key KSi from the key stream KS, and taking a plaintext character CTi from a short message plaintext CT; generating a decryption ciphertext PTi by using the CTi and the KSi; judging whether each PTi belongs to the decrypted effective character, if not, obtaining a new decrypted ciphertext PTi by using the CTi and the KSi until all the CTi are decrypted; the PTi is composed into a decrypted ciphertext PT.
The CTi is decrypted using the following encryption cycle:
(1) acquiring a K value of a divisor K used in encryption;
(2) obtaining an encryption sub-key NKSi by sub-key KSi operation, wherein the NKSi and the KSi are integers, and the operation is carried out by dividing the KSi by a divisor K;
(3) generating a tentative decryption character TPTi by using the acquired ith bit encryption sub-key NKSi and the ith bit Beidou short message ciphertext character CTi, wherein the specific mode is that the ith bit encryption sub-key NKSi is subtracted from the ith bit encryption character CTiA of the Beidou short message ciphertext to obtain a decryption TPTiA, if the TPTiA is smaller than the value of C1A, the TPTiA is C96- (C1- (CTI-NKSI)) +1, if the TPTiA is larger than C1A, the TPTiA uses the result value, and an ASCII code table is inquired to acquire the tentative decryption character TPTi according to the TPTiA value;
(4) judging whether the temporary decryption character TPTi belongs to the effective character set of the Beidou short message, namely the TPTi meets the condition that the TPTi belongs to the element C and
(5) if the tentative decrypted character TPTi satisfies TPTi ∈ C and
judging that the character is a decryption character PTi of the ith ciphertext character CTi of the Beidou short message ciphertext;
(6) if the tentative decrypted character TPTi satisfies TPTi ∈ C and
the new value obtained by subtracting NKSi from the tentative decrypted character TPTIa is assigned to TPTi, TPTIa ═ C96- (C1-TPTIa) +1 if TPTIa is less than the value of C1A, TPTIa ═ C96- (C1-TPTIa) +1, TPTIa is used if TPTIa is greater than C1A, and the resulting value is used according to the new valueAnd (5) the TPTiA queries an ASCII code table to obtain a new tentative decrypted character TPTi, and then the step (4) is repeated.
The invention has the beneficial effects that:
according to the Beidou satellite communication system, Beidou short message communication, a radio station and communication network information are integrated into the multi-channel emergency communication module, the sub-packaging, compression, decompression, data encryption and decryption of multi-channel data are studied, Beidou data transmission can be achieved in remote areas where 4G signals cannot cover, and the problem of data transmission in the remote areas is solved.
According to the Beidou short message encryption and decryption method based on the Beidou, the data encryption is carried out on the Beidou short message by using the sequence cipher algorithm, the encrypted ciphertext data can be guaranteed to be contained in the effective character set (not containing reserved characters) of the Beidou short message, meanwhile, the method does not increase the length of the encrypted data, does not have the possibility of encryption failure, and has high reliability and encryption efficiency. .
Detailed Description
Example (b): as shown in the figure 1, the tower footing safety monitoring terminal comprises a microprocessor, a 4G module, a Beidou communication module, a sensor module, a storage module and a man-machine interaction module. The microprocessor is in communication connection with the 4G module, the Beidou communication module, the human-computer interaction module and the sensor module respectively. The processor module collects sensor data, compresses and encrypts the data and sends the data through the 4G module or the Beidou module.
Such as a data transmission process diagram in the tower footing safety monitoring terminal and method shown in fig. 2. Wherein the data transmission process comprises: displacement signal acquisition module 1, subside signal acquisition module 2, stress signal acquisition module 3, osmotic pressure signal acquisition module 4, data packing module 5, 4G communication data encryption module 6, 4G communication data control frame inserts module 7, TCP data packing module 8, big dipper communication data encryption module 9, big dipper communication branch data subpackage module 10, big dipper communication data control word inserts module 11, communication switching module 12. Displacement signal acquisition module 1 is connected to data packing module 5, subside signal acquisition module 2, stress signal acquisition module 3, osmotic pressure signal acquisition module 4, in order to receive displacement data respectively, subside data, stress data and osmotic pressure data, data packing module becomes the available data package of 4G communication and the available data package of big dipper communication with data packing, the available data package of 4G communication sends for 4G data encryption module 6 in proper order, 4G communication data control frame inserts the module, TCP data packing module 8, in order to obtain 4G transmission message, or send big dipper communication data package for big dipper data encryption module 9 in proper order, big dipper communication data control word inserts module 10, in order to obtain big dipper transmission message. Further, the data transmission in the tower footing safety monitoring terminal and method for Beidou communication and 4G communication further comprises a displacement signal acquisition module 1 for acquiring a tower footing geological displacement signal and performing analog-to-digital conversion, sending 16-system byte stream data containing the displacement signal, a settlement signal acquisition module 2 for acquiring a tower footing geological settlement signal and performing analog-to-digital conversion, sending 16-system byte stream data containing the settlement signal, a stress signal acquisition module 3 for acquiring a reinforcement stress signal in the tower footing reinforced concrete and performing analog-to-digital conversion, sending 16-system byte stream data containing the stress signal, a osmotic pressure signal acquisition module for acquiring a tower footing geological groundwater osmotic pressure signal and performing analog-to-digital conversion, and sending 16-system byte stream data containing the osmotic pressure signal. The data packing module 5 is connected with the displacement signal acquisition module 1, the settlement signal acquisition module 2, the stress signal acquisition module 3 and the osmotic pressure signal acquisition module 4, and packs the received displacement data, settlement data, stress data and osmotic pressure data into a 4G data packet and a BD data packet,
the 4G data packets are ASCII character strings with the size of less than 1500 bytes and meeting JSON standard, and the BD data packets are 16-system byte streams represented by the ASCII character strings with the size of less than 1500 bytes.
The 4G communication data encryption module 6 is connected to the data packaging module 5 to obtain a packaged 4G data packet, and encrypts the obtained 4G data packet to obtain an encrypted 4G data packet, wherein the encrypted 4G data packet uses a symmetric encryption algorithm to change original information data from a plaintext to a ciphertext.
The 4G communication data control frame inserting module 7 is connected with the 4G communication data encryption module 6 to receive an encrypted 4G data packet, and adds a 4G communication message control frame on the basis of the encrypted 4G data packet to form a 4G communication message to ensure that a receiving end can normally receive the 4G encrypted data packet, wherein the 4G communication message is formed by inserting a 2-byte fixed frame header before the encrypted 4G data packet and a 4-byte load length, the load length refers to the number of bytes of the 4G encrypted data packet, and the TCP data packing module 8 is connected with the 4G communication data control frame inserting module 7 to receive the 4G communication message and pack the received 4G communication message into a standard TCP communication message frame to be transmitted to the Internet; what is needed is
The Beidou communication data encryption module 9 is connected with the data packaging module 5 to obtain the BD data packet, and encrypts the obtained BD data packet into an encrypted BD data packet, wherein the encrypted BD data packet changes original information data from a plaintext into a ciphertext by using a symmetric encryption algorithm,
the Beidou communication sub-packaging module 10 is connected with the Beidou data encryption module 9 so as to receive the encrypted BD data package, the Beidou communication packet module 10 packetizes the received encrypted BD packets into encrypted BD packet groups of 200 bytes in size, the encrypted BD data packet group comprises a plurality of encrypted packets, the Beidou communication data control word insertion module 11 is connected with the Beidou data packet module 10 and receives the encrypted BD data packet group from the Beidou data packet module 10, control words are inserted into a plurality of encrypted packets in the encrypted BD data packet group to form a plurality of BD communication messages which are sent to the Beidou network for transmission, the BD communication message is inserted with a fixed frame header, an ID of a sender, an address of a receiver, a security requirement, a receipt mark and a message length before a small packet is encrypted, adding a checksum after the encryption packet, wherein the message length refers to the number of data bytes of the encryption packet; the communication switching module 12 is connected with the 4G communication data encryption module 6, the 4G communication data control frame inserting module 7, the TCP data packaging module 8, the Beidou data communication data encryption module 9, the Beidou data sub-packaging module 10 and the Beidou communication data control word inserting module 11, the communication control module 12 determines to send the 4G data packet generated by the data packaging module into the 4G communication data encryption module 6 according to the control signal, the 4G communication data control frame inserting module 7, the TCP data packaging module 8 processes the data packet in sequence and sends the data packet through the 4G network, or sends the BD data packet into the Beidou communication encryption module 9, the Beidou communication sub-packaging module 10 and the Beidou data control word inserting module 11 process the data packet in sequence and send the data packet through the Beidou network. The control signal is from predetermined programming, the procedure can judge whether current 4G network is normal, 4G network normal use 4G network sends the data package, 4G network abnormal use big dipper network sends the data package.
Fig. 3 shows a transmission method of tower footing safety monitoring data based on Beidou communication and 4G communication: the data transmission is started, firstly 4G transmission is used, and if the 4G transmission is successful, the data transmission is ended; if the 4G transmission fails, continuing to try 4G transmission, and adopting Beidou transmission after 3 times of failure; if the Beidou transmission is successful, the data transmission is finished; and if the Beidou transmission fails, the Beidou transmission is continuously tried, and the data transmission is finished by storing the data after 3 times of failure.
Data are encrypted when Beidou transmission is adopted:
1. obtaining unencrypted Beidou short message plain text, wherein the Beidou short message is a plain text readable ASCII character string and can be represented as PT1, PT2, PT3, … … and PTn, wherein n represents that the character length of the Beidou short message is n bytes, wherein the ith plaintext character is represented by PTi, and the parameter 1 is not less than i and not more than n. In the Beidou short message plaintext, all characters are in a Beidou short message protocol effective character set but do not belong to a reserved character set, wherein the effective character set can be expressed as C (C1, C2, … … and Ce), wherein e is the number of characters in the effective character set, the ASCII code values of C1 to Ce are sequentially increased, the ASCII code value of C1 is minimum, and the ASCII code value of Ce is maximum; CR { CR1, CR2, …, CRf }, where f is the number of reserved character sets, PTi ∈ C, and
![Figure BDA0003018284510000081](https://patentimages.storage.googleapis.com/74/da/2a/c8d8ce1fd318fc/BDA0003018284510000081.png)
the second part of the road transport vehicle satellite positioning system Beidou compatible satellite positioning module issued by 2017-09-29 specifies that 96 Beidou short message communication effective characters are provided, wherein 8 characters are reserved, namely e is 96, f is 8, and the standard JT/T1159.2-2017 can be seen.
2. According to the Beidou short message plaintext in the step 1, acquiring the plaintext length n of the Beidou short message to be encrypted, and generating a key stream with the length larger than or equal to the byte length of the Beidou short message according to a sequence cipher algorithm, wherein KS is KS1, KS2, … … and KSJ; j is the byte length of the encryption key stream, J is more than or equal to n, wherein the ith bit of key data is represented by KSi, and the I is called as a sub key; the sequential Cipher, also known as Stream Cipher (Stream Cipher), is one of symmetric Cipher algorithms. The sequence cipher has the characteristics of simple realization, convenient hardware implementation, high encryption and decryption processing speed, no or limited error propagation and the like, so the sequence cipher has advantages in practical application, particularly in special or confidential institutions, and typical application fields comprise wireless communication and external communication.
3. Encrypting each byte in the Beidou short message plaintext PT by using the key stream, and encrypting the optional character PTi of the ith bit in the Beidou short message plaintext character string PT by using the following encryption cycle
(1) A divisor K is obtained, and 1< (256/K) <96 is satisfied, wherein K is an integer, and when K satisfies (256/K) <96, the smaller K is better.
(2) And obtaining an encryption sub-key NKSi by sub-key KSi operation, wherein the NKSi and the KSi are integers, and the operation divides the KSi by the divisor K to carry out rounding operation.
(3) The method includes the steps that an obtained ith bit encryption sub-key NKSi and an ith bit Beidou short message plaintext character PTi are used for generating a tentative encryption character TCTi, the specific mode is that the I CII code values of the ith bit encryption sub-key NKSi and the ith bit Beidou short message plaintext character PTi are added to obtain an encrypted ASCII code value TCTiA, if the TCTiA is larger than C96A, the TCTiA is KSi + PTiA-C96A + C1A-1, and if the value of the TCTiA is smaller than or equal to C96A, the TCTiA uses the result value, a query code table obtains the tentative encryption character TCTi according to the TCTiA value, wherein subscript A represents that the parameter is the ASCII code value of the character.
(4) Judging whether the temporary encryption character TCTi belongs to the effective character set of the Beidou short message, namely the TCTi meets the condition that the TCTi belongs to the C and
(5) if the tentative cryptographic character TCTi satisfies TCTi ∈ C and
and judging that the character is the encrypted character CTi of the ith plaintext character PTi of the Beidou short message plaintext.
(6) If the tentative crypt character TCTi does not satisfy TCTi ∈ C and
adding NKSi to the ASCII code value TCTiA of the temporary encrypted character TCTi to obtain a new value, and assigning the new value to TCTiA if TCTiA is not the same>At C96A, TCTiA is TCTiA-C96A + C1A-1, and if the value of TCTiA is less than or equal to C96A, TCTiA uses the result value to obtain a new tentative encrypted character TCTi by querying an ASCII code table for new TACiA, and then step (4) is repeated.
In the above encryption process, the condition that NKSi is less than 96 and the valid character is 96, so the operation must obtain an encrypted character TCTi satisfying the condition TCTi ∈ C and the valid character TCTi ∈ C
There is no case of encryption failure. Through the steps 1-6, ciphertext characters CTi corresponding to any ith Beidou short message plaintext character PTi can be obtained, and n-bit Beidou short message plaintext PT can be converted into n-bit Beidou short message ciphertext CT through n times of circulation.
The Beidou short message decryption is the reverse operation of Beidou short message encryption, wherein the meaning of parameters is consistent with the encryption parameters, and the decryption process refers to the following steps:
1. obtaining the cipher text of the Beidou short message, wherein the Beidou short message is a plaintextReadable ASCII strings can be represented as CT1, CT2, CT3, … …, CTn, where the ith ciphertext character is represented by CTi. For any CTi there is a CTi ∈ C and
}。
2. obtaining the length n of the Beidou short message ciphertext to be decrypted according to the Beidou short message ciphertext, generating a key stream with the length larger than or equal to the byte length of the Beidou short message according to a sequence cipher algorithm, and expressing the key stream by using KS and the I-th bit key data by using KSi as the encryption parameters.
3. Encrypting each byte in the Beidou short message ciphertext CT by using the key stream, and decrypting the ith bit of any character CTi in the Beidou short message ciphertext character string CT by using the following encryption cycle
(1) Obtaining divisor K, K is the same as K value used in encryption
(2) And obtaining an encryption sub-key NKSi by sub-key KSi operation, wherein the NKSi and the KSi are integers, and the operation divides the KSi by the divisor K to carry out rounding operation.
(3) The method comprises the following steps of generating a tentative decryption character TPTi by using an obtained ith bit encryption sub-key NKSi and an ith bit Beidou short message ciphertext character CTi, subtracting the ith bit encryption sub-key NKSi from the ith bit encryption character CTiA of the Beidou short message ciphertext to obtain a decrypted TPTiA, if the TPTiA is smaller than a value of C1A, using the result value of the TPTiA as C96- (C1- (CTI-NKSI)) +1, if the TPTiA is larger than C1A, and inquiring an ASCII code table to obtain the tentative decryption character TPTi according to the TPTiA value.
(4) Judging whether the temporary decryption character TPTi belongs to the effective character set of the Beidou short message, namely the TPTi meets the condition that the TPTi belongs to the element C and
(5) if the tentative decrypted character TPTi satisfies TPTi ∈ C and
then the character is judged to be the Beidou short message ciphertextAnd a decryption character PTi of the ith bit ciphertext character CTi.
(6) If the tentative decrypted character TPTi satisfies TPTi ∈ C and
and (3) subtracting NKSi from the tentative decrypted character TPTIA to obtain a new value, assigning the new value to TPTi, if TPTiA is smaller than the value of C1A, TPTiA is C96- (C1-TPTiA) +1, if TPTiA is larger than C1A, TPTiA uses the result value, queries an ASCII code table according to the new TPTiA to obtain a new tentative decrypted character TPTi, and then repeats the step (4).
Through the steps 1-6, the plain characters PTi corresponding to any ith Beidou short message ciphertext character CTi can be obtained, and through n times of circulation, the Beidou short message ciphertext CT with the n-bit length can be converted into the Beidou short message plaintext CT with the n-bit length.
Implementation example for encryption of plaintext of short message with length of 3 Beidou
1. Obtaining Beidou short message plaintext PT with the length of n, wherein all characters in the Beidou short message plaintext meet the relation { x | x ∈ C and
}; if the beidou short message plaintext to be encrypted is PT ═ 0, a, o, the short message plaintext does not contain the reserved character CR and all characters belong to C, wherein n ═ 3;
2. acquiring an encryption key stream, in this embodiment, an RC4 algorithm is selected to acquire the key stream, and RC4 is a symmetric cryptographic algorithm, and belongs to a sequential cipher (also called a stream cipher) in the symmetric cryptographic algorithm, and is a stream cipher with variable key length and byte-oriented operation. Firstly initializing a state vector S by the RC4 algorithm, then initializing the state vector S with any key length, and performing replacement operation on the state vector S to generate a key stream KS ═ KS1, KS2, … … and Kn with the length of the Beidou short message PT being n; generating a key stream KS with the length of 3 as 03h,46h and 3Fh according to the Beidou short message plaintext in the embodiment 1; where h represents the data as 16-ary.
3. Encrypting each byte in Beidou short message plaintext PT by using key stream KS
(1) Obtaining the value of K, in this example 3
(2) And obtaining an encryption sub-key NKSi by sub-key KSi operation, wherein the NKSi and the KSi are integers, and the operation divides the KSi by the divisor K to carry out rounding operation. If the key is used as in step 2, NKS2 is 23, and NKS3 is 21;
(3) in the present embodiment, if the plaintext character PT2 is calculated to obtain TCT2A ═ 71, the encrypted candidate character TCT2 ═ X 'is obtained by the encryption method, the plaintext character PT3 is calculated to obtain TCT3A ═ 36, and the encrypted candidate character TCT3 ═' $ 'is obtained by the encryption method'
(4) The tentative cryptographic character TCT2 satisfies TCT2 ∈ C in the above example and
the ciphertext character corresponding to the Beidou plaintext character PT2 is 'X'
(5) The tentative cryptographic character TCT3 does not satisfy TCT3 ∈ C and
the encrypted character is regenerated as described in the encryption method, TCT3 ═ 9'.
According to the encryption method, the beidou short message plaintext PT is 0, and the ciphertext corresponding to a, n is CT1, X, 9.
Beidou short message encryption and decryption method based on sequence cipher, and implementation example of decryption on Beidou short message ciphertext with length of 3
4. Obtaining a Beidou short message ciphertext CT with the length of n, wherein all characters in the Beidou short message plaintext meet the relation { x | x ∈ C and
}; if the beidou short message ciphertext to be decrypted is PT1, X, 9, the short message ciphertext does not contain the reserved character CR and all characters belong to C, wherein n is 3;
5. acquiring a decryption key stream, in this embodiment, an RC4 algorithm is selected to acquire the key stream, and RC4 is a symmetric cryptographic algorithm, and belongs to a sequential cipher (also called a stream cipher) in the symmetric cryptographic algorithm, and is a stream cipher with variable key length and byte-oriented operation. Firstly initializing a state vector S by the RC4 algorithm, then initializing the state vector S with any key length, and performing replacement operation on the state vector S to generate a key stream KS ═ KS1, KS2, … … and Kn with the length of the Beidou short message PT being n; generating a key stream KS of length 3 as 03h,46h, and 3Fh according to the beidou short message ciphertext in embodiment 1; where h represents that the data is 16-ary, the decryption key stream with length 3 is the same key as the encryption key stream, and RC4 belongs to symmetric encryption, the same decryption key stream is generated.
6. Decrypting each word in Beidou short message plaintext CT by using key stream KS
(6) Obtaining K value, according to convention, keeping the K value same with the encrypted K value, and taking 3
(7) And obtaining an encryption sub-key NKSi by sub-key KSi operation, wherein the NKSi and the KSi are integers, and the operation divides the KSi by the divisor K to carry out rounding operation. If the key is used as in step 2, NKS2 is 23, and NKS3 is 21;
(8) in the present embodiment, if TPT2A ═ 65 is obtained by calculating ciphertext character CT2, TPT2 ═ a 'is obtained by the decryption method, TPT3A ═ 36 is obtained by calculating ciphertext character CT3, and decrypted candidate character TCT3 ═ $ is obtained by the encryption method'
(9) The tentative decryption character TPT2 in the above example satisfies TCT2 ∈ C and
the ciphertext character corresponding to the Beidou plaintext character PT2 is 'A'
(10) The tentative decryption character TPT3 does not satisfy TCT3 ∈ C and
the decrypted character is regenerated as described in the decryption method, TCT3 ═ 0'.
According to the encryption method, the beidou short message ciphertext CT is 1, and the plaintext corresponding to X, 9 is PT is 0, a, o.