BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 05-14-2009, 12:16 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Generate AES key with seed value

Please Login to Remove!

Hi,

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?
Please help.

Thanks.
Offline  
Old 05-14-2009, 11:45 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

net.rim.device.api.crypto.AESKey(byte [] data) or other similar constructors.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 05-14-2009, 11:05 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes,I have used the same.
Actually,whenever the encrypted text is generated,its different everytime.How can I generate same encrypted text everytime?
Offline  
Old 05-16-2009, 05:01 PM   #4 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

How are you encrypting the data? I used this KB article to start.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 05-17-2009, 11:38 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
Thanks for reply.
I am encrypting data in follwing manner:


System.out.println("Message to be encrypted >>> "+message);
AESKey key = new AESKey();
byte [] aesByte = key.getData();

AESstring = new String(aesByte);

AESEncryptorEngine encryptionEngine = new AESEncryptorEngine(key);

PKCS5FormatterEngine formatterEngine = new PKCS5FormatterEngine( encryptionEngine );

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

BlockEncryptor encryptor = new BlockEncryptor( formatterEngine, outputStream );

encryptor.write( message.getBytes() );

encryptor.close();

encryptedData = outputStream.toByteArray();
Offline  
Old 05-18-2009, 09:50 AM   #6 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Well, there's your problem. from the API documentation AESKey() "Creates a new random 128-bit key". So it is not surprising that you get different cyphertext each time.
__________________
My other Blackberry is a PlayBook.
Offline  
Old 05-27-2009, 06:01 AM   #7 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8100
PIN: N/A
Carrier: vodafone
Posts: 33
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi again,
Coming back to my previous thread...

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?

Please help,badly stuck in this issue.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

NEW Century K2789-01 Inverter Arc 120 Stick Welder, 10-90 amp
$129.9
NEW Century K2789-01 Inverter Arc 120 Stick Welder, 10-90 amp pictureBRAND NEW IN BOX HONDA EU3000iS 3,000 Watt Portable Inverter Generator PACKAGE
$750.0
BRAND NEW IN BOX HONDA EU3000iS 3,000 Watt Portable Inverter Generator PACKAGE picture3KW 220V VFD Inverter Variable Frequency Drive 4HP Output 3 Phase 13A&2M Cable
$149.99
3KW 220V VFD Inverter Variable Frequency Drive 4HP Output 3 Phase 13A&2M Cable pictureHonda EU2000i Portable Generator 2000 Watt Super Quiet Power Inverter $765 BIN
$425.0
Honda EU2000i Portable Generator 2000 Watt Super Quiet Power Inverter   $765 BIN pictureNEW Lenze E82EV222K4C Frequency Inverter 2.2kW
$600.0
NEW Lenze  E82EV222K4C Frequency Inverter 2.2kW  picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.