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!

TripleDES

Status
Not open for further replies.

saraca

Programmer
Nov 8, 2004
4
0
0
US
I need to create a key manually to use with TripleDES


I need to decrypt a string that its being pass to us on a Form as POST. They are using TripleDES and they will be providing me with the values to use for the key and VectorIV. Coldfusion says that you should be able to generate your own key manully but I keep getting the following error "ByteArray objects cannot be converted to strings" on Encrypt. The code at the bottom is from Macromedia web site on how to generate a key manually.

<CFSET algorithm = "DESEDE">
<!--- generate a key --->
<cfset theKey = toBase64"112971151151191111141003232323232323232")>
<cfset geKey =tobinary(theKey)>
<CFSET str = "this is a test" >
<cfset enc = Encrypt(str, geKey, algorithm, "base64", geKey)>
<cfset dec= decrypt(enc,geKey, algorithm,"base64", geKey)>
<cfoutput>
string=#str#<br>
encrypted1=#enc#<br>
decrypted1=#dec#<br>
key=#geKey#
algorithm=#algorithm#
</cfoutput>

-----------------------------------------------------------
FROM MACROMEDIA
For example, to create a 32-byte key to use with the AES algorithm with the hex value:

8738fed68e7677d374e0946c8f7bd3bb4f50f23717f9f3667b2419483959039c

you would use the ColdFusion functions BinaryDecode and ToBase64 to create the key:

<cfset myKey = ToBase64(BinaryDecode("8738fed68e7677d374e0946c8f7bd3bb4f50f23717f9f3667b2419483959039c", "Hex")>
<cfset encrypted = Encrypt(myString, myKey, "AES")>

I need to create a key to use with TripleDES

 
You're missing the opening parentheses...
Code:
<cfset theKey = toBase64[red]([/red]"112971151151191111141003232323232323232")>


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top