Summary of the invention
The embodiment of the present invention provides RSA Algorithm private key element acquisition methods and RSA Algorithm private key element deriving means, all can not meet the problem of the RSA Algorithm private key element demand of obtaining safety chip to solve existing method.
First aspect, the embodiment of the present invention provides a kind of RSA Algorithm private key element acquisition methods, and the method comprises:
Test patterns is set, and it is long that the bit length of described test patterns equals the bit of RSA PKI mould of tested safety chip, and described test patterns is comprised of height half part and low half part of bit appearance etc., and the bit of described low half part is long is t; By for described test patterns, different data being set, whether the RSA Algorithm private key element of testing described tested safety chip can obtain; When the RSA Algorithm private key element of described tested core can obtain, for described test patterns arranges preset data; According to the described preset data in described test patterns, the described low partly value of the t-1 bit of part is arranged; After described value setting of hanging down the t-1 bit of half part completes, according to the value to described low half part i bit, the data in rear described test patterns are set, the described low partly value of the i-1 bit of part is arranged, wherein i belongs to [2, t-1]; After the value setting of other bits of described low half part except the 0th bit completes, according to the data in described test patterns, value to described low half part the 0th bit is arranged, after the value setting of described low half part the 0th bit completes, the data in described low half part are a RSA Algorithm private key element of tested safety chip.
In conjunction with first aspect, in the first in possible implementation,
Described by for described test patterns, different data being set, whether the RSA Algorithm private key element of testing described tested safety chip can obtain, comprise: the value of the t bit of described test patterns is set to preset value, and the value of the 0th bit is set to 1, and the value of all the other all bits is set to 0; The first power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing; After obtaining the first power consumption curve, keep the value of all bits of described height half part constant, the value of the low all bits of half part is set to 1; The second power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing; More described the first power consumption curve with described the second power consumption curve in power consumption and whether consistent on the time.
The possible implementation in conjunction with the first of first aspect, at the second in possible implementation,
When the described private key of the RSA Algorithm when described tested core element can obtain, for described test patterns arranges preset data, be specially: when described the first power consumption curve and described the second power consumption curve in power consumption and when consistent on the time, keep the value of described height half part constant, the value of the described low all bits of half part is set to 0; Described according to the described preset data in described test patterns, the described low partly value of the t-1 bit of part is arranged, comprising: keep the value of other bit in described test patterns constant, the value of described low half part t-1 bit is revised as to 1; The 3rd power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing; More described the first power consumption curve with described the 3rd power consumption curve in power consumption and whether consistent on the time; When described the first power consumption curve and described the 3rd power consumption curve in power consumption and when consistent on the time, the value of described low half part t-1 bit is set to 1, perhaps, when described the first power consumption curve and described the 3rd power consumption curve, in power consumption or when inconsistent on the time, the value of described low half part t-1 bit is set to 0.
The possible implementation in conjunction with the first of first aspect, at the third in possible implementation,
Described basis arranges the data in rear described test patterns to the value of described low half part i bit, the described low partly value of the i-1 bit of part is arranged, comprise: keep value to the i bit that the value of other bits in rear described test patterns is set constant, the value of the i-1 bit of described low half part is set to 1; The 4th power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing; More described the first power consumption curve with described the 4th power consumption curve in power consumption and whether consistent on the time; When described the first power consumption curve and the 4th power consumption curve in power consumption and when consistent on the time, the value of the i-1 bit of described low half part is set to 1, perhaps, when described the first power consumption curve and described the 4th power consumption curve, in power consumption or when inconsistent on the time, the value of the i-1 bit of described low half part is set to 0.
The possible implementation in conjunction with the first of first aspect, in the 4th kind of possible implementation,
Described according to the data in described test patterns, value to described low half part the 0th bit is arranged, comprise: after the value setting of other bits of described low half part except the 0th bit completes, the 5th power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing; More described the first power consumption curve with described the 5th power consumption curve in power consumption and whether consistent on the time; When described the first power consumption curve and described the 5th power consumption curve, in power consumption and when consistent on the time, the value of the 0th bit of low half part is set to 1.
Second aspect, the embodiment of the present invention also provides a kind of RSA Algorithm private key element deriving means, and this device comprises:
Setting unit, for test patterns is set, it is long that the bit length of described test patterns equals the bit of RSA PKI mould of tested safety chip, and described test patterns is comprised of height half part and low half part of bit appearance etc., and the bit of described low half part is long is t; Test cell, for by for the described test patterns of described setting unit setting arranges different data, whether the RSA Algorithm private key element of testing described tested safety chip can obtain; Default unit, for the test when through described test cell, when the RSA Algorithm private key element of described tested core can obtain, for described test patterns arranges preset data; The first determining unit, the described preset data of presetting for the described default unit according to described test patterns, arranged the described low partly value of the t-1 bit of part; The second determining unit, after in described the first determining unit, the value setting of the t-1 bit of described low half part being completed, according to the value to described low half part i bit, the data in rear described test patterns are set, the described low partly value of the i-1 bit of part is arranged, wherein i belongs to [2, t-1]; The 3rd determining unit, after in described the second determining unit, the value setting of other bits of described low half part except the 0th bit being completed, according to the data in described test patterns, value to described low half part the 0th bit is arranged, after the value setting of described low half part the 0th bit completes, the data in described low half part are a RSA Algorithm private key element of tested safety chip.
In conjunction with second aspect, in the first, in possible implementation, described test cell comprises:
First arranges subelement, for the value of the t bit of described test patterns, is set to preset value, and the value of the 0th bit is set to 1, and the value of all the other all bits is set to 0; First generates subelement, the first power consumption curve while for obtaining described tested safety chip, the data of the first generation subelement setting described in described test patterns being carried out to computing; Second arranges subelement, after at described the first generation subelement, obtaining the first power consumption curve, keeps the value of all bits of described height half part constant, and the value of the low all bits of half part is set to 1; Second generates subelement, the second power consumption curve while for obtaining described tested safety chip, the data of the second generation subelement setting described in described test patterns being carried out to computing; First compares subelement, for the more described first described the first power consumption curve and described second that generates the subelement generation, generates the described second power consumption curve of subelement generation in power consumption and whether consistent on the time.
The possible implementation in conjunction with the first of second aspect, at the second in possible implementation,
Described default unit, specifically for when described the first power consumption curve and described the second power consumption curve in power consumption and when consistent on the time, keep the value of described height half part constant, the value of the described low all bits of half part is set to 0;
Described the first determining unit comprises: first revises subelement, constant for the value that keeps described other bit of test patterns, and the value of described low half part t-1 bit is revised as to 1; The 3rd generates subelement, for obtain described tested safety chip to described test patterns the 3rd power consumption curve when the amended data of the first modification subelement are carried out computing; Second compares subelement, for the more described first described the first power consumption curve and the described the 3rd that generates the subelement generation, generates described the 3rd power consumption curve of subelement generation in power consumption and whether consistent on the time; First determines subelement, for according to the described second comparative result that compares subelement, the described low partly value of the t-1 bit of part being arranged, when described the first power consumption curve and described the 3rd power consumption curve in power consumption and when consistent on the time, the value of described low half part t-1 bit is set to 1, perhaps, when described the first power consumption curve and described the 3rd power consumption curve, in power consumption or when inconsistent on the time, the value of described low half part t-1 bit is set to 0.
The possible implementation in conjunction with the first of second aspect, at the third, in possible implementation, described the second determining unit comprises:
Second revises subelement, after completing for the value setting of the t-1 bit to described low half part, keep value to the i bit that the value of other bits in rear described test patterns is set constant, the value of the i-1 bit of described low half part is set to 1, wherein i belongs to [2, t-1]; The 4th generates subelement, for obtain described tested safety chip to described test patterns the 4th power consumption curve when the amended data of the second modification subelement are carried out computing; The 3rd compares subelement, for the more described first described the first power consumption curve and the described the 4th that generates the subelement generation, generates described the 4th power consumption curve of subelement generation in power consumption and whether consistent on the time; Second determines subelement, for according to the described the 3rd comparative result that compares subelement, the described low partly value of the i-1 bit of part being arranged, when described the first power consumption curve and the 4th power consumption curve in power consumption and when consistent on the time, the value of the i-1 bit of described low half part is set to 1, perhaps, when described the first power consumption curve and described the 4th power consumption curve, in power consumption or when inconsistent on the time, the value of the i-1 bit of described low half part is set to 0.
The possible implementation in conjunction with the first of second aspect, in the 4th kind of possible implementation, described the 3rd determining unit comprises:
The 5th generates subelement, after completing for the value setting at other bits of described low half part except the 0th bit, and the 5th power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing; The 4th compares subelement, for the more described first described the first power consumption curve and the described the 5th that generates the subelement generation, generates described the 5th power consumption curve of subelement generation in power consumption and whether consistent on the time; The 3rd determines subelement, for according to the described the 4th comparative result that compares subelement, the described low partly value of the 0th bit of part being arranged, when described the first power consumption curve and described the 5th power consumption curve, in power consumption and when consistent on the time, the value of the 0th bit of low half part is set to 1.
Compared with prior art, the RSA Algorithm private key element acquisition methods that the embodiment of the present invention provides and RSA Algorithm private key element deriving means, can effectively obtain the RSA Algorithm private key element of safety chip, can meet the demand of obtaining RSA Algorithm private key element, for the RSA Algorithm private key that generates safety chip provides condition.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out to clear, complete description, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making under the creative work prerequisite the every other embodiment obtained, belong to the scope of protection of the invention.
Secondly, the present invention is described in detail in conjunction with schematic diagram, when the embodiment of the present invention is described in detail in detail; for ease of explanation; the profile of indication device structure can be disobeyed general ratio and be done local the amplification, and described schematic diagram is example, and it should not limit the scope of protection of the invention at this.The three-dimensional space that in actual fabrication, should comprise in addition, length, width and the degree of depth.
Referring to Fig. 1, be the flow chart of an embodiment of RSA Algorithm private key element acquisition methods of the present invention, the method comprises the steps:
Step 101, arrange test patterns, and it is long that the bit length of described test patterns equals the bit of RSA PKI mould of tested safety chip, and described test patterns is comprised of height half part and low half part of bit appearance etc., and the bit of described low half part is long is t.
Obtain safety chip, i.e. the RSA Algorithm private key element of tested safety chip, at first need, according to the bit length of the RSA PKI mould of tested safety chip, a test patterns is set, and this test patterns can mean with C.Test patterns C can be the memory space of a regular length, it is long that the bit length of test patterns C equals the bit of RSA PKI mould, the long bit for RSA PKI mould of bit that is memory space is long, because the bit long of RSA PKI key mould in actual use is generally even number, test patterns C is comprised of the contour half part CH of bit appearance and low half part CL, i.e. C=CH||CL.The value of each bit of test patterns C can be arranged as required or be revised, by the data in test patterns C, arranged, finally obtain RSA Algorithm private key element, the data that the data setting in test patterns C is being kept in memory space are arranged.
Because the bit of RSA PKI mould is long, it is even number, the bit length of RSA PKI mould can mean by 2t, when the bit length of RSA PKI mould is 2t, the height half part CH of test patterns C is t with the bit length of low half part CL, each bit of high half part CH can be labeled as from high to low 2t-1,2t-2 ..., t; Each bit of low half part CL can be labeled as from high to low t-1, t-2 ..., 0; The highest-order bit of high half part CH is the 2t-1 bit, and the lowest bit position of high half part CH is the t bit, and the highest-order bit of low half part CL is the t-1 bit, and the lowest bit position of low half part CL is the 0th bit; The first RSA Algorithm private key element p or the second RSA Algorithm private key element q bit length are also t usually, thus be the bit of the chip modulus m that carries out RSA-test patterns CRT modulo operation long be also t.For example, when the bit length of RSA PKI mould is 1024 bit, high half part CH is also that 512, m is also that 512 bits are long with the bit length that the bit length of hanging down half part CL is 512, the first RSA Algorithm private key element p or the second RSA Algorithm private key element q.
Step 102, by for described test patterns, different data being set, whether the RSA Algorithm private key element of testing described tested safety chip can obtain.
Use method of the present invention to obtain RSA Algorithm private key element, when during precondition, chip is signed at data decryption or to data, will carry out direct modulo operation.Therefore at first to judge that whether safety chip carries out modulo operation when carrying out data signature or deciphering, obtains RSA Algorithm private key element when comprising modulo operation again.Due to tested safety chip, data are signed or decrypted packet when the modulo operation, whether carry out the relation that the delivery process depends on input data and modulus m, when the input data are more than or equal to m, need execution delivery process; When the input data are less than m, without carrying out the delivery process.Therefore can, by setting two different values, whether carry out the delivery process while according to tested safety chip, these two different values being processed and judge.
When whether the RSA Algorithm private key element of the tested safety chip of test can obtain, at first for test patterns C, a preset value is set.When for test patterns C, preset value being set, can be arranged respectively height half part CH and low half part CL.
In the ordinary course of things the value of the t bit of test patterns C is made as to 0, and then the value that other bits are set tested, specifically, the value of all bits of height half part CH of test patterns C is set to 0; And the value that will hang down the 0th bit of half part CL is made as 1, the value of other bits of low half part CL all is made as 0,, the value of the 0th bit of test patterns C is made as to 1 that is, and the value of all the other bits all is set to 0.After for test patterns C, setting up preset value, the data in test patterns C can be designated as C1.
Data C1 in test patterns C is input in tested safety chip as the input data, tested safety chip can carry out computing according to the input data, the first power consumption curve when by the energy spectrometer instrument, obtaining tested safety chip and carry out computing, this first power consumption curve can be designated as TraceL.
After obtaining the first power consumption curve, keep the value of high half part CH in test patterns C constant, and the value of the low all bits of half part CL is set to 1, now the data in test patterns C can be designated as C2; Data C2 in test patterns C is input in tested safety chip as the input data, the second power consumption curve when by the energy spectrometer instrument, obtaining tested safety chip and carry out computing, this second power consumption curve can be designated as TraceH.
The information such as the power consumption curve got due to the energy spectrometer instrument has embodied tested safety chip when the input data are processed required time, power consumption, so TraceL and obtain TraceH and embodied time or the power consumption that tested safety chip consumes when C1, two different data of C2 are processed.Therefore by contrast TraceL and TraceH.Can know chip power consumption or temporal difference when processing two different input data, according to comparison result, judgement can judge whether the RSA Algorithm private key element of tested safety chip can obtain, if TraceL and TraceH are variant, the RSA Algorithm private key element that this chip is described can obtain, if TraceL and TraceH indifference, can further be tested chip.
Also the value of the t bit of test patterns C can be made as to 1 in the other situation, and then the value that other bits are set is tested, specifically, the value of the t bit of the height of test patterns C half part CH is made as to 1, the value of other bits of high half part CH all is made as 0, and the value that will hang down the 0th bit of half part CL is made as 1, the value of other bits of low half part CL all is made as 0,, the value of the t bit of test patterns C and the 0th bit is made as to 1, and the value of all the other bits all is set to 0.Then use the aforementioned process of obtaining and comparing TraceL and TraceH, according to comparison result, judgement can judge whether the RSA Algorithm private key element of tested safety chip can obtain, if TraceL and TraceH are variant, the RSA Algorithm private key element that this chip is described can obtain, if TraceL and TraceH indifference, can further be tested chip.
When chip is tested, if first the value of the t bit of test patterns C is made as to 1, the test draw TraceL and TraceH indifference as a result the time, the value of the t bit of test patterns C can be made as to 0, and then tested, if still draw the test result of two power consumption curve indifferences, so just the RSA Algorithm private key element of tested safety chip can not obtain, otherwise, if two power consumption curves are variant, can draw the retrievable conclusion of RSA Algorithm private key element of tested safety chip.
Same, when chip is tested, if first the value of the t bit of test patterns C is made as to 0, the test draw TraceL and TraceH indifference as a result the time, the value of the t bit of test patterns C can be made as to 1, and then tested, if still draw the test result of two power consumption curve indifferences, so just the RSA Algorithm private key element of tested safety chip can not obtain, otherwise, two power consumption curves are variant, can draw the retrievable conclusion of RSA Algorithm private key element of tested safety chip.Concrete test process, referring to aforementioned, just repeats no more at this.
At this, it should be noted that, the present invention does not do restriction to the order of obtaining the first power consumption curve TraceL and obtain the second power consumption curve TraceH, can first obtain wherein any one.
Step 103, when the RSA Algorithm private key element of described tested core can obtain, for described test patterns arranges preset data.
When through to the comparison of TraceL and TraceH, determine when variant between the two, illustrate that tested safety chip can carry out modulo operation when data being decrypted or signing, the RSA Algorithm private key element of tested safety chip can obtain.Now can judge the whether retrievable process of tested safety chip RSA Algorithm private key element according to aforementioned, data in test patterns C are arranged, specifically, due to when obtaining TraceL and TraceH, height half part CH is set to a preset value, as TraceL and TraceH, when variant, need to keep the value of high half part CH in test patterns C constant, the value that then will hang down each bit of half part CL all is set to 0.
Step 104, according to the described preset data in described test patterns, arranged the described low partly value of the t-1 bit of part.
When chip utilizes Chinese remainder theorem to be accelerated the processing procedure of signature or deciphering, whether carry out the relation that the delivery process depends on input data and modulus m in processing procedure to the input data, therefore can be by input different input data to tested safety chip, then by being to judge whether that delivery judges the magnitude relationship of input data and m, input data by modification, make to input data approximation in m, and then obtain the value of m.
The highest-order bit to low half part CL, when the value of the t-1 bit of test patterns C is arranged, can keep the value of other bits in test patterns C constant, and the value of low half part CL t-1 bit is revised as to 1; The 3rd power consumption curve when obtaining described tested safety chip the data C3 in test patterns C being carried out to computing, the 3rd power consumption curve can be designated as Trace (t).Then relatively the first power consumption curve TraceL with the 3rd power consumption curve Trace (t) in power consumption and whether consistent on the time; Finally according to comparative result, the value to the t-1 bit of low half part CL is arranged, and when TraceL is consistent with Trace (t), the value of the t-1 bit of low half part CL is set to 1; As TraceL and Trace (t), when inconsistent, the value of the t-1 bit of low half part CL is set to 0.
Step 105, after described value setting of hanging down the t-1 bit of half part completes, according to the value to described low half part i bit, the data in rear described test patterns are set, the described low partly value of the i-1 bit of part is arranged, wherein i belongs to [2, t-1].
After the value setting to the t-1 bit completes, at first from the height low level that puts in place, successively the remaining bits position except the 0th bit low half part CL is arranged, be set to be designated as the i-1 bit, when the value of i-1 bit is arranged, need to use the value to the i bit that the data in rear test patterns C are set, wherein i belongs to [2, t-1], that is, from the higher bit position to low bit, by bit, the value to low half part CL t-2 bit to the 1 bit is arranged.For example, when the value of the 510th bit in test patterns C is arranged, need to use the value to the 511st bit in test patterns C that the data in rear test patterns C are set.
Specifically: when the i-1 bit to low half part CL is arranged, keep value to the i bit that the value of other bits in rear test patterns C is set constant, the value of the i-1 bit of low half part CL is set to 1; The 4th power consumption curve when then obtaining described tested safety chip the data C4 in test patterns C being carried out to computing, the 4th power consumption curve can be designated as Trace (i); More described TraceL with Trace (i) in power consumption and whether consistent on the time; Finally according to comparative result, the value to the i-1 bit of low half part CL is arranged, when TraceL is consistent with Trace (i), the value of the i-1 bit of low half part CL is set to 1, perhaps, as TraceL and Trace (i), when inconsistent, the value of the current bit of low half part CL is set to 0.
Step 106, after the value setting to other bits of described low half part except the 0th bit completes, according to the data in described test patterns, value to described low half part the 0th bit is arranged, after the value setting of described low half part the 0th bit completes, the data in described low half part are a RSA Algorithm private key element of tested safety chip.
After the value setting of other bits to outside low half part CL the 0th bit completes, value to the 0th bit of low half part CL, while being arranged, when the value of the 0th bit of low half part CL is arranged, at first obtain the 5th power consumption curve of described tested safety chip when in test patterns C, existing data C5 carries out computing, the 5th power consumption curve can be designated as Trace(0); Then compare TraceL and Trace(0) in power consumption and whether consistent on the time; As TraceL and Trace(0) when consistent, the value of the 0th bit of low half part CL is set to 1.After the value setting of low half part CL the 0th bit completes, the data of low half part CL are a RSA Algorithm private key element of tested safety chip.
Can find out from above-described embodiment, adopt method provided by the invention, can effectively obtain the RSA Algorithm private key element of safety chip.
Referring to Fig. 2, be the flow chart of another embodiment of RSA Algorithm private key element acquisition methods of the present invention, this embodiment describes the overall process of obtaining tested safety chip RSA Algorithm private key element in detail.
Step 201, arrange test patterns, and it is long that the bit length of described test patterns equals the bit of RSA PKI mould of tested safety chip, and described test patterns is comprised of height half part and low half part of bit appearance etc., and the bit of described low half part is long is t.
Step 202, the value of all bits by described test patterns except the 0th bit all is set to 0.
Step 203, the first power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing.
Step 204, after obtaining the first power consumption curve, keep the value of all bits of described height half part constant, and the value of the low all bits of half part all is set to 1.
Step 205, the second power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing.
Step 206, more described the first power consumption curve with described the second power consumption curve in power consumption and whether consistent on the time.
Step 207, in power consumption and when consistent on the time, keep the value of all bits of described height half part constant when described the first power consumption curve and described the second power consumption curve, and the value of the described low all bits of half part all is set to 0.
Step 208, keep the value of other bits in described test patterns constant, and the value of described test patterns t-1 bit is revised as to 1.
Step 209, the 3rd power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing.
Step 210, more described the first power consumption curve with described the 3rd power consumption curve in power consumption and whether consistent on the time.
Step 211, when described the first power consumption curve and described the 3rd power consumption curve in power consumption and when consistent on the time, the value of described low half part t-1 bit is set to 1, perhaps, when described the first power consumption curve and described the 3rd power consumption curve, in power consumption or when inconsistent on the time, the value of described low half part t-1 bit is set to 0.
Step 212, keep value to the i bit that the value of other bits in rear described test patterns is set constant, and the value of the i-1 bit of described low half part is set to 1, and wherein i belongs to [2, t-1].
Step 213, the 4th power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing.
Step 214, more described the first power consumption curve with described the 4th power consumption curve in power consumption and whether consistent on the time.
Step 215, when described the first power consumption curve and the 4th power consumption curve in power consumption and when consistent on the time, the value of the i-1 bit of described low half part is set to 1, perhaps, when described the first power consumption curve and described the 4th power consumption curve, in power consumption or when inconsistent on the time, the value of the i-1 bit of described low half part is set to 0.
Step 216, after the value setting to other bits of described low half part except the 0th bit completes, the 5th power consumption curve when obtaining described tested safety chip the data in described test patterns being carried out to computing.
Step 217, more described the first power consumption curve with described the 5th power consumption curve in power consumption and whether consistent on the time.
Step 218, when described the first power consumption curve and described the 5th power consumption curve in power consumption and when consistent on the time, the value of the 0th bit of low half part is set to 1, after the value setting of the low all bits of half part CL completes, the data of low half part CL are a RSA Algorithm private key element of tested safety chip A algorithm chip.
Can find out from above-described embodiment, adopt method provided by the invention, can effectively obtain the RSA Algorithm private key element of safety chip.
Corresponding with the RSA Algorithm private key element acquisition methods of safety chip of the present invention, the present invention also provides the RSA Algorithm private key element deriving means of safety chip.
Referring to Fig. 3, it is an embodiment block diagram of RSA Algorithm private key element deriving means of the present invention.
This device comprises: setting unit 301, test cell 302, default unit 303, the first determining unit 304, the second determining unit 305, the three determining units 306.
Wherein, described setting unit 301, for test patterns C is set, it is long that the bit length of described test patterns C equals the bit of RSA PKI mould of tested safety chip, described test patterns is comprised of height half part and low half part of bit appearance etc., and the bit of described low half part is long is t.
Obtain the RSA Algorithm private key element of tested safety chip, at first setting unit 301 needs, according to the bit length of the RSA PKI mould of tested safety chip, a test patterns C is set.It is long that the bit length of test patterns C equals the bit of RSA PKI mould, and test patterns C is comprised of the contour half part CH of bit appearance and low half part CL, i.e. C=CH||CL.The value of each bit of test patterns C can be arranged as required or be revised.
Described test cell 302, arrange different data for the described test patterns by arranging for described setting unit 302, and whether the RSA Algorithm private key element of testing described tested safety chip can obtain.
Whether at the RSA Algorithm private key element of the tested safety chip of test can obtain the time, at first test cell 302 is arranged the value of each bit of test patterns C.In the ordinary course of things the value of the t bit of test patterns C is made as to 0, and then the value that other bits are set is tested; When needs are further tested, then the value of the t bit of test patterns C is made as to 0, and then the value that other bits are set is tested; Perhaps, also the value of the t bit of test patterns C can be made as to 1, and then the value that other bits are set is tested; When needs are further tested, then the value of the t bit of test patterns C is made as to 0, and then the value that other bits are set is tested.Concrete test process can, referring to previous embodiment, just repeat no more at this.
Described default unit 303, for the test when through described test cell 302, when the RSA Algorithm private key element of described tested core can obtain, for described test patterns C arranges preset data.
When through the test of test cell 302, and determine when variant between the two to TraceL and TraceH, illustrate that tested safety chip can carry out modulo operation when data being decrypted or signing, the RSA Algorithm private key element of tested safety chip can obtain.Now default unit 303 can judge the whether retrievable process of tested safety chip RSA Algorithm private key element according to aforementioned, data in test patterns C are arranged, specifically, due to when obtaining TraceL and TraceH, CH is set to a preset value, as TraceL and TraceH, when variant, keep the value of high half part CH in test patterns C constant, the value that then will hang down each bit of half part CL all is set to 1.
Described the first determining unit 304, for the default described preset data in described default unit 303 according to described test patterns, arranged the described low partly value of the t-1 bit of part.
When the t-1 bit of the low half part CL of the first 304 pairs of determining units is arranged, can keep the value of other bits in test patterns C constant, the value of low half part CL t-1 bit is revised as to 1; The 3rd power consumption curve when obtaining described tested safety chip the data C3 in test patterns C being carried out to computing; The 3rd power consumption curve can be designated as Trace (t), can more described the first power consumption curve TraceL with described the 3rd power consumption curve Trace (t) in power consumption and whether consistent on the time; When described TraceL is consistent with described Trace (t), the value of the t-1 bit of low half part CL is set to 1; As described TraceL and described Trace (t), when inconsistent, the value of the t-1 bit of low half part CL is set to 0.
Described the second determining unit 305, after in described the first determining unit 304, the value setting of the t-1 bit of described low half part being completed, according to the value to described low half part i bit, the data in rear described test patterns are set, the described low partly value of the i-1 bit of part is arranged, wherein i belongs to [2, t-1].
The second determining unit 305, when the i-1 bit is arranged, keeps value to the i bit that the value of other bits in rear test patterns C is set constant, and the value of the i-1 bit of low half part CL is set to 1; The 4th power consumption curve when obtaining described tested safety chip the data C4 in test patterns C being carried out to computing, the 4th power consumption curve can be designated as Trace (i); More described TraceL with Trace (i) in power consumption and whether consistent on the time; When TraceL is consistent with Trace (i), the value of the i-1 bit of low half part CL is set to 1, or, when TraceL and Trace (i) are inconsistent, the value of hanging down the current bit of half part CL is set to 0.
Described the 3rd determining unit 306, after completing for the value setting according at other bits of 305 pairs of described low half parts of described the second determining unit except the 0th bit, according to the data in described test patterns, value to described low half part the 0th bit is arranged, after the value setting of described low half part the 0th bit completes, the data in described low half part are a RSA Algorithm private key element of tested safety chip.
The 3rd determining unit 306 is after the value setting of other bits to outside low half part CL the 0th bit completes, value to the lowest bit position of low half part CL, the i.e. value of the 0th bit, while being arranged, at first obtain the 5th power consumption curve of described tested safety chip when in test patterns C, existing data C5 carries out computing, the 5th power consumption curve can be designated as Trace (0), relatively TraceL with Trace (0) in power consumption and whether consistent on the time; When TraceL is consistent with Trace (0), the value of the 0th bit of low half part CL is set to 1, after the value setting of low half part CL the 0th bit completes, the data of low half part CL are a RSA Algorithm private key element of tested safety chip.
Need two RSA Algorithm private key elements when encrypting due to RSA Algorithm, two RSA Algorithm private key elements can mean with p and q, because method provided by the invention can be obtained a RSA Algorithm private key element p, so PKI N and e based on known, by calculating N/p(or q), obtain the value of another prime number q; By calculating e about (p-1) and (q-1) contrary, can calculate dp, dq; Finally, by calculating contrary about p of q, obtain complete RSA_CRT key pair.
Can find out from above-described embodiment, adopt safety chip RSA Algorithm private key element deriving means provided by the invention, can effectively obtain a RSA Algorithm private key element of the RSA Algorithm of safety chip.
Referring to Fig. 4, it is an embodiment block diagram of RSA Algorithm private key element deriving means test cell of the present invention.
This test cell comprises: first arranges subelement 401, the first generation subelements 402, the second arranges relatively subelement 405 of subelement 403, the second generation subelements 404, the first.
Wherein, described first arranges subelement 401, for the value of the t bit of described test patterns, is set to preset value, and the value of the 0th bit is set to 1, and the value of all the other all bits is set to 0, and described preset value is 0 or 1.
Described first generates subelement 402, the first power consumption curve TraceL while for obtaining described tested safety chip, the data C1 that described in described test patterns C, the first generation subelement 401 arranges being carried out to computing.
Described second arranges subelement 403, after at described the first generation subelement 402, obtaining the first power consumption curve TraceL, keeps the value of high half part CH constant, and the value of low half each bit of part CL all is set to 1.
Described second generates subelement 404, the second power consumption curve TraceH while for obtaining described tested safety chip, the data C2 that described in described test patterns C, the second generation subelement 403 arranges being carried out to computing.
Described first compares subelement 405, for the more described first described the first power consumption curve TraceL and described second that generates subelement 402 generations, generates the described second power consumption curve TraceH of subelement 404 generations in power consumption and whether consistent on the time.
From above-described embodiment, can find out, the test cell of invention safety chip RSA Algorithm private key element deriving means, can whether obtain and judge the RSA Algorithm private key element of tested safety chip, for obtaining a ready condition of RSA Algorithm private key element of RSA Algorithm.
Referring to Fig. 5, it is an embodiment block diagram of RSA Algorithm private key element deriving means of the present invention the first determining unit.
This first determining unit comprises: first revises subelement 501, the three generates the relatively definite subelement 504 of subelement 503, the first of subelement 502, the second.
Wherein, described first revises subelement 501, constant for the value that keeps described other bits of test patterns C, and the value of described low half part CL t-1 bit is revised as to 1.
The described the 3rd generates subelement 502, for obtain described tested safety chip to described test patterns C the 3rd power consumption curve Trace (t) when the amended data C3 of the first modification subelement 501 carries out computing.
Described second compares subelement 503, for the more described first described the first power consumption curve TraceL and the described the 3rd that generates the subelement generation, generates described the 3rd power consumption curve Trace (t) of subelement 502 generations in power consumption and whether consistent on the time.
Described first determines subelement 504, value for the comparative result according to described the second comparison subelement 503 to the t-1 bit of described low half part CL is arranged, as described the first power consumption curve TraceL and described the 3rd power consumption curve Trace (t) in power consumption and when consistent on the time, the value of described low half part CL t-1 bit is set to 1, perhaps, when described the first power consumption curve and described the 3rd power consumption curve, in power consumption or when inconsistent on the time, the value of described low half part CL t-1 bit is set to 0.
Can find out that from above-described embodiment the first determining unit of invention safety chip RSA Algorithm private key element deriving means can be arranged the value of low half part CL the highest-order bit, for obtaining a ready condition of RSA Algorithm private key element of RSA Algorithm.
Referring to Fig. 6, it is an embodiment block diagram of RSA Algorithm private key element deriving means of the present invention the second determining unit.
This second determining unit comprises: second revises subelement 601, the four generates the relatively definite subelement 604 of subelement 603, the second of subelement 602, the three.
Wherein, second revises subelement 601, after described value setting of hanging down the t-1 bit of half part CL is completed, the value that maintenance arranges other bits in rear described test patterns C to the value of i bit is constant, the value of the i-1 bit of described low half part CL is set to 1, wherein i belongs to [2, t-1].
The 4th generates subelement 602, for obtain described tested safety chip to described test patterns C the 4th power consumption curve Trace (i) when the amended data C4 of the second modification subelement 601 carries out computing.
The 3rd compares subelement 603, for the more described first described the first power consumption curve TraceL and the described the 4th that generates the subelement generation, generates described the 4th power consumption curve Trace (i) of subelement 604 generations in power consumption and whether consistent on the time.
Second determines subelement 604, value for the comparative result according to described the 3rd comparison subelement to the i-1 bit of described low half part CL is arranged, as described the first power consumption curve TraceL and the 4th power consumption curve Trace (i) in power consumption and when consistent on the time, the value of the i-1 bit of described low half part CL is set to 1, perhaps, as described the first power consumption curve TraceL and described the 4th power consumption curve Trace (i), when inconsistent, the value of the i-1 bit of described low half part CL is set to 0.
From above-described embodiment, can find out, the second determining unit of invention safety chip RSA Algorithm private key element deriving means, can the value of low other bits of half part CL except the highest-order bit and lowest bit position be arranged, for obtaining a ready condition of RSA Algorithm private key element of RSA Algorithm.
Referring to Fig. 7, it is an embodiment block diagram of RSA Algorithm private key element deriving means of the present invention the 3rd determining unit.
The 3rd determining unit comprises: the 5th generates the relatively definite subelement 703 of subelement 702, the three of subelement 701, the four.
Wherein, the described the 5th generates subelement 701, after in described the second determining unit, the value setting of described low other bits of half part CL except the 0th bit being completed, the 5th power consumption curve Trace(0 when obtaining described tested safety chip the data C5 in described test patterns C being carried out to computing).
The described the 4th compares subelement 702, for the more described first described the first power consumption curve TraceL and the described the 5th that generates the subelement generation, generates described the 5th power consumption curve Trace(0 that subelement 701 generates) in power consumption and whether consistent on the time.
The described the 3rd determines subelement 703, value for the comparative result according to described the 4th comparison subelement 702 to the 0th bit of described low half part CL is arranged, as described the first power consumption curve TraceL and described the 5th power consumption curve Trace(0) in power consumption and when consistent on the time, the value of the 0th bit of low half part CL is set to 1.
Can find out that from above-described embodiment the 3rd determining unit of invention safety chip RSA Algorithm private key element deriving means can be arranged the value of low half part CL the 0th bit, for obtaining a ready condition of RSA Algorithm private key element of RSA Algorithm.
Those skilled in the art can be well understood to the mode that technology in the embodiment of the present invention can add essential general hardware platform by software and realize.Understanding based on such, the part that technical scheme in the embodiment of the present invention contributes to prior art in essence in other words can embody with the form of software product, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprise that some instructions are with so that a computer equipment (can be personal computer, server, or the network equipment etc.) carry out the described method of some part of each embodiment of the present invention or embodiment.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and between each embodiment, identical similar part is mutually referring to getting final product, and each embodiment stresses is the difference with other embodiment.Especially, for system embodiment, due to it, substantially similar in appearance to embodiment of the method, so description is fairly simple, relevant part gets final product referring to the part explanation of embodiment of the method.
Above-described embodiment of the present invention, do not form limiting the scope of the present invention.Any modification of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., within all should being included in protection scope of the present invention.