Encrypting CFM Files with CFencode

After reading Ben Nadels blog post about a new CF builder Extension for encrypting and decrypting ColdFusion files I thought I would do a companion blog post about the pros/cons of doing so. 

First off I should really say we are encoding them, not encrypting them.  Basically the .cfm or .cfc files become binary instead of ascii text files.   This ends up causing a number of issues which I will get into later.

Long ago Allaire (creators of ColdFusion) created an executable utility to encode CF files. 

You know you have come across such a file if it starts with: "Allaire Cold Fusion Template
Header Size:"  Yes even with CF 8 the encode utility still mentions Allaire.  I haven't tried on CF9 but I have to imagine it still will.  After that will be a seriese of characters like "@¼¤ÇKŸ}¿Iùz̪" that may go on for a while depending on the size of the file.

So why would someone use this utility?

At first thought you may think this is perfect to protect your intellectual property.  This just isn't the case.  It is VERY easy to decrypt these files back to original source code, as evidenced by Ben's extension.  The decrypt utility isn't by Adobe.  Some other person made it 4 or 5 years ago.  There are probably several of them actually.  A little googling for it should set you down the right path.

It is, however, a barrier to editing files.  If you mostly want to keep people away from modifying core files, and are ok that if they really want to they can, then you can use the utility to protect them.  Why?  As an example lets say you have an app that you need to upgrade regularly on various client installations.  Clients often modify files all over the place.  But if they can't easily, they then look to your config files instead (where they are supposed to add their custom code).  This way you can make your upgrades much easier on both of you.  This also means you have to have created a pretty flexible and extensible program so that your clients can still do what they need.

So why would you NOT use this utility?

It is a barrier.  While that can be good for you, it also means that clients can't see your code to help you fix bugs, or make enhancements, or simply better understand their product. 

It also makes life difficult when using some FTP clients.  You see as a binary file programs like Dreamweaver simply break it when uploading to a server.  They send it as ASCII and what you end up with is the content of the gibberish file shown on the page instead of rendering.  Dreamweaver seems to be the big culpret here, but other ftp clients can cause this as well.  You know that Dreamweaver feature that uploads 'related' files?  Yup, it can upload encrypted files you didn't mean to upload causing all kinds of issues. 

Bottom line: There are good reasons why most people don't use the utility.  It doesn't prevent people from seeing your code.  It can cause issues with some ftp clients.  Lots of companies require sourcecode these days as well.  However if you need to have general protection against clients or end users changing a core file that you know needs to be upgraded later it can be a means to force that protection.

TweetBacks
Comments
Brian Rinaldi's Gravatar Oftentimes the barrier is just part of how the licensing is done. By that I mean, your license is for encrypted source and, even though its easy to decrypt, by decrypting (and modifying or distributing) you've violated your license agreement. The user can't argue intent since the very act of decrypting signals their intent to break the license agreement. Anyway, not that I encrypt anything (hell, everything I put out in public nowadays has a WTFPL license), just saying.
# Posted By Brian Rinaldi | 11/19/09 1:08 PM
Ben Nadel's Gravatar From my testing, the cfencode.exe that ships with CF9 is still the same one from way back when.
# Posted By Ben Nadel | 11/19/09 1:23 PM
leef's Gravatar I didn't realize you were UsefulConcept during the RIAdventure!!! I've been following your blog forever = ]
# Posted By leef | 12/14/09 4:03 PM
Joshua's Gravatar :-) Ya I guess since I wasn't presenting I didn't show my own contact info. Doh!
# Posted By Joshua | 12/14/09 4:19 PM

NAVIGATION

Home
About Me

RSS


Search

Subscribe

Enter your email address to subscribe to this blog.

Recent Entries

Flash Camp Boston
New Blog Design
Pre-Conference Training at cf.Objective()
FireFox 3.6 KTML Editor Fix
I am now a part of the Adobe Community Professionals Group

Recent Comments

FireFox 3.6 KTML Editor Fix
Fred said: Found another bug in Firefox 3.6 When inserting a table you can't select the number of columns. So I... [More]

Repeating Events Question
ueghbxedu said: UaejcB <a href="http://ysyhrmkbkhco.com/&...;, [url=http://pwncz... [More]

Repeating Events Question
fadxkfyuadn said: n6qVCL <a href="http://bdiorhdtbwzb.com/&...;, [url=http://uvnao... [More]

FireFox 3.6 KTML Editor Fix
Joshua said: While changing that far will load the editor, does it show the drop down class menu correctly now? [More]

FireFox 3.6 KTML Editor Fix
Al Johnson said: HI, I am still fighting to keep my code going as there is nothing better than KTML nad I have writt... [More]

Calendar

Sun Mon Tue Wed Thu Fri Sat
 123456
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31    

Archives By Subject

blogs (31) [RSS]
books (4) [RSS]
Crazy (39) [RSS]
DIY (8) [RSS]
Flex (3) [RSS]
games (10) [RSS]
GRRR (13) [RSS]
Ideas (11) [RSS]
Local (14) [RSS]
LOLpics (2) [RSS]
money (9) [RSS]
music (3) [RSS]
Personal (27) [RSS]
Photos (8) [RSS]
Politics (8) [RSS]
Projects (22) [RSS]
Review (18) [RSS]
RPM (9) [RSS]
Spam (16) [RSS]
Technology (66) [RSS]
Testing (3) [RSS]
TV (15) [RSS]
video (32) [RSS]
Web Dev (218) [RSS]
World of Warcraft (16) [RSS]