简体   繁体   English

如何在PHP的多个域之间安全地传输变量/参数?

[英]How should I transfer variables/ parameters securely between multiple domains in PHP?

I would like to securely transfer sensitive variables between multiple in PHP. 我想在多个PHP之间安全地传输敏感变量。 Normally I would use url parameters or session cookies to transfer non-sensitive values. 通常,我会使用url参数或会话cookie来传输非敏感值。 I'm not sure how secure I can make cookies and url params or if there is a better option out there? 我不确定我可以制作Cookie和url参数有多安全,或者那里是否有更好的选择?

If you need good security, you can serialize() your parameters into a string, and AES encrypt the string on the origin server with mcrypt() , wrapped in base 64 encoding with base64_encode() . 如果需要良好的安全性,则可以将参数serialize()为字符串,然后使用mcrypt()在原始服务器上AES加密该字符串,该字符串以base64编码和base64_encode()包装。 Pass the encrypted, encoded data to the other server as a single URL parameter where it can be decrypted using the AES shared key and parsed back to individual variables with unserialize() . 将加密的编码数据作为单个URL参数传递给另一台服务器,在该服务器上可以使用AES共享密钥对其进行解密,并使用unserialize()解析回单个变量。

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

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