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

问题描述

如何使用种子值生成AES密钥,以便每当生成具有相同种子值的密钥时,我都可以获得相同的AES密钥?



I要为我的Blackberry Pearl 8100设备生成此密钥。



我无法使用AESKey(keyData)生成AES密钥。



此外,每当我以String或byte []的形式打印它,我都无法生成它。(打印)实际的键从不打印。



可以做些什么来获取密钥?



更新



  AESKey key = new AESKey(keyData) ; 

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



现在使用这个密钥我正在对数据进行加密。每次加密我得到不同的加密值。这是我的问题加密后,如何获取相同的数据,以便我可以将其发送到服务器?



更新



我无法使用AESKey(keyData)生成AES密钥。



此外,每当我以String或byte [ ],我无法生成它(打印)实际的键从不打印。



可以做什么来获取密钥?

解决方案

描述了一种方法。



具体来说,种子值由PA​​SSPHRASE和SALT组成。但是给出相同的密码和盐,总是会导致相同的密钥。



是一个javascript实现。



具有更多信息,并链接到其他实现。


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?

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

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

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?

Update

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.

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?

Update

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

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?

解决方案

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/ is a javascript implementation.

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

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

07-30 11:52