Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

View Source 1

Status
Not open for further replies.

jmath

Programmer
Mar 16, 2001
2
0
0
US
Does anyone know how to encrypt ColdFusion/HTML code in such a way that the user is unable to view the source?
 
You can't encrypt HTML, but you can encrpyt Cold Fusion code.

From the Cold Fusion User Guide:

You can use the command-line utility cfencode to encode any ColdFusion application template. By default, the utility is installed in the /cfusion/bin directory. It is especially useful for securing custom tag code before distributing it.

cfencode uses the following syntax:

cfencode infile outfile [/r /q] [/h "message"] /v"2"

The following options are supported:

Option Description
input file Name of the file you want to encode. cfencode will not process an encoded file.

output file Path and filename of the output file. Warning: If you don't specify an output file name, a warning message asks if you want to continue, in which case the encoded file will overwrite the source file.

/r Recursive, when used with wildcards, recurses through subdirectories to encode files.

/q Suppresses warning messages.

/h Header, allows custom header to be written to the top of the encoded file(s).

/v Required parameter that allows encoding using a specified version number. Use "1" for pages you want to be able to run on ColdFusion 3.x. Use "2" for pages you want to run strictly on ColdFusion 4.0 and later.

If you want a small measure of security and keep some people from looking at the generated HTML, you can use a Javascript function to prevent users from getting the source. You can add:

<body oncontextmenu=&quot;return false&quot;>

But all they ahve to do is turn Javascript off, and they'll see the HTML
 
The only way I know how is to use Javascript. It's not a real encryption, but it makes it harder to steal the code:

Javscript Examples:

These are really good examples, the code isn't recognizable at all:
- pages load slow.

The rest of these use the same concept of creating url encoded html, and then unencoding them and writing them to the page with JavaScript. It would be fairly easy to get the real code by copying it and puting it through something like ColdFusions URLDecodedFormat function:
- Same as above, does batch - shareware
- Same as above, does batch - shareware



- tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top