(Optional.) The PROPID_Q_PRIV_LEVEL property specifies the privacy level that is required by the queue. The privacy level determines how the queue handles encrypted messages.
This property can be set to one of the following values:
The queue accepts only non-private (clear) messages.
The queue accepts only private (encrypted) messages.
The default. The queue does not enforce privacy. It accepts private (encrypted) messages and non-private (clear) messages.
The application can set the privacy level of queues and messages. If the privacy level of the message (PROPID_M_PRIV_LEVEL) does not match the privacy level of the queue, the queue rejects the message. In addition, if the sending application requested a negative acknowledgment message when it sent the message, MQMSG_CLASS_BAD_ENCRYPTION will be returned to the sending application to indicate that the message was rejected.
To change the privacy level of a queue, specify PROPID_Q_PRIV_LEVEL in the MQQUEUEPROPS structure and call MQSetQueueProperties. When changing the privacy level of the queue, the new setting affects only arriving messages; it does not affect messages already in the queue.
To retrieve the privacy level of a queue, specify PROPID_Q_PRIV_LEVEL in the MQQUEUEPROPS structure, call MQGetQueueProperties, and examine its returned value.
When retrieving the privacy level required by the queue, the type indicator can be set to VT_UI4 or VT_NULL. If you set the type indicator equal to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.
Private messages can be encrypted by the sending queue manager or by the sending application.
|For information on||See|
Having Message Queuing encrypt messages
Having your application encrypt messages
Setting and retrieving the privacy level of a queue when you are using COM components
Equivalent COM Property
When using COM components, the privacy level of the queue can be set and retrieved using the MSMQQueueInfo.PrivLevel property.
The following code fragments show how PROPID_Q_PRIV_LEVEL is specified in arrays that can be used to initialize an MQQUEUEPROPS structure for setting and retrieving the privacy level of the queue.
To Set the Privacy Level
DWORD dwPrivacyLevel = MQ_RIV_LEVEL_BODY; aQueuePropID[i] = PROPID_Q_PRIV_LEVEL; // Property identifier aQueuePropVar[i].vt = VT_UI4; // Type indicator aQueuePropVar[i].ulVal = dwPrivacyLevel; // Privacy level of queue i++;
To Retrieve the Privacy Level
aQueuePropID[i] = PROPID_Q_PRIV_LEVEL; // Property identifier aQueuePropVar[i].vt = VT_NULL; // Type indicator i++;
The following examples are included in Using Message Queuing.
|For an example of||See|
Requesting encryption when sending messages
Creating a queue that accepts only private messages
Setting and retrieving the privacy level of the queue