Utilize SD card to authorize software to install and upgrade the method using
Technical field
The present invention relates to a kind of SD of utilization card and authorize software that the method for upgrading use is installed, relate in particular toA kind ofly on embedded device, utilize mandate software that SD card carries out card one machine to install to upgrade the method using.
Background technology
Some products-hardware platforms of embedded device are identical, are only the Content contents that S/W is upper and loadDifference, may load up to a hundred Japanese dictionaries such as A money e-dictionary for a product of Japanese learner,And B money e-dictionary is for the user of English learning, load up to a hundred English dictionaries, and C money electronics dictionWhat allusion quotation was perhaps loaded is German dictionary. And A, B, tri-sections of dictionary hardware platforms possibilities of C are general, and (the same is hardPart). For the user of product of study Japanese, want again English learning (Britain and Japan are two repaiies) if follow-up, andIt can buy upgrading card bag on A money e-dictionary, to install some English dictionaries.
Although online website can, by management such as DRM, coordinate the sequence number of subscriber set, authorizes pipeReason, but it often will require to obtain the sequence number (client or link PC by USB, and using of client machineWebsite or PC ending tool grab sequence number and send to website, or by user's registration of website user, fill outWrite the sequence number printing on consumer products description or product box), then website background program is according to user'sSequence number backstage generates the special installation procedure bag for this subscriber set and downloads and installs for user. But thisA little modes all need to know the condition code (such as sequence number) of subscriber set. Then backstage need to be used according to specifyingThe program that the special medical treatment code at family need to be downloaded user is authorized encryption, to limit the card of this mandateAllow to install and use on the embedded device of assigned serial number, to avoid a card Multi-computer Sharing.
And user may meet difficulty to obtaining of embedded device sequence number, cannot such as some possibly of userWebsite login (without INTERNET time cannot submit sequence number to) easily, some user is buying productAfter not in time (or lazy) use sequence number carry out website account registration and binding, some user mayAbsolutely can not find the nameplate that is printed with sequence number, and the sequence number of the embedded device using that is in no position to take possession of,Ask for help after sale and need phone to send a telegraph, some user cannot find the sequence of printing on packing boxNumber (as packing box loss etc.).
The sequence number of some user's input (as the sequence number with reference to product nameplate or packing box, likely willSequence number input error), and sequence number is cannot be corresponding upper and make DRM when producing verification or installationInstallation and use that cannot normal authorization software.
Even if receive by approach and collected the embedded device product ID that allows the user who uses, upgradingIn card manufacturing process, collect the numerous user's sequence numbers that come (as read because will read from certain databaseGet), increase the operation of burning, and also will guarantee sheet and correlated series number corresponding embedded establishing that burning goes outThe standby user that holds does correspondence one by one, can not have any collocation of obscuring. This is for batch making and produce literLevel card will certainly produce operation and increase production cost and time.
And the distribution of upgrading card, logistics distribution, if it is the same to be similar to the Sales Channel of embedded device,If can there be a kind of upgrade card, make the sequence number that card does not need the embedded device of collecting in advance user(or further feature value, as the CID/PID of the SD card of the built-in card of embedded device), and can directly criticizeAmount carry out burning, number corresponding one by one with the host sequence of specific embedded device without card respectively, and then makeObtain the production of card, circulation, sales process is more flexible and convenient.
Summary of the invention
In order to solve the above-mentioned technical problem existing in background technology, the invention provides one can be directly in batchesCarry out burning, number corresponding and can make card with the host sequence of specific embedded device without cardProduction, circulation, sales process are utilized more flexibly and easily SD card to authorize software that renewal is installed and are madeWith method.
Technical solution of the present invention is: the invention provides one and utilize SD card to authorize software peaceDress upgrades the method using, and its special character is: said method comprising the steps of:
1) batch production upgrade card;
2) the mandate software that utilizes SD card to carry out card one machine on embedded device is installed and is upgraded and uses.
Above-mentioned steps 1) specific implementation be:
1.1) identification upgrading card obtain the CID/PID value of this upgrading card;
1.2) can storage area rebuild card MBR at upgrading card; Described MBR at least comprisesAuthorizationCardID field and FirstUsedDeviceID field;
1.3) data or the program of the required loading of burning upgrading card.
Above-mentioned steps 1.2) in AuthorizationCardID field be upgrading card firmwareCIDRegisterThe CID/PID capturing obtains the ID that ciphertext is preserved after encrypting; Described AuthorizationCardID field warpCrossing deciphering can reduce and obtain upgrading the CID/PID value of card; The upgrading card of described publisher's distributionThe decoded CID/PID value of AuthorizationCardID equates with the CID/PID of card own;
Described step 1.2) in FirstUsedDeviceID field every upgrade card is being carried out to burning production processIn set for identifying the special string of Virgin state of upgrade card; Described special string is through addingClose rear ciphertext is preserved; Described Virgin state is that this card was not installed and used by any embedded device; Work as cardAfter being used by certain embedded device success update contruction, under the keeping records of FirstUsedDeviceID fieldThe sequence number of the embedded device that the supporting success of First and upgrading card is used.
Above-mentioned steps 2) specific implementation be:
2.1) embedded device identification upgrade card;
2.2) judge whether upgrade card is that the legal distribution of publisher or illegal clone are pirate; If so, carry outStep 2.3); If not, exit renewal updating operation;
2.3) judge that whether first upgrade card for embedded device operation; If so, issue normallyThe renewal updating operation that business authorizes; If not, carry out step 2.4);
2.4) judge whether embedded device is the object that this upgrade card upgrades upgrading for the first time; If carry outThe renewal updating operation that normal publisher authorizes; If not, exit renewal updating operation.
Above-mentioned steps 2.2) specific implementation be:
2.2.1) embedded device, from the CID/PID value of upgrade card CID register read card, obtains A-idData;
2.2.2) read the AuthorizationCardID field of MBR in upgrade card, and it be decrypted,Obtain B-id data;
2.2.3) determining step 2.2.1) the A-id data and the step 2.2.2 that obtain) the B-id data that obtain areNo identical; If identical, this upgrade card is the legal distribution of publisher; If not identical, this upgrade card isIllegal clone is pirate.
Above-mentioned steps 2.3) specific implementation be:
2.3.1) embedded device reads the FirstUsedDeviceID field of MBR from upgrade card, and rightIts deciphering, obtains C-id data;
2.3.2) determining step 2.3.1) the C-id data and the step 1.2 that obtain) in the spcial character that setsWhether go here and there identically, if identical, upgrade card is to move first for embedded device, allows to issue normallyThe renewal updating operation that business authorizes is used later no matter upgrading card write protector is at this upgrade card simultaneouslyNo opening, is all written to upgrade card by unique sequence number of the embedded device of use according to agreement password by forceThe AuthorizationCardID field of MBR; If not, upgrade card is non-head for embedded deviceInferior operation, forbids upgrading upgrading.
Above-mentioned steps 2.4) specific implementation be:
2.4.1) according to step 2.3.2) in the AuthorizationCardID that writes by force upgrade card MBRField, deciphering obtains D-id data;
2.4.2) determining step 2.3.1) the C-id data and the step 2.4.1 that obtain) whether the D-id data that obtainIdentical, if so, represent that this upgrading card is exactly successful operation on this embedded equipment for the first time, belong toReuse normally, allow to continue to upgrade updating operation; If not, represent that this upgrade card attempts to manyEmbedded device uses, and refusal is carried out and upgraded updating operation and exit.
The cipher mode of above-mentioned CID/PID is Crypted password or the direct CID with upgrading card that adopts agreementThe value of/PID is Crypted password.
The manner of decryption of above-mentioned CID/PID is clear crytpographic key or the direct CID with upgrading card that adopts agreementThe value of/PID is clear crytpographic key.
Advantage of the present invention is:
The invention discloses a kind of sequence number (feature that does not need the embedded device of collecting in advance user's useValue), do not need to take the SD card of hardware enciphering and deciphering, and only at any common SD card that possesses storage dataIn, by the region, end, MasterBootRecord region in the MBR of card in conjunction with in card firmwareThe value of CID/PID, and four values of sequence number of the embedded device using contrast cleverly,Can reach card and embedded device 1 blocks the mechanism that 1 machine is licensed. And possess the card of preventing and used mirrorIt is pirate that picture clone's instrument (as WinHex) etc. carries out illegal clone. The restriction of card and use main frame is postponed and being existedThe card for the first time normal write protection label of ignoring card after successfully using writes by force, thus allow card batchAmount burning can be without any need for the sequence number of embedded device, and simplifies production procedure, and only writes oneThe approximately definite value that can special identifier card be never used is (as being that 0 data oneself are entered according to the password of agreement entirelyCiphertext after row is encrypted), increase substantially burning efficiency, and the card of burning is being sold and logistics distributionChannel can not need to paste other maintenance card and specific user's (coupling of card and embedded device) is just matchingTrue information, so allow sell with Logistics Operation more simple. Selling card can be embedded as enjoying otherDevice (main frame) is equally convenient. And because the information in MBR is all to add according to special ruleClose processing (as used fixed password, or using this province of card CID/PID as password), can resist non-Method user enumerates multiple cards and attempts to find out the intention of rule, and finally realizes card and embedded equipment (masterMachine) one card one machine restriction license.
Brief description of the drawings
Fig. 1 is the schematic flow sheet of method provided by the present invention;
Fig. 2 be the present invention upgrade card is carried out in batches burning schematic flow sheet;
Fig. 3 is the ciphering process schematic diagram of the present invention to upgrading card CID/PID;
Fig. 4 is the decrypting process schematic diagram of the present invention to upgrading card CID/PID.
Detailed description of the invention
16 bytes of the CID/PID of each SD card producer are unique numberings.
The structure of card subregion MBR is as follows:
Main boot partition table
Byte displacement |
Field length |
Field name and definition |
Content (value) |
0 |
446 |
MBR |
Unrestrictedly |
446 |
16 |
The 1st partition table |
16 byte information of subregion 1 |
462 |
16 |
The 2nd partition table |
16 byte information of subregion 2 |
478 |
16 |
The 3rd partition table |
16 byte information of subregion 3 |
494 |
16 |
The 4th partition table |
16 byte information of subregion 4 |
510 |
2 |
End mark word |
0x55,0xAA |
The value of the CID/PID of the upgrading card of loading installation procedure is passed through to encrypt (such as AES, or 3DESDeng other AES) write the specific location area of delimiting in the MasterBootRecord region of MBR.
Batch production upgrade card, only needs cd-rom recorder in the process of burning card, will when identification cardThe CID/PID grabbing encrypts and writes the specific field of MBR in card 0sector according to the mode of agreementIn (referring to table two), do not need additionally to ask in reply database and collect the permission of so-called binding and use embeddedThe characteristic sequences number of equipment.
By 2 partial datas in the MBR of the card Sector0 that writes, so realize that upgrading card produces timeWait, only allow cd-rom recorder capture the intrinsic CID/PID of upgrading card and after encryption, be stored in MBR tableIn, (former factory is sent out can to identify former the factory card of producing and the card of illegally cloning copy by this fieldThe upgrade card of row, the character code obtaining after the field decoding in MBR is consistent with card CID/PID).
And limit for a upgrade card requirement that (only allowing) used on an embedded device, be alsoA reserved field in the MBR of upgrading card, when dispatching from the factory, fill in into a special character string (asAll write 0 character string, to identify the Virgin state of upgrade card, change card and do not pacified by any embedded deviceDress used), and then do not need in burning upgrading card in batches to fill out in advance authorized embedded producing lineThe sequence number that equipment is intrinsic, to allow production upgrading card can not need to collect user's embedded device at handHost sequence number, and allow produce and circulation sale (distribution) link do not need to bind concrete user'sThe host sequence number of embedded device, can omit and guarantee upgrade card and relevant embedded device host sequence numberThe link of information matches, saves time and cost.
The authorized upgrade card of the normal channel of user, its success is upgrading (installation) complete card on a machineWhen program, the sequence number of this embedded device ignores the write-protect state of card after upgrading, strongRow is written in the MBR relevant field of upgrading card Sector0. And afterwards in this card Virgin identity change(i.e. the upper unique sequence number that allows the embedded device being used of record), and then when attempting to block to other with thisWhen embedded device uses, the MBR relative recording that can read out upgrading card Sector0 allows to be madeWith unique sequence number of embedded device main frame and embedded the establishing of the card of operation upgrading (installation) programStandby sequence number own contrasts, and matches, and represents that card remains in used embedding for the first timeOn formula equipment, reuse, if do not mated, represent that this card attempts to make to second embedded deviceWith, and judge the use for not allowing (without authorizing), and denial of service.
In selected part region, card MBR " MasterBootRecord " region, mark off 2 part fields:
A field: the ciphertext after the CID/PID of record upgrading card itself encrypts.
A field: dispatch from the factory and be preset as particular value (as after being entirely set to 0 data and encrypting again at card systemCiphertext writes in this field, blocks for the Virgin state that dispatches from the factory to identify this). When card is by certain embedded deviceAfter successfully upgrading (installation) is used for the first time, ignore the write-protect of card, automatically by force by used embeddingThe serial number encryption that enters formula equipment obtains ciphertext and is written to card MBR " MasterBootRecord " region and refers toIn fixed field.
Dealer can be the same with common other embedded device by the upgrading card of volume production, do not distinguish client straightConnect sale, as long as the normal channel of client is bought obtain, can use upgrading card to carry out software upgradingOn the embedded device of (or extender installation), use. Because can be by embedded the establishing using after usingStandby unique sequence number feedback record is in upgrading card MBR, so follow-up limit of used upgrading cardFixed successfully use first the embedded device of (installation) function of upgrading with this, and if user uses thisAttempt upper use of other embedded device (the non-equipment that success is used for the first time), with crossing card onceMeeting is inconsistent because of the sequence number of MBR binding in card and the embedded device of use, and cannot pass through mandate,And do not ban use of the service of program upgrade (installation) of upgrading card.
The present invention does not need to use special category (if support hardware encryption technology [is that Class7 supports CMD42LOCKUNLOCK order] card) SD card, and any common SD card, T-Flash card. Pass throughBe written in every card in the fixing register of card in the manufacturer of record upgrading card in MBR all uniqueThe value of CID/PID, and after encryption, be recorded in the specific field of MBR of card, and omittedProduction burning card is just collected the unique sequence number number that is allowed to the embedded device using, and fills in such as entirelyPortion be 0 special string and encrypt after be recorded in the MBR of Sector0 of upgrade card in special field. AsThis one, i.e. batch production easily, circulation, and selling, but realized again simultaneously upgrading card prevent byIllegal piracy, because upgrading card is designed to can collect fortune after being upgraded for the first time (installation) successUnique sequence number of the embedded device main frame of row, limits the permission of a card to embedded establishing to reachThe standby restriction using (having accomplished the restriction of card one machine).
For MBR gauge outfit 446 bytes, choose some spaces and be used for depositing upgrading card copyright ID and card firstThe sequence number information of the authorized embedded device using. Embedded device CPU startup does not rely on outside yetIn MBR in card " MasterBootRecord " Code, so Master in the MBR of general cardBootRecord also can't deposit the Code content that Bootloader starts.
Table 1
In upper table, Partition1 is partition table 1; Partition2 is partition table 2; Partition3 is partition table3; Partition4 is partition table 4;
→ be adjusted to following compatible structure
Table 2
Wherein: NewBootCode(MasterBootRecord), AuthorizationCardID, FirstUsedTri-field total lengths of DeviceID are 446 bytes.
AuthorizationCardID: the CID/PID warp that upgrading card firmwareCIDRegister capturesCross the ID that obtains ciphertext preservation after encrypting. Can reduce and obtain expressly (card of upgrading through decipheringCID/PID value).
The decoded plaintext of upgrading card AuthorizationCardID of publisher's distribution is with card itselfCID/PID equates. Even if attempt publisher as disabled user uses reflect tool (as WinHex mirror image)The card of distribution is attempted Clone mirror and is looked like to revert on certain other SD card. But because every card itselfCID/PID can be different, so be not former card, and the coupling card itself that clone's pirate card cannot be correctThe plaintext of AuthorizationCardID decoding reduction in CID/PID and MBR, and then can differentiate upgradingCard is publisher's master, the card still illegally cloning.
FirstUsedDeviceID: all will when every card of card that burning in enormous quantities is produced dispatches from the factoryContent in this field is set to particular value (as being all 0), and ciphertext is preserved after encrypting. Through separatingCode can reduce and obtain expressly, and card factory state expressly equals the particular value of setting, (as being 0 entirely). Work as cardSheet by certain embedded device successfully upgrade (installation) use after, under the keeping records of this field First withThe sequence number (SerialNumber) of the embedded device that the supporting success of upgrading card is used.
If FirstUsedDeviceID field contents is particular value by the rear value of decoding in upgrade card MBR(preset value (if content is 0 entirely) of burning, shows that this upgrading card was not always used, in VirginState, allows under this state to be used by any embedded device. Once but authorize card by certainPlatform embedded device successfully uses, can be by the embedded unique serial number encryption using in successful use procedureBe recorded in the FirstUsedDeviceID field of MBR, again re-used by other equipment to limit this card.This writes the write protection label that need to ignore card, no matter user when using card whether by cardWrite-protect open, all need in the FirstUsedDeviceID field of the MBR that writes by force card.
In upgrade card MBR the decoded clear content of FirstUsedDeviceID as be not equal to particular value timeWait (as complete non-zero situation), represent that this card bound by certain embedded device, and bindThe Displacement Sequence of embedded device be kept at FirstUsedDeviceID in card MBR after number also encryptingIn field. When used the also upgrading card of bound mistake by certain embedded device, if be again inserted into notEmbedded device in use, can be because of after FirstUsedDeviceID decoding in upgrade card MBRPlaintext cannot match the sequence number (SerialNumber) of embedded device, and can be judged to authorize differentUpgrading and the use of the card content of often and not upgrading.
Burning upgrade card as shown in Figure 2 in batches.
The flow process of embedded device identification and use upgrade card as shown in Figure 1.
Embedded device recognizes after upgrading card, from the CID/PID value of card CID register read card,Obtain the data of A-id, read afterwards the AuthorizationCardID field of the MBR of upgrading card, andBe decrypted according to intrinsic agreement password (or taking A-id value as password), obtain B-id. (wherein B-idIn burning, just fill in be exactly the value of A-id according to agreement the value after password encryption). So if producerThe card of legal distribution, A-id can be the same with B-id value. And if illegally use the cards gram such as similar WinHexGrand card because every card dispatches from the factory producer write the CID/PID of CID register can be different, so cloneIn the AuthorizationCardID field contents decoding of the MBR of card, out B-id can be not identical. And thenCan identification card whether be that the legal distribution of publisher or illegal clone are pirate.
Confirming that card is that legal distribution (non-clone is pirate) afterwards, is read First in card MBR againUsedDeviceID field, if the value reading out equally according to agreement agreement password (or with A-idValue is password) carry out decoding and obtain C-id.
If equaling default value (as being 0 entirely) mark, C-id upgrades card never by any embedded device masterMachine used, allow user upgrade (installation) use, and use later no matter upgrading card is write guarantorWhether protection unit is opened, all by force by use embedded device unique sequence number according to agreement password (orPerson is taking A-id value as password) be written to the AuthorizationCardID field of MBR of upgrading card, withThis realizes so that card is limited and only allows to use to this main frame that (instead of burning is when making upgrading cardThe embedded device sequence number of just collecting upper user writes).
If C-id is not equal to default value (if not being 0 entirely), represent that this upgrade card is embedded by certainInstall successfully and used, and this C-id is exactly the sequence number of that embedded equipment of use. It is right to needThan the sequence number of embedded equipment main frame of this operation and the value of C-id (being D-id value),
If C-id and D-id equate, represent that upgrading card is exactly successfully to transport for the first time on this embedded equipmentOK, belong to normally and reuse (normal authorization), allow to continue to use.
As the value of D-id and C-id, if unequal, represent that this card attempts to use to many embedded devices,And run counter to " card limits a machine " principle that uses, and refusal is carried out service below, and then reach mandate "One card limits a machine " use protection.
Wherein card CID/PID encrypting and decrypting is respectively shown in Fig. 3 and Fig. 4, can take agreement password orThe value of the direct CID/PID taking upgrading card is as password.