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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving encrypted string to database

Status
Not open for further replies.

Jami

Programmer
Jul 18, 2000
54
US
Hi all,
I am trying to use encrypt and decrypt to save values such as Credit Card numbers to my database. Here is my problem:

For a credit card, for example, I have an Oracle database table with a field of varchar2 and want to store this encrypted data. Here is my insert statement (the encrypt key is stored in my Application.cfm file):

<cfquery>
insert into table(field_name)
values('#encrypt(cc_number, key_name)#')
</cfquery>

The problem is that in some cases, the encrypted code will include a single apostrophe and will not allow my sql insert to be carried out. Can anyone help?

Thanks in advance!
Jami
 
On a related note, the same would occur if the encrypted string contained a pound sign, #, and I'd also like to watch for that.

Thanks again! Jami
 
I'm still working on this. Now I am using the Replace function. Works fine for a single apostrophe, but not the pound sign. Can anyone help here?

<cfset ccnumber = '#Replace(encrypt(trim(cardnumber), key_name),&quot;'&quot;,&quot;''&quot;)#'>
<cfset ccnumber = '#Replace(encrypt(trim(cardnumber), key_name),&quot;##&quot;,&quot;###&quot;)#'>

Thanks again!
Jami
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top