All Products
Search
Document Center

Message Service:Encrypt messages for transmission

Last Updated:Mar 15, 2024

This topic describes how to improve the security of the network connections between clients and Message Service (MNS).

Background information

MNS allows you to use HTTPS to encrypt messages for transmission over the Internet. For the transmission of 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 on clients to prevent data theft.

Usage notes

  • 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.

Solution

This section describes a solution provided by MNS to encrypt messages for transmission.

  1. Encrypt messages on the sender client before the messages are sent.

  2. Decrypt and consume messages on the receiver client.

Download the SecurityQueue.zip package to obtain the sample code.

  • The SeurityQueue.java file provides the putMessage, popMessage, and deleteMessage API operations.

    • putMessage: 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 more information, see ReadMe.txt.