Forum Discussion
Kevin_Stewart
Employee
Mar 13, 2008AES functions
Hello Devcentral gurus,
Does anyone know the specifics of the AES functions and how they work. Specifically, look at the following code snippet:
set testkey "test"
set testdata "blah"
log local0. "aes output -> [AES::encrypt $testkey $testdata]"
I've searched and searched through the forum and perhaps I just don't understand it. The above code delivers a different result every time a new browser window is opened. I have to assume that internally AES is pulling some additional information to "seed" the result, but then why the key? I would have thought that since the AES::key function delivers a random key, everything else would be static, and entering a static key would give the same result every time. What am I missing? Say for example I am strongly encrypting something that is being sent to the user in a file-based cookie. When they come back to the site later, I would like to be able to decrypt that data. Again, am I missing something? As it stands, the AES functions don't allow that.
Thank you for your help.
Kevin
24 Replies
- JRahm
Admin
No, the iRules implementation supports only CWC at this time. - habeebaslam_348
Nimbostratus
Thank you Citizen_Elah. Do we have an ETA about other methods availability? - JRahm
Admin
I'm not sure if that is in the works or not. If it's something you need, you can contact support to open an (or link to existing) RFE. - IheartF5_45022
Nacreous
Hello - did this information ever get published? I want to know the feasibility of exporting the key and decrypting on another device, a value encrypted on the F5,
Thanks - laz_53723
Nimbostratus
It looks like the information was never published.
There's definitely some non determinism WRT length of data to encrypted data:
: data length 1 encrypted length 38
: data length 2 encrypted length 38
: data length 3 encrypted length 41
: data length 4 encrypted length 42
: data length 5 encrypted length 43
: data length 6 encrypted length 42
: data length 7 encrypted length 43
: data length 8 encrypted length 43
: data length 9 encrypted length 47
: data length 10 encrypted length 47
: data length 11 encrypted length 46
: data length 12 encrypted length 50
: data length 13 encrypted length 51
: data length 14 encrypted length 45
: data length 15 encrypted length 53
: data length 16 encrypted length 52
So guessing where the nonce (iv and salt), data, and auth tag are is annoying. Without any docs from F5, I'm calling it quits, and will look at non-F5 solutions for my current need. - aaron_613
Nimbostratus
Hi Laz,
Did you try contacting F5 Support for help with this? DC is a great place to share informal info, but it's not an avenue for official product support.
Aaron - laz_53723
Nimbostratus
I'm working through support in parallel. I was first told that the F5 couldn't encrypt data in a way that anything non-F5 could decrypt it. I pressed for details on why, and am waiting for a response.
It's extremely disappointing that this type of information is not available as a part of the standard documentation. - hoolio
Cirrostratus
I think Support is going to be the best way to handle the request. If they're not able to provide you with the info you're looking for, you could escalate the request through your sales person. Hopefully F5 will be able to provide the functionality you're looking for.
Aaron - laz_53723
Nimbostratus
The variable length encryption thing is fixed by upgrading to v10.2 code (I was testing with v10.1, which is apparently broken).
My support guy got back to me and says the data format is this: iv (11 bytes) + key salt (11 bytes) + encrypted data (N bytes) + tag (16 bytes)
There's CWC-AES code at http://gladman.plushost.co.uk/oldsite/AES/ that can be used to interoperate with the F5's CWC-AES implementation. - JCohenRet. EmployeeI know this is an old thread, but I wanted to answer the question from Scott about the key length above for anyone else landing here.
The AES::key command generates object represented as a list with 3 elements or a string in the format "AES (128 | 192 | 256) <32, 48, 64 HEX digits respectively>".
when RULE_INIT {
set secret_key [AES::key 128]
log local0. " of chars of key is [string length $secret_key]"
log local0. "Key as list: [list $secret_key]"
log local0. "Key as string: $secret_key"
}
Jul 8 06:01:51 info tmm1[4989]: Rule aes-key : of chars of key is 40
Jul 8 06:01:51 info tmm1[4989]: Rule aes-key : Key as list: {AES 128 679152125086aacfbc35ef2b1ede5abf}
Jul 8 06:01:51 info tmm1[4989]: Rule aes-key : Key as string: AES 128 679152125086aacfbc35ef2b1ede5abf
When specifying a key to the AES::encrypt or AES::decrypt commands it can either be a key object as generated by AES::key or a passphrase. If you generate a key using AES::key (or a string with the correct format) it will use that key for encryption and decryption.
A string that does not match the above format will be interpreted as a passphrase and will be used (along with random salt) to generate a key. This is where AES::decrypt is affected by ID224113.
So the extra 8 bytes you see in the string length is the "AES 128 " part of the string.
Hope this helps.
Jason
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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