版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、data encryptionfirst synopsisin the open correspondence and in the computer system, builds the safe reliable electronic commerce platform is very important. usually needs through the encryption method to the customer related information, like the password, the contract and so on to protect, causes i
2、t not to steal or the distortion. when the customer hands in the service application, must to the customer status validity, the text integrity carry on the confirmation.hmac (keyed-hashing for message authentication) is a public agreement. it is one kind based on keys text complete proof technique,
3、its security is the establishment in the hash algorithm foundation. it requests the correspondence both sides shared system key, the agreement algorithm, to carry on the hash operation to the text, like md5, sha, ripemd and so on, form the fixed length the authentication code. correspondence both si
4、des determine the text through the authentication codes verification the validity. this agreement may use for to make the encryption, the digital signature, the text confirmation and so on. hmac may with any iteration hashing function bundle use. md5 and sha-1 are this kind of hashing functions.this
5、 kind of structures leading role is:1. does not need the revision to be possible to use the suitable hashing function. moreover the hashing function displays in the software aspect is very good. and the sound code is public and general. 2. maintain the hashing function original performance, but does
6、 not cause its degeneration. 3. cause reasonably based on about first floor hashing function supposition message discrimination mechanism encryption strength analysis. 4. when discovers either needs the operating speed is quicker or the safer hashing function, may very easy realize the first floor h
7、ashing function replace.annotation: when comp book documents, md5 and sha-1 are use the most widespread encryption to use the hashing function.second hmac algorithm principles2.1 hmac algorithm definition:expresses as follows with the formula:hmac=h(key or opad ,h(key or ipad,text)h(x, y) expression
8、 carries on one kind of hash operation to x + y news.representative ipad is redundant b time single byte hexadecimal system system constant ox36;representative opad is redundant b time single byte hexadecimal system constant ox5c; key represents 64 bytes strings of character, is composed of the key,
9、 insufficient makes up 0; text represents the random length text;key length l byte. when is bigger than b, passes through the hash computation to form l byte peru key (b is first in the hash algorithm an iterative computation block data byte count; l is the hash algorithm forms the text abstract the
10、 byte count, in md5 is in 16, sha-1 is 20).2.2 algorithm step(1) increases behind key k 0 founds a word length is the b string of character. (e.g., if the k word length is 20 bytes, b=60 byte, then after k, will join 44 zero byte 0x00), if the k length will be bigger than time b, should undergo hash
11、ing function processing.if (key_len 64) md5_ctx tctx; md5init(&tctx); md5update(&tctx, key, key_len); md5final(tk, &tctx); key = tk; key_len = 16;(2) on one step will produce the b word lengths string of character and ipad make the or else. k_ipadi = 0x36;(3) fills data stream text to the second ste
12、p result string of character.(4) affects with h in the data stream which third step produces. transfer hashing function (md5, sha-1)(5) the b word length string of character which and opad first step produces does the or else. k_opadi = 0x5c;(6) enters again the fourth step result packing in the fif
13、th step result.(7) affects with h in the data stream which sixth step produces, the output final outcome.2.3 md5 algorithmthe md5 algorithm by circulates many times to the random length news the iterative hash operation, forms 16 byte text abstract finally. this abstract has uniqueness to the text,
14、may take the authentication code. under target computers computation speed, this abstract is difficulty with explains(1) the text fillsthe md5 algorithm request carries on the packing to the random length text, the constitution n64 byte news grouping, n is an integer. and each grouping padding data
15、is divided 2 steps. first, the packing causes the data position length exactly for (n64-8) the byte number, namely in text valid data replacement 1 0x1, other makes up 0x0 to satisfy the above request. then, again on replacement 8 bytes (64) before text data length (packing, byte count). thus, the d
16、ata by the packing is 64byte (512bit) integral multiple. also divides 16 4 byte sub-groupings.(2) initialization md5 parameter the 4 4 byte shift quantity (a, b, c, d) use for to take the text abstract the starting value: a=0x01234567 b=0x89abcdef c=0xfedcba98 d=0x76543210(3) algorithm the md5 algor
17、ithm is to the news grouping in turn iterative algorithm. 1st time operates the starting value is abcd, each iterative computations result will replace later abcd to take the next time starting value, altogether will undergo n time iterative computation, will obtain this news text abstract.2.4 reali
18、ze the stepthe first step: increases fillsincreases padding to cause the data length (bit is unit) the mold 512 is 448. if the data length happen to is the mold 512 is 448, increases 512 to fill bit, i.e. fills the integer is 1-512. first bit is 1, other are 0 completely.the second step: makes up le
19、ngththe data length transformation is the 64bit value, if the length surpasses the data length scope which 64bit can express, the value retains finally 64bit, increases behind data which fills to front, causes the final data is the 512bit integral multiple. is also the 32bit 16 time of integral mult
20、iples. in rfc1321, 32bit is called word.the third step: initialization variable with to 4 variables, respectively is a, b, c, d, is 32bit is long. the initialization is: a: 01 23 45 67 b: 89 ab cd ef c: fe dc ba 98 d: 76 54 32 10the fourth step: data processing first defines 4 auxiliary functions: f
21、(x, y, z) g(x, y, z) h(x, y, z) i(x, y, z) in which: x&y expresses according to the position and, x | y expressed that according to the position or, not(x) expressed takes according to the position instead. xor expresses according to the position different or. in the function x, y, z are 32bit. defi
22、nes the array which needs to use: the t(i), i value 1-64, t(i) was equal to that abs(sin(i) 4294967296 time of integral part, i is a radian.after the supposition first three step processing data length is 32*16*nbitthe fifth step: output: obtains finally abcd is the output result, altogether 128bit.
23、 a is the low position, d is a top digit.third keyuse in hmac the key being possible to be the random length (key which will be longer than b first by the h processing). but when the key length is smaller than the l situation is disappointing, because like this will reduce the function the working s
24、trength. the length is bigger than l the key is acceptable, but the extra length cannot remarkable enhance the function the working strength. (if a stochastic key were considered that is unreliable, then chooses a long key is unwise). the key must select (or use stochastically formidable based on st
25、ochastic seeds pseudo-random production method), and wants the periodic renewal. (the present attack has not pointed out an effective replacement keys frequency, because these attacks are not in fact feasible. however, the periodic renewal key is one latent defect basic security measure which copes
26、with the function and the key exists, and may reduce divulges the harm which the key brings. )forth matters needing attentionhmac is may not revise the sound code according to the first floor hashing function to be possible to use this way to define. especially it when uses the h function must rely
27、on the pre-definition initialization value iv (a definite value, by each iteration hashing function when initialization its compression function assigns). however, if you want, may revise the h function the sound code to support invariable initialization value ivs.this idea is this: the compression
28、function the intermediate result which (k xor opad) and (k xor ipad) produces in the b word length block data may when the key just produced in advance calculates well. saves first these intermediate results, then when each time has the news needs to confirm produces the h function the initializatio
29、n value iv. this method must distinguish the news which has preserved the h compression function regarding two b word length block data (k xor opad) and (k xor ipad) the application for each. when distinguishes the short data stream, preserves such information is important. what we must stress: trea
30、ts these intermediate results to treat the key to be the same likely, and wants same to carry on the security.the above choice realizes the result which the hmac method is local carries out, to internal operational has not affectedfifth safehere will explain that the message discrimination mechanism
31、 the security is decided by the hashing function encryption characteristic which uses: 1. anti-conflict attack capability (is restricted in initialization value is only stochastic, and secret, and function output to aggressor is not available situation) 2. treats as uses when the single block data t
32、he h compression function the message discrimination attribute (in hmac these block data is part unknown, when aggressor self-restraint interior h functional calculus result, and aggressor cannot full choice)in hmac uses above the hashing function has or a stronger attribute generally. in fact, if a
33、 hashing function does not have above attribute that it not to be suitable regarding the majority encryption application procedure, including based on this function choice message discrimination plan. (see also bck1 to hmac function principle detailed elaboration and complete analysis), so long as o
34、btains about the candidate hashing function encryption intensity limited trust, then observes it to use in the message discrimination the security and the following hmac structure two kind of attributes is very important.1. this kind of structure is the independence in the hashing function which con
35、crete uses, and the latter is may encrypt the hashing function substitution by any other securities2. the message discrimination was opposite in the encryption is one kind “the instant” the influence. public can cause this plan to one kind of message discrimination plans destruction to replace, but
36、it to has distinguished the information is actually helpless. this forms the sharp contrast with the encryption. if its encryption algorithm is explained. today encrypts the data, can receive in the future the threat which explains,to the hmac known most powerful attack is based on the hashing funct
37、ion conflict frequency. (“birthday attack law” pv, bck2, but is not suitable completely for the smallest rational hashing function.數(shù) 據(jù) 加 密一 簡介 在開放的通信和計(jì)算機(jī)系統(tǒng)中,建立安全可靠的電子商務(wù)平臺是十分重要的。通常需要通過加密的方法對客戶的有關(guān)信息,如密碼、合同等加以保護(hù),使之不被盜取或篡改。當(dāng)客戶提出服務(wù)申請時(shí),必須對客戶身份的合法性、報(bào)文的完整性進(jìn)行確認(rèn)。hmac(keyed-hashing for message authentication)是
38、一個(gè)公開的協(xié)議。它是一種基于密鑰的報(bào)文完整性的驗(yàn)證方法,其安全性是建立在hash算法基礎(chǔ)上的。它要求通信雙方共享密鑰、約定算法、對報(bào)文進(jìn)行hash運(yùn)算,如md5、sha、ripemd等,形成固定長度的認(rèn)證碼。通信雙方通過認(rèn)證碼的校驗(yàn)來確定報(bào)文的合法性。這個(gè)協(xié)議可以用來作加密、數(shù)字簽名、報(bào)文驗(yàn)證等。hmac可以與任何迭代散列函數(shù)捆綁使用。md5和sha1就是這種散列函數(shù)。這種結(jié)構(gòu)的主要作用是:1. 不用修改就可以使用適合的散列函數(shù)。而且散列函數(shù)在軟件方面表現(xiàn)的很好。且源碼是公開和通用的。2. 可以保持散列函數(shù)原有的性能而不致使其退化。3. 可以使得基于合理的關(guān)于底層散列函數(shù)假設(shè)的消息鑒別機(jī)制的加
39、密強(qiáng)度分析。4. 當(dāng)發(fā)現(xiàn)或需要運(yùn)算速度更快或更安全的散列函數(shù)時(shí),可以很容易的實(shí)現(xiàn)底層散列函數(shù)的替換。注釋:在寫本文檔時(shí),md5和sha1是使用最廣泛的加密用散列函數(shù)。二 hmac的算法原理2.1 hmac算法定義:用公式表示如下:hmac=h(key or opad ,h(key or ipad,text)h(x,y)表示對 x + y的消息進(jìn)行一種hash運(yùn)算。ipad代表重復(fù)b次的單字節(jié)十六進(jìn)制常數(shù)ox36;opad代表重復(fù)b次的單字節(jié)十六進(jìn)制常數(shù)ox5c;key代表64字節(jié)的字符串,由密鑰組成,不足的補(bǔ)0;text代表任意長度文本;密鑰長度l字節(jié)。當(dāng)大于b時(shí),先經(jīng)hash計(jì)算形成l字節(jié)的
40、秘鑰 (b是hash算法中一次迭代運(yùn)算的數(shù)據(jù)塊字節(jié)數(shù);l是hash算法形成報(bào)文摘要的字節(jié)數(shù),md5中是16,sha-1中是20)。2.2算法步驟(1)在密鑰k后面添加0來創(chuàng)建一個(gè)字長為b的字符串。(例如,如果k的字長是20字節(jié),b60字節(jié),則k后會(huì)加入44個(gè)零字節(jié)0x00),如果k的長度大于b時(shí),則應(yīng)經(jīng)過散列函數(shù)處理。if (key_len 64) md5_ctx tctx; md5init(&tctx); md5update(&tctx, key, key_len); md5final(tk, &tctx); key = tk; key_len = 16;(2)將上一步生成的b字長的字符串與
41、ipad做異或運(yùn)算。 k_ipadi = 0x36;(3)將數(shù)據(jù)流text填充至第二步的結(jié)果字符串中。(4)用h作用于第三步生成的數(shù)據(jù)流。調(diào)用散列函數(shù)(md5,sha-1)(5)將第一步生成的b字長字符串與opad做異或運(yùn)算。k_opadi = 0x5c;(6)再將第四步的結(jié)果填充進(jìn)第五步的結(jié)果中。(7)用h作用于第六步生成的數(shù)據(jù)流,輸出最終結(jié)果。2.3 md5算法md5算法以對任意長度消息多次循環(huán)迭代的散列運(yùn)算,最終形成16 byte報(bào)文摘要。這摘要對文本具有唯一性,可作為認(rèn)證碼。在目標(biāo)計(jì)算機(jī)的計(jì)算速度下,這個(gè)摘要是難于破解的。(1)報(bào)文填充md5算法要求對任意長度報(bào)文進(jìn)行填充,構(gòu)成n64
42、byte消息分組,n為整數(shù)。其中每一分組填充數(shù)據(jù)分2步。首先,填充使得數(shù)據(jù)位長度恰好為(n64-8)byte的數(shù),即在報(bào)文有效數(shù)據(jù)后補(bǔ)1個(gè)0x1,其它補(bǔ)0x0至滿足上述要求。然后,再后補(bǔ)上8字節(jié)(64位)的報(bào)文數(shù)據(jù)長度(填充前字節(jié)數(shù))。這樣,數(shù)據(jù)就被填充為64byte(512bit)的整數(shù)倍。又劃分16個(gè)4字節(jié)子分組。(2)初始化md5參數(shù)4個(gè)4字節(jié)位變量(a、b、c、d)用來作為報(bào)文摘要的初始值:a=0x01234567 b=0x89abcdef c=0xfedcba98 d=0x76543210( 3 ) 算法md5算法是對消息分組依次迭代算法。第1次運(yùn)算的初始值為abcd,以后每一次迭代
43、運(yùn)算的結(jié)果都替換abcd作為下一次的初始值,共經(jīng)過n次的迭代運(yùn)算,就得到該消息的報(bào)文摘要. 2.4實(shí)現(xiàn)步驟第一步:增加填充 增加padding使得數(shù)據(jù)長度(bit為單位)模512為448。如果數(shù)據(jù)長度正好是模512為448,增加512個(gè)填充bit,也就是說填充的個(gè)數(shù)為1-512。第一個(gè)bit為1,其余全部為0。 第二步:補(bǔ)足長度 將數(shù)據(jù)長度轉(zhuǎn)換為64bit的數(shù)值,如果長度超過64bit所能表示的數(shù)據(jù)長度的范圍,值保留最后64bit,增加到前面填充的數(shù)據(jù)后面,使得最后的數(shù)據(jù)為512bit的整數(shù)倍。也就是32bit的16倍的整數(shù)倍。在rfc1321中,32bit稱為一個(gè)word。 第三步:初始化變量 用到4個(gè)變量,分別為a、b、c、d,均為32bit長。初始化為: a: 01 23 45 67 b: 89 ab cd ef c: fe dc ba 98 d: 76 54 32 10 第四步:數(shù)據(jù)處理 首先定義4個(gè)輔助函數(shù)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 合同zao的法律認(rèn)定
- 合同法第115條內(nèi)容
- 統(tǒng)考版2025屆高考?xì)v史一輪復(fù)習(xí)課后限時(shí)集訓(xùn)39新文化運(yùn)動(dòng)與馬克思主義的傳播含解析新人教版
- 2024年山東客運(yùn)從業(yè)資格證應(yīng)用能力考試
- 2024最高額質(zhì)押反擔(dān)保合同
- 2024購房合同能否更名以及如何更名
- 專題10.人物描寫及其作用-2023年三升四語文暑期閱讀專項(xiàng)提升(統(tǒng)編版)
- 四年級讀書卡完整版
- 三年級語文上冊第五單元測試卷-基礎(chǔ)知識與綜合能力篇 含答案 部編版
- 2024成品柴油買賣合同
- 市政設(shè)施維護(hù)方案
- 建筑防水工程技術(shù)規(guī)程DBJ-T 15-19-2020
- 大學(xué)會(huì)計(jì)生涯發(fā)展展示
- 2024年“312”新高考志愿填報(bào)指南
- 13區(qū)域分析與區(qū)域規(guī)劃(第三版)電子教案(第十三章)
- 醫(yī)院設(shè)備維保方案
- 小學(xué)科普社團(tuán)活動(dòng)計(jì)劃
- 初中女生會(huì)議課件省公開課金獎(jiǎng)全國賽課一等獎(jiǎng)微課獲獎(jiǎng)?wù)n件
- 跨界產(chǎn)品研發(fā)與實(shí)戰(zhàn)智慧樹知到期末考試答案2024年
- 2024年山東青島城投金融控股集團(tuán)有限公司招聘筆試參考題庫含答案解析
- 工業(yè)機(jī)器人應(yīng)用4-裝配
評論
0/150
提交評論