久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Java 中使用 PBKDF2 進行密碼驗證

Password Verification with PBKDF2 in Java(在 Java 中使用 PBKDF2 進行密碼驗證)
本文介紹了在 Java 中使用 PBKDF2 進行密碼驗證的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在用 Java 進行基于密碼的文件加密;我使用 AES 作為底層加密算法和 PBKDF2WithHmacSHA1 使用以下代碼(我從本網站上的另一張慷慨的海報中獲得)從鹽和密碼組合中派生密鑰.

I'm doing password based file encryption in Java; I'm using AES as the underlying encryption algorithm and PBKDF2WithHmacSHA1 to derive a key from a salt and password combination using the following code (which I got from another generous poster on this site).

SecretKeyFactory f = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1");
KeySpec ks = new PBEKeySpec(password,salt,1024,128);
SecretKey s = f.generateSecret(ks);
Key k = new SecretKeySpec(s.getEncoded(),"AES");

我共享鹽,用戶在每一端輸入他們的密碼,加密和解密工作正常:-) 我的問題是我希望能夠在開始之前驗證用戶輸入的密碼是否正確(可能很長)解密過程.我知道 PBKD 規范包含一個可選的 2 字節驗證值,但我不確定如何使用上述方法生成該值.Java 是否為此提供支持,或者如果不提供支持,那將是一個安全的替代方案嗎?

I share the salt, the user enters their password at each end and encryption and decryption work fine :-) My problem is that i would like to be able to verify that the password the user enters is correct before embarking on the (potentially long) decryption process. I know the PBKD spec includes an optional 2 byte verification value but I'm not sure how to generate this value using the above approach. Does Java provide support for this or if not what would be a secure alternative?

感謝您的寶貴時間.

推薦答案

嘿,感謝瘋狂的蘇格蘭人和克里斯的幫助.在做了一些挖掘之后,我決定使用 Dr Gladmans 文件加密頁面 上描述的方法用于進行密碼驗證和消息驗證.我相信這種基于 PBKDF2 和 MAC 的方法使得導出密碼的驗證值足夠昂貴以使其安全.再次感謝,我希望這個解決方案對其他人有所幫助.

Hey, thanks to crazy scot and Chris for there help. After doing some digging i decided to use the methods described on Dr Gladmans file encryption page for doing both password verification and message authentication. I believe this method, based on the PBKDF2 and a MAC, makes deriving the verfication value for m the password sufficiently expensive as to make it secure. Thanks again, and i hope this solution aids others.

這篇關于在 Java 中使用 PBKDF2 進行密碼驗證的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to wrap text around components in a JTextPane?(如何在 JTextPane 中的組件周圍環繞文本?)
MyBatis, how to get the auto generated key of an insert? [MySql](MyBatis,如何獲取插入的自動生成密鑰?[MySql])
Inserting to Oracle Nested Table in Java(在 Java 中插入 Oracle 嵌套表)
Java: How to insert CLOB into oracle database(Java:如何將 CLOB 插入 oracle 數據庫)
Why does Spring-data-jdbc not save my Car object?(為什么 Spring-data-jdbc 不保存我的 Car 對象?)
Use threading to process file chunk by chunk(使用線程逐塊處理文件)
主站蜘蛛池模板: 超碰综合 | 四虎伊人| 久草精品在线 | 99视频免费在线观看 | 欧美一区二区免费电影 | 91视频在线看| 免费观看av | 成人国产精品视频 | 91精品国产91久久久久游泳池 | 在线看一区二区三区 | 成年人网站在线观看视频 | 成人av观看 | 精品永久 | 久久国产区| 免费一区 | 日韩成人 | 国产一区日韩在线 | 久草免费在线视频 | 人人做人人澡人人爽欧美 | 国产亚洲久 | 中文字幕第49页 | 成人午夜电影在线观看 | 不卡一区二区在线观看 | 免费精品 | 成人在线中文字幕 | 一区二区三区在线看 | 天堂视频中文在线 | 国产日韩欧美在线观看 | 午夜在线视频 | 欧美日韩久久精品 | 欧美亚洲国产一区二区三区 | 啪啪精品 | 亚洲综合色视频在线观看 | 中文字幕在线观看 | dy天堂| 欧美日韩一区二区视频在线观看 | 九九久久久久久 | 亚洲一区视频在线播放 | 亚洲顶级毛片 | 日本视频免费观看 | 欧美一级片在线看 |