Java等效于C#的Rfc2898DerivedBytes [英] Java equivalent of C#'s Rfc2898DerivedBytes

查看:202
本文介绍了Java等效于C#的Rfc2898DerivedBytes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道有没有人试图做一个相当于



$ pre> Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(secret,saltValueBytes);
byte [] secretKey = key.GetBytes(16); Java中的

秘密是一个字符串(密码),而saltValueBytes是一个字节数组的盐。



我尝试过的东西,但似乎不能包装我的

解决方案

我发现这个实现通过Google搜索,但我从来没有使用过。


RFC 2898的免费Java实现
/ PKCS#5 PBKDF2



似乎没有小而自由的
可用的Java实现RFC
2898 / PKCS#5可用。小的
只有几个源文件,琐碎的
编译和没有依赖,在LGPL中作为
免费。



给定HMACSHA1在
中的标准SUN JCE加密
提供程序的可用性,这样的一个实现是
非常简单,可以从
派生出来的RFC描述。
我的代码是一个洁净室实现
,只有RFC作为依据。



I was wondering if anyone have tried to do an equivalent of

Rfc2898DeriveBytes key = new Rfc2898DeriveBytes(secret, saltValueBytes);
byte[] secretKey = key.GetBytes(16);

in Java. Where secret is a string(password), and saltValueBytes is, well, a salt in byte array.

I've tried stuff, but can't seem to wrap my head around it.

解决方案

I found this implementation by means of a Google search but I have never used it.

A free Java implementation of RFC 2898 / PKCS#5 PBKDF2

There seems to be no small and freely available Java implementation of RFC 2898 / PKCS#5 available. Small as in only a few source files, with trivial compile and no dependencies, free as in LGPL.

Given the availability of HMacSHA1 in the standard SUN JCE cryptographic provider, such an implementation is quite simple and can be derived from the RFC description quite literally. My code is a clean-room implementation with only the RFC as its basis.

这篇关于Java等效于C#的Rfc2898DerivedBytes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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