Sending Messages While Impersonating Another User

Sending messages while impersonating another user requires that the security information must be retrieved from the certificate using MQGetSecurityContext, even if you are using the internal certificate supplied by MSMQ.

To send an authenticated message
  1. Call MQGetSecurityContext. When using an external certificate, specify the certificate you want to use. When using the internal certificate provided by MSMQ, specify NULL. MQGetSecurityContext must always be used when impersonating a user.

  2. Set PROPID_M_SECURITY_CONTEXT to the returned handle.

After the message is sent, the remaining work is done by MSMQ. For information on what MSMQ does to authenticate the message, see How MSMQ Authenticates Messages.


© 1997 by Microsoft Corporation. All rights reserved.