CSecureChannelClient::EncryptParam
The EncryptParam method uses the session key of the secure authenticated channel to encrypt the data contained in a parameter.
Syntax
HRESULT EncryptParam(
BYTE* pbData,
DWORD dwDataLen
);
Parameters
pbData
Pointer to the first byte of a data buffer containing the parameter that is to be encrypted.
dwDataLen
Pointer to a DWORD specifying the length of the buffer to which pbData points.
Return Values
The method returns an HRESULT. All the interface methods in Windows Media Device Manager and service provider can return any of the following classes of error codes:
- Standard COM error codes
- Windows error codes converted to HRESULT values
- Windows Media Device Manager error codes
For a complete list of possible error codes, see Error Codes.
Possible values include, but are not limited to, those in the following table.
Return code | Description |
S_OK | The method succeeded. |
E_INVALIDARG | A parameter is invalid or is a NULL pointer. |
E_FAIL | An unspecified error occurred. |
Remarks
Call the EncryptParam method to encrypt certain parameters before calling functions in other components.
Encrypt only the parameters that are specified as requiring encryption. See Secure Authenticated Channel Interface for a table of methods that must use the message authentication code algorithm and encrypted parameters.
Example Code
// Create the MAC to send to ExamineData.
CSecureChannelClient *pSCClient = NULL;
UINT fuTempFlags;
pSCClient->MACInit(&hMAC);
fuTempFlags = WMDM_SCP_EXAMINE_DATA;
pSCClient->MACUpdate(hMAC, (BYTE*)(&fuTempFlags), sizeof(fuTempFlags));
pSCClient->MACUpdate(hMAC, (BYTE*)(pData), dwExSize);
pSCClient->MACUpdate(hMAC, (BYTE*)(&dwExSize), sizeof(dwExSize));
pSCClient->MACFinal(hMAC, abTempMAC);
// Encrypt the pData Parameter.
pSCClient->EncryptParam(pData, dwExSize);
Requirements
Header: Include scclient.h.
Library: mssachlp.lib
See Also