I recently needed to encrypt passwords or short text strings with asymmetric cryptography, using two keys, one for encryption and the other for decryption (private and public) in my Coldfusion Application.
RSA provides such algorithms, but Coldfusion only has adequate functions (encrypt, decrypt) with support for symmetric encryption and decryption.
Then I just started to build a component with the use of java.security objects, and now it is ready to use with three simple methods.
Create_key_pair returns two keys. Encrypt_string and decrypt_string do what they are built for.
You can download the RSA component from GitHub/ggfx/Coldfusion-rsa.
A quick example:
<cfscript> my_string = "my secret"; obj_rsa = createObject("component","_cfcs.rsa").init(); keys = obj_rsa.create_key_pair(2048); encrypted = obj_rsa.encrypt_string(my_string,keys.public_key); decrypted = obj_rsa.decrypt_string(enc,keys.private_key); </cfscript>
Of course you can save the keys in a file or a database and then reload them when you need to use encrypt_string and decrypt_string.