Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL & ColdFusion Encryption

I know how to encrypt data using ColdFusion using AES_128. I also know how to encrypt data using MSSQL AES_128. Does anyone know if it’s possible to encrypt data in ColdFusion using AES_128, then decrypt the string in MSSQL?

I’ve played around with it a lot and can’t seem to figure it out.

Thanks, Paul

like image 280
Paul Avatar asked Sep 07 '10 18:09

Paul


1 Answers

Yes this is possible. There is nothing about AES that makes it proprietary. However, there are many ways of implementing a block cipher, and most of them are incorrect. MS SQL's encryptbykey() uses ECB mode and defaults to ANSI_PADDING. I would try decrypting a message using the same key with an AES in ECB mode and it will likely just work. CBC mode should be used, but this requires a IV, and encryptbykey() doesn't accept an IV as a parameter so its ECB mode. (MySQL also ecb mode, i've looked at the code. Its a shame I can't do that with MS SQL).

like image 62
rook Avatar answered Oct 07 '22 01:10

rook