生成的种子值AES密钥 [英] Generate AES key with seed value

查看:521
本文介绍了生成的种子值AES密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何生成种子值AES密钥,这样每当我生成相同的种子值的关键,我shud能够得到相同的AES密钥?

How do I Generate AES key with seed value so that whenever I generate key with same seed value,I shud be able to get the same AES key?

我要生成此键为我的黑莓珍珠8100设备。

I want to generate this key for my Blackberry Pearl 8100 device.

我不能够产生与AESKey(KEYDATA)AES密钥。

I am not able to generate AES key with AESKey(keyData) .

此外,每当我打印出来无论是在字符串或形式的byte [],我不能够生成它。(打印)实际密钥从不打印。

Also whenever I print it either in the form of String or byte[] , I am not able to generate it.(print it) Actual key is never printed.

可以做些什么来得到钥匙?

What can be done to get the key?

更新

我试图通过传递字节[我的资料],如follws产生AESKey:

I tried generating AESKey by passing byte[] of my data,as follws:

 AESKey key = new AESKey(keyData);

每次我得到相同的密钥,这是正确的。

Everytime I get same key, which is correct.

现在使用这个键,我加密加密我,我得到的加密不同的价值data.Everytime。这里是我的问题。我怎样才能得到加密后的数据相同每次,这样我就可以将其发送到服务器?

Now using this key I am encrypting the data.Everytime I encrypt I get different value of encryption. Here is my problem. How can I get same data everytime after encryption,so that I can send it to server?

更新

我不能够产生与AESKey(KEYDATA)AES密钥。

I am not able to generate AES key with AESKey(keyData) .

此外,每当我打印出来无论是在字符串或形式的byte [],我不能够生成它。(打印)实际密钥从不打印。

Also whenever I print it either in the form of String or byte[] , I am not able to generate it.(print it) Actual key is never printed.

可以做些什么来得到钥匙?

What can be done to get the key?

推荐答案

第5.2节中 RFC 2898 描述了这样的一种方式。

Section 5.2 in RFC 2898 describes one way of doing this.

具体地讲,种子值由一个密码短语和盐的;但考虑到相同的密码和盐,总是会导致相同的密钥。

Specifically, the "seed" value consists of a "PASSPHRASE" and a "SALT"; but given the same passphrase and salt, will always result in the same key.

http://anandam.name/pbkdf2/ 是一个JavaScript实现。

http://anandam.name/pbkdf2/ is a javascript implementation.

http://en.wikipedia.org/wiki/PBKDF2 有更多的信息,并链接到其他的实现。

http://en.wikipedia.org/wiki/PBKDF2 has more information, and links to other implementations.

这篇关于生成的种子值AES密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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