Electronic cigarette and encryption and decryption authentication method thereof
Technical Field
The invention relates to the technical field of encryption and decryption security mechanisms of electronic cigarettes, in particular to an electronic cigarette and an encryption and decryption authentication method thereof.
Background
The electronic cigarette is an electronic product simulating cigarette, its substance is a cigarette liquid (nicotine) atomizer, and has the appearance, smoke, taste and feeling similar to cigarette, and it can change nicotine (containing essential oil) into steam by means of atomization, etc. to form inhalable smoke, and can give smoker a pleasant feeling of swallowing and spitting.
The electronic cigarette mainly comprises a cigarette rod, an atomizer and a cigarette cartridge, wherein the cigarette rod comprises a PCB (printed circuit board), a rechargeable battery and a key/display device; the atomizer is a heating element, and heats the tobacco tar in the smoke cartridge to generate smoke; the cigarette bullet comprises suction nozzle and tobacco tar storehouse, holds the tobacco tar in the tobacco tar storehouse. The third generation of electronic cigarettes at present integrates an atomizer into a cigarette cartridge, and the structure of the electronic cigarette is simplified into a cigarette rod and the cigarette cartridge. In selling of electron cigarette, the long service life of tobacco rod can not often change, and the absorption number of times of cigarette bullet is limited, often can change the cigarette bullet, so the sales volume of cigarette bullet is the main profit source of electron cigarette. Most of electronic cigarettes in the market do not have an encryption authentication function, a cigarette rod and a cigarette cartridge do not need authentication, the cigarette rod can be randomly used by the cigarette cartridges of other manufacturers, and only a few electronic cigarettes are encrypted and authenticated.
For a few electronic cigarettes with encryption authentication, an encryption scheme of a cigarette rod and a cigarette cartridge generally adopts an encryption chip to generate a random number, the random number is also a plaintext, a ciphertext is generated through an encryption algorithm of an encryption and decryption module, the decryption scheme is that the ciphertext is decrypted into the plaintext through reverse decryption of the encryption and decryption module according to a decryption algorithm with the same rule of the encryption algorithm, and when the electronic cigarette absorbs the action each time, communication between the cigarette rod and the cigarette cartridge follows the same encryption algorithm, and the same fixed secret key is used for encryption and decryption.
That is to say, the encryption authentication between the cigarette rod and the cigarette cartridge of the existing electronic cigarette adopts a fixed encryption and decryption algorithm and a fixed secret key, so that the encryption authentication is easy to be cracked by a competitor of the cigarette cartridge by means of an instrument, the encryption and decryption principle is analyzed, and the cigarette cartridge with the same encryption authentication can be imitated, so that the single fixed encryption manner is not safe and firm, can be cracked, and is difficult to realize effective encryption authentication.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention aims to provide an electronic cigarette and an encryption and decryption authentication method thereof, which perform encryption and decryption by adopting a mode of combining fixed key encryption and dynamic key encryption to improve the encryption performance of the electronic cigarette, so that a cigarette rod and a cigarette bomb have a bidirectional anti-counterfeiting function, the two are matched to be used together, the anti-counterfeiting function of the electronic cigarette is enhanced, the encryption and authentication function of the electronic cigarette is not cracked, the cigarette rod and the cigarette bomb are ensured to be special for one rod and one bomb, and the cigarette bomb cannot be copied and imitated by a competitor.
To achieve the above and other objects, the present invention provides an electronic cigarette, including:
the cigarette rod is used for interacting with the cigarette cartridge in a mode of combining fixed key encryption and dynamic key encryption;
a cartridge for interacting with the tobacco rod;
the control module is used for supplying power to the smoke cartridge and forming a communication channel for authenticating the smoke cartridge;
the power supply module is used for rectifying and filtering the output of the control module to obtain direct-current voltage required by the work of the smoke bomb;
and the heating module is used for generating heat under the control of a heating wire heating control signal CTRL output by the cigarette cartridge.
Preferably, the control module is a PMOS transistor Q1, the battery output VDD in the smoke rod is connected to the source of the PMOS transistor Q1, an output port GPIO of the control circuit in the smoke rod is connected to the gate of the PMOS transistor Q1, and the drain of the PMOS transistor Q1 is connected to the input VIN of the cartridge, the power module and the heating module.
Preferably, the power supply module comprises a diode D1 and an energy storage capacitor C1, the anode of the diode D1 is connected to the drain of the PMOS transistor Q1, the cathode of the diode D1 is connected to the positive power input terminal Vcc of the cartridge and one end of the energy storage capacitor C1, and the other end of the energy storage capacitor C1 is grounded.
Preferably, the heating module comprises a heating wire and an NMOS tube Q2, one end of the heating wire is connected to the drain of the PMOS tube Q1, the other end of the heating wire is connected to the drain of the NMOS tube Q2, a heating wire heating control signal CTRL output by the cartridge is connected to the gate of the NMOS tube Q2, and the source of the NMOS tube Q2 is grounded.
Preferably, a Smart-Wire single-Wire communication loop is formed between the cigarette rod and the cigarette cartridge through the output port GPIO of the cigarette rod, the input end VIN of the cigarette cartridge and the ground to perform authentication and identification, and the battery output VDD of the cigarette rod, the output port GPIO of the cigarette rod, the heating Wire of the cigarette cartridge, the energy storage capacitor C1 and the ground loop supply power to the cigarette cartridge.
Preferably, after the authentication and identification of the cigarette rod and the cigarette cartridge are successful, when the suction action occurs, the cigarette rod sends a heating Wire heating command to the cigarette cartridge through a Smart-Wire single-Wire communication loop, and after the analysis command of the cigarette cartridge is successful, the heating Wire heating loop is switched on through the heating Wire heating control signal CTRL.
In order to achieve the above object, the present invention further provides an encryption and decryption authentication method for an electronic cigarette, including the following steps:
step S1, when an absorbing action instruction is received, the cigarette rod and the cartridge of the electronic cigarette realize handshake connection through a RESET handshake instruction;
step S2, interaction is carried out between the tobacco rod and the cartridge to obtain UID and TM of the cartridge, and the command of interaction between the tobacco rod and the cartridge is encrypted by the encryption and decryption module SAC and then is interacted;
and step S3, the cigarette rod generates a dynamic key B according to the acquired UID and TM values of the current cigarette cartridge, the cigarette cartridge utilizes the UID and TM values of the current cigarette cartridge, when the cigarette rod sends a heating wire command, the cigarette rod encrypts the heating wire command by utilizing the generated dynamic key B and then sends the encrypted heating wire command to the cigarette cartridge, and the cigarette cartridge decrypts and verifies the heating wire command by the corresponding dynamic key B so as to realize the absorption process of the electronic cigarette.
Preferably, in step S1, the data will be transmitted in plain text format, and the tobacco rod and the cartridge interact through a Smart-Wire single line.
Preferably, the step S2 further includes:
step S200, the tobacco rod sends UID (user identification) and TM (TM) commands for inquiring the cartridge; .
Step S201, encrypting UID and TM commands of the inquiry smoke cartridge by using a fixed secret key, and transmitting encrypted ciphertext data to the smoke cartridge through a Smart-Wire single line;
step S202, after the ciphertext data are received by the smoke bomb, the same fixed secret key is used for decryption through an SAC module of the smoke bomb, and after the verification is passed, whether the command format of the obtained data is normal or not is judged;
step S203, when the format is correct, the UID and TM values of the smoke cartridge are encrypted by using a fixed secret key to be a ciphertext and sent back to the tobacco rod;
and S204, after the cigarette rod receives the data packet, decrypting and analyzing the data by adopting the SAC module of the cigarette rod by using the same fixed secret key, and successfully obtaining the UID and TM values of the cigarette bullet.
Preferably, the step S3 further includes:
step S300, the tobacco rod obtains a dynamic key B through a special algorithm according to the acquired UID and TM values of the current cigarette cartridge;
s301, obtaining the same dynamic secret key B by applying the UID and TM values for the cigarette cartridge and a special algorithm the same as that of the cigarette rod;
step S302, the smoke cartridge decrypts the data by using a dynamic secret key B after receiving the data, and checks whether the command format of the obtained data is a heating wire command or not after the verification is passed;
and step S303, after the command is checked to be correct, the heating wire heating loop is switched on through the heating wire heating control signal CTRL, and the suction process of the electronic cigarette is completed.
Compared with the prior art, the electronic cigarette and the encryption and decryption authentication method thereof improve the encryption performance of the electronic cigarette by adopting an encryption safety mechanism combining a fixed secret key and a dynamic secret key, so that the tobacco rod and the tobacco cartridge have a bidirectional anti-counterfeiting function, and can be used together after being matched with each other, the anti-counterfeiting function of the electronic cigarette is enhanced, the encryption authentication function of the electronic cigarette is not cracked, the tobacco rod and the tobacco cartridge are ensured to be special for one rod and one cartridge, and the tobacco cartridge cannot be copied and imitated by competitors.
Drawings
Fig. 1 is a schematic structural diagram of an electronic cigarette according to the present invention;
fig. 2 is a flowchart illustrating steps of an encryption/decryption authentication method of an electronic cigarette according to the present invention;
FIG. 3 is a flow chart of the interaction between the tobacco rod and the cartridge in the embodiment of the present invention
FIG. 4 is a UID, TM query flow diagram in an embodiment of the present invention;
fig. 5 is a flow chart of heating the electric heating wire according to the embodiment of the present invention.
Detailed Description
Other advantages and capabilities of the present invention will be readily apparent to those skilled in the art from the present disclosure by describing the embodiments of the present invention with specific embodiments thereof in conjunction with the accompanying drawings. The invention is capable of other and different embodiments and its several details are capable of modification in various other respects, all without departing from the spirit and scope of the present invention.
Fig. 1 is a schematic structural diagram of an electronic cigarette according to the present invention. As shown in fig. 1, an electronic cigarette of the present invention includes: a tobacco rod 10, a cartridge 20, a control module 30, a power module 40 and a heating module 50.
As shown in fig. 1. The cigarette rod 10 comprises a shell, a rechargeable battery and a control circuit, wherein the shell is used for simulating a traditional cigarette tobacco section and storing the rechargeable battery and the control circuit, the rechargeable battery is used for supplying power to the electronic cigarette, and the control circuit is used for controlling the system to work, receiving the electric energy supplemented by an external power supply and completing key input and display; the cartridge 20 is composed of a microprocessor, a suction nozzle and a tobacco tar bin, and is used for performing bidirectional authentication with the tobacco stem, providing a container for containing tobacco tar and providing a user suction interface, and when the electric heating wire is heated, the tobacco tar in the cartridge is atomized to form smoke; the control module 30 consists of a PMOS tube Q1 and is used for supplying power to the cartridge and forming a communication path for authentication of the cartridge; the power supply module 40 consists of a diode D1 and an energy storage capacitor C1 and is used for rectifying and filtering the output of the control module 30 to obtain and store direct-current voltage required by the work of the smoke bomb; the heating module 50 is composed of a heating wire and an NMOS tube Q2, and generates heat under the control of a heating wire heating control signal CTRL.
Specifically, a battery output VDD in the smoke rod is connected to a source electrode of a PMOS tube Q1, an output port GPIO of a control circuit in the smoke rod is connected to a grid electrode of a PMOS tube Q1, a drain electrode of the PMOS tube Q1 is connected to an input end VIN of the smoke bomb, an anode of a diode D1 and one end of a heating wire, a cathode of the diode D1 is connected to a positive power input terminal Vcc of the smoke bomb and one end of an energy storage capacitor C1, the other end of the heating wire is connected with a drain electrode of an NMOS tube Q2, a heating wire heating control signal CTRL output by the smoke bomb is connected to the grid electrode of the NMOS tube Q2, and the source electrode of the NMOS tube Q2, the other end of the energy storage capacitor C1 and the negative power input terminal of the smoke.
A Smart-Wire single-line communication loop is formed between the cigarette rod and the cigarette cartridge through the output port GPIO of the cigarette rod and the input end VIN of the cigarette cartridge, and authentication and identification are carried out; meanwhile, a battery output VDD of the cigarette rod, a cigarette rod output port GPIO, a heating wire of the cigarette cartridge, an energy storage capacitor C1 and a ground form a loop to supply power to the cigarette cartridge. When the cigarette is successfully identified and the sucking action occurs, the cigarette rod sends a heating Wire heating command to the cigarette bullet through a Smart-Wire single-Wire communication loop, after the analysis command of the cigarette bullet is successful, the heating Wire heating loop is switched on through a heating Wire heating control signal CTRL, so that the heating Wire heats the cigarette oil, and the electronic cigarette sucking process is completed.
Fig. 2 is a flowchart illustrating steps of an encryption/decryption authentication method for an electronic cigarette according to the present invention. As shown in fig. 2, the encryption and decryption authentication method for an electronic cigarette of the present invention includes the following steps:
and step S1, when the suction action instruction is received, the cigarette rod and the cartridge of the electronic cigarette realize handshake connection through a RESET handshake instruction.
In the invention, the tobacco rod is used as a main device, the cigarette cartridge is used as a slave device, and the initiator of the data is the main device. When the electronic cigarette generates a sucking action, the smoke rod sends a RESET handshake request to the smoke bomb, at the moment, CRC (cyclic redundancy check) and encryption are not carried out on data, the data are transmitted in a plaintext format, the smoke bomb returns a request confirmation instruction to the smoke rod, and the smoke rod and the smoke bomb RESET handshake connection is successful. In this step, the tobacco rod and the smoke cartridge are interacted through a Smart-Wire single line.
And step S2, interaction is carried out between the tobacco rod and the cartridge to obtain UID and TM of the cartridge, and the command of interaction between the tobacco rod and the cartridge is encrypted by the encryption and decryption module SAC and then interacted.
Specifically, step S2 further includes:
step S200, the tobacco rod sends UID and TM commands for inquiring the smoke cartridge, the UID is the only identity authentication information of the smoke cartridge, the UID of each smoke cartridge is different, the TM is the number of times the smoke cartridge has been sucked currently, and the TM value changes along with the number of times the smoke cartridge has been sucked.
And step S201, encrypting the UID and TM commands of the inquiry smoke cartridge by using a fixed secret key, and transmitting the encrypted ciphertext data to the smoke cartridge through a Smart-Wire single line.
Specifically, the cigarette rod firstly carries out CRC8 check calculation on UID and TM command plaintext of the inquiry cigarette, inserts a check code into data, then encrypts the data by using a fixed key A through a SAC (Security Algorithm Controller) module, and finally transmits the obtained ciphertext data to the cigarette through a Smart-Wire single line.
Step S202, after receiving the ciphertext data, the smoke bomb decrypts the ciphertext data by using the same fixed key A through a SAC (secure Algorithm controller) module of the smoke bomb, and then CRC8 inspection is carried out on the obtained data, and after the verification is passed, whether the command format of the obtained data is normal is judged;
and step S203, when the format is correct, the UID and TM values of the smoke cartridge are encrypted by the fixed secret key A into a ciphertext and the ciphertext is sent back to the smoke rod. Specifically, when the format is correct, CRC8 check calculation is performed on the UID and TM values, the check code is inserted into the data, and a Secure Algorithm Controller (SAC) module is used to encrypt and package the data with a fixed key as a ciphertext and send the ciphertext back to the tobacco rod.
And step S204, after the cigarette rod receives the data packet, analyzing the data in the same way as the cigarette bullet end, and successfully obtaining the UID and TM values of the cigarette bullet. That is, after the cigarette holder receives the data packet, the data packet is decrypted by the SAC module of the cigarette holder using the same fixed key, and the obtained data is subjected to CRC8 check to obtain the UID and TM values of the cartridge.
And step S3, when the tobacco rod sends a heating electric wire command, the tobacco rod generates a SAC dynamic secret key B according to the acquired UID and TM values of the current cigarette cartridge, the current UID and TM values of the current cigarette cartridge are utilized by the cigarette cartridge, the tobacco rod encrypts the heating electric wire command by utilizing the generated SAC dynamic secret key B and then sends the encrypted heating electric wire command to the cigarette cartridge, and the cigarette cartridge decrypts and verifies the heating electric wire command by the corresponding SAC dynamic secret key B so as to realize the absorption process of the electronic cigarette.
Specifically, step S3 further includes:
and step S300, obtaining a SAC dynamic secret key B by the tobacco rod through a special algorithm according to the obtained UID and TM values of the current cigarette cartridge. Because different cartridges have different UIDs for marking the identities of the cartridges, the dynamic keys of the different cartridges in the process are different, and moreover, after each suction action occurs, the TM value of the cartridge also changes, which also causes the dynamic keys of the same cartridge in different suction actions to be different.
And S301, obtaining the same SAC dynamic secret key B by the UID and TM values for the smoke cartridge and applying the same special algorithm as the smoke rod.
And step S302, when the cigarette rod sends a heating Wire command, the heating Wire command is subjected to CRC8 check package, a dynamic key B is used for encryption by using a SAC (secure algorithm control unit) module to form a ciphertext, and the ciphertext is transmitted to the cigarette bullet through a Smart-Wire single line.
The heating electric wire is a process that the cigarette rod sends a heating electric wire command to the cigarette bullet, and the cigarette bullet turns on a switch of the electric wire to start heating the tobacco tar.
Step S303, decrypting the data received by the smoke bomb by using the dynamic key B to obtain the data, then performing CRC8 verification, and checking whether the command format of the obtained data is a heating wire command or not after the verification is passed;
and step S304, after the command checks that the cigarette is correct, the cigarette cartridge opens the heating wire to heat the cigarette oil, and the process of sucking the electronic cigarette is completed.
Examples
In this embodiment, a communication interaction flow between a smoke rod and a smoke cartridge of an electronic cigarette is shown in fig. 3, and the communication interaction flow is divided into three parts, namely RESET connection handshake, UID and TM query, and electric heating Wire switch control, data are interacted through a Smart-Wire single line, the smoke rod serves as a master device, the smoke cartridge serves as a slave device, and an initiator of the data serves as the master device.
In this embodiment, the interaction between the tobacco rod and the cartridge adopts an encryption mechanism combining fixed key encryption and dynamic key encryption, which is specifically implemented as follows:
1. RESET handshake connection
When the electronic cigarette absorbs the action, the cigarette rod sends a RESET hand-holding command, at the moment, CRC (cyclic redundancy check) and encryption are not carried out on data, and the data are transmitted in a plaintext format.
2. UID, TM queries
After the cigarette rod and the smoke cartridge RESET are successfully connected in a handshaking mode, the cigarette rod sends UID (user identification) and TM (TM) commands for inquiring the smoke cartridge. The UID is the only identity authentication information of the cigarette cartridge, and the UID of each cigarette cartridge is different. The TM is the number of times the cartridge has been currently drawn and the TM value varies with the number of times the cartridge has been drawn. In the data interaction process, the encryption and decryption module SAC encrypts the data by a fixed key, the flow is as shown in fig. 4, the smoke rod firstly performs CRC8 check calculation on the UID and TM command plaintext of the inquiry smoke, inserts a check code into the data, then encrypts the data by the fixed key a through the SAC (Security Algorithm control unit) module, and finally obtains ciphertext data which is transmitted to the smoke cartridge through a Smart-Wire single line. After the cipher text data is received by the smoke bomb, the security algorithm control unit SAC decrypts the cipher text data by using the same fixed key, and the obtained data is subjected to CRC8 inspection. And (4) checking the data after passing the verification, judging whether the command format is normal, and when the command format is correct, carrying out CRC8 and fixed key encryption package on the UID and TM values to obtain a ciphertext and sending the ciphertext back to the tobacco rod by the smoke bomb. And after the cigarette holder receives the data packet, analyzing the data in the same way to successfully obtain the UID and the TM.
3. Heating wire
The heating electric wire is a process that the cigarette rod sends a heating electric wire command to the cigarette bullet, and the cigarette bullet turns on a switch of the electric wire to start heating the tobacco tar. The data of the communication process is encrypted and transmitted by means of a dynamic key, and the flow is shown in fig. 5. The tobacco rod is inquired to obtain the current UID and TM of the cigarette, the SAC dynamic secret key B is obtained through a special algorithm, and meanwhile the UID and TM of the cigarette use the same special algorithm as the tobacco rod to obtain the same SAC dynamic secret key B. Different cartridges have different UIDs identifying their identities, so the dynamic keys for different cartridges in the process are different. Furthermore, after each suction action, the TM value will also change, which will also result in different dynamic keys for the same cartridge during different suction actions. The heating electric heating Wire command passes through a CRC8 check package, the security algorithm control unit SAC encrypts by using a dynamic key B to form a ciphertext, and the ciphertext is transmitted to the smoke bomb by a Smart-Wire single line. And after the data is received by the cartridge, decrypting the data by using the dynamic key B, performing CRC8 verification after the data is obtained, and checking whether the command format is a heating wire command or not after the verification is passed. After the order check is correct, the cigarette bullet opens the heating wire to heat and develop, and begins to heat the tobacco tar, and completes the suction process of the electronic cigarette. When next sucking action occurs, the SAC dynamic secret key obtains a new B' value through special operation of the UID and the TM. Also if the cartridge is replaced, this B' value is different.
In summary, the electronic cigarette and the encryption and decryption authentication method thereof improve the encryption performance of the electronic cigarette by adopting an encryption security mechanism combining a fixed secret key and a dynamic secret key, so that the cigarette rod and the cigarette bomb have a bidirectional anti-counterfeiting function, and can be used together after being matched with each other, thereby enhancing the anti-counterfeiting function of the electronic cigarette, preventing the encryption authentication function of the electronic cigarette from being cracked, ensuring that the cigarette rod and the cigarette bomb are special for one rod and one bomb, and ensuring that the cigarette bomb cannot be copied and copied by competitors.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Modifications and variations can be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the present invention. Therefore, the scope of the invention should be determined from the following claims.