简体   繁体   中英

Encryption/decryption between Java and Android

I am using the same code on Java SE and Android project. The apps running in Java and Android connect to the same MQTT broker and exchange messages. The messages are encrypted/decrypted using AES. I have very little experience with Java Security Architecture, so my questions are:

1) What should I expect if I use the same Cipher algorithm, but from different providers (one on Java and another on Android)? Does using a different provider to decrypt a message encrypted with another provider automatically mean that the message won't be decrypted successfully?

2) What would be a recommended provider to use that would allow Java and Android applications to communicate correctly in this case? I have seen some answers online, but some are relatively old, so I'm not sure if they are still best answers.

What should I expect if I use the same Cipher algorithm, but from different providers (one on Java and another on Android)?

The same result.

Does using a different provider to decrypt a message encrypted with another provider automatically mean that the message won't be decrypted successfully?

No.

2) What would be a recommended provider to use that would allow Java and Android applications to communicate correctly in this case?

The one built into the JRE, assuming it supports AES.

But I'm wondering why you aren't using SSL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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