PROPID_Q_PRIV_LEVEL

 

Updated: July 19, 2016

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

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

Property ID

PROPID_Q_PRIV_LEVEL

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

This property can be set to one of the following values:

MQ_PRIV_LEVEL_NONE

The queue accepts only non-private (clear) messages.

MQ_PRIV_LEVEL_BODY

The queue accepts only private (encrypted) messages.

MQ_PRIV_LEVEL_OPTIONAL

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 set the privacy level when creating the queue, specify PROPID_Q_PRIV_LEVEL in the MQQUEUEPROPS structure and call MQCreateQueue.

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 onSee
Having Message Queuing encrypt messagesMessage Queuing-Encrypted Messages
Having your application encrypt messagesApplication-Encrypted Messages
Setting and retrieving the privacy level of a queue when you are using COM componentsMSMQQueueInfo.PrivLevel

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 ofSee
Requesting encryption when sending messagesC/C++ Code Example: Requesting Encryption
Creating a queue that accepts only private messagesC/C++ Code Example: Enforcing Encryption
Setting and retrieving the privacy level of the queueC/C++ Code Example: Setting PROPID_Q_PRIV_LEVEL

 C/C++ Code Example: Retrieving PROPID_Q_PRIV_LEVEL

Queue Properties
MQCreateQueue
MQGetQueueProperties
MQQUEUEPROPS
MQSetQueueProperties

Community Additions

ADD
Show: