Summary of the invention
The application provides a kind of authentication method based on NFC and system and plug and socket component, solves in prior art, the problem that between NFC module and NFC label, communications security is low.
According to the first aspect of the application, the application provides a kind of authentication method based on NFC, comprises the following steps:
NFC module obtains authorization information preset in NFC label, and authorization information comprises the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message; NFC module uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information; NFC module judges that whether the first decryption information is identical with the first authentication information;
If identical, NFC module uses the second double secret key second enciphered message to be decrypted, and obtains the second decryption information; NFC module judges that whether the second decryption information is identical with the second authentication information preset in NFC module;
If identical, NFC module is by the certification of NFC label.
According to the second aspect of the application, the application provides a kind of Verification System based on NFC, comprise NFC module and NFC label, preset authorization information in NFC label, authorization information comprises the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message; The second authentication information is preset in NFC module;
NFC module for obtaining authorization information, and uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information; NFC module, when determining the first decryption information and being identical with the first authentication information, uses the second double secret key second enciphered message to be decrypted, obtains the second decryption information; NFC module when determining the second decryption information and being identical with the second authentication information, for the certification by NFC label.
According to the third aspect of the application, the application provides a kind of plug and socket component based on NFC, the plug comprising socket and be connected with external equipment, the control switch being provided with NFC module in socket and being electrically connected with NFC module, control switch is serially connected between power supply and the power output end of socket, plug is provided with the NFC label removably connected, preset authorization information in NFC label, authorization information comprises the first key, the first enciphered message, the first authentication information and the second key, the second enciphered message; The second authentication information is preset in NFC module;
NFC module for obtaining authorization information, and uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information; NFC module, when determining the first decryption information and being identical with the first authentication information, for using the second double secret key second enciphered message to be decrypted, obtains the second decryption information; NFC module when determining the second decryption information and being identical with the second authentication information, for connecting control switch.
The beneficial effect of the application is, because the application obtains authorization information preset in NFC label by NFC module, authorization information comprises the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message; NFC module uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information; NFC module judges that whether the first decryption information is identical with the first authentication information; If identical, NFC module uses the second double secret key second enciphered message to be decrypted, and obtains the second decryption information; NFC module judges that whether the second decryption information is identical with the second authentication information preset in NFC module; If identical, NFC module is by the certification of NFC label.Safety certifying method based on NFC and the system of the application carry out double probate to NFC label, and the authentication information of double probate is different, improves the fail safe communicated between NFC module and NFC label.
The plug and socket component based on NFC of the application, the NFC label that NFC module on socket recognizes on plug could be energized, plug without NFC label cannot usurp socket, and when not obtaining NFC module certification, socket power output also can not be charged simultaneously, adds the fail safe of socket.
Embodiment
By reference to the accompanying drawings the present invention is described in further detail below by embodiment.
Embodiment 1:
Based on an authentication method of NFC, as shown in Figure 1, comprise the steps:
S101:NFC module obtains authorization information preset in NFC label, and authorization information comprises the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message; NFC module uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information; NFC module judges that whether the first decryption information is identical with the first authentication information;
S102: if identical, NFC module uses the second double secret key second enciphered message to be decrypted, and obtains the second decryption information; NFC module judges that whether the second decryption information is identical with the second authentication information preset in NFC module;
S103: if identical, NFC module is by the certification of NFC label.
Authorization information preset in NFC label, authorization information comprises the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message.Distance between NFC label and NFC module reaches distance of reaction, and namely NFC module obtains the authorization information in NFC label.NFC module uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information, and then NFC module judges that whether the first decryption information is identical with the first authentication information, if not identical, then verification process stops.If identical, NFC module just uses the second double secret key second enciphered message to be decrypted, obtain the second decryption information, judge that whether the second decryption information is identical with the second authentication information preset in NFC module again, if not identical, then verification process stops, if identical, NFC module is just by the certification of NFC label.
Embodiment 2:
As the improvement of embodiment 1, in the present embodiment, the first key is UID field key, and the first enciphered message is UID encrypted fields, and the first authentication information is UID authentication information, and the first decryption information is UID decryption information; Second key is Key field key, and the second authentication information is Key authentication information, and the second enciphered message is Key encrypted fields, and the second decryption information is Key decryption information.UID and user identity prove, its information is unique, the content in NFC label can be prevented to be replicated, thus can promote fail safe.But UID itself is transparent, if it is just dangerous to have cracked UID encryption rule.Thus use key again to encrypt, just add an encryption rule in addition, improve its fail safe further.
Further, Key field key is Key field random key, and UID field key is UID field random key, uses random key, adds the difficulty that key cracks, and promotes its fail safe further.
In other embodiments, the first key is Key field key, and the first authentication information is Key authentication information, and the first enciphered message is Key encrypted fields, and the first decryption information is Key decryption information; Second key is UID field key, and the second authentication information is UID authentication information, and the second enciphered message is UID encrypted fields, and the second decryption information is UID decryption information.Also the effect promoting fail safe further can be played.
Embodiment 3:
As the improvement of above-described embodiment, in the present embodiment, first key, the first enciphered message, the first certification letter, the second key and the second enciphered message lack of alignment in authorization information, and also comprise before the step using the first double secret key first enciphered message to be decrypted in NFC module: NFC module is resequenced to the first key of lack of alignment, the first enciphered message, the first authentication information, the second key and the second enciphered message.Due to the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message lack of alignment in authorization information, even if these are acquired, also cannot learn which is key, which is enciphered message, thus key pair encryption information cannot be used to be decrypted, ensure that the fail safe of information.
When applying above-described embodiment, designer can exchange the order of the first key, the first enciphered message, the first certification letter, the second key and the second enciphered message, first key, the first enciphered message, the first authentication information, the second key and the second enciphered message are returned, namely to its rearrangement in exchange according to contrary order at NFC module write code.Said sequence also only has designer to know, thus can promote its fail safe further.
Embodiment 4:
Based on a Verification System of NFC, comprise NFC module and NFC label, preset authorization information in NFC label, authorization information comprises the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message; The second authentication information is preset in NFC module.
NFC module for obtaining authorization information, and uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information; NFC module, when determining the first decryption information and being identical with the first authentication information, uses the second double secret key second enciphered message to be decrypted, obtains the second decryption information; NFC module when determining the second decryption information and being identical with the second authentication information, for the certification by NFC label.
Embodiment 5:
As the improvement of embodiment 4, in the present embodiment, the first key is UID field key, and the first enciphered message is UID encrypted fields, and the first authentication information is UID authentication information, and the first decryption information is UID decryption information; Second key is Key field key, and the second authentication information is Key authentication information, and the second enciphered message is Key encrypted fields, and the second decryption information is Key decryption information.UID and user identity prove, its information is unique, the content in NFC label can be prevented to be replicated, thus can promote fail safe.But UID itself is transparent, if it is just dangerous to have cracked UID encryption rule.Thus use key again to encrypt, just add an encryption rule in addition, improve its fail safe further.
Further, Key field key is Key field random key, and UID field key is UID field random key, uses random key, adds the difficulty that key cracks, and promotes its fail safe further.
Further, the first key, the first enciphered message, the first authentication information, the second key and the second enciphered message lack of alignment in authorization information; NFC module, before use first double secret key first enciphered message is decrypted, is resequenced for the first key to lack of alignment, the first enciphered message, the first authentication information, the second key and the second enciphered message.
In other embodiments, the first key is Key field key, and the first authentication information is Key authentication information, and the first enciphered message is Key encrypted fields, and the first decryption information is Key decryption information; Second key is UID field key, and the second authentication information is UID authentication information, and the second enciphered message is UID encrypted fields, and the second decryption information is UID decryption information.
Embodiment 6:
A kind of plug and socket component based on NFC, as shown in Figure 2, the plug 2 comprising socket 1 and be connected with external equipment, the control switch 12 being provided with NFC module 11 in socket 1 and being electrically connected with NFC module 11, control switch 12 is serially connected between the power output end 13 of power supply 3 and socket 1.
As shown in Figure 3, socket 1 comprises shell 16, is arranged on the circuit board 15 in shell 16 and the panel 14 for closure 16, and panel 14 is provided with jack 141, and circuit board 15 is provided with NFC module 11.Plug 2 is provided with the NFC label 21 removably connected, and NFC label 21 upper cover is covered with one deck barrier paper, and after tearing barrier paper, NFC label 21 is pasted on plug 2 removably.NFC label 21 has the shape matched with plug 2 end face, and it is provided with the through hole corresponding with iron plate on plug 2, thus makes NFC label 21 intactly can be pasted on plug 2 to be provided with on that end face of iron plate.
In NFC label 21, preset authorization information, authorization information comprises the first key, the first enciphered message, the first authentication information and the second key, the second enciphered message; The second authentication information is preset in NFC module 11;
NFC module 11 for obtaining authorization information, and uses the first double secret key first enciphered message to be decrypted, and obtains the first decryption information; NFC module 11, when determining the first decryption information and being identical with the first authentication information, for using the second double secret key second enciphered message to be decrypted, obtains the second decryption information; NFC module 11 is when determining the second decryption information and being identical with the second authentication information, for connecting control switch 12, now, the power output end 13 of socket 1 is by charged, thus, plug in the present embodiment without NFC label cannot usurp socket, and when not obtaining NFC module certification, socket power output also can not be charged simultaneously, adds the fail safe of socket.
Embodiment 7:
As the improvement of embodiment 6, in the present embodiment, the first key is UID field key, and the first enciphered message is UID encrypted fields, and the first authentication information is UID authentication information, and the first decryption information is UID decryption information; Second key is Key field key, and the second authentication information is Key authentication information, and the second enciphered message is Key encrypted fields, and the second decryption information is Key decryption information.UID and user identity prove, its information is unique, the content in NFC label can be prevented to be replicated, thus can promote fail safe.But UID itself is transparent, if it is just dangerous to have cracked UID encryption rule.Thus use key again to encrypt, just add an encryption rule in addition, to improve its fail safe.And Key field key is Key field random key, UID field key is UID field random key, uses random key, adds the difficulty that key cracks, and promotes its fail safe further.
In other embodiments, the first key is Key field key, and the first authentication information is Key authentication information, and the first enciphered message is Key encrypted fields, and the first decryption information is Key decryption information; Second key is UID field key, and the second authentication information is UID authentication information, and the second enciphered message is UID encrypted fields, and the second decryption information is UID decryption information.Also the effect promoting fail safe further can be played.
Above content is in conjunction with concrete execution mode further description made for the present invention, can not assert that specific embodiment of the invention is confined to these explanations.For general technical staff of the technical field of the invention, without departing from the inventive concept of the premise, some simple deduction or replace can also be made.