如何在 Java 客户端和 CodeIgniter 服务器之间安全地通信?

发布于 2025-01-08 16:41:32 字数 267 浏览 0 评论 0原文

我需要在基于 PHP CodeIgniter 的服务器和 Java 客户端之间传递命令和数据。我正在考虑使用非常简单的加密来加密/解密消息。我在尝试在 Java 端进行非常基本的加密时遇到了很多问题。

要么我想要一些关于加密的 Java 方面的帮助,要么需要一个不同的想法来保护客户端和服务器之间的通信。

数据不敏感,只要我能确保它来自正确的来源,就可以明文发送。我正在考虑使用基本加密作为不会被重放攻击规避的身份验证措施。但我的做法可能全错了。

任何帮助或评论表示赞赏。

I need to pass commands and data between a PHP CodeIgniter based server and a Java Client. I was thinking of using very simple encryption to encrypt / decrypt the messages. I have run into a lot of issues trying to do very basic crypto on the Java side.

Either I would like some help with the Java side of the Crypto, or a different idea to secure communication between the Client and Server.

The data is not sensitive and can be sent in the clear, as long as I can ensure it is coming from the correct source. I was thinking of using the basic encryption as an authentication measure that would not be circumvented by a replay attack. But I could be going about this all wrong.

Any help or comments are appreciated.

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

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

发布评论

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

评论(1

绅士风度i 2025-01-15 16:41:32

没有方法可以保证您的服务器收到的数据来自 Java 应用程序的合法版本。如果您使用任何形式的加密,则密钥必须存储在应用程序字节码中的某个位置。此外,破解客户端应用程序并让它发送无效数据也不是很困难。

正确的方法是记住,在服务器端,您的数据可能不是来自正确的来源,因此您必须验证所有数据,以确保没有发生任何非法行为。

如果您只是想保证使用客户端应用程序的合法用户可以确定他们正在与您的服务器进行通信,则可以使用 HTTPS 或其他使用非对称加密的方法。

There is no method of guaranteeing that the data your server is received comes from a legitimate version of your Java app. If you're using any form of encryption, the key must be stored somewhere in your application bytecode. Also, it is not very difficult to hack the client-side application and let it send invalid data.

The correct approach is to keep in mind, on the server side, that your data might not be coming from the correct source and therefore you'll have to validate all data in order to make sure nothing illegal is being done.

If you just want to guarantee that legitimate users using your client application can be certain that they are communicating with your server, you can use HTTPS or some other method using asymmetric encryption.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文