Summary of the invention
Technical problem to be solved by this invention is to provide a kind of application program of mobile phone (App) and sends and control note to main frame, and short message content can stab variation in time, thus the implementation method of dynamic encryption note between the application program of mobile phone that realization is encrypted and main frame.
The present invention is achieved through the following technical solutions: the implementation method of dynamic encryption note between a kind of application program of mobile phone and main frame, application program of mobile phone (App) sends and controls note to main frame, short message content can stab variation in time, thereby realize, encrypts.
The implementation method of dynamic encryption note between application program of mobile phone and main frame, its concrete encrypting step is as follows:
Step 1: application program of mobile phone (APP) is write the text of controlling alarm host machine;
Step 2: obtain the current time of mobile phone, extract wherein time, minute, second, day, the moon be as the timestamp of dynamic encryption;
Step 3: step 1 and step 2 are carried out to XOR, realize for the first time and encrypting;
Step 4: the result of fixed password and step 3 is carried out to XOR, realize for the second time and encrypting;
Step 5: add to encrypt boot flag " $ $ 111 " and the character length of encryption section, form complete note.
An implementation method for dynamic encryption note between application program of mobile phone (App) and main frame, its concrete decryption step is as follows:
Step 1: obtain band " $ $ 111 " sign note;
Step 2: the character of fixed password and step 1 is carried out to XOR, realize deciphering for the first time;
Step 3: the timestamp after obtaining step two deciphering in text;
Step 4: whether the timestamp of determining step three and the error amount of current time in system in 5 minutes, if surpassed, are not just processed this note;
Step 5: the text after the timestamp of step 3 and timestamp is carried out to XOR, realize deciphering for the second time, obtain controlling really the text of alarm host machine.
As preferred technical scheme, the text of note is followed timestamp and is changed, and same note is only effective in 5 minutes.
The invention has the beneficial effects as follows: when application program of mobile phone (App) sends control note to main frame, the content of note is understood temporal evolution and is changed, because short message content temporal evolution is encrypted, therefore the direct content of short message reading of user, and same note, after 5 minutes, can not continue to use, prevent that other people from intercepting note and doing illegal use, and the also data interaction of applicable non-short message mode of this method.
Embodiment
As depicted in figs. 1 and 2, the implementation method of dynamic encryption note between a kind of application program of mobile phone of the present invention and main frame, application program of mobile phone (App) sends and controls note to main frame, and short message content can stab variation in time, thereby realize, encrypts.
The implementation method of dynamic encryption note between application program of mobile phone and main frame, its concrete encrypting step is as follows:
Step 1: application program of mobile phone (APP) is write the text of controlling alarm host machine;
Step 2: obtain the current time of mobile phone, extract wherein time, minute, second, day, the moon be as the timestamp of dynamic encryption;
Step 3: step 1 and step 2 are carried out to XOR, realize for the first time and encrypting;
Step 4: the result of fixed password and step 3 is carried out to XOR, realize for the second time and encrypting;
Step 5: add to encrypt boot flag " $ $ 111 " and the character length of encryption section, form complete note.
An implementation method for dynamic encryption note between application program of mobile phone (App) and main frame, its concrete decryption step is as follows:
Step 1: obtain band " $ $ 111 " sign note;
Step 2: the character of fixed password and step 1 is carried out to XOR, realize deciphering for the first time;
Step 3: the timestamp after obtaining step two deciphering in text;
Step 4: whether the timestamp of determining step three and the error amount of current time in system in 5 minutes, if surpassed, are not just processed this note;
Step 5: the text after the timestamp of step 3 and timestamp is carried out to XOR, realize deciphering for the second time, obtain controlling really the text of alarm host machine.
Wherein, the text of note is followed timestamp and is changed, and same note is only effective in 5 minutes.
Embodiment 1:
Table 1: transformat
Concrete implementation step is as follows:
One, dynamic encryption note is comprised of unencrypted note head (PackHead) and encryption section (Content) two parts, and complete dynamic encryption messaging format is in Table 1;
Two, establish the password that will encrypt, suppose that password is for " dinsafe ";
Three, timestamp binary-coded decimal: high 4 while being used for depositing, the minute, second of byte, day, month tens, low 4 while being used for depositing, the minute, second of byte, day, month units, the form of being write as 10 bit times stamps such as the time " 16:30:56 December 31 " for " 1630563112 ", the timestamp array of binary-coded decimal is " 16 30 56 31 12 ";
Four, the Content in binary-coded decimal timestamp and table 1 is partly carried out to XOR, realize the encryption to content for the first time;
Five, will in password " dinsafe " and table 1, can carry out XOR by encryption section, realize for the second time and encrypting, the object of encrypting is for the second time mainly that timestamp is encrypted;
Six, for example: current time " 16:30:56 December 31 ", the text of host computer control be " 123456#ZONE01=door " (totally 24 bytes), according to the form of table 1, the text before unencryption should for " 1630563112123456#ZONE01=door open! ".
Seven, encrypt for the first time (encryption to content), first by timestamp " 16 30 56 31 12 " and text " 123456#ZONE01=door " carry out XOR, can obtain new array (24 bytes) " 27 02 65 05 27 20 13 0C 7E 5C 53 00 67 0C 76 79 5F 24 11 7D 6,655 38 10 ";
Eight, encrypt for the second time (to encrypting again of timestamp and content), by fixed password " dinsafe " with timestamp and the array that after encrypting for the first time, content produces carry out XOR, can obtain 29 new byte arrays " 72 59 38 42 73 41 67 01 6C 49 53 72 6A 1B 38 3A 6E 14 6D10 1C 3B 4D 7F 0E 07 33 5D 74 ";
Nine, the text that array is converted to 58 bytes for "
72593842734167016C4953726A1B383A6E146D101C3B4D7F0E07335D74”;
Ten, add note labeling head " $ $ 111 " and 58 bytes of character length, complete transmission content is
“$$11105872593842734167016C4953726A1B383A6E146D101C3B4D7F0E07335D74”。
The invention has the beneficial effects as follows: when application program of mobile phone (App) sends control note to main frame, the content of note is understood temporal evolution and is changed, because short message content temporal evolution is encrypted, therefore the direct content of short message reading of user, and same note, after 5 minutes, can not continue to use, prevent that other people from intercepting note and doing illegal use, and the also data interaction of applicable non-short message mode of this method.
The above, be only the specific embodiment of the present invention, but protection scope of the present invention is not limited to this, and any variation of expecting without creative work or replacement, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range that claims were limited.