通过多步骤表单传递信用卡号的最安全方法?
在第 3 步中,我有一个接受信用卡的表格,第 4 步重新打印信息,包括信用卡的最后 4 位数字,第 5 步我需要知道完整的 CC # 来处理它并通过我的 https 发送它与第 3 方供应商的连接 - 我应该通过隐藏输入或 $_SESSION 存储它,以便我可以在第 3 步和第 5 步之间访问它?
仅供参考:我的整个网站已经是 https 了。
On step 3 I have a form which accepts a credit card, Step 4 re-prints the information including the last 4 digits of the credit card, and Step 5 I need to know the full CC # to process it and send it through my https connection to a 3rd party vendor - should I store it through hidden inputs or $_SESSION
so I can access it in between the 3rd and 5th step?
FYI: My entire site is already https'd.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
将信用卡号作为最后一步,这样您就不必存储它。存储该信息存在许多法律问题。
Take the credit card number as the last step so you don't have to store it. There are many legal issues around storing that information.
SSL 不会保护存储在磁盘上的数据。此外,PHP 会话数据默认存储在文件系统中具有最小权限的临时目录下。因此,数据不仅以纯文本形式存储,而且可以被许多不同的系统用户访问(取决于您的 Web 服务器配置)。
如果您想实现多步骤结帐流程,我建议您在浏览器端执行一些 AJAX/Javascript 魔法。您可以使用一系列隐藏/折叠的 DIV 来收集账单信息,并一次性发布完整的数据集,将 CC 数据一次性发送到您的服务器,然后服务器将 CC 数据中继到您的支付处理器。
SSL won't protect data stored on disk. Additionally, PHP session data is stored by default in the file system under a temp directory with minimal permissions. So not only is the data stored in plain-text but also can be accessed by many different system users (depending on your web server configuration).
If you want to implement a multi-step checkout process I'd suggest doing some AJAX/Javascript magic on the browser side. You can collect the billing information using a series of DIVs that are hidden/collapsed and post the complete data set in one go, sending the CC data one-time to your server, which then relays the CC data to your payment processor.
绝对不在隐藏表单字段中。如果用户离开或保存页面或有人点击后退按钮,则完整的抄送信息可用。计算机可能与其他人共享。
如果您确实将 CC 保存到磁盘/数据库,则必须对 CC 进行加密,否则您将违反支付卡行业 (PCI) 的要求。为了方便起见,您可以单独保留最后 4 位数字。
请注意,如果您使用会话(出于其他原因),您必须注意对会话的攻击,包括但不限于会话固定。
另一种可能性是重新设计您的客户端,以便各个步骤只是 ajax 调用(抄送在 js 变量中而不是表单字段中)并使用 CSS 来显示/隐藏各种 div - 在最后一步将整个信息发布到您的服务器。
Definitely not in a hidden form field. If the user walks away or saves the page or someone hits the back button, then full CC information is available. The computer may be shared with others.
If you do persist the CC to disk/database then the CC must be encrypted otherwise you would be violating Payment Card Industry (PCI) requirements. You could keep the last 4 digits in the clear separately for convenience.
Note if you go with sessions (for other reasons) you have to take care of attacks on session including but not limited to session fixation.
One other possibility is to rework your client side such that the various steps are just ajax calls (cc is in js variable not in form field) and use CSS to display/hide various divs - on the final step post the entire information to your server.
根本不要存储它。那里有很多信用卡处理设施。除非您绝对必须在内部拥有此功能,否则不要这样做。
说真的,你可以选择。
Don't store it at all. There are lots of credit card processing facilities out there. Unless you absolutely must have this functionality in house, don't do it.
Seriously, take your pick.
都不是。您应该(以某种方式)将其加密存储在服务器上。
neither way. you should store it (somehow) encrypted on the server.