将信用卡信息存储到数据库的最佳实践

发布于 2024-09-04 09:44:05 字数 172 浏览 5 评论 0 原文

在我的国家,在线支付并不是什么新鲜事,我第一次看到网络应用程序直接将付款存入本地银行账户是在去年。

所以,我是一个编码网络支付系统的新手。

我的问题是,将信用卡信息存储到数据库中的最佳实践是什么......

我有很多想法:加密信用卡、数据库安全限制等。

你做了什么?

In my country the online payments are not an old thing, the first time i saw a web application taking payments directly to a local bank account was last year.

So, Im a newbie coding web payment system.

My question is, what are the best practices to store creditcard information into the database...

I have many ideas: encrypting the creditcard, database security restriction, etc.

What have you done?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

迷离° 2024-09-11 09:44:05

不要这样做

这涉及的风险太大,您通常需要接受外部审核,以确保您遵守所有相关的当地法律和安全实践。

有许多第三方公司可以为您做这件事,他们已经经历了所有麻烦来确保他们的系统安全、遵守当地法律等等。我过去在美国使用过的一个例子是 authorize.net。一些银行还拥有可以连接的系统来存储信用卡数据和处理付款。

我知道你所在的国家可能没有像美国那样严格的法律,但在我看来,这并不是你制定自己的法律的借口。当你处理别人的钱时,风险太大了,无法保证。

DON'T DO IT

There is simply far too much risk involved, and you will typically need to be externally audited to ensure that you're complying with all the relevant local laws and security practises.

There are many third-party companies that do it for you that have already gone through all trouble of making sure their system is secure, that they comply with local laws and so on. An example in the US that I have used in the past is authorize.net. Some banks also have systems that you can hook into to store credit card data and process payments.

I realise the country you're in may not have as strict laws as the U.S., but in my opinion that's no excuse for rolling your own. When you're dealing with other people's money, the risk is just too much to warrant.

清泪尽 2024-09-11 09:44:05

2020 年,请使用 Stripe,并避免自己存储付款信息。

历史答案:

为此,我建议采用全面、分层的方法。

首先,存储信用卡信息应该是一种选择。

其次,应使用强大的加密形式安全地存储数据。我推荐使用 256 位密钥大小的 AES。确保在选择密钥时使用整个密钥空间(仅使用随机生成的字母数字符号字符串作为密钥是一个菜鸟错误)。

第三,需要妥善保护 AES 密钥。不要将该值嵌入到代码中。如果您使用的是 Windows,请考虑使用 DPAPI。

第四,您需要设置数据库权限,以便应用程序和计算机可以根据需要进行访问。

第五,保护数据库的连接字符串。

第六,确保任何有权访问信用卡数据的应用程序都能正确保护其安全。

In 2020, use Stripe, and avoid storing payment information yourself.

HISTORICAL ANSWER:

For this, I recommend a comprehensive, layered approach.

First, storing credit card info should be an option.

Secondly, the data should be stored securely, using a strong form of encryption. I recommend AES with 256bit key size. Make sure when choosing your key, you use the entire keyspace (it's a rookie mistake to just use a randomly generated alphanumericsymbol string as a key).

Third, the AES key needs to be properly secured. Do not embed the value inside your code. If you are using windows, consider using DPAPI.

Fourth, you will want to setup database permissions so that applications and computers will have access on a need to know basis.

Fifth, secure the connection string to your database.

Sixth, ensure that any application that will have access to the credit card data, will properly secure it.

芯好空 2024-09-11 09:44:05

至少遵循 PA DSS(支付应用程序数据安全标准)。更多信息可以在这里找到:

https://www.pcisecuritystandards.org/security_standards/pa_dss.shtml< /a>

此外,明智的做法是查看 PCI DSS,可以在此处找到:

https:/ /www.pcisecuritystandards.org/security_standards/pci_dss.shtml

At miniumum follow the PA DSS (Payment Appliction Data Security Standard). More info can be found here:

https://www.pcisecuritystandards.org/security_standards/pa_dss.shtml

Also it would be wise to look at PCI DSS, which could be found here:

https://www.pcisecuritystandards.org/security_standards/pci_dss.shtml

友欢 2024-09-11 09:44:05

加密加密加密。如果不是绝对必要,请不要解密 - 不要解密以显示最后 4 位数字。不要解密来告诉用户他们的卡是什么。

事实上,如果可以的话,甚至不要将加密的卡号与其他用户信息保存在同一物理服务器中。

Encrypt encrypt encrypt. Don't decrypt if you don't absolutely have to - don't decrypt to show the last 4 digits. Don't decrypt to tell the user what their card was.

In fact, if you can, don't even keep the encrypted card numbers in the same physical server as the rest of the user information.

秋意浓 2024-09-11 09:44:05

您应该避免存储任何信用卡信息,因为这样做会给您和客户带来风险。

You should avoid storing any credit card information due to the risks to you and to customers of doing so.

享受孤独 2024-09-11 09:44:05

Authorize.net 有一个 客户信息管理器 API,允许您将客户信息存储在他们的系统中。费用为 20 美元/月。作为您帐户的附加组件。

Authorize.net has a Customer Information Manager API that allows you to store customer information in their system. It costs $20/mo. as an add-on to your account.

幸福丶如此 2024-09-11 09:44:05

我建议您使用强大的算法(类似 AES)和长密钥来加密卡号。

然后,将您的密钥保存在安全的地方,例如外部硬盘或光盘。
当您需要密钥时,请使用外部硬盘。

如果您使用共享主机,则必须将密钥存储在外部设备中。

严格您的数据库

  1. 为您的数据库定义严格的用户
  2. 如果不需要,请删除数据库的根用户。

I suggest you encrypt card numbers with a strong algorithm( similar AES) and a long secret key.

Then,keep your secret key in a secure place similar an external hard or optical disk.
When you need to secret key,use external hard.

If you are using a shared host, you have to store your secret key in an external device.

Strict your database

  1. Define strict users for your database
  2. Remove root user of your database if it is not needed.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文