Generate AES key with initial value

How to create an AES key with an initial value so that whenever I generate a key with the same initial value, I can get the same AES key?

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

I cannot generate an AES key using AESKey (keyData).

And whenever I print it either in the form of String or byte [], I cannot generate it. (print it) The actual key is never printed.

What can be done to get the key?

Update

I tried to create an AESKey by passing a byte [] from my data, as described below:

 AESKey key = new AESKey(keyData);

Every time I get the same key, that's right.

Now, using this key, I encrypt the data. Every time I encrypt, I get a different encryption value. Here is my problem. How can I get the same data every time after encryption so that I can send it to the server?

Update

I cannot generate an AES key using AESKey (keyData).

And whenever I print it either in the form of String or byte [], I cannot generate it. (print it) The actual key is never printed.

What can be done to get the key?

+3
source share
3 answers

Section 5.2 of RFC 2898 describes one way to do this.

, "" "PASSPHRASE" "SALT"; , , .

http://anandam.name/pbkdf2/ - javascript.

http://en.wikipedia.org/wiki/PBKDF2 .

+7

. , , - . , ( , ):

  • ; , Java , .
  • () (passphrase? hash ? - ).
  • N RNG; . , 2, N .
  • RNG , (, Python, None, ).
0

, .

How do you use your AESKey? If you are doing something using CBC Encryption (i.e. using net.rim.device.api.crypto.CBCEncryptorEngine), then your initialization vector should be the same for each call. Use the constructor for CBCEncryptorEngine, which accepts the Initializer, as well as BlockEncryptorEngine.

A Wikipedia article with more information on why this is.

0
source

Source: https://habr.com/ru/post/1708311/


All Articles