MSMQMessage.PrivLevel

 

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

The PrivLevel property of the MSMQMessage object specifies privacy level of the message.

Data type:Long
Run-time access:Read/write
Property PrivLevel As Long  

PrivLevel can be set to one of the following values:

MQMSG_PRIV_LEVEL_BODY

(Not supported for applications compiled with the header and library files for MSMQ 3.0.) Privacy is enforced, and 40-bit end-to-end encryption of the message body is used.

MQMSG_PRIV_LEVEL_BODY_BASE

(Introduced in MSMQ 2.0.) Privacy is enforced, and 40-bit end-to-end encryption of the message body is used.

MQMSG_PRIV_LEVEL_BODY_ENHANCED

(Introduced in MSMQ 2.0.) Privacy is enforced, and 128-bit end-to-end encryption of the message body is used.

MQMSG_PRIV_LEVEL_NONE

The default. The message is a non-private (clear) message.

The MSMQMessage.PrivLevel is used to request encryption by Message Queuing. For information on how Message Queuing encrypts messages, see Message Encryption.

The sending application can request encryption by setting the PrivLevel property to MQMSG_PRIV_LEVEL_BODY, MQMSG_PRIV_LEVEL_BODY_BASE, or MQMSG_PRIV_LEVEL_BODY_ENHANCED. When one of these settings is used, the body of the message is encrypted with the algorithm specified by MSMQMessage.EncryptAlgorithm.

System_CAPS_ICON_note.jpg Note

MSMQ 2.0 applications can use MQMSG_PRIV_LEVEL_BODY or MQMSG_PRIV_LEVEL_BODY_BASE to request 40-bit encryption, or they can use MQMSG_PRIV_LEVEL_BODY_ENHANCED to request 128-bit encryption. When requesting encryption, MSMQ 3.0 applications can use only MQMSG_PRIV_LEVEL_BODY_BASE (40-bit encryption) or MQMSG_PRIV_LEVEL_BODY_ENHANCED (128-bit encryption).

It is recommended that you use 128-bit encryption, which provides strong encoding. Attackers can decrypt data encoded with 40-bit encryption relatively easily.

Messages can also be encrypted by applications. In this case the PrivLevel property must be set as follows.

  • If your application is encrypting the message body with a 40-bit key, ignore the PrivLevel property when sending messages.

  • If your application is encrypting the message body with a 128-bit key, set PrivLevel to MQMSG_PRIV_LEVEL_BODY_ENHANCED and include it with the message.

For information on application encryption, see Application-Encrypted Messages.

Equivalent API Function Property

With API function calls, the equivalent property is PROPID_M_PRIV_LEVEL.

The following examples are included in Using Message Queuing.

For an example ofSee
Requesting encryption when sending messagesVisual Basic Code Example: Requesting Encryption
Setting the privacy level of a queue to enforce encryption when creating a queueVisual Basic Code Example: Enforcing Encryption

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

MSMQMessage
MSMQMessage.EncryptAlgorithm
PROPID_M_PRIV_LEVEL

Community Additions

ADD
Show: