PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, February 26, 2022

[FIXED] Cant store encrypted Integer in Database

 February 26, 2022     laragon, laravel, mysql, rc4-cipher     No comments   

Issue

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

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.



Answered By - O. Jones
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing