Summary of the invention
In view of this, the technical problem to be solved in the present invention is to provide a kind of VCI device program upgrade method and device, to strengthen stability and the security of VCI device upgrade.
It is as follows that the present invention solves the problems of the technologies described above adopted technical scheme:
According to an aspect of the present invention, a kind of VCI device program upgrade method providing, the method comprises:
Receive after application program updating request, enter upgrade mode and set up temporary file;
Receive after the header of upgrade file the relevant information of recording head information;
Receive upgrade file, and according to the Data Update temporary file of upgrade file;
After receiving upgrade file, the data of temporary file are encrypted, and temporary file are saved as to the redaction application file of read-write catalogue.
Preferably, the header of upgrade file comprises: file size, CRC information and signature sign.
Preferably, after receiving the header of upgrade file, the data that receive upgrade file also comprise before:
Judge that whether the signature sign in header is identical with the signing messages of VCI equipment this locality, if not identical, finish the flow process of upgrading.
Preferably, receive upgrade file, and further comprise according to the Data Update temporary file of upgrade file:
Receive the packet of upgrade file, and whether verification current data packet is correct, if correct, request sends next packet, otherwise request repeat current data packet;
According to the current packet receiving and length, upgrade temporary file, and the data total length of record reception;
Whether the data total length that judgement receives equals the file size of header, if not, above-mentioned steps is carried out in circulation.
Preferably, after receiving upgrade file, the data of temporary file are encrypted further and are comprised:
When the data total length receiving equals after the file size of header, judge when whether the check (CRC) of all packets and the CRC information of described header conform to, if conformed to, upgrade data is encrypted.
Preferably, after said method, also comprise: the step of restarting systems.
Preferably, also comprise the step of loading application programs file after the step of above-mentioned restarting systems, this step further comprises:
Check whether redaction application file in the read-write catalogue of file system exists and effectively, if, load redaction application file to internal memory deciphering, if not, the legacy version application file in the read-only catalogue of load document system is to internal memory deciphering.
According to another aspect of the present invention, a kind of VCI device program update device providing, this device comprises:
Monitor module, for receiving after application program updating request, enter upgrade mode and set up temporary file;
Logging modle, for receiving after the header of upgrade file, the relevant information of recording head information;
Update module, for receiving upgrade file, and according to the Data Update temporary file of upgrade file;
Preserve module, for after receiving upgrade file, the data of temporary file are encrypted, and temporary file are saved as to the redaction application file of read-write catalogue.
Preferably, update module further comprises:
Receiving element, for receiving the packet of upgrade file, and whether verification current data packet is correct, if correct, request sends next packet, otherwise request repeat current data packet;
Updating block, for upgrading temporary file according to the current packet receiving and length, and the data total length of record reception;
Judging unit, for judging whether the data total length of reception equals the file size of header, if not etc., notify receiving element to continue to receive packet.
Preferably, this device also comprises load-on module, for checking whether the redaction application file of read-write catalogue of file system exists and effectively, if, load redaction application file to internal memory deciphering, if not, the legacy version application file in the read-only catalogue of load document system is to internal memory deciphering.
VCI device program upgrade method and the device of the embodiment of the present invention, by the standalone upgrade mode to application function code, and in escalation process, add data packet format verification, after executable code file encryption after upgrading, deposit in file system, dynamic load again while needing, and carry out after deciphering, strengthened stability and the security of VCI device upgrade.
Embodiment
In order to make technical matters to be solved by this invention, technical scheme and beneficial effect clearer, clear, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Refer to Fig. 1, a kind of VCI device program upgrade method that the embodiment of the present invention provides comprises the following steps:
S201, receive after application program updating request, enter upgrade mode and set up temporary file.
S202, receive after the header of upgrade file the relevant information of recording head information.
Wherein, the header of upgrade file comprises: file size, CRC information and signature sign.
S203, reception upgrade file, and according to the Data Update temporary file of upgrade file.
As a kind of preferred version, this step further comprises: receive the packet of upgrade file, and whether verification current data packet is correct, if correct, request sends next packet, otherwise request repeat current data packet;
According to the current packet receiving and length, upgrade temporary file, and the data total length of record reception;
Whether the data total length that judgement receives equals the file size of header, if not, circulation is carried out above-mentioned steps until the data total length receiving equals the file size of header.
S204, after receiving upgrade file, the data of temporary file are encrypted, and temporary file are saved as to the redaction application file of read-write catalogue.
Specifically, when the data total length receiving equals after the file size of header, judge when whether the check (CRC) of all packets and the CRC information of described header conform to, if conformed to, upgrade data is encrypted.
As a kind of preferred version, after receiving the header of upgrade file, the data that receive upgrade file also comprise before: judge that whether the signature sign in header is identical with the signing messages of VCI equipment this locality, if not identical, finish the flow process of upgrading.Further so effective security that improves upgrading.
As a kind of preferred version, after said method, also comprise: the step of restarting systems, the step that also comprises loading application programs file after the step of restarting systems, this step further comprises: check whether redaction application file in the read-write catalogue of file system exists and effectively, if, load redaction application file to internal memory deciphering, if not, the legacy version application file in the read-only catalogue of load document system is to internal memory deciphering.Like this, the former version that makes of ROMPaq has backup in read-only catalogue, only has system normally to start, and the former destroyed probability of version file that makes is very little, and the stability of system strengthens; Only need to be upgraded to the application code carried out of redaction, updating speed is fast; The rear executable code of upgrading has carried out encrypting in reading and writing of files catalogue to be deposited, and only when operation, deciphers internal memory and carries out, and has promoted the difficulty that cracks of program, and the security of the rear VCI equipment of upgrading is higher.
As a kind of preferred version, after said method, also comprise restarting systems, after restarting systems, also comprise the step of loading application programs file, this step further comprises:
Check whether redaction application file in the read-write catalogue of file system exists and effectively, if, load described redaction application file to internal memory deciphering, if not, the legacy version application file in the read-only catalogue of load document system is to internal memory deciphering.Wherein, the legacy version application file in the read-only catalogue of file system is the dispatch from the factory default document of time configuration of VCI equipment.
Refer to Fig. 2, a kind of VCI device program upgrade method that the embodiment of the present invention provides comprises the following steps:
S201, start.
Whether the redaction file in S202, the read-write catalogue of inspection file system exists and effectively, if so, performs step S203, otherwise execution step S204.
S203, the code file loading in read-write catalogue are also deciphered to internal memory, submit to and carry out.
S204, load read-only catalogue old edition file to internal memory deciphering, submit to and carry out.
S205, enter the duty of awaiting orders.
S206, judge whether to receive upgrade request, if so, return to step S205, otherwise execution step S207.
Specifically, PC software encapsulates the compiling function code carried out file out, adds certain data layout and signature.In the operation of VCI equipment, can by USB cable, connect with it by PC software, PC software sends the request of upgrade application program in machine code to VCI equipment.
S207, enter upgrade code pattern, set up temporary file, and wait for and receive the relevant data message of upgrade file.
S208, reception upgrade file packet.
Specifically, PC software sends upgrade code current data packet, and notifies this packet length and this packet check information of VCI equipment.
Whether S209, verification current data packet be correct, if so, performs step S210, otherwise execution step S211.
Specifically, VCI equipment writes temporary file according to packet length and bag verification, and the total length that receives of record.
S210, request repeat current data packet, go to step S208.
S211, judge whether to receive all packets, if so, perform step S212, otherwise execution step S213.
S212, request send next packet, go to step S208.
S213, judge that whether the CRC of all packets is correct, if so, perform step S215, otherwise execution step S214.
Whether the check (CRC) that specifically, the calculates all data whether CRC information in header conforms to.
S214, all packets of request repeat, go to step S208.
S215, temporary file data are saved as to the redaction file of formal read-write code directory.
S216, restarting systems.
The VCI device program upgrade method of the embodiment of the present invention, by the standalone upgrade mode to application function code, and in escalation process, adopt list to wrap verification and overall budget CRC check mode, program in machine code after upgrading is after encrypting in file system, after must moving front deciphering, carry out, strengthened stability and the security of VCI device upgrade.
Refer to Fig. 3, a kind of VCI device program update device that the embodiment of the present invention provides comprises:
Monitor module 10, for receiving after application program updating request, enter upgrade mode and set up temporary file;
Logging modle 20, for receiving after the header of upgrade file, the relevant information of recording head information;
Update module 30, for receiving upgrade file, and according to the Data Update temporary file of upgrade file;
Preserve module 40, for after receiving upgrade file, the data of temporary file are encrypted, and temporary file are saved as to the redaction application file of read-write catalogue.
Preferably, update module 30 further comprises:
Receiving element 301, for receiving the packet of upgrade file, and whether verification current data packet is correct, if correct, request sends next packet, otherwise request repeat current data packet;
Updating block 302, for upgrading temporary file according to the current packet receiving and length, and the data total length of record reception;
Judging unit 303, for judging whether the data total length of reception equals the file size of header, if not etc., notify receiving element to continue to receive packet.
Preferably, this device also comprises load-on module 50, for checking whether the redaction application file of read-write catalogue of file system exists and effectively, if, load redaction application file to internal memory deciphering, if not, the legacy version application file in the read-only catalogue of load document system is to internal memory deciphering.
VCI device program upgrade method and the device of the embodiment of the present invention, by the standalone upgrade mode to application function code, and in escalation process, add data packet format verification, after executable code file encryption after upgrading, deposit in file system, dynamic load again while needing, and carry out after deciphering, strengthened stability and the security of VCI device upgrade.
It should be noted that, the technical characterictic in said method embodiment is all corresponding applicable at this device, no longer repeats here.
With reference to the accompanying drawings of the preferred embodiments of the present invention, not thereby limit to interest field of the present invention above.Those skilled in the art do not depart from the scope and spirit of the present invention interior done any modification, are equal to and replace and improve, all should be within interest field of the present invention.