Share via


PROPID_M_ENCRYPTION_ALG

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The PROPID_M_ENCRYPTION_ALG property specifies the encryption algorithm used to encrypt the message body of a private message.

Property ID

PROPID_M_ENCRYPTION_ALG

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

In MSMQ 1.0, 2.0, and 3.0, this property can be set to CALG_RC2 or CALG_RC4. The default value is CALG_RC2.

In MSMQ 4.0, this property can be set to CALG_RC2, CALG_RC4, or AES. The default value is CALG_RC4.

Remarks

When you send private messages, the algorithm specified by PROPID_M_ENCRYPTION_ALG is used to encrypt the body of the message (this can be done by your application or by the sending queue manager) and to decrypt the message body when it is accepted by the destination queue manager.

To set the encryption algorithm, specify PROPID_M_ENCRYPTION_ALG in the MQMSGPROPS structure and call MQSendMessage.

To retrieve the encryption algorithm, specify PROPID_M_ENCRYPTION_ALG in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned value. When retrieving this property, the type indicator can be set to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

The algorithm identifiers CALG_RC2 and CALG_RC4 are defined by the ALG_ID data type in wincrypt.h.

Equivalent COM Property

With COM components, the equivalent property for setting and retrieving the encryption algorithm is MSMQMessage.EncryptAlgorithm.

For information on See
Letting Message Queuing encrypt messages Message Queuing-Encrypted Messages
Having your application encrypt messages Application-Encrypted Messages
Authenticated messages How Message Queuing Authenticates Messages

Example Code

The following code fragments show how PROPID_M_ENCRYPTION_ALG is included in arrays that can be used to initialize an MQMSGPROPS structure to specify a certain encryption algorithm and to ascertain the encryption algorithm.

To Specify the Encryption Algorithm

aMsgPropID[i] = PROPID_M_ENCRYPTION_ALG ;  // Property ID  
aMsgPropVar[i].vt = VT_UI4;                // Type indicator  
aMsgPropVar[i].ulVal = CALG_RC4;           // Value  

To Retrieve the Encryption Algorithm

aMsgPropID[i] = PROPID_M_ENCRYPTION_ALG ;  // Property ID  
aMsgPropVar[i].vt = VT_NULL;               // Type indicator  

The following example is included in Using Message Queuing.

For an example of See
Sending Message Queuing-encrypted private messages C/C++ Code Example: Requesting Encryption

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MQSendMessage
PROPID_M_PRIV_LEVEL