Enabling Unlimited Strength Cryptography in ColdFusion

coldfusionjava

If you want to use very strong encryption in ColdFusion you may need to install the Unlimited Strength Jurisdiction Policy Files in the JVM running ColdFusion.

For example if you want to use AES encryption with anything higher than a 128 bit key, then you need to do this otherwise you will get an exception about invalid key length when you try to encrypt or decrypt.

But - Pete? you ask, how do I use a higher key bit length with AES encryption in ColdFusion? Instead of GenerateSecretKey("AES") use this: GenerateSecretKey("AES", 256)

You my also be thinking what if I don't use the Encrypt or Decrypt functions - should I still do this? My answer here would be Yes. Other techonologies such as HTTPS can use AES 256 encryption, without this policy a cfhttp call can only use 128 bit encryption even if the server supports 256 bit SSL (note I haven't done any tests to back this up, I am assuming that is the case).

Now if you do your development on a Mac you might find that AES 256 works just fine without doing anything. The JVM that apple ships appears to have unlimited crypto enabled (at least if you live in the US it does - may differ depending on your locale).

Ok - how do I enable it?

First, head over to oracle and download the policy files for Java 1.6 (unless you are running a different version of Java, but if you are running CF 8 or 9 you are probably running java 1.6).

Next locate the JVM directory that ColdFusion is using. If you are at this point sayings what's a JVM I never installed a JVM, then you are probably using the JVM that ships with ColdFusion, which on windows might be located at c:\ColdFusion9\runtime\jre\ here's how to find out for sure:

  • Login to ColdFusion Administrator
  • Click on Settings Summary on the left under the Server Settings
  • Look for Java Home under the JVM Details heading

Now you will want to place the two jar files local_policy.jar and US_export_policy.jar under the lib/security/ folder. If the files already exist copy them into a temp directory for backup, then replace with the ones you just downloaded. Restart ColdFusion, and you're done.

Upgrade your JVM to at least 1.6.0_24

Now is probably a good time to upgrade your JVM if you are running a 1.6 version lower than 1.6.0_24 - because without doing so you are leaving your server open to a serious DOS vulnerability. Adobe has certified and supports Java 1.6.0_24 for all versions of ColdFusion 8 and 9 (more info on the JVM DOS vulnerability here)



Related Entries

2 people found this page useful, what do you think?

 Download FuseGuard WAF for ColdFusion

Trackbacks

Trackback Address: 803/1B32618A4026A60BD9134368F90C4A5F

Comments

On 03/14/2012 at 11:10:54 PM EDT Brian Hendel wrote:
1
Thanks Pete! I would very much like to see asymmetric cryptography supported in some way. That is the encryption key exposed in CF can't be used to decrypt the data. That way we can safely embed our key on the server, while keeping the decryption key private off-site.

-Brian

On 03/15/2012 at 12:17:47 PM EDT Pete Freitag wrote:
2
I agree it would be nice to have something builtin to handle Asymmetric encryption in ColdFusion, but you can always leverage Java from your cfml to do this.

On 03/26/2012 at 11:51:25 AM EDT Jennifer wrote:
3
if you use a suffix such as .enc' for erceyptnd files, you can also use VIM to edit an erceyptnd file. It asks for the password to decrypt then if you write it will ask for the password again to encrypt Add the following to your .vimrc file Edit erceyptnd using openssl aes-256-cbcaugroup encautocmd!autocmd BufReadPre,FileReadPre *.enc set binautocmd BufReadPre,FileReadPre *.enc set noswapfileautocmd BufReadPost,FileReadPost *.enc set shell=shautocmd BufReadPost,FileReadPost *.enc set shellredir=>autocmd BufReadPost,FileReadPost *.enc [,']!openssl aes-256-cbc -d -aautocmd BufReadPost,FileReadPost *.enc exe doau BufReadPost .expand( %:r )autocmd BufReadPost,FileReadPost *.enc set nobinautocmd BufReadPost,FileReadPost *.enc redraw!autocmd BufWritePre,FileWritePre *.enc mark zautocmd BufWritePre,FileWritePre *.enc set binautocmd BufWritePre,FileWritePre *.enc [,']!openssl aes-256-cbc -a -saltautocmd BufWritePost,FileWritePost *.enc undoautocmd BufWritePost,FileWritePost *.enc set nobinautocmd BufWritePost,FileWritePost *.enc zaugroup ENDTo create a new file just start vim without a file name and then write' it to one ending in .enc' for example:w secret_stuff.encTo look at or modify the file just run vim secret_stuff.encWARNING: when saving make sure the file gets written correctly by looking at the output before quitting.ASIDE: The above was developed from old PGP and GPG erceyptnd file techniques from vim.

Post a Comment




  



Spell Checker by Foundeo

Recent Entries



foundeo


did you hack my cf?