All Products
Search
Document Center

Simple Message Queue (formerly MNS):Encrypt messages for transmission

Last Updated:Jan 06, 2025

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

Background information

SMQ 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 SMQ by using the following two methods:

  • Use HTTPS endpoints of SMQ.

  • 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 SMQ 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 SecurityQueue.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 SMQ servers.

    • popMessage: decrypts messages that are received from SMQ 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.