Reliable implementation of PBKDF2-HMAC-SHA256 for JAVA(PBKDF2-HMAC-SHA256 for JAVA 的可靠实现)
问题描述
2019 年更新:Bouncycastle 现在支持 PBKDF2-HMAC-SHA256,因为 bouncycastle 1.60
对于 JAVA 是否有可靠的 PBKDF2-HMAC-SHA256 实现?
Is there any reliable implementation of PBKDF2-HMAC-SHA256 for JAVA?
我曾经使用 bouncycastle 加密,但它不提供 PBKDF2WithHmacSHA256'.
I used to encrypt using bouncycastle but it does not provide PBKDF2WithHmacSHA256'.
我不想自己写加密模块.
I do not want to write crypto module by myself.
您能否推荐任何替代库或算法(如果我可以坚持使用 bouncycastle)
Could you recommend any alternative library or algorithm (if i can stick with bouncycastle)
(这里是 bouncycastle 支持的算法)http://www.bouncycastle.org/specifications.html
(here are the algorithms that bouncycastle supports) 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 for JAVA 的可靠实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PBKDF2-HMAC-SHA256 for JAVA 的可靠实现
基础教程推荐
- 存储 20 位数字的数据类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
