A kind of safe verification method that is used for car diagnosis communicationTechnical field
The present invention relates to the car diagnosis communication field, particularly a kind of safe verification method that is used for car diagnosis communication.
Background technology
Along with developing of automobile industry, the application of car diagnosis communication system also more and more widely.Wherein the car diagnosis communication agreement of generally using is ISO 14230 agreements and ISO 15765 agreements.Carry out control of authority for vehicle diagnosis is operated, these two kinds of car diagnosis communication agreements have all been stipulated the safety verification service.Diagnostic equipment must send the safety verification service request, and by safety verification, could be subjected to the diagnostic operation of safety verification protection to automobile controller.
The operation of this safety verification service as shown in Figure 1, in the 1st step, diagnostic equipment sends the requirement of request seed to automobile controller; In the 2nd step, automobile controller calculates a seed; In the 3rd step, automobile controller is placed on the value of this seed in the response message, returns to diagnostic equipment; In the 4th step, diagnostic equipment by a kind of safety verification algorithm, calculates a key with the value of the seed received; In the 5th step, diagnostic equipment is placed on the key that calculates in the message of requests verification service, sends to automobile controller; In the 6th step, automobile controller with the seed that generates in the 2nd step, by using the algorithm identical with diagnostic equipment, also calculates a key equally, and the key of sending with diagnostic equipment contrasts.If two keys are identical, then safety verification passes through; If different, then safety verification is rejected, and diagnostic equipment can not be subjected to the diagnostic operation of safety verification protection to automobile controller; In the 7th step, automobile controller returns to diagnostic equipment with the safety verification result.
Therefore the key of this safety verification validity is that the algorithm of diagnostic equipment computation key must be consistent with the algorithm of the computation key of automobile controller.This algorithm is generally grasped by car load manufactory and is externally not open, is carried out unauthorized diagnostic operation to prevent automobile controller.In case the algorithm of this computation key is leaked to the public, car load manufactory will redesign a cover key algorithm.
Summary of the invention
In view of this, the objective of the invention is to, safe verification method in a kind of car diagnosis communication is proposed, this method has enough fail safes, can resist Brute Force, and has enough flexibilities, causing for some reason under the situation of divulging a secret, also can generate new key algorithm at an easy rate, thereby more effectively guarantee the fail safe of the safety verification in the car diagnosis communication, the exploitation of key algorithm and maintenance are more prone to easy.
The safe verification method that is used for car diagnosis communication of the present invention comprises the steps:
A, diagnostic equipment send the requirement of request seed to automobile controller;
B, automobile controller calculate a pseudo random number as seed in conjunction with calculated factor;
C, automobile controller are placed on the value of pseudo-random number seed described in the step b in the response message, return to diagnostic equipment;
D, diagnostic equipment add a key bytes string with the value of pseudo-random number seed described in the step b that receives, form a new byte serial, by the MD5 algorithm this new byte serial are encrypted, and the result who encrypts is exported as key;
E, diagnostic equipment send to automobile controller with the key that steps d calculates;
F, automobile controller are with the described pseudo-random number seed of calculating among the step b, add the described key bytes string that adopts in the steps d, form a new byte serial, by the MD5 algorithm this new byte serial is encrypted, the result who encrypts is exported the key contrast that this key and diagnostic equipment are sent as key; If two keys are identical, then safety verification passes through; If different, then safety verification is rejected, and diagnostic equipment can not be subjected to the diagnostic operation of safety verification protection to automobile controller;
G, automobile controller return to diagnostic equipment with the result of safety verification.
In step b, the running time after resetting with automobile controller is as described calculated factor; Encrypted result among steps d and the f all is 128 a big integer.Described key bytes string is the random length except that 0, can get arbitrary value.
Cryptographic algorithm MD5 (Message Digest Algorithm 5) is a kind of cryptographic algorithm that is widely adopted.This algorithm carries out the hash conversion to byte serial (Message), can be transformed into the byte serial of random length 128 big integer.This algorithm has two characteristics: it is infeasible on calculating that two inputs of first searching obtain identical output valve, promptly has anti-collision; It two is to look for an input, and can obtain given output is infeasible on calculating, and promptly has irreversibility.Therefore the MD5 algorithm is being widely adopted such as data security fields such as digital signature, cryptoguards.
The present invention program introduces the MD5 algorithm, has mainly utilized this two characteristics.Because this programme is when carrying out the safety verification of car diagnosis communication, the seed number that generates is a pseudo random number, and the anti-collision of MD5 algorithm has guaranteed to have two different seeds to obtain identical key by calculating making, so key has uniqueness; Even the irreversibility of MD5 algorithm has then guaranteed the cracker and has intercepted and captured correct seed and corresponding key, also can't calculate and infer the keyword that adds when computation key.The security reliability height, this is one of advantage of the present invention program.
Another advantage of the present invention program is that implementation is simple, the exploitation of key algorithm and easy to maintenance.MD5 algorithm application described in the invention is very universal, in a lot of equipment ready-made MD5 algoritic module is arranged all, therefore only need slightly do to transform to existing equipment and just can realize the present invention program.Length for seed does not require yet, if system upgrade or other design reasons, when causing seed length to change, the present invention program's key algorithm does not need to do change, and extensibility is strong.Key bytes string in the described key algorithm of the present invention program can be the random length except that 0, can get arbitrary value.The need to be keep secret of car load manufactory have only the key bytes string, algorithm is disclosed.Even under the situation that the key bytes string is artificially revealed, car load manufactory only need revise the key bytes string simply and get final product.
Description of drawings
Fig. 1 carries out the schematic diagram of safe verification method in the car diagnosis communication for prior art;
Fig. 2 carries out the schematic diagram of safe verification method in the car diagnosis communication for the present invention;
Fig. 3 carries out the workflow diagram of safety verification in the car diagnosis communication for the present invention.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, the present invention is described in further detail below in conjunction with the drawings and specific embodiments.
Show the workflow of carrying out safety verification in the car diagnosis communication as Fig. 2,3:
Step 1: diagnostic equipment initiates a message to automobile controller by safety verification request #1 (SecurityAccess Request#1), the request seed.Safety verification service (SecurityAccess) is the service that is specifically designed to safety verification of regulation among car diagnosis communication agreement ISO 14230 and the ISO 15765, and the safety verification request #1 (SecurityAccess Request#1) in this service is used for diagnostic equipment to automobile controller request seed.
Step 2: be calculated factor the running time after automobile controller resets with controller, calculates a pseudo random number as seed.
Step 3: automobile controller responds #1 (SecurityAccessResponse#1) by safety verification, sends response message to diagnostic equipment, and the seed that calculates in thestep 2 is returned to diagnostic equipment.Safety verification response #1 in the safety verification service is the response message of stipulating among car diagnosis communication agreement ISO14230 and the ISO 15765 that seed is returned in the safety verification service that is used for.
Step 4: diagnostic equipment adds that with the seed of receiving key bytes string " 12345 " becomes a new byte serial, goes out one 128 key then by the MD5 algorithm computation.The key bytes string " 12345 " of this example refers to 5 continuous bytes, and the value of each byte is respectively 1,2,3,4,5.
Step 5: diagnostic equipment sends to automobile controller with key, the requests verification key by safety verification request #2 (SecurityAccess Request#2).Safetyverification request #2 in the safety verification service is that the safety verification that is used for of regulation is served diagnostic equipment sends key and request message from requests verification to automobile controller among car diagnosis communication agreement ISO 14230 and the ISO 15765.
Step 6: automobile controller will add that key bytes string " 12345 " becomes a new byte serial with the seed that calculates equally instep 2, also go out one 128 key then by the MD5 algorithm computation, and and the key that sends over of the diagnostic equipment received compare.If two keys are identical, then checking is passed through, and automobile controller can be subjected to the diagnostic operation of safety verification protection; If two key differences, then checking is rejected, and will be refused by automobile controller by the diagnostic operation of safety verification protection.The key bytes string that is used for diagnostic equipment calculating in key bytes string " 12345 " here and thestep 4 is just the same.
Step 7: automobile controller responds #2 (SecurityAccessResponse#2) by safety verification, sends response message to diagnostic equipment, and the result returns to diagnostic equipment with key authentication.Safetyverification response #2 in the safety verification service is the response message of stipulating among car diagnosis communication agreement ISO 14230 and the ISO 15765 that safety verification service automobile controller returns to the safety verification result diagnostic equipment that is used for.
The above only is a preferable enforcement example of the present invention, not in order to restriction the present invention, all any modifications of being done within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.