BTW, the encrypt function looks like this:
<cffunction name="encryptString" access="public" returntype="Any"
output="false">
<!--- Take in the string to encrypt and the key to encrypt with --->
<cfargument name="inputString" type="string" />
<cfargument name="key" type="any" />
<!--- Create a Java Cipher object and get a mode --->
<cfset var cipher = createObject('java',
'javax.crypto.Cipher').getInstance("RSA") />
<!--- The mode tells the Cipher whether is will be encrypting or
decrypting --->
<cfset var encMode = cipher.ENCRYPT_MODE />
<cfset var encryptedValue = "" /> <!--- Return variable --->
<!--- Initialize the Cipher with the mode and the key --->
<cfset cipher.init(encMode, key) />
<!--- Convert the string to bytes --->
<cfset stringBytes = inputString.getBytes("UTF8") />
<!--- Perform encryption --->
<cfset encryptedValue = cipher.doFinal(stringBytes, 0, len(inputString))
/>
<cfreturn encryptedValue />
</cffunction>
-----Original Message-----
From: Brook Davies [mailto:[email protected]]
Sent: February-10-11 3:27 PM
To: cf-talk
Subject: RE: cfx_pwtextcrypt & CF9
Hi Leigh,
I noticed that, and I tried that. I tried:
<cfset publicKey_string = ToBase64(publicKey.getEncoded())>
But, later, if I try to call encrypt and pass it that publicKey_string, it
fails because the encrypt() function expects the java object.
Brook
-----Original Message-----
From: Leigh [mailto:[email protected]]
Sent: February-10-11 3:10 PM
To: cf-talk
Subject: RE: cfx_pwtextcrypt & CF9
> I can't figure out how to get public/private key strings from that and
> use those to encrypt/decrypt data. Anybody know?
IIRC, key.getEncoded() returns the bytes which you can encode as hex or
however you want
-Leigh
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:342136
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm