This topic describes how to encrypt messages to improve the security of the network connections between clients and MNS.
You can use HTTP requests to access MNS from the Internet. For messages that contain sensitive information, you can improve the security of the network connections between clients and MNS by using the following two methods:
- Use HTTPS endpoints of MNS.
- Encrypt messages to prevent data theft.
This section describes a solution provided by MNS to encrypt messages.
- Encrypt messages on the sender client.
- Decrypt and consume messages on the receiver client.
Click here to download the sample code.
- The SeurityQueue.java file provides the putMessage, popMessage, and deleteMessage API operations.
- putMesssage: uses keys and an algorithm to encrypt messages before the messages are sent to MNS servers.
- popMessage: decrypts messages that are received from MNS servers and returns the decrypted messages.
- The SecurityKeyGenerator.java file is used to generate the secretKey value that is used to encrypt and decrypt messages.
- The SecurityQueueDemo.java file provides the sample code that is used to encrypt, decrypt, and delete messages.
For information about how to use the sample code, see ReadMe.txt.
- Message encryption and decryption may affect the performance of the consumer client and receiver client.
- Do not send unencrypted messages to a queue that exclusively receives encrypted messages.