简体   繁体   English

无法在数据库中存储加密的 Integer

[英]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 Error 1我正在使用 Laravel 开发一个接受信用卡在线支付的网站,并且在存储到数据库之前必须对其进行加密r ����`q 如此奇怪的符号和徽标无法存储,因为我的数据库排序规则是 utf16 general_ci 我使用了其他东西但它不起作用 [此错误1

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.解决您的问题的一个好方法是在将加密的二进制数据放入 MySQL 之前使用base64_encode()将其转换为文本,并在从 MySQL 读取二进制数据后使用base64_decode()取回二进制数据。

Warning: RC4 encryption is not secure.警告:RC4 加密不安全。 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.如果您想处理信用卡数据,最好的办法是使用支付服务提供商,例如 stripe.com、paypal 或许多其他提供商之一。 You don't want credit card numbers, even encrypted ones, stored in your database.您不希望将信用卡号(即使是加密的)存储在您的数据库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM