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
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