Partilhar via


PROPID_M_SENDER_CERT_LEN

 

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

(Read-only.) The PROPID_M_SENDER_CERT_LEN property specifies the length of the sender certificate buffer.

Property ID

PROPID_M_SENDER_CERT_LEN

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

The length (in bytes) of the sender certificate returned by PROPID_M_SENDER_CERT.

Remarks

PROPID_M_SENDER_CERT_LEN is only used by the receiving application. It is required when PROPID_M_SENDER_CERT is specified in the MQMSGPROPS structure.

To retrieve the sender certificate from a message, specify PROPID_M_SENDER_CERT and PROPID_M_SENDER_CERT_LEN in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned values. The type indicator of this property can be set to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

When the function call succeeds, first test the returned value of PROPID_M_SENDER_CERT_LEN to see if a sender certificate exists. A returned value of 0 indicates that a sender certificate was not included in the message. A non-0 return value indicates that a sender certificate was returned by PROPID_M_SENDER_CERT.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_SENDER_CERT_BUFFER_TOO_SMALL error, use the returned value of PROPID_M_SENDER_CERT_LEN to reallocate the sender certificate buffer and call the applicable function again.

Equivalent COM Property

This property is not needed when you are using COM components.

Example Code

The following code fragment shows how PROPID_M_SENDER_CERT_LEN is specified in arrays that can be used to initialize an MQMSGPROPS structure when retrieving the sender certificate.

ULONG ulSenderCertBufferSize = 4096;  
UCHAR *pucSenderCertBuffer = NULL;  
pucSenderCertBuffer = (UCHAR *)malloc(ulSenderCertBufferSize);  
if (pucSenderCertBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(pucSenderCertBuffer, 0, ulSenderCertBufferSize);  
aMsgPropId[i] = PROPID_M_SENDER_CERT;       // Property ID  
aMsgPropVar[i].vt = VT_VECTOR | VT_UI1;     // Type indicator  
aMsgPropVar[i].caub.pElems = (UCHAR*)pucSenderCertBuffer;  
aMsgPropVar[i].caub.cElems = ulSenderCertBufferSize;  
i++;  
  
aMsgPropId[i] = PROPID_M_SENDER_CERT_LEN;   // Property ID  
aMsgPropVar[i].vt = VT_NULL;                // Type indicator  
i++;  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MQSendMessage
PROPID_M_SENDER_CERT