Share via


MSMQMessage.SenderCertificate (Compact 2013)

3/26/2014

This property provides an array of bytes that represents the security certificate. The security certificate is used to authenticate messages.

Syntax

HRESULT get_SenderCertificate( 
  VARIANT* pvarSenderCert 
);
HRESULT put_SenderCertificate( 
  VARIANT varSenderCert
);

Parameters

  • pvarSenderCert or varSenderCert
    Security certificate, internal or external.

Return Value

The following table describes the common return values.

Value

Description

S_OK

Success

E_INVALIDARG

One or more arguments are invalid

E_NOTIMPL

The function contains no implementation

E_OUTOFMEMORY

Out of memory

Remarks

Use SenderCertificate when you want to authenticate a small number of messages with the same certificate.

Note

When sending a large number of messages using the same certificate, use security context information to attach the certificate. Security context information is obtained by calling MSMQMessage.AttachCurrentSecurityContext. This security context method creates a security context based on the data in MSMQMessage.SenderCertificate. If MSMQMessage.SenderCertificate is not set before calling AttachCurrentSecurityContext, the Message Queuing internal certificate for the user is used for the security context.

Message Queuing uses the certificate to authenticate the message. However, the receiving application can use the information in an external certificate to verify who sent the message. (When an internal certificate is used, the information in the certificate is not useful to the receiving application.)

The receiving application should use only SenderCertificate when an external certificate is sent with the message. After retrieving the certificate, use the CryptoAPI to validate the information in the certificate.

If you do not know if an external or internal certificate was sent, retrieve the certificate and look at its locality attribute. If the locality attribute was set by MSMQ, the certificate is a Message Queuing internal certificate.

You can also set and retrieve the security certificate when using Message Queuing function calls.

Requirements

Header

mqoai.h

Library

mqoa.lib

See Also

Reference

MSMQMessage