开发者

What's the best way to secure data between an PHP webservice and a Android/Java application

开发者 https://www.devze.com 2023-02-21 22:19 出处:网络
And by that i don\'t mean using HTTPS, but data encryption. Is there a nice encrypti开发者_运维问答on method that i can use in PHP to encrypt the data and decrypt in Java?

And by that i don't mean using HTTPS, but data encryption.

Is there a nice encrypti开发者_运维问答on method that i can use in PHP to encrypt the data and decrypt in Java?

Thanks in advance.


AES-256 is the same in both Java as PHP: the algorithm itself is naturally language agnostic, so you can just pick one. That said, if you were to use HTTPS, the data would be encrypted either way, so perhaps you're overcomplicating things? Is the data that important and privacy-sensitive?


HTTPS does data encryption. If you're planning to negotiate the encryption without any pre-shared keys then HTTPS is probably one of your best options. It's not trivial to get encryption done in a proper way, so it's usually best to leverage existing implementations.

If you are planning on using a shared key that the client and server each know about, then you do likely want to use AES. For the Java side see an example here. You'll have to search around for the PHP side. Be sure to follow all of the best practices if you're aiming for security.

0

精彩评论

暂无评论...
验证码 换一张
取 消