To implement IComponentAuthenticate in a Service Provider or Secure Content Provider
- Include Sac.h and Scserver.h.
- Link to Mssachlp.lib.
- Add the Keys.c file that you received when you signed the license agreement for your project.
- Declare a CSecureChannelServer object. This object must be available to all other objects implemented in your component.
- Implement IComponentAuthenticate on the main object of your component. For an SP, this is the object that implements IMDServiceProvider, and for an SCP this is the object that implements ISCPSecureAuthenticate. Use code similar to that in the following example in the constructor for your main object:
g_pAppSCServer = new CSecureChannelServer();
if (g_pAppSCServer)
{
g_pAppSCServer->SetCertificate(SAC_CERT_V1, (BYTE*)abCert,
sizeof(abCert), (BYTE*)abPVK, sizeof(abPVK));
}
- Delegate the methods of IComponentAuthenticate to the global CSecureChannelServer object. Use code such as:
if (g_pAppSCServer)
hr = g_pAppSCServer->SACAuth(dwProtocolID, dwPass, pbDataIn,
dwDataInLen, ppbDataOut, pdwDataOutLen);
else
hr = E_FAIL;
if (g_pAppSCServer)
hr = g_pAppSCServer->SACGetProtocols(ppdwProtocols,
pdwProtocolCount);
else
hr = E_FAIL;
- When the caller has not been authenticated, return WMDM_E_NOT_CERTIFIED from all of your methods.
See Also
© 1999 Microsoft Corporation. All rights reserved.