【正文】
}PEKSCipher。 }Trapdoor。 char s[1000]。 pbc_param_t param。 fp = fopen(, r)。 size_t count = fread(s, 1, 1000, fp)。 fclose(fp)。 if (rv) { return rv。 if (!rv) { return 2。}(2) 當(dāng)系統(tǒng)進(jìn)行存儲(chǔ)操作時(shí),首先系統(tǒng)會(huì)生成密鑰,調(diào)用keygen函數(shù)生成密鑰,其中pk為公鑰,sk為私鑰。 element_init_G1(pkh, parampairing)。 element_random(pkg)。 element_pow_zn(pkh, pkg, skalpha)。} RSA加密系統(tǒng)初始化public class RSA { //創(chuàng)建密鑰對(duì)生成器,指定加密和解密算法為RSA public String[] Skey_RSA(int keylen){//輸入密鑰長(zhǎng)度 String[] output = new String[5]。 (keylen)。 //生成密鑰對(duì) RSAPublicKey puk = (RSAPublicKey)()。 BigInteger e = ()。 BigInteger d = ()。 BigInteger q = ()。 output[1]=()。 output[3]=()。 } catch (NoSuchAlgorithmException ex) { (()).log(, null, ex)。 } 數(shù)據(jù)存儲(chǔ)的實(shí)現(xiàn) 數(shù)據(jù)存儲(chǔ)界面在主界面點(diǎn)擊儲(chǔ)存按鈕后,程序會(huì)跳轉(zhuǎn)至數(shù)據(jù)存儲(chǔ)界面,在關(guān)鍵字一欄輸入關(guān)鍵字,在數(shù)據(jù)欄輸入數(shù)據(jù)完成后,點(diǎn)擊保存按鈕后,會(huì)實(shí)現(xiàn)事件響應(yīng),系統(tǒng)會(huì)將數(shù)據(jù)content和關(guān)鍵字keyword發(fā)送至PEKS系統(tǒng)中進(jìn)行后續(xù)的操作,PEKS系統(tǒng)在接受關(guān)鍵詞和數(shù)據(jù)后會(huì)在系統(tǒng)內(nèi)進(jìn)行加密操作,并返回密文cipher,系統(tǒng)會(huì)將cipher發(fā)送至存儲(chǔ)系統(tǒng)SaveImpl, 函數(shù)進(jìn)行存儲(chǔ),具體代碼實(shí)現(xiàn)如下(new ActionListener(){ public void actionPerformed(ActionEvent e) { String keyword1 = ()。 PEKSSystem peksSys = new PEKSSystem()。 SaveImpl si = new SaveImpl(cipher)。 } } PEKS系統(tǒng)實(shí)現(xiàn)(1)生成密鑰后,對(duì)即將進(jìn)行加密存儲(chǔ)的數(shù)據(jù)的關(guān)鍵進(jìn)行PEKS加密,其中pk為公鑰,keyword為關(guān)鍵詞,keywordlen為關(guān)鍵詞長(zhǎng)度,cipher為密文,具體實(shí)現(xiàn)代碼如下:int PEKS(sysparams *param, pubkey *pk, unsigned char *keyword, int keywordLen, PEKSCipher *cipher) //PEKS密文生成函數(shù){ element_t r, tmp1, tmp2。 element_init_GT(cipherc2,parampairing)。 element_random(r)。 element_init_G1(tmp1, parampairing)。 element_init_G1(tmp2, parampairing)。 element_pairing(cipherc2, tmp1, tmp2)。}(2) 使用RSA加密算法對(duì)數(shù)據(jù)進(jìn)行加密,具體代碼實(shí)現(xiàn)如下,content為輸入PEKS系統(tǒng)中的明文public String Enc_RSA(String content,String eStr,String nStr){ String cipher = new String()。 BigInteger n = new BigInteger(nStr)。 BigInteger m = new BigInteger(ptext)。 cipher = ()。 } return cipher。 char[] chardata = ()。a。 } 數(shù)據(jù)檢索界面當(dāng)用戶點(diǎn)擊了檢索按鈕后,系統(tǒng)會(huì)跳轉(zhuǎn)至檢索界面,在用戶輸入完成關(guān)鍵字后,系統(tǒng)會(huì)將關(guān)鍵字keyword發(fā)送至PEKS系統(tǒng)進(jìn)行陷門函數(shù)操作,同時(shí)將輸出的關(guān)鍵詞密文keyWord_cipher送至存儲(chǔ)系統(tǒng)SaveImpl中的search方法,其中包含TEST(關(guān)鍵詞檢索算法),該算法會(huì)將發(fā)送來的keyWord_cipher與系統(tǒng)中的每個(gè)密文進(jìn)行比對(duì),若test返回true,則SaveImpl中的search返回輸出該數(shù)據(jù),具體代碼實(shí)現(xiàn)如下(new ActionListener(){ public void actionPerformed(ActionEvent e) { String keyWord1 = ()。 String keyWord_cipher = (keyWord1)。 String content_result = 。 } catch (IOException e1) { ()。 } })。 element_init_G1(tmp, parampairing)。 element_init_G1(twt, parampairing)。 return 0。 element_init_GT(tmp, parampairing)。 if (element_cmp(tmp, cipherc2)==0) return 0。}(3) 使用RSA解密密文,具體代碼實(shí)現(xiàn)如下,其中cipher為存儲(chǔ)系統(tǒng)輸出的密文,content為解密后輸出的明文 public String Dec_RSA(String cipher,String dStr,String nStr){ StringBuffer content= new StringBuffer()。//獲取私鑰的參數(shù)d,n BigInteger n=new BigInteger(nStr)。 BigInteger m=(d,n)。//計(jì)算明文對(duì)應(yīng)的字符串并輸出 for(int i=0。i++){ ((char)mt[i])。 }} 第四章 系統(tǒng)測(cè)試測(cè)試內(nèi)容測(cè)試方法測(cè)試結(jié)果備注數(shù)據(jù)存儲(chǔ)啟動(dòng)系統(tǒng),進(jìn)行操作測(cè)試通過10臺(tái)計(jì)算機(jī),每臺(tái)不少于50次數(shù)據(jù)加密強(qiáng)度對(duì)數(shù)據(jù)加密強(qiáng)度進(jìn)行破解通過對(duì)兩組數(shù)據(jù)進(jìn)行破解,失敗數(shù)據(jù)檢索啟動(dòng)系統(tǒng),進(jìn)行操作測(cè)試通過穩(wěn)定些兼容性通過 第五章 結(jié)束語數(shù)據(jù)安全與信息系統(tǒng)的穩(wěn)定可靠息息相關(guān),因此,數(shù)據(jù)安全問題得到了越來越廣泛的關(guān)注。本系統(tǒng)是基于PEKS,即帶關(guān)鍵詞的公鑰加密系統(tǒng)。在我查閱資料的時(shí)候,學(xué)習(xí)到了對(duì)pbc庫的學(xué)習(xí)使用,由于pbc庫是基于C語言的,然而我又不是很掌握c語言的編程,所以本系統(tǒng)的主界面是在JAVA下做成的,而PEKS中的核心代碼是通過在JAVA中對(duì)C的調(diào)用來實(shí)現(xiàn)的,總的來說是在C語言代碼段的開頭加上JAVA語言文件編譯成頭文件加在C語言代碼段的開頭進(jìn)行調(diào)用。數(shù)字簽名也在一定程度上加強(qiáng)了數(shù)據(jù)的安全存儲(chǔ),信息的不可抵賴性在這里得到了體現(xiàn),在公鑰加密中中間人攻擊是一種常見的形式,采用了數(shù)字簽名后極大的避免了這種攻擊形式。在比如在數(shù)據(jù)傳入PEKS系統(tǒng)時(shí)也未做保密處理,可能會(huì)存在漏洞,但由于我的知識(shí)匱乏,這一方面我也仍在努力。 致謝大學(xué)生活一晃而過,回首走過的歲月,心中倍感充實(shí),當(dāng)我寫完這篇畢業(yè)論文的時(shí)候,有一種如釋重負(fù)的感覺,感慨良多。他在忙碌的教學(xué)工作中擠出時(shí)間來審查、修改我的論文。 感謝四年中陪伴在我身邊的同學(xué)、朋友,感謝他們?yōu)槲姨岢龅挠幸娴慕ㄗh和意見,有了他們的支持、鼓勵(lì)和幫助,我才能充實(shí)的度過了四年的學(xué)習(xí)生活。通過論文的撰寫,使我能夠更系統(tǒng)、全面地學(xué)習(xí)計(jì)算機(jī)相關(guān)的前沿理論知識(shí),并得以借鑒眾多專家學(xué)者的寶貴經(jīng)驗(yàn),這對(duì)于我今后的工作和我為之服務(wù)的企業(yè),無疑是不可多得的寶貴財(cái)富。 參考文獻(xiàn)[1] 盧開澄,計(jì)算機(jī)密碼學(xué)一計(jì)算機(jī)網(wǎng)絡(luò)中的數(shù)據(jù)保密與安全[M〕,北京:清華大學(xué)出版社,2003.[2] Riehter Jeffrey,Windows核心編程[M」,北京:機(jī)械工業(yè)出版社,2003.[3] 谷大武等,高級(jí)加密標(biāo)準(zhǔn)(AES)算法一Rijndael的設(shè)計(jì)[M孔北京:清華大學(xué)出版社,2003.[4] 程庭,張明慧,一種基于DES和RSA的數(shù)據(jù)加密方案及實(shí)現(xiàn)「J」,河南教育學(xué)報(bào),自然科學(xué)出版社,2003,12.[5] 徐桂祥.《數(shù)據(jù)庫系統(tǒng)原理和應(yīng)用技術(shù)》.清華大學(xué)業(yè)出版社, 2010[6] 楊學(xué)全.《SQL Server實(shí)例教程》.電子工業(yè)出版社,2007[7] Y. Daniel Liang.《Introduction to Java Programming.Pearson Education》,2008[8] 劉偉, 張利國.《Java Web開發(fā)與實(shí)戰(zhàn):Eclipse+Tomcat+Servlet+JSP整合應(yīng)用》.科學(xué)出版社,2008[9] 郝玉龍.《Java EE 編程技術(shù)》.清華大學(xué)出版社,2008[10] 耿祥義.《JSP基礎(chǔ)教程》.清華大學(xué)出版社,2004[11] 程偉,汪孝宜.《開發(fā)者突擊:JSP網(wǎng)絡(luò)開發(fā)經(jīng)典模塊實(shí)現(xiàn)全集》.電子工業(yè)出版社,2008[12] 張新曼.《精通JSP:Web開發(fā)技術(shù)與典型應(yīng)用》.人民郵電出版社,2007[13] 趙斌.《SQL Server 2008應(yīng)用程序開發(fā)案例解析》.科學(xué)出版社,2009[14] 郭鄭州,陳軍紅.《SQL Server 2008完全學(xué)習(xí)手冊(cè)》.清華大學(xué)出版社,2011[15] Itzik BenGan.《Microsoft SQL Server 2008技術(shù)內(nèi)幕:TSQL查詢:TSQL querying》.電子工業(yè)出版社,2010[16] 崔群法, 祝紅濤, 趙喜來.《SQL Server 2008中文版從入門到精通》.電子工業(yè)出版社,2009附錄1 英文文獻(xiàn)SENTINEL: Securing Database from Logic Flaws in WebApplications 39Xiaowei LiDepartment of ElectricalEngineering and ComputerScienceVanderbilt UniversityNashville, TN USA 37203Wei YanDepartment of ElectricalEngineering and ComputerScienceVanderbilt UniversityNashville, TN USA 37203Yuan XueDepartment of ElectricalEngineering and ComputerScienceVanderbilt UniversityNashville, TN USA 37203ABSTRACTLogic flaws within web applications allow the attackers to disclose or tamper sensitive information stored in backend databases, since the web application usually acts as the singletrusted user that interacts with the database. In this paper, we model the web application as an extended finite state machine and present a blackbox approach for deriving the application specification and detecting malicious SQL queries that violate the specification. Several challenges arise, such as how to extract persistent state information in the database and infer data constraints. We systematically extract a set of invariants from observed SQL queriesand responses, as well as session variables, as the appl