Solved

How to encrypt/decrypt data?

Posted on 2002-07-27
4
361 Views
Last Modified: 2013-12-24
Hi,

I have a webpage written in Coldfusion and would like user to submit info (Registration type). How can I enrypt the data when adding the record to Access and decrypt it when user needs to view it? My database is reside at someone's server and I do not want the Admin to view anything.

Other Questions:
1. Anyway to encrypt data already in Access?
2. Any other easier ways to do it, for lazy person like me? (Example: Just encrypt the whole database rather than do it for each data entry)
3. And lastly, where to encrypt the data? Part of my registration page is as below. Modify my code will be very helpful.

<tr><td>Company*</td>
<td><input name="name" size="30"></td></tr>

<tr><td>Login Name*</td>
<td><input class=textfield type=text name="loginname" size="30"></td></tr>

<tr><td>Address 1*</td>
<td><input name="address1" size="30"></td></tr>

<tr><td>Address 2</td>
<td><input name="address2" size="30"></td></tr>

Thanks.
0
Comment
Question by:buybuy
4 Comments
 
LVL 11

Accepted Solution

by:
jimmy282 earned 100 total points
ID: 7183180
You can use the Inbuilt Coldfusion Functions.
Encrypt() and Decrypt()

Have a look at this example.

<!--- This example shows the use of Encrypt and Decrypt --->
<html>
<head>
<title>Encrypt Example</title>
</head>

<body bgcolor = silver>
<H3>Encrypt Example</H3>

<P>This function allows for the encryption and decryption of a
string. Try it out by entering your own string and a key of your
own choosing and seeing the results.
<cfif IsDefined("FORM.myString")>
  <cfset string = FORM.myString>
  <cfset key = FORM.myKey>
  <cfset encrypted = encrypt(string, key)>
  <cfset decrypted = decrypt(encrypted, key)>
  <cfoutput>
   <H4><B>The string:</B></H4> #string# <BR>
   <H4><B>The key:</B></H4> #key#<BR>
   <H4><B>Encrypted:</B></H4> #encrypted#<BR>
   <H4><B>Decrypted:</B></H4> #decrypted#<BR>
  </cfoutput>
</cfif>
<form action = "encrypt.cfm" method = "post">
<P>Input your key:
<P><input type = "Text" name = "myKey" value = "foobar">
<P>Input your string to be encrypted:
<P><textArea name = "myString" cols = "40" rows = "5" WRAP = "VIRTUAL">
This string will be encrypted (try typing some more)
</textArea>
<input type = "Submit" value = "Encrypt my String">
</FORM>
</body>
</html>    



You encrypt it before you enter the record into database and decrypt it when you fetch from database.

Hope it helps.

Jimmy
0
 
LVL 17

Expert Comment

by:anandkp
ID: 7184443
HI there,

Jimmy is perfectly right abt this -

but make sure u set ur key value to something like "buybuy_or_whatever_u_want"

& use the same key value while encrypting & decrypting ur values.

keep in mind that if at ne-point u change ur key value - u cannot decrypt teh earlier encrypted values, using the new key.

so the value of key - has to remain a constant - througout !!!

K'Rgds
Anand
0
 

Author Comment

by:buybuy
ID: 7186843
Thanks guys for your help. :)
0
 

Expert Comment

by:mistergin
ID: 13055054
I heard that the native encryption techniques were less than ideal, any news on their status in MX?

I've had several friends use other custom methods instead because of this...
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now