Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Cant store encrypted Integer in Database

I am Developing a website using Laravel that accept Online payment with Credit card and this must be encrypted before storing into the database
I am Using RC4 Encryption to encrypt an integer then store it in my database
it throwing an error cause after encryption it looks like that
r ���`�q�
so weird symbols and logos
it cannot be stored as my database collation is utf16 general_ci
I used something else but it didn’t work
[This Error1

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Encrypted data is generally binary data, and the characters you show in your question suggest that’s the case in your application.

A good solution to your problem is to use base64_encode() to convert your encrypted binary data to text before putting it into MySQL, and base64_decode() to get back the binary data after you read it from MySQL.

Warning: RC4 encryption is not secure. It’s been cracked for almost a decade. If you use it to store sensitive credit card data, it is very likely that cybercriminals will steal that data. Your customers won’t like that.

If you want to handle credit card data, your best bet is to use a payment service provider like stripe.com, paypal, or one of many others. You don’t want credit card numbers, even encrypted ones, stored in your database.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading