Question

My Question is simple - is there a build in functionality, like AES_ENCRYPT / AES_DECRYPT, for asymmetric (public / private key) encryption in MySQL?

Sadly, I only find answers that involve PHP (to encrypt it in php), and stuff like that. I would like to keep it in MySQL, since the whole application logic is handled by procedures - and I would like to avoid ruining that by bringing in external languages to solve this issue.

Was it helpful?

Solution

There is no functionality for RSA encryption within MySQL. it's sort of an odd use case, so the MySQL folks probably haven't seen fit to implement it

You'll have to do the RSA operations in the application layer, and pass the results into your procedures, unless you fancy implementing RSA within MySQL yourself (which I really cannot advise at all)

OTHER TIPS

What you can do is something like this; Make a shared secret between multiple users using their pub/priv keys, then use that shared secret as the AES symetric key to unlock the data in mysql.

What this means is that you can utilize mysql's inbuilt AES encrypt function for convenience while still maintaining secure data given that you will never know the shared secret.

eg: Alice / Bob shared secret / coloured paint

Also you can try reading this enter link description here

I am very much agree to @Peter Elliott. But as part of answer I would like to add that MySQL Enterprise Encryption provide that kind of facility such as :

MySQL Enterprise Encryption gives DBAs and Developers the tools they need for:

  • Asymmetric Public Key Encryption (RSA) Asymmetric Private Key
  • Decryption (RSA) Generate Public/Private Key (RSA, DSA, DH) Derive
  • Symmetric Keys from Public and Private Key pairs (DH) Digitally Sign
  • Data (RSA, DSA) Verify Data Signature (RSA, DSA) Validation Data
  • Authenticity (RSA, DSA)

For more information you can visit MySQL Enterprise Encryption, I hope this will be helpful to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top