Forum Discussion
ARS_70214
Nimbostratus
Mar 17, 2010problem to decrypt AES
Hello,
I have currently some problems with to decrypt AES encrypted string in f5 irules.
In fact It works well when I encrypt and decrypt a string in the same irule, but if I want to decrypt an already encrypted string then the AES::decrypt function return an empty string. Of course the key used to decrypt the encrypted string is the key I used to encrypt this one.
when HTTP_REQUEST {
/* Below is the part working */
set ::key be474444865c70f3e13624aec61eb292cef6cf5c4ce1725dd4fa49a93bf997c8
log local0. "key: $::key"
set ::toencrypt "test"
log local0. " $::toencrypt"
set ::encrypted [b64encode [AES::encrypt $::key $::toencrypt]]
log local0. "encrypted: $::encrypted"
set ::decrypted [AES::decrypt $::key [b64decode $::encrypted]]
log local0. "decrypted: $::decrypted"
/* the following example doesn't work */
set ::alreadyencrypted "if5fcuQNslSrend46PiyfBV/Bu60+lfXLAN76wSFxtmk13EnzNi0Zfu/"
log local0. "alreadyencrypted: $::alreadyencrypted"
set ::decrypted2 [AES::decrypt $::key [b64decode $::alreadyencrypted]]
log local0. "alreadydecrypted: $::decrypted2"
}
I'm asking if there is not something else to do to declare the encrypted string (bold line).
Do you know what to do to fix this problem?
Many thanks
2 Replies
- JCohenRet. EmployeeWhen specifying a key to AES::encrypt or AES::decrypt it can either be a key object as generated by AES::key (a string with the correct format) or a passphrase.
- hoolio
Cirrostratus
Now, using global variables and CMP is a whole other discussion. :)
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects