Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Data Encryption


Message #1 by "Mike Frane" <mfrane@t...> on Tue, 5 Mar 2002 04:41:09
I want to capture a number and encrypt it before putting it into an Access 

database. How do I accomplish this? Also, how can I unencrypt the 

information later if I need it?
Message #2 by "Owain Williams" <email@o...> on Fri, 8 Mar 2002 17:07:56
You can not do this natively from within ASP, you would need to use either 

a third party program, for example a COM object, or write your own 

encryption/decryption routines, either as part of your ASP code, or as an 

external program, again like a COM object.



If you are going to tackle the encryption/decryption on your own then you 

can use functions like



	ASC(n) where n is the character number, e.g. 65. This returns the

	character



and 



	CHR(a) where a is a character, e.g. A. This returns the character

	code



These will give you the character number and character (it is easier to 

manipulate numbers than it is characters), then loop through all the 

characters and perform some sort of encryption/decryption algorithm. You 

could try adding an encryption string or key for example. I have done this 

in Visual Basic, but never in VBScript so it may not be possible unless 

you use an external program.



One question, why do you need to encrypt the data? Why not just make sure 

you never write the database field out to the response page? You may want 

to look at Secure Socket Layer (SSL), this will encrypt the data sent from 

the client to the server and vice-versa, but both the client and server 

will be able to read the data, just nobody else will. SSL does cost 

though, and you will have to either find an ISP that is willing to give 

you space on their secure server, or buy your own secure certificate (I 

have no idea how much these cost).

  Return to Index