可靠的实现PBKDF2-HMAC-SHA256为JAVA [英] Reliable implementation of PBKDF2-HMAC-SHA256 for JAVA

查看:1824
本文介绍了可靠的实现PBKDF2-HMAC-SHA256为JAVA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于JAVA,有没有可靠的PBKDF2-HMAC-SHA256实现?

Is there any reliable implementation of PBKDF2-HMAC-SHA256 for JAVA?

我曾经用bouncycastle加密,但是没有提供PBKDF2WithHmacSHA256'。

I used to encrypting by bouncycastle but it does not provides PBKDF2WithHmacSHA256'.

我不想自己写加密模块。

I do not want to write crypto module by myself.

你可以推荐任何替代库或算法with bouncycastle)

Could you recommend any alternative library or algorithm (if i can stick with bouncycastle)

(这里是bouncycastle支持算法的算法)
http://www.bouncycastle.org/specifications.html

(here are algorithms that bouncycastle supports algorithm) http://www.bouncycastle.org/specifications.html

推荐答案

使用BouncyCastle类:

Using BouncyCastle classes directly:

PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator(new SHA256Digest());
gen.init("password".getBytes("UTF-8"), "salt".getBytes(), 4096);
byte[] dk = ((KeyParameter) gen.generateDerivedParameters(256)).getKey();

这篇关于可靠的实现PBKDF2-HMAC-SHA256为JAVA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆