久久久久久久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蜜 | 中文在线一区 | 久久久久久亚洲精品 | 日韩欧美网 | 国产一在线观看 | 羞羞的视频在线观看 | 中文字幕乱码一区二区三区 | www.99热.com | www久久久 | 亚洲午夜小视频 | 中文字幕一区在线 | 国产精品久久久久久久一区探花 | 精品三区| 狠狠综合网 | 国产精品久久av | 亚洲精品一区在线观看 | 99精品国产一区二区三区 | 精品国产99| av性色 | 亚洲精品视频在线播放 | 999久久久久久久久6666 | 国产亚洲日本精品 | 欧美又大粗又爽又黄大片视频 | 久久99国产精品 | 最新高清无码专区 | 在线亚洲欧美 | www久久99 | 在线观看免费黄色片 | 日韩精品一区二区三区中文在线 | 国产亚洲第一页 | 91国语清晰打电话对白 | 国内精品久久久久久 | 国产一区二区自拍 | 欧美精品日韩精品 | 久久国品片 | 亚洲综合激情 | 一区二区在线 | www.中文字幕.com| 欧美成人hd | 亚洲精品成人在线 |