Background technology
Firmware (Firmware) is a kind of software that electronic equipment is carried out internal control.The electronic equipment that typically has firmware comprises: at personal user's end product, and for example telepilot, counter, mobile phone, digital camera; Assembly relevant or equipment, for example hard disk, keyboard, CD-ROM drive, display, storage card with computing machine; Scientific instrument; Industrial robot etc.Firmware provides very the basis, low-level operation for electronic equipment; In case leave firmware, electronic equipment will can't be worked fully.
Firmware is stored in the nonvolatile memory (Non-volatile Memory) of electronic equipment usually, for example ROM, PROM or Flash etc.Firmware needs upgrading, and upgrading is normally for the mistake that corrects original firmware or for the new function of electronic equipment increase etc.The upgrading of firmware normally provides binary image file (image file) by electronic equipment set manufacturer, makes electronic equipment load this firmware file and upgrades according to certain program.The firmware upgrade of some electronic equipment need be by staff's operation of manufacturer, and the firmware upgrade of other electronic equipments is then operated by the user.
A kind of firmware upgrade method of existing electronic equipment is: manufacturer is open firmware file on the website, and user's download this document also carries out firmware upgrade to electronic equipment.
Owing to comprise some confidential information usually in the firmware file, this firmware upgrade method is open with firmware file, and third party particularly rival is easy to obtain confidential information from firmware file.
The firmware upgrade method of another kind of existing electronic equipment is: set up safe network between electronic equipment and manufacturer's website (server) and be connected, server carries out firmware upgrade to electronic equipment then directly to the electronic equipment firmware file.
This firmware upgrade method adopts client-server mode transfer firmware file, and the minority server is connected to numerous client (electronic equipment) usually, so file transfer speed is very restricted.
Summary of the invention
Technical matters to be solved by this invention provides a kind of firmware upgrade method of electronic equipment, can satisfy the security requirement of firmware file, has taken into account its transfer rate again.
For solving the problems of the technologies described above, the firmware upgrade method of electronic equipment of the present invention comprises the steps:
The 1st step, firmware file is expressly carried out block encryption, form the firmware file ciphertext;
With at least one of firmware file ciphertext as key blocks;
With the key of block encryption and/or initialization vector together as access certificate;
In the 2nd step, the firmware file ciphertext is removed the part of key blocks, public publication on network;
The key blocks of firmware file ciphertext and access certificate, only the network connection by safety transfers to electronic equipment;
In the 3rd step, after electronic equipment obtains the firmware file ciphertext and removes the key blocks of the part of key blocks, firmware file ciphertext, access certificate, preceding two parts are merged into complete firmware file ciphertext, and decrypt firmware file expressly by access certificate;
In the 4th step, electronic equipment expressly carries out firmware upgrade according to firmware file.
The firmware upgrade method of electronic equipment of the present invention, firmware file is encrypted to a plurality of ciphertext blocks of " indispensable ", and therefrom extract key blocks, itself and access certificate only are transferred to electronic equipment by the network channel of safety, then issue by disclosed network channel for the firmware file ciphertext of removing outside the key blocks.After lacking key blocks and access certificate, anyone can't form complete firmware file ciphertext, the more impossible firmware file plaintext that decrypts, and this has just fully guaranteed the safety of firmware file.Key blocks and access certificate are less, and the firmware file ciphertext of removing outside the key blocks is bigger, and part that will be bigger is issued with open channel, thereby allows the user obtain speed of download faster.
Embodiment
See also Fig. 1, the firmware upgrade method of electronic equipment of the present invention comprises the steps:
The 1st step, electronic equipment set manufacturer carries out block encryption to the plaintext of firmware file, the algorithm pattern of block encryption is CBC pattern or CFB pattern or OFB pattern, at least one of the firmware file ciphertext that will obtain after will encrypting then as key blocks, and with the key of block encryption and initialization vector together as access certificate.
In the 2nd step, the firmware file ciphertext is removed the part of key blocks, public publication on network; The key blocks of firmware file ciphertext and access certificate, only the network connection by safety transfers to electronic equipment.
In the 3rd step, after electronic equipment obtains the firmware file ciphertext and removes the key blocks of the part of key blocks, firmware file ciphertext, access certificate, preceding two parts are merged into complete firmware file ciphertext, and decrypt firmware expressly by access certificate.
In the 4th step, electronic equipment expressly carries out firmware upgrade according to firmware file.
Generally the encryption equipment based on key is shaped on two kinds: symmetric key encryption (Symmetric KeyCryptogtaphy) and asymmetric-key encryption (Asymmetric Key Cryptography).Symmetric key encryption is divided into stream encryption (stream ciphers) and block encryption (block ciphers) again.Stream encryption is a position in the encrypting plaintext, for example a bit (position) or a byte (byte).Block encryption is a piece in the encrypting plaintext, claims block encryption again.
See also Fig. 2, the basic skills of block encryption is: earlier plaintext is divided into a plurality of Plaintext block, the length of each Plaintext block is identical, and last Plaintext block can be filled to satisfy length requirement.Again each Plaintext block is encrypted according to cryptographic algorithm, thereby obtain a plurality of ciphertext blocks.The quantity of ciphertext blocks is identical with the quantity of Plaintext block.The integral body of these a plurality of ciphertext blocks is exactly ciphertext.For different cryptographic algorithm, algorithm pattern, when encrypting, also need key and/or initialization vector.
The common algorithm of block encryption has: AES (advanced encryption standard, Advanced Encryption Standard); DES (data encryption standard, data encryption standards) also claims DEA (dataencryption algorithm, data encryption algorithm); DESX (extended data encryptionstandard, the data encryption standards of expansion); Three times of DES (triple DES); RC2; RC5; RC6 etc.
Algorithm pattern (algorithm mode) is the combination of a series of rudimentary algorithm steps in the block encryption, and common algorithm pattern has: ECB (Electronic Code Book, electronic codebook mode) pattern; CBC (Cipher Block Chaining, cipher block chaining) pattern; CFB (Cipher Feedback, cipher feedback) pattern; OFB (Output Feedback, output feedback) pattern." safety theory of communication network and technology " (publishing house of Tsing-Hua University 2006 publishes, wear the hermit, Wang Peikang, Chen Wei write) 10.2.2 joint has detailed description for the encryption and decryption operation of above-mentioned various algorithm patterns.
CBC, CFB have identical characteristics with the OFB algorithm pattern: when first Plaintext block is encrypted, need use initialization vector and key; When second and later Plaintext block are encrypted, need use previous Plaintext block (or certain value in the previous Plaintext block ciphering process) and key.During to first ciphertext blocks deciphering, need use initialization vector and key; During to second and later ciphertext blocks deciphering, need use previous ciphertext blocks (or certain value in the previous ciphertext blocks decrypting process) and key.This means, form a plurality of ciphertext blocks, lack wherein that any one ciphertext blocks just can't decrypt whole Plaintext block, thereby can't obtain plaintext when adopting CBC, CFB or OFB algorithm pattern to encrypt.
Said method has just made full use of CBC, CFB and the OFB algorithm pattern of the block encryption in the symmetric cryptography in the 1st step, and a plurality of ciphertext blocks of having constructed " indispensable " are as the firmware file ciphertext.Then with at least one ciphertext blocks in the firmware file ciphertext as key blocks.Under the preferable case, with first ciphertext blocks of firmware file ciphertext as key blocks.With the initialization vector in the ciphering process and key as access certificate.Key and initialization vector can be one group, also can be many groups, and obviously the latter's security is stronger.Because symmetric cryptography mechanism, this access certificate also is used for decryption oprerations simultaneously.
Said method is in the 2nd step, and the firmware file ciphertext is removed the part of key blocks, and with the publicity pattern distribution, the user can download from each big website, thereby obtains transfer rate faster.Because public publication is not complete firmware file ciphertext, so the third party can't obtain firmware file expressly thus.The key blocks of firmware file ciphertext and access certificate, only the network by safety connects from the Server Transport to the electronic equipment.The network of so-called safety connects, and for example to be electronic equipment is connected the network connection line data of going forward side by side by the https agreement transmits with server.
Said method is in the 3rd step, electronic equipment will disclose firmware file ciphertext that channel obtains and remove the key blocks of the firmware file ciphertext that the part of key blocks, safe channel obtain and merge into complete firmware file ciphertext, and the access certificate that obtains with safe channel decrypts the firmware plaintext again.The third party can't obtain from the crucial money and the access certificate of the firmware file ciphertext of safety channel transmission, so the third party both can't obtain complete firmware file ciphertext, also can't decrypt firmware file expressly.
Enumerate the specific embodiment of the firmware upgrade method of an electronic equipment of the present invention below.
The 1.1st step generated key and initialization vector that m organizes the AES-256 cryptographic algorithm at random, and all keys and initialization vector are formed access certificate jointly.
The 1.2nd step was a plurality of Plaintext block with unencrypted firmware file (promptly expressly) cutting, and the length of each Plaintext block is identical, and this length is necessary for the multiple of 16 bytes.If the length of last Plaintext block less than the length of other Plaintext block, then adds to identical with other Plaintext block length.In the preferred case, the length of each Plaintext block should be qualified minimum length.
The 1.3rd step, use m group key and initialization vector to encrypt a plurality of Plaintext block by turns, form a plurality of ciphertext blocks identical with Plaintext block quantity.
The 1st group key and initialization vector encrypt the 1st, m+1,2m+1,3m+1 ... individual Plaintext block; The 2nd group key and initialization vector encrypt the 2nd, m+2,2m+2,3m+2 ... individual Plaintext block; The rest may be inferred, m group key and initialization vector encrypt m, 2m, 3m, 4m ... individual Plaintext block.The algorithm of encrypting is AES-256, and algorithm pattern is CBC.
With the 1st group key and initialization vector is example, need use the 1st group key and the 1st group of initialization vector when encrypting the 1st Plaintext block, obtains the 1st ciphertext blocks; Need use the 1st ciphertext blocks and the 1st group key when encrypting m+1 Plaintext block, obtain m+1 ciphertext blocks; Need use m+1 ciphertext blocks and the 1st group key when encrypting 2m+1 Plaintext block ...This encryption mode is exactly the CBC algorithm pattern, during deciphering similarly.
Adopting the AES-256 cryptographic algorithm, is because its enciphering rate is fast, safe, is suitable for encrypting mass data.Adopting the CBC algorithm pattern, is because it has the characteristics of " lack any ciphertext blocks and just can't decrypt whole Plaintext block ".
Obviously, AES-256 cryptographic algorithm among this embodiment can replace with any block encryption algorithm, CBC algorithm pattern among this embodiment can replace with CFB or OFB algorithm pattern, many group keys and initialization vector among this embodiment can replace with a group key and initialization vector, this to the present invention without any materially affect.
The 1.4th step, every group key and initialization vector are encrypted the first ciphertext blocks that forms as key blocks, promptly the 1st, 2 ... m ciphertext blocks is as key blocks, and this is preferred situation.Perhaps, can get one or more arbitrarily ciphertext blocks as key blocks.
In the 2nd step, the key blocks of firmware file ciphertext and access certificate, directly are transferred to the electric terminal from server as the https agreement together by reliable encrypted tunnel, with the key blocks of guaranteeing the firmware file ciphertext and the transmission security of access certificate.The firmware file ciphertext of removing outside the key blocks is may volume bigger, and for example tens or MB up to a hundred, therefore by the network public publication, allow the user to use various download tools to download, thereby accelerate speed of download from the website that each has this resource.
The 3rd step, electronic equipment obtains the key blocks of access certificate and firmware file ciphertext by the https agreement, after also obtaining to remove firmware file ciphertext outside the key blocks, two parts firmware file ciphertext merged form complete firmware file ciphertext from public download channel.Electronic equipment is again by access certificate, decrypt firmware file expressly according to the AES-256 decipherment algorithm from the firmware file ciphertext.
If cryptographic algorithm is not AES-256, then decipherment algorithm should be corresponding with cryptographic algorithm.
In the 4th step, electronic equipment utilizes firmware file (promptly expressly) to carry out firmware upgrade.
The group number of the cryptographic algorithm that the foregoing description provides, decipherment algorithm, algorithm pattern, key and initialization vector, key blocks etc. are signal; any change of being done under the prerequisite of not violating inventive concept all should be regarded as within protection scope of the present invention.