Summary of the invention
Main purpose of the present invention is to provide a kind of safety protecting method and client of PIN code, is intended to strengthen the safe class of PIN code, makes the transmission of PIN code have more fail safe.
The embodiment of the present invention discloses a kind of safety protecting method of PIN code, comprises the following steps:
Middleware loads the PIN code input system, when loading successfully, by the data interaction interface, the PIN code input rule is set; Show the PIN code input frame, input PIN code for the user;
The PIN code of described PIN code input system recording user input is encrypted and encodes to process described PIN code and obtains the PIN code ciphertext, and described PIN code ciphertext is sent to described middleware by described data interaction interface;
Described middleware obtains described PIN code ciphertext, judges whether described PIN code ciphertext meets described PIN code input rule; If, decipher described PIN code ciphertext, obtain described PIN code.
Preferably, described PIN code input system is encrypted described PIN code and encodes to process and obtains the PIN code ciphertext and comprise:
Generate one or more random numbers, be encrypted the result of computing as encryption key with described random number or to described random number; Perhaps
With the character string that presets or described character string is encrypted the result of computing as encryption key; Perhaps
Generate one or more random numbers, with described random number and the character string that presets or described random number and character string are encrypted the result of computing as encryption key;
With described encryption key, described PIN code is encrypted, obtains the P1 ciphertext, described P1 ciphertext is encoded, obtain described PIN code ciphertext.
Preferably, describedly judge described PIN code ciphertext also comprises after whether meeting the step of described PIN code input rule:
If not, empty described PIN code input frame by described data interaction interface, and return to execution in step: show the PIN code input frame, input PIN code for the user.
Preferably, also comprise step after described middleware loading PIN code input system:
The described data interaction interface of described PIN code input system initialization.
Preferably, also comprise step:
Described middleware empties all characters in described PIN code frame by described data interaction interface, discharges described PIN code input system.
The embodiment of the invention also discloses a kind of client for the PIN code security protection, comprise middleware and PIN code input system;
Described middleware is used for, and loads the PIN code input system, when loading successfully, by the data interaction interface, the PIN code input rule is set; Show the PIN code input frame, input PIN code for the user;
Described PIN code input system is used for, and the PIN code of recording user input is encrypted and encodes to process described PIN code and obtains the PIN code ciphertext, and described PIN code ciphertext is sent to described middleware by described data interaction interface;
Described middleware also is used for, and obtains the described PIN code ciphertext that described PIN code input system transmits, and judges whether described PIN code ciphertext meets described PIN code input rule; If, decipher described PIN code ciphertext, obtain described PIN code.
Preferably, described PIN code input system also is used for:
Generate one or more random numbers, be encrypted the result of computing as encryption key with described random number or to described random number; Perhaps
With the character string that presets or described character string is encrypted the result of computing as encryption key; Perhaps
Generate one or more random numbers, with described random number and the character string that presets or described random number and character string are encrypted the result of computing as encryption key;
With described encryption key, described PIN code is encrypted, obtains the P1 ciphertext, described P1 ciphertext is encoded, obtain described PIN code ciphertext.
Preferably, described middleware also is used for:
When the described PIN code ciphertext of judgement does not meet described PIN code input rule, empty described PIN code input frame by described data interaction interface, and return to execution in step: show the PIN code input frame, input PIN code for the user.
Preferably, described PIN code input system also is used for:
The described data interaction interface of initialization.
Preferably, described middleware also is used for:
By described data interaction interface, empty all characters in described PIN code frame, discharge described PIN code input system.
The present invention loads the PIN code input system by middleware, when loading successfully, by the data interaction interface, the PIN code input rule is set; Show the PIN code input frame, input PIN code for the user; The PIN code of described PIN code input system recording user input is encrypted and encodes to process described PIN code and obtains the PIN code ciphertext, and described PIN code ciphertext is sent to described middleware by described data interaction interface; Described middleware obtains described PIN code ciphertext, judges whether described PIN code ciphertext meets described PIN code input rule; If, decipher described PIN code ciphertext, obtain the method for described PIN code, have at the driving layer and PIN code is reinforced, strengthened the beneficial effect of PIN code fail safe, effectively realize the authentication to the caller identity, prevented from driving the PIN code intercept operation of layer and application layer; Simultaneously, have the ability of stronger antibonding dish hook, can the keyboard hook of main flow be protected, interrupt the transmission of hook chain, effectively prevented the security threat that keyboard hook class trojan horse program causes PIN code.And, adopt independently the PIN code input system to carry out to the protection of PIN code, facilitated the operations such as the transplanting of PIN code protection and modification.
Embodiment
The present invention is used for the safety protecting method of the customer end adopted PIN code of PIN code security protection, reaches the purpose of PIN code being carried out security protection; The safety protecting method of PIN code is: when loading the success of PIN code input system, show the PIN code input frame by middleware, input PIN code for the user; After the user inputs PIN code, the PIN code input system is encrypted PIN code and encodes, obtain the PIN code ciphertext, and the PIN code ciphertext is sent to middleware by specific data interaction interface, when this PIN code ciphertext of middleware judges meets the PIN code input rule, decipher the PIN code ciphertext, obtain meeting the PIN code of input rule.
Further illustrate technical scheme of the present invention below in conjunction with Figure of description and specific embodiment.Should be appreciated that specific embodiment described herein only in order to explain the present invention, is not intended to limit the present invention.
With reference to Fig. 1, Fig. 1 is the safety protecting method first embodiment schematic flow sheet of PIN code of the present invention; As shown in Figure 1, the safety protecting method of PIN code of the present invention comprises the following steps:
Step S01, middleware load the PIN code input system, when loading successfully, by the data interaction interface, the PIN code input rule are set;
Step S02, middleware show the PIN code input frame, input PIN code for the user;
After the user opened middleware and moves middleware, middleware loaded the PIN code input system; If load unsuccessfully, obtain and load failed error code, and point out the user this load unsuccessfully; If load successfully, by the safe interface that carries out data interaction with the PIN code input system, the PIN code input rule is set; Described middleware arranges the PIN code input rule and comprises: the minimum and maximum number of characters that character rule, permission input are set.
After setting was completed, middleware showed the PIN code input frame, and the prompting user can input corresponding PIN code.
The PIN code of step S03, PIN code input system recording user input is encrypted and encodes to process described PIN code and obtains the PIN code ciphertext, and described PIN code ciphertext is sent to middleware by the data interaction interface.
The user inputs corresponding PIN code in the PIN code input frame after, the PIN code of PIN code input system recording user input at once simultaneously, is added up the number of characters of this PIN code, and at the driving layer, PIN code is encrypted.The PIN code input system is according to random number and preset the hard coded character string, obtains encryption key, at the driving layer, PIN code is encrypted.
The mode that the PIN code input system is obtained encryption key comprises: the PIN code input system generates one or more random numbers, directly with described random number as encryption key, perhaps this random number is encrypted computing, with the random number after encrypting as encryption key; The character string that presets as encryption key, perhaps is encrypted computing to this character string that presets, will presets character string as encryption key after encrypting; With the random number that generates and the character string that presets as encryption key, perhaps with this random number with preset character string and be encrypted computing, with above-mentioned cryptographic calculation result as encryption key.Above-mentioned related data is encrypted computing can adopts the 3DES cryptographic algorithm.Please refer to Fig. 2, Fig. 2 is in the safety protecting method of PIN code of the present invention, when the PIN code input system is encrypted the PIN code of inputting, obtains encryption key one embodiment schematic flow sheet; As shown in Figure 2, the PIN code input system is called PIN code and is encrypted required correlation function, and the random number that described correlation function imports into is carried out SHA1(Secure Hash Algorithm, Secure Hash Algorithm) hash, namely adopt Secure Hash Algorithm that the random number of importing into is processed, obtaining the first Hash data is Hash data 1, get Hash data 1 front 6, it is saved as S1.The PIN code input system is carried out the SHA1 hash to presetting the hard coded character string, namely adopts Secure Hash Algorithm to process presetting the hard coded character string, and obtaining the second Hash data is Hash data 2, get Hash data 2 rear 4, it is saved as S2.According to S1 and S2, obtain new character string S1+S2+S1, with it as S3; At this moment, get character string S1 rear 3 as character string S4; The composition character string M1 of S3 and S4 is encrypted wherein " M1=S3+S4+S3 " as the PIN code of encryption key to user's input.The PIN code input system utilizes encryption key M1 that the PIN code of input is encrypted, and after obtaining the P1 ciphertext, then the P1 ciphertext is encoded, and obtains described PIN code ciphertext.The PIN code input system is sent to middleware with the PIN code ciphertext by specific data interaction interface.
Because encryption key is that the PIN code input system dynamically generates, therefore guaranteed the uniqueness of encryption key; And the P1 ciphertext that writes shared drive has been carried out coding processed, made the transmission of PIN code that fail safe more be arranged.
In the embodiment of the present invention, the method that the PIN code input system is encoded to the P1 ciphertext can adopt the BASE64 coded system.
Step S04, middleware obtain described PIN code ciphertext, judge whether described PIN code ciphertext meets described PIN code input rule; If, execution in step S05; If not, return to execution in step S02.
Step S05, the described PIN code ciphertext of deciphering are obtained described PIN code.
Middleware obtains the PIN code ciphertext that the PIN code input system transmits, and obtains simultaneously the number of characters of this PIN code ciphertext, judges whether the number of characters of this PIN code ciphertext meets the PIN code input rule.If the number of characters of this PIN code ciphertext does not meet the PIN code input rule, middleware by specific data interaction interface, empties the character in the PIN code frame, and is back to step S02, middleware demonstration PIN code input frame, requires the user to re-enter PIN code.If the number of characters of middleware judges PIN code ciphertext meets the PIN code input rule, resolve the PIN code ciphertext.Described middleware is resolved the PIN code ciphertext and is adopted the decipherment algorithm suitable with the PIN code input system, and described decipherment algorithm can be Secure Hash Algorithm; If the PIN code input system adopts the 3DES cryptographic algorithm, when middleware is to the PIN code decrypt ciphertext, also adopt the 3DES decipherment algorithm.
If middleware is resolved unsuccessfully the PIN code ciphertext, send and resolve failed information, the prompting user fails and obtains described PIN code.
Middleware is resolved the PIN code ciphertext, after getting PIN code, judges whether PIN code meets the PIN code input rule, if by the data interaction interface of PIN code input system, empty all characters in the PIN code frame, and discharge the PIN code input system; If the PIN code after middleware judges is resolved does not meet the PIN code input rule, pass through the data interaction interface of PIN code input system, empty all characters in the PIN code frame, and return to execution in step S02, middleware demonstration PIN code input frame, require the user to re-enter PIN code.
Further, please refer to Fig. 3, Fig. 3 is the safety protecting method second embodiment schematic flow sheet of PIN code of the present invention; The difference of the present embodiment and the described embodiment of Fig. 1 is only to have increased:
Step S00, the described data interaction interface of described PIN code input system initialization.
After middleware loads PIN code input system success and the PIN code input rule is set, for guaranteeing the fail safe of PIN code transmission, the specific data interaction interface of the mutual employing of PIN code input system and middleware.The PIN code input rule that the PIN code input system arranges according to middleware, carry out initialization one specific implementation process to specific described data interaction interface as follows:
<1>、void?Clear(void)
[function] empties the character in the PIN code frame.
<2>、void?GetLen(LONG?*nLen)
[function] obtains in the PIN code frame length of input character.
<3>、void?GetVerCtrl?(BSTR?*szVer)
[function] obtains PIN code system, the version number of control.
<4>、void?GetVerDrv?(BSTR?*szVer)
[function] obtains the PIN code system, drives the version number of file.
<5>、void?GetPin?(LPCTSTR?bstrRand,LPCTSTR?bstrContent,BSTR?*szPin)
[function] obtains the encrypt data of PIN code frame.
<6>、void?GetLastError(LONG?*nCode)
[function] obtains the last error code value of Pin code control.
<7>、void?InitPinInput(LONG?minLength,LONG?maxLength,LPCTSTR?strRand,LPCTSTR?strRule)
[function] PIN code input control system initialization interface.
<8>、void?FocusOnOrNot(LONG?*pRet)
[function] judges that current input focus is whether in pin code input frame control.
The PIN code input system is by to the initialization of data interactive interface, with the protection module independent of PIN code, make PIN code protection module call more convenient.
Further, please refer to Fig. 4, Fig. 4 is safety protecting method the 3rd embodiment schematic flow sheet of PIN code of the present invention; The difference of the present embodiment and Fig. 3 embodiment is only to have increased:
Step S06, middleware empty all characters in described PIN code frame by described data interaction interface, discharge described PIN code input system.
Middleware is resolved the PIN code ciphertext, after getting the PIN code that meets the PIN code input rule, and by specific data interaction interface, all characters in situation PIN code frame, and discharge the PIN code input system.
In the present embodiment, described middleware can be U shield program commonly used; Take U shield program as example, the interaction flow of middleware and PIN code input system please refer to Fig. 5, and Fig. 5 is the interaction flow schematic diagram of PIN code input system of the present invention and middleware; As shown in Figure 5, after the user moved U shield program, U shield program calibration PIN code input system arranged the PIN code input rule that comprises character rule, maximum and minimum input character number, and shows the PIN code input frame, inputs PIN code for the user; After user's input is completed, click<submit to button, the PIN code input system is obtained the PIN code of user's input, to the PIN code of input be encrypted and encode process after, return to the PIN code ciphertext to U shield program, U shield program receives this PIN code ciphertext, after the number of characters that judges this PIN code ciphertext meets the PIN code input rule, the PIN code ciphertext is resolved, after successfully resolved, obtain PIN code, when this PIN code of judgement meets the PIN code input rule, by specific data interaction interface, empty all characters in the PIN code frame, and discharge the PIN code input system; U shield program does not meet the PIN code input rule, the PIN code ciphertext is resolved unsuccessfully, when the PIN code of obtaining is not met the PIN code input rule, all sent information to the user in judgement PIN code ciphertext.
Because middleware U shield program and PIN code input system as shown in Figure 5 all adopts specific data interaction interface, and the level of security of PIN code input system and client log in control and be consistent, and therefore, reduced the service time of client encryption and decryption; Simultaneously, adopt the method for dynamic generation encryption key due to the PIN code input system, therefore, guaranteed the uniqueness of encryption key, improved the fail safe of PIN code.
The present embodiment has been realized the authentication to the caller identity effectively by at the driving layer, PIN code being reinforced, and has prevented from driving the PIN code intercept operation of layer and application layer; Simultaneously, have the ability of stronger antibonding dish hook, can the keyboard hook of main flow be protected, interrupt the transmission of hook chain, prevented that effectively keyboard hook class trojan horse program to the security threat that PIN code causes, having strengthened the fail safe of PIN code.
With reference to Fig. 6, Fig. 6 is the client one example structure schematic diagram that the present invention is used for the PIN code security protection.As shown in Figure 6, the present invention comprises for the client of PIN code security protection: middleware 01 and PIN code input system 02.
Middleware 01 is used for, and loads PIN code input system 02, when loading successfully, by the data interaction interface, the PIN code input rule is set; Show the PIN code input frame, input PIN code for the user;
PIN code input system 02 is used for, and the PIN code of recording user input is encrypted and encodes to process described PIN code and obtains the PIN code ciphertext, and described PIN code ciphertext is sent to described middleware 01 by described data interaction interface;
Middleware 01 also is used for, and obtains the described PIN code ciphertext that described PIN code input system 02 transmits, and judges whether described PIN code ciphertext meets described PIN code input rule; If, decipher described PIN code ciphertext, obtain described PIN code.
Particularly, please referring again to Fig. 5, middleware 01 with the reciprocal process of PIN code input system 02 is:
After middleware 01 loads PIN code input system success and the PIN code input rule is set, for guaranteeing the fail safe of PIN code transmission, the specific data interaction interface of mutual employing of PIN code input system 02 and middleware 01.PIN code input system 02 is carried out initialization according to the PIN code input rule that middleware 01 arranges to this specific data interaction interface, and its specific implementation process is as follows:
<1>、void?Clear(void)
[function] empties the character in the PIN code frame.
<2>、void?GetLen(LONG?*nLen)
[function] obtains in the PIN code frame length of input character.
<3>、void?GetVerCtrl?(BSTR?*szVer)
[function] obtains PIN code system, the version number of control.
<4>、void?GetVerDrv?(BSTR?*szVer)
[function] obtains the PIN code system, drives the version number of file.
<5>、void?GetPin?(LPCTSTR?bstrRand,LPCTSTR?bstrContent,BSTR?*szPin)
[function] obtains the encrypt data of PIN code frame.
<6>、void?GetLastError(LONG?*nCode)
[function] obtains the last error code value of Pin code control.
<7>、void?InitPinInput(LONG?minLength,LONG?maxLength,LPCTSTR?strRand,LPCTSTR?strRule)
[function] PIN code input control system initialization interface.
<8>、void?FocusOnOrNot(LONG?*pRet)
[function] judges that current input focus is whether in pin code input frame control.
PIN code input system 02 is by the initialization to the data interactive interface, with the protection module independent of PIN code, make PIN code protection module call more convenient.
After the user opened middleware 01 and moves middleware 01, middleware 01 loaded PIN code input system 02; If load unsuccessfully, obtain and load failed error code, and point out the user this load unsuccessfully; If load successfully, by the safe interface that carries out data interaction with PIN code input system 02, the PIN code input rule is set; Described middleware 01 arranges the PIN code input rule and comprises: the minimum and maximum number of characters that character rule, permission input are set.
After setting was completed, middleware 01 showed the PIN code input frame, and the prompting user can input corresponding PIN code.
The user inputs corresponding PIN code in the PIN code input frame after, the PIN code of PIN code input system 02 recording user input at once simultaneously, is added up the number of characters of this PIN code, and at the driving layer, PIN code is encrypted.PIN code input system 02 is according to random number and preset the hard coded character string, obtains encryption key, at the driving layer, PIN code is encrypted.
When the PIN code of 02 pair of input of PIN code input system is encrypted, the mode of obtaining encryption key comprises: the PIN code input system generates one or more random numbers, directly with described random number as encryption key, perhaps this random number is encrypted computing, with the random number after encrypting as encryption key; The character string that presets as encryption key, perhaps is encrypted computing to this character string that presets, will presets character string as encryption key after encrypting; With the random number that generates and the character string that presets as encryption key, perhaps with this random number with preset character string and be encrypted computing, with above-mentioned cryptographic calculation result as encryption key.Above-mentioned related data is encrypted computing can adopts the 3DES cryptographic algorithm.The detailed process that PIN code input system 02 is obtained encryption key please refer to the specific descriptions of the described embodiment of Fig. 2, does not repeat them here.PIN code input system 02 utilizes encryption key that the PIN code of input is encrypted, and after obtaining the P1 ciphertext, then the P1 ciphertext is encoded, and obtains described PIN code ciphertext.PIN code input system 02 is sent to middleware 01 with the PIN code ciphertext by specific data interaction interface.Because encryption key is that PIN code input system 02 dynamically generates, therefore guaranteed the uniqueness of encryption key; And 02 pair of PIN code input system writes the P1 ciphertext of shared drive and has carried out the coding processing, makes the transmission of PIN code that fail safe more be arranged.
In the embodiment of the present invention, the method that 02 pair of P1 ciphertext of PIN code input system is encoded can adopt the BASE64 coded system.
Middleware 01 obtains the PIN code ciphertext that PIN code input system 02 transmits, and obtains simultaneously the number of characters of this PIN code ciphertext, judges whether the number of characters of this PIN code ciphertext meets the PIN code input rule.If the number of characters of this PIN code ciphertext does not meet the PIN code input rule, middleware 01 by specific data interaction interface, empties the character in the PIN code frame, and shows the PIN code input frame, requires the user to re-enter PIN code.If the number of characters of middleware 01 judgement PIN code ciphertext meets the PIN code input rule, resolve the PIN code ciphertext.Described middleware 01 is resolved the PIN code ciphertext and is adopted the decipherment algorithm suitable with PIN code input system 02, and described decipherment algorithm can be Secure Hash Algorithm; If PIN code input system 02 adopts the 3DES cryptographic algorithm, during 01 pair of PIN code decrypt ciphertext of middleware, also adopt the 3DES decipherment algorithm.If 01 pair of PIN code ciphertext of middleware is resolved unsuccessfully, send and resolve failed information, the prompting user fails and obtains described PIN code.
Middleware 01 is resolved the PIN code ciphertext, after getting PIN code, judges whether PIN code meets the PIN code input rule, if by the data interaction interface of PIN code input system 02, empty all characters in the PIN code frame, and discharge PIN code input system 02; If the PIN code after middleware 01 judgement is resolved does not meet the PIN code input rule, by the data interaction interface of PIN code input system 02, empty all characters in the PIN code frame, and show the PIN code input frame, require the user to re-enter PIN code.
Because middleware 01 and PIN code input system 02 all adopt specific data interaction interface, and the level of security of PIN code input system 02 and client log in control and be consistent, and therefore, reduced the service time of client encryption and decryption; Simultaneously, adopt the method for dynamic generation encryption key due to PIN code input system 02, therefore, guaranteed the uniqueness of encryption key, improved the fail safe of PIN code.
The present embodiment has been realized the authentication to the caller identity effectively by at the driving layer, PIN code being reinforced, and has prevented from driving the PIN code intercept operation of layer and application layer; Simultaneously, have the ability of stronger antibonding dish hook, can the keyboard hook of main flow be protected, interrupt the transmission of hook chain, prevented that effectively keyboard hook class trojan horse program to the security threat that PIN code causes, having strengthened the fail safe of PIN code.
The above is only the preferred embodiments of the present invention; not thereby limit its scope of the claims; every equivalent structure or equivalent flow process conversion that utilizes specification of the present invention and accompanying drawing content to do; directly or indirectly be used in other relevant technical fields, all in like manner be included in scope of patent protection of the present invention.