Forum Discussion

Harold_Deadman_'s avatar
Harold_Deadman_
Icon for Nimbostratus rankNimbostratus
Apr 13, 2007

AES decryption returning empty string

I am working on encrypting some cookies but I must be doing something wrong because I get empty strings when I decrypt the cookie. I have made the following example to demonstrate what I am seeing. Does anyone see what I am doing wrong? This is on 9.4. Thanks.

 

 

 

when RULE_INIT {

 

set ::key [AES::key 256]

 

set stringtoencrypt "Testing encryption"

 

set encrypted [b64encode [AES::encrypt $::key $stringtoencrypt]]

 

log local0. "Encrypted and encoded $encrypted"

 

set decrypted [AES::decrypt $::key [b64decode $encrypted]]

 

log local0. "Decrypted and decoded $decrypted"

 

}

 

 

From the local logfile, note the decrypted value is empty:

 

 

Fri Apr 13 19:43:24 BST 2007 tmm tmm[1579] Rule : Decrypted and decoded

 

Fri Apr 13 19:43:24 BST 2007 tmm tmm[1579] Rule : Encrypted and encoded Ppoyd/a17LTVDQgmjJ39rXstNUNCLmJpDJvOlymi0allgb/MviS9JloTerv/ZrlefNnosSpI=

 

18 Replies