如何加密/解密 PHP GET 参数?
我有一个常规请求,例如:
http://myserver.com/index.php?var1=85842.23&var2=212.235&name=Teddie&valid=1
我希望这些 $_GET 参数被加密为类似的东西(不是真实的,只是一个例子:)):
http://myserver.com/index.php?eParam=ks883d48223v2czozoz227272j2nn2dn2d2du3dh4hn4f4f4f4h3383xh8383s38s3j83sj8s3j92h2s89hs387h2s87hs287h2s87h2ui2c3iuhc287z9m2389f
当然,我需要在每一侧都有一个内置密钥,这将能够解密该信息。 有没有什么功能可以实现这一点? 我不关心客户端,因为它将是一个正在运行的应用程序,而不是网页或任何可以轻松进行逆向工程的东西。
谢谢 !
I have a regular request, for example:
http://myserver.com/index.php?var1=85842.23&var2=212.235&name=Teddie&valid=1
I would like those $_GET parameters be encrypted to something like (not real, just an example:)):
http://myserver.com/index.php?eParam=ks883d48223v2czozoz227272j2nn2dn2d2du3dh4hn4f4f4f4h3383xh8383s38s3j83sj8s3j92h2s89hs387h2s87hs287h2s87h2ui2c3iuhc287z9m2389f
Of course, I need a built in key on each side, that will be able to decrypt that info.
Is there any function that may render that possible ?
I am not concerned about the client side, as it will be a running application, not a webpage or anything that would be easily reverse-engineered.
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需使用 SSL(即 HTTPS 而不是普通 HTTP)。然后,除了 DNS 查找域以及与域解析的 IP 地址建立的连接之外的所有内容都将被加密。
Just use SSL (i.e. HTTPS instead of plain HTTP). Then everything except the DNS look up for the domain and that a connection is made to the ip address that domain resolves to will be encrypted.
实际上你可以这样做......你可以有一个加密/解密函数,包括给定参数的时间到期时间。我有一个脚本可以为我的网络系统执行此操作。而且你必须自己构建它,我不能公开我的安全脚本...但想法是这样的:
Actually you can do that... You can have an encrypt/decrypt function including a time expiry for the given parameter. I have a script that does that for my network systems. And you have to build that on your own, I can't go public with my security scripts... But here's the idea: