0
RSA Encryption Help with Bouncy Castle
New Here
,
/t5/coldfusion-discussions/rsa-encryption-help-with-bouncy-castle/td-p/614925
Apr 08, 2007
Apr 08, 2007
Copy link to clipboard
Copied
Does anyone have experience doing RSA encryption with Bouncy
Castle installed as a security provider?
For example, what is the proper syntax of the Encrypt(string, key[, algorithm[, encoding]])) function to send an RSA encrypted string to someone given the following values:
string = "This is the string to encrypt"
RSA Public Key Moduls = qFP+TNkUxiwqgYkce7iBR1Z2VndmSDLlxM0UQEW5UQQPdTWdEl6iIjteIZr5M9R6EBsGh6XKHG7et9SAJ/0h/OwBJMOaoGpoQq2IJHKqKA4UhC30fnFZcfVz6ne4dTUemkJinIUiSlHLaChdANoe9lC9wNVGu1tUpkiwj+Pn4/c=
RSA Public Key Exponent = AQAB
Padding = pKCS#1 v1.5
Thanks in advance for any help you can provide.
For example, what is the proper syntax of the Encrypt(string, key[, algorithm[, encoding]])) function to send an RSA encrypted string to someone given the following values:
string = "This is the string to encrypt"
RSA Public Key Moduls = qFP+TNkUxiwqgYkce7iBR1Z2VndmSDLlxM0UQEW5UQQPdTWdEl6iIjteIZr5M9R6EBsGh6XKHG7et9SAJ/0h/OwBJMOaoGpoQq2IJHKqKA4UhC30fnFZcfVz6ne4dTUemkJinIUiSlHLaChdANoe9lC9wNVGu1tUpkiwj+Pn4/c=
RSA Public Key Exponent = AQAB
Padding = pKCS#1 v1.5
Thanks in advance for any help you can provide.
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/coldfusion-discussions/rsa-encryption-help-with-bouncy-castle/m-p/614926#M57449
Apr 09, 2007
Apr 09, 2007
Copy link to clipboard
Copied
<cfsavecontent variable="myText">
This is a bunch of text that will
be encrypted in the file.
</cfsavecontent>
<cfset myKey = ToBase64("F00BarKey")>
<b>Encrypted Key</b>
<p>
<cfoutput>#myKey#</cfoutput>
</p>
<cfset crypText = Encrypt(myText,myKey,"twofish")>
<cfset deCryptText = Decrypt(crypText,myKey,"twofish")>
<b>Encrypted Text</b>
<p>
<cfoutput>#crypText#</cfoutput>
</p>
<p>
<b>Un-Encrypted Text</b>
<p>
<cfoutput>#deCryptText#</cfoutput>
</p>
This is a bunch of text that will
be encrypted in the file.
</cfsavecontent>
<cfset myKey = ToBase64("F00BarKey")>
<b>Encrypted Key</b>
<p>
<cfoutput>#myKey#</cfoutput>
</p>
<cfset crypText = Encrypt(myText,myKey,"twofish")>
<cfset deCryptText = Decrypt(crypText,myKey,"twofish")>
<b>Encrypted Text</b>
<p>
<cfoutput>#crypText#</cfoutput>
</p>
<p>
<b>Un-Encrypted Text</b>
<p>
<cfoutput>#deCryptText#</cfoutput>
</p>
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
rick-h
AUTHOR
New Here
,
LATEST
/t5/coldfusion-discussions/rsa-encryption-help-with-bouncy-castle/m-p/614928#M57451
Apr 09, 2007
Apr 09, 2007
Copy link to clipboard
Copied
Hi, Thanks for your reply. A couple of clarifications. I need
to use the public key provided by the a 3rd party that I am sending
encrypted data to, and I must use RSA encryption. I believe what I
am looking for will be something like:
<cfsavecontent variable="myText">
This is a bunch of text that will
be encrypted in the file.
</cfsavecontent>
<cfset myText_encrypted = encrypt(myText, pubKey, "RSA/NONE/PKCS1Padding")>
I am not sure how to set the value of pubKey. I have the Base64 encoded modulus and exponent for the 3rd parties Public Key, but I am not sure how to convert the modulus and exponent into the key format that the encrypt() function is looking for.
<cfsavecontent variable="myText">
This is a bunch of text that will
be encrypted in the file.
</cfsavecontent>
<cfset myText_encrypted = encrypt(myText, pubKey, "RSA/NONE/PKCS1Padding")>
I am not sure how to set the value of pubKey. I have the Base64 encoded modulus and exponent for the 3rd parties Public Key, but I am not sure how to convert the modulus and exponent into the key format that the encrypt() function is looking for.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Engaged
,
/t5/coldfusion-discussions/rsa-encryption-help-with-bouncy-castle/m-p/614927#M57450
Apr 09, 2007
Apr 09, 2007
Copy link to clipboard
Copied
my previous post is only an example using the standard
encrypt/decrypt using twofish from bouncy castle. The following
link (
http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=e546373d)
will give you more information on using Bouncy Castle as a security
provider.
For PGP, most solutions I've seen use either a custom tag, cfexecute, or possibly the Java route ( http://cephas.net/blog/2004/04/01/pgp-encryption-using-bouncy-castle/)
Hopefully this will give you something to go on.
For PGP, most solutions I've seen use either a custom tag, cfexecute, or possibly the Java route ( http://cephas.net/blog/2004/04/01/pgp-encryption-using-bouncy-castle/)
Hopefully this will give you something to go on.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

