Need to encrypt form results in Database

Permalink
Hello,

I have an external form that I need to store in a secondary DB/table encrypted. I have the form submitting successfully to the DB/table.

However, I need to encrypt the data in the Database. Can someone help out here? The data from this table is pulled into an API call and sent to an internal server at the client where it needs to be decrypted and imported into their CRM system. They handle that part. All I need is to encrypt the Data and tell them how to decrypt.

I am using C5 8.5.1 and PHP 7.1

Thanks in advance!

View Replies:
mnakalay replied on at Permalink Reply
mnakalay
The easiest way is to use the Crypto class that comes with Concrete5.
use Defuse\Crypto\Crypto;
// To encrypt
$encryptedText = Crypto::encryptWithPassword($plaintext, $password);
// To decrypt
$decryptedText = Crypto::decryptWithPassword($encryptedText , $password);

If your client is also using C5 they can use that code directly. Otherwise, they can download the library from Github and install it on their server. The link is:https://github.com/defuse/php-encryption...
GrizzlyAdams replied on at Permalink Reply
Thank you for the reply. Is there a guide somewhere for this? I have never used the built in encryption before.

I have one form POST that I need to do this to from an External Form.

Thank you.
JohntheFish replied on at Permalink Reply
JohntheFish
If you have a dedicated server, you could approach this from the other direction and use disk encryption in the OS. Either for the entire server, or just on a partition for the database files.

Someone stealing the disk won't be able to read it. But anyone with a server login will be able to read it.

You can also encrypt tables within MySQL.https://dev.mysql.com/doc/refman/5.7/en/faqs-tablespace-encryption.h...

With table encryption, the table will only be readable through MySQL. Anyone with a login who doesn't have access to the MySQL database table won't be able to read it.

I think you may also be able to specify just columns to be stored encrypted.