Disclosure of Invention
The invention aims to solve the technical problems that: 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 for transmitting power data by Beidou when 4G communication signals are not available are provided.
The technical scheme of the invention is as follows:
a tower footing safety monitoring terminal based on Beidou communication and 4G communication comprises a microprocessor, wherein the microprocessor is respectively connected with a 4G module, a Beidou communication module and a man-machine interaction module, and a sensor module is in 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 sedimentation signal acquisition module, a stress signal acquisition module and an osmotic pressure signal acquisition module, wherein each sensing signal is transmitted to the data packaging module, 4G communication or Beidou communication is selected by the communication control module, and if 4G communication is selected, the packaged data sequentially pass through the 4G communication data encryption module, the 4G communication data control frame insertion module and the TCP packaging module and then are transmitted in a 4G communication mode; if the 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 subjected to Beidou communication transmission.
The data packaging module packages the data into a 4G communication available data packet and a Beidou communication available data packet, and packages the received displacement data, sedimentation 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 is obtained by changing original information data from plaintext to ciphertext by using a symmetric encryption algorithm;
the 4G communication data control frame insertion module adds a 4G communication message control frame on the basis of an encrypted 4G data packet to form a 4G communication message, wherein the 4G communication message is a 2-byte fixed frame header and a 4-byte load length are inserted before the encrypted 4G data packet;
the TCP data packing module packs 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 from plaintext to ciphertext by using a symmetric encryption algorithm;
the Beidou communication data packet module packetizes the received encrypted BD data packets into an encrypted BD data packet group with the size of 200 bytes, wherein the 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 an encrypted BD data packet group to form a plurality of BD communication messages, the BD communication messages are transmitted to a Beidou network, the BD communication messages are inserted with fixed frame heads, sender IDs, receiver addresses, confidentiality requirements, receipt marks and message lengths before the encrypted packets, and checksums are added after the encrypted packets;
the communication control module selects 4G communication or Beidou communication according to control signals, wherein the control signals come from preset programming, and the program can judge whether the current 4G network is normal or not.
The 4G packet is an ASCII string satisfying JSON standards with a size of less than 1500 bytes, and the BD packet is a 16-byte stream represented by an ASCII string with a size of less than 1500.
A tower foundation safety monitoring data transmission method based on Beidou communication and 4G communication adopts the tower foundation safety monitoring terminal to carry out data transmission, wherein 4G communication is selected firstly during data transmission, and Beidou communication is selected to carry out transmission if 4G communication transmission fails.
Each byte in the Beidou short message is encrypted by using a sequence cipher algorithm, and the encryption steps are as follows: acquiring a Beidou short message text PT; obtaining a key stream KS according to a sequence cipher algorithm; extraction of sub-keys KS from a key stream KS i The plaintext character PT is taken out from the short message plaintext PT i The method comprises the steps of carrying out a first treatment on the surface of the By PT i And KS i Generating encrypted ciphertext CT i The method comprises the steps of carrying out a first treatment on the surface of the Judgment of CT i Whether it belongs to encryption valid character, if not, re-using PT i And KS i Generating new encrypted ciphertext CT i The method comprises the steps of carrying out a first treatment on the surface of the All PT i Is encrypted and then is obtained by CT i The encryption ciphertext CT is formed.
The PTi is encrypted using the following encryption loop:
(1) Obtaining a divisor K, wherein the divisor K satisfies 1< (256/K) <96, and K is an integer, and when K satisfies (256/K) <96, the smaller the K is, the better;
(2) Calculating a sub-key KSi to obtain an encrypted sub-key NKSI, wherein NKSI=KSi/K, and the calculation is carried out by dividing KSi by a divisor K to obtain a rounding operation;
(3) Generating a tentative encryption character TCTi by using the obtained ith encryption subkey NKSI and the ith Beidou short message plaintext character PTi, wherein the method comprises the steps of adding the ith encryption subkey NKSI and the ASCII code value of the ith character PTi of the Beidou short message to obtain an encrypted ASCII code value TCTiA, if TCTiA is greater than C96A, TCTiA=KSi+PTiA-C96 A+C1A-1, if the value of TCTiA is less than or equal to C96A, TCTiA uses the result value, inquiring an ASCII code table to obtain the tentative encryption character TCTi according to the TCTiA value, and the subscript A represents that the parameter is the ASCII code value of the character;
(4) Judging whether the tentative encryption character TCTi belongs to the effective character set of the Beidou short message, namely that TCTi meets TCTi epsilon C and
(5) If the tentative encryption character TCTi meets TCTi epsilon C andjudging the character as an encrypted character CTi of a ith plaintext character PTi of the Beidou short message plaintext;
(6) If the tentative encryption character TCTi does not meet TCTi epsilon C andadding the ASCII code value TCTiA value of the tentative encryption character TCTi to NKSI, and giving the new value to TCTiA, if TCTiA>At C96A, tctia=tctia-c96a+c1a-1, if the value of TCTiA is less than or equal to C96A, TCTiA uses the result value to query the ASCII code table for a new tentative encrypted character TCTi according to the new TACiA, and then step (4) is repeated.
The CTi is decrypted using the encryption loop of the following steps: acquiring a Beidou short message ciphertext CT; obtaining a key stream KS according to a sequence cipher algorithm, extracting a sub-key KSi from the key stream KS, and extracting plaintext characters CTi from a short message plaintext CT; generating a decrypted ciphertext PTi using the CTi and the KSi; judging whether each PTi belongs to a decrypting valid character, if not, obtaining a new decrypting ciphertext PTi by using the CTi and the KSi until all CTi are decrypted; the PTi is composed into the decrypted ciphertext PT.
The CTi is decrypted using the following encryption loop:
(1) Obtaining a K value of a divisor K used in encryption;
(2) Obtaining an encrypted sub-key NKSi, nksi=ksi/K by computing a sub-key KSi, wherein NKSi and KSi are integers, and the computing uses KSi divided by a divisor K for rounding;
(3) Generating a tentative decryption character TPTi by using the obtained ith encryption subkey NKSi and the ith Beidou short message ciphertext character CTi of the ith bit, wherein the method comprises the following steps of subtracting the ith encryption subkey NKSi from the ith encryption character CTiA of the Beidou short message ciphertext to obtain a decrypted TPTiA, if the TPTiA is smaller than a value of C1A, TPTiA=C96- (C1- (CTI-NKSI)) +1, if the TPTiA is larger than C1A, TPTiA uses the result value, and inquiring an ASCII code table to obtain a tentative decryption character TPTi according to the TPTiA value;
(4) Judging whether the tentative decryption character TPTi belongs to the effective character set of the Beidou short message, namely TPTi meets TPTi epsilon C and
(5) If the tentative decryption character TPTi satisfies TPTi epsilon C andjudging the character as a decryption character PTi of the ith ciphertext character CTi of the Beidou short message ciphertext;
(6) If the tentative decryption character TPTi satisfies TPTi epsilon C andthen subtracting NKSi from the tentative decrypted character TPTIa, assigning a new value to TPTi, if TPTIa is less than the value of C1A, tptia=c96- (C1-TPTIa) +1, if TPTIa is greater than C1A, TPTIa using the resulting value, querying an ASCII code table for a new tentative decrypted character TPTi from the new TPTIa, and repeating step (4).
The invention has the beneficial effects that:
according to the invention, the Beidou short message communication, the radio station and the communication network information are integrated into the multichannel emergency communication module, and the packetization, compression, decompression, data encryption and decryption of multichannel data are researched, so that the Beidou data transmission can be realized in remote areas which are not covered by 4G signals, and the problem of data transmission in remote areas is solved.
The method for encrypting and decrypting the Beidou short message based on the Beidou short message uses the sequence cipher algorithm to encrypt the Beidou short message, can ensure that the encrypted ciphertext data are all contained in the effective character set (not containing reserved characters) of the Beidou short message, does not increase the length of the encrypted data, does not have the possibility of encryption failure, and has higher reliability and encryption efficiency. .
Detailed Description
Examples: referring to fig. 1, the tower footing safety monitoring terminal includes a microprocessor, a 4G module, a Beidou communication module, a sensor module, a storage module and a man-machine interaction module. The microprocessor is respectively connected with the 4G module, the Beidou communication module and the man-machine interaction module, and the sensor module is in communication connection. 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 the data transmission process diagram in the tower foundation safety monitoring terminal and the method shown in fig. 2. The data transmission process comprises the following steps: 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 insert module 7, TCP data packing module 8, big dipper communication data encryption module 9, big dipper communication data packet module 10, big dipper communication data control word insert module 11, communication switching module 12. The data packing module 5 is connected with the displacement signal acquisition module 1, the sedimentation signal acquisition module 2 and the stress signal acquisition module 3, and the osmotic pressure signal acquisition module 4 is used for respectively receiving displacement data, sedimentation data, stress data and osmotic pressure data, and the data packing module is used for packing data into a 4G communication available data packet and a Beidou communication available data packet, and the 4G communication available data packet is sequentially sent to the 4G data encryption module 6, the 4G communication data control frame insertion module and the TCP data packing module 8 to obtain a 4G transmission message, or the Beidou communication data packet is sequentially sent to the Beidou data encryption module 9 and the Beidou communication data control word insertion module 10 to obtain the Beidou transmission message. Further, the data transmission in the tower footing safety monitoring terminal and the method for Beidou communication and 4G communication further comprises a displacement signal acquisition module 1, a settlement signal acquisition module 2, a stress signal acquisition module 3, a stress signal acquisition module and an osmotic pressure signal acquisition module, wherein the displacement signal acquisition module 1 acquires a tower footing geological displacement signal and performs analog-to-digital conversion, transmits 16-system byte stream data containing the displacement signal, the settlement signal acquisition module 2 acquires a tower footing geological settlement signal and performs analog-to-digital conversion, transmits 16-system byte stream data containing the settlement signal, the stress signal acquisition module 3 acquires a reinforcing steel bar stress signal in tower footing reinforcing steel bar concrete and performs analog-to-digital conversion, transmits 16-system byte stream data containing the stress signal, and the osmotic pressure signal acquisition module acquires an osmotic pressure signal of tower footing geological groundwater and performs analog-to-digital conversion, and transmits 16-system byte stream data containing the osmotic pressure signal. The data packaging module 5 is connected with the displacement signal acquisition module 1, the sedimentation signal acquisition module 2, the stress signal acquisition module 3 and the osmotic pressure signal acquisition module 4, the sedimentation data, the stress data and the osmotic pressure data are packaged into a 4G data packet and a BD data packet,
the 4G packet is an ASCII string satisfying JSON standards with a size of less than 1500 bytes, and the BD packet is a 16-byte stream represented by an ASCII string with a size of less than 1500.
The 4G communication data encryption module 6 is connected to the data packing module 5 to obtain a packed 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 plaintext to ciphertext.
The 4G communication data control frame inserting module 7 is connected with the 4G communication data encrypting 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, so that a receiving end can normally receive the 4G encrypted data packet, wherein the 4G communication message is a 2-byte fixed frame header inserted before the encrypted 4G data packet, the 4-byte load length refers to the byte number 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 on the Internet; by a means of
The Beidou communication data encryption module 9 is connected with the data packaging module 5 to acquire the BD data packet and encrypt the acquired BD data packet into an encrypted BD data packet, wherein the encrypted BD data packet changes original information data from plaintext to ciphertext by using a symmetric encryption algorithm,
the Beidou communication sub-packaging module 10 is connected with the Beidou data encryption module 9 to receive an encrypted BD data packet, the Beidou communication sub-packaging module 10 sub-packages the received encrypted BD data packet into an encrypted BD data packet group with the size of 200 bytes, the encrypted BD data packet group comprises a plurality of encrypted small packets, the Beidou communication data control word insertion module 11 is connected with the Beidou data sub-packaging module 10 to receive the encrypted BD data packet group from the Beidou data sub-packaging module 10 and insert control words into the plurality of encrypted small packets in the encrypted BD data packet group to form a plurality of BD communication messages, the BD communication messages are transmitted to a Beidou network, the BD communication messages are inserted into a fixed frame header before the encrypted small packets, an sender ID, an addressee address, a confidentiality requirement, a receipt mark and a message length are added into a checksum after the encrypted small packets, wherein the message length refers to the number of data bytes of the encrypted small packets; the communication switching module 12 is connected with the 4G communication data encryption module 6,4G communication data control frame inserting module 7, the TCP data packing module 8, the Beidou data communication data encryption module 9, the Beidou data packetizing module 10 and the Beidou communication data control word inserting module 11, the communication control module 12 determines that the 4G data packet generated by the data packing module is sent to the 4G communication data encryption module 6,4G communication data control frame inserting module 7 according to a control signal, the TCP data packing module 8 sequentially processes the 4G communication data packets and sends the 4G data packets or sends the BD data packets to the Beidou communication encryption module 9, the Beidou communication data packetizing module 10 and the Beidou data control word inserting module 11 sequentially process the same and send the same through a Beidou network. The control signal comes from a preset program design, and the program can judge whether the current 4G network is normal, the 4G network normally uses the 4G network to send the data packet, and the 4G network abnormally uses the Beidou network to send the data packet.
Referring to fig. 3, a tower foundation safety monitoring data transmission method based on Beidou communication and 4G communication comprises the following steps: starting data transmission, firstly using 4G transmission, and ending the data transmission if the 4G transmission is successful; if the 4G transmission fails, continuously attempting the 4G transmission, and adopting Beidou transmission after 3 times of failure; if the Beidou transmission is successful, ending the data transmission; if the Beidou transmission fails, continuing to try Beidou transmission, and storing the data after 3 times of failure to finish data transmission.
Encrypting data when Beidou transmission is adopted:
1. an unencrypted Beidou short message Wen Mingwen is obtained, wherein the Beidou short message is a plaintext readable ASCII character string and can be expressed as PT=PT1, PT2, PT3, … … and PTn, wherein n represents that the character length of the Beidou short message is n bytes, PTi represents that the ith plaintext character is equal to or less than i, and the parameter 1 is equal to or less than n. In the Beidou short message, all characters are in the Beidou short message protocol effective character set but do not belong to reserved character sets, wherein the effective character set can be expressed as C= { C1, C2, … … and Ce }, wherein e is the number of characters of 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, has PTi ε C andin the second part of the "Beidou compatible satellite positioning Module of road transportation vehicle satellite positioning System" issued by 2017-09-29, 96 Beidou short message communication valid characters are provided, wherein 8 reserved characters, namely e=96 and f=8, can be seen in the standard JT/T1159.2-2017.
2. According to the beidou short message Wen Mingwen described in the item 1, the beidou short message plaintext length n to be encrypted is obtained, and a key stream with the length greater than or equal to the beidou short message byte length is generated according to a sequence cipher algorithm, which can be expressed as ks=ks 1, KS2, … …, KSJ; wherein J is the byte length of the encryption key stream, J is larger than or equal to n, wherein KSi is used for representing the ith bit key data, and the encryption key is called a subkey; sequence Cipher, also known as Stream Cipher (Stream Cipher), is one type of symmetric Cipher algorithm. The sequence cipher has the characteristics of simple implementation, convenient hardware implementation, high encryption and decryption processing speed, no or limited error propagation and the like, so that 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 utilizing a key stream, and encrypting any character PTi of the ith bit in the Beidou short message plaintext character string PT by using the following encryption cycle
(1) The divisor K is obtained, 1< (256/K) <96 is satisfied, K is an integer, and in the present invention, when K satisfies (256/K) <96, the smaller K is, the better.
(2) An operation on the sub-key KSi, where KSi and KSi are integers, takes the cryptographic sub-key NKSi, nksi=ksi/K, and takes the whole operation by dividing KSi by the divisor K.
(3) Generating a tentative encryption character TCTi by using the obtained ith encryption subkey NKSI and the ith Beidou short message plaintext character PTi, in the specific manner, adding the ith encryption subkey NKSI and the ASCII code value of the ith character PTi of the Beidou short message to obtain an encrypted ASCII code value TCTiA, if TCTiA > C96A, TCTiA=KSi+PTiA-C96 A+C1A-1, and if the value of TCTiA is smaller than or equal to C96A, then TCTiA uses the result value to query an ASCII code table to obtain the tentative encryption character TCTi according to the TCTiA value, wherein the subscript A represents the parameter as the ASCII code value of the character.
(4) Judging whether the tentative encryption character TCTi belongs to the effective character set of the Beidou short message, namely that TCTi meets TCTi epsilon C and
(5) If the tentative encryption character TCTi meets TCTi epsilon C andand judging the character as an encryption character CTi of the ith plaintext character PTi of the Beidou short message plaintext.
(6) If the tentative encryption character TCTi does not meet TCTi epsilon C andadding the ASCII code value TCTiA value of the tentative encryption character TCTi to NKSI, and giving the new value to TCTiA, if TCTiA>At C96A, tctia=tctia-c96a+c1a-1, if the value of TCTiA is less than or equal to C96A, TCTiA uses the result value to query the ASCII code table for a new tentative encrypted character TCTi according to the new TACiA, and then step (4) is repeated.
In the above encryption process, NKSi is less than 96 and the valid character is 96, so that the operation must result in an encrypted character TCTi satisfying the condition TCTi εC andthere is no case of encryption failure. Through the steps 1-6, ciphertext characters CTi corresponding to any ith Beidou short message plaintext characters PTi can be obtained, and through n times of circulation, the Beidou short message plaintext PT with n-bit length can be replaced by the Beidou short message ciphertext CT with n-bit length.
The Beidou short message decryption is 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. the method comprises the steps of obtaining a Beidou short message ciphertext, wherein the Beidou short message is a plaintext readable ASCII character string and can be expressed as CT=CT1, CT2, CT3, … … and CTn, and the ith ciphertext character is expressed by CTi. For any CTi there is CTi ε C and}。
2. and 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 greater than or equal to the byte length of the Beidou short message according to a sequence cipher algorithm, and representing the key stream by KS and representing the I-bit key data in KSi as well as encryption parameters.
3. Encrypting each byte in the Beidou short message ciphertext CT by utilizing a key stream, and decrypting the CTi of any character CTi of the ith bit in the Beidou short message ciphertext character string CT by using the following encryption cycle
(1) The divisor K is obtained, and the K is the same as the K used in encryption
(2) An operation on the sub-key KSi, where KSi and KSi are integers, takes the cryptographic sub-key NKSi, nksi=ksi/K, and takes the whole operation by dividing KSi by the divisor K.
(3) Generating a tentative decryption character TPTi by using the obtained ith encryption subkey NKSi and the ith Beidou short message ciphertext character CTi of the ith bit, in the specific manner that the ith encryption subkey NKSi is subtracted from the ith encryption character CTiA of the Beidou short message ciphertext to obtain a decrypted TPTiA, if the TPTiA is smaller than the value of C1A, tptia=c96- (C1- (CTi-NKSi)) +1, if the TPTiA is larger than the value of C1A, the TPTiA uses the result value to query an ASCII code table to obtain the tentative decryption character TPTi according to the TPTiA value.
(4) Judging whether the tentative decryption character TPTi belongs to the effective character set of the Beidou short message, namely TPTi meets TPTi epsilon C and
(5) If the tentative decryption character TPTi satisfies TPTi epsilon C andand judging the character as a decryption character PTi of the ith ciphertext character CTi of the Beidou short message ciphertext.
(6) If the tentative decryption character TPTi satisfies TPTi epsilon C andthen subtracting NKSi from the tentative decrypted character TPTIa, assigning a new value to TPTi, if TPTIa is less than the value of C1A, tptia=c96- (C1-TPTIa) +1, if TPTIa is greater than C1A, TPTIa using the resulting value, querying an ASCII code table for a new tentative decrypted character TPTi from the new TPTIa, and repeating step (4).
Through the steps 1-6, the clear character 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 length of n bits can be converted into the Beidou short message ciphertext CT with the length of n bits.
Encryption implementation example for length-3 Beidou short message plaintext
1. Acquiring a Beidou short message text PT with the length of n, wherein all characters in the Beidou short message text meet the relation { x|x epsilon C and-a }; if the Beidou short message plaintext to be encrypted is PT=0, A and o, the short message plaintext does not contain reserved characters CR and all characters belong to C, wherein n=3;
2. the encryption key stream is obtained, in this embodiment, the key stream is obtained by using an RC4 algorithm, where RC4 is a symmetric cryptographic algorithm, which belongs to a sequence cipher (also called a stream cipher) in the symmetric cryptographic algorithm, and is a stream cipher for byte-oriented operation with variable key length. The RC4 algorithm does not initialize the state vector S, and then performs the replacement operation on the state vector S with arbitrary initial key length to generate key streams KS=KS1, KS2, … … and Kn with the length of the Beidou short message PT being n; generating a key stream ks=03h, 46h,3fh with a length of 3 according to the beidou short message plaintext as described in embodiment 1; where h represents that the data is 16-ary.
3. Encrypting each byte in Beidou short message plaintext PT by utilizing key stream KS
(1) Obtaining a K value, in this embodiment 3
(2) An operation on the sub-key KSi, where KSi and KSi are integers, takes the cryptographic sub-key NKSi, nksi=ksi/3, and takes the whole operation by dividing KSi by the divisor K. As with the key shown in example 2, nks2=23 and nks3=21;
(3) The encryption sub-keys KSi and PTi are used to generate the encryption character CTi, in this implementation, as tct2a=71 is calculated on the plaintext character PT2, the encryption alternative character tct2= 'X' is obtained according to the encryption method, tct3a=36 is calculated on the plaintext character PT3, and the encryption alternative character tct3= '$is obtained according to the encryption method'
(4) In the above example, the transient encryption character TCT2 satisfies TCT2 εC andciphertext character corresponding to Beidou plaintext character PT2 is 'X'
(5) The tentative encrypted character TCT3 does not satisfy TCT3 εC andthe encrypted character is regenerated as described in the encryption method, tct3= '9'.
According to the encryption method, the ciphertext corresponding to the Beidou short message plaintext PT=0, A and n is CT=1, X and 9.
Beidou short message encryption and decryption method based on sequence password, and decryption implementation example of 3-length Beidou short message ciphertext
4. Acquiring a Beidou short message ciphertext CT with the length of n, wherein all characters in the Beidou short message ciphertext meet the relation { x|x epsilon C and-a }; if the Beidou short message ciphertext to be decrypted is PT=1, X and 9, the short message ciphertext does not contain reserved characters CR and all characters belong to C, wherein n=3;
5. the decryption key stream is obtained, in this embodiment, the key stream is obtained by using an RC4 algorithm, where RC4 is a symmetric cryptographic algorithm, which belongs to a sequence cipher (also called a stream cipher) in the symmetric cryptographic algorithm, and is a stream cipher for byte-oriented operation with variable key length. The RC4 algorithm does not initialize the state vector S, and then performs the replacement operation on the state vector S with arbitrary initial key length to generate key streams KS=KS1, KS2, … … and Kn with the length of the Beidou short message PT being n; generating a key stream ks=03h, 46h,3fh with a length of 3 according to the beidou short message ciphertext described in embodiment 1; where h represents that the data is 16-ary, the decryption key stream with the length of 3 is the same key as the encryption key stream, and RC4 is symmetric encryption, so as to generate the same decryption key stream.
6. Decrypting each word in the Beidou short message plaintext CT by utilizing key stream KS
(6) Obtaining K value, according to convention, obtaining 3 in the same K value and the above-mentioned encryption K value
(7) An operation on the sub-key KSi, where KSi and KSi are integers, takes the cryptographic sub-key NKSi, nksi=ksi/3, and takes the whole operation by dividing KSi by the divisor K. As with the key shown in example 2, nks2=23 and nks3=21;
(8) The plaintext character PTi is generated by using the encryption subkeys KSi and CTi, in this embodiment, if tpt2a=65 is obtained by calculating the ciphertext character CT2, tpt2= ' a ' is obtained by calculating the ciphertext character CT3 according to the decryption method, tpt3a=36 is obtained by calculating the ciphertext character CT3, tct3= ' $ ' is obtained by calculating the decryption method according to the encryption method '
(9) In the above example, the transient decryption character TPT2 satisfies TCT2 εC andciphertext character corresponding to Beidou plaintext character PT2 is 'A'
(10) The tentative decryption character TPT3 does not satisfy TCT3 εC andthe decrypted character is regenerated as described by the decryption method, tct3= '0'.
According to the encryption method, the plaintext corresponding to the Beidou short message ciphertext CT=1, X,9 is PT=0, A, o.