RpcServerRegisterAuthInfo function

The RpcServerRegisterAuthInfo function registers authentication information with the RPC run-time library.


RPC_STATUS RPC_ENTRY RpcServerRegisterAuthInfo(
   unsigned char             *ServerPrincName,
   unsigned long             AuthnSvc,
   void                      *Arg



Pointer to the principal name to use for the server when authenticating remote procedure calls using the service specified by the AuthnSvc parameter. The content of the name and its syntax are defined by the authentication service in use. For more information, see Principal Names.


Authentication service to use when the server receives a request for a remote procedure call.


Address of a server-application-provided routine that returns encryption keys. See RPC_AUTH_KEY_RETRIEVAL_FN.

Specify a NULL parameter value to use the default method of encryption-key acquisition. In this case, the authentication service specifies the default behavior. Set this parameter to NULL when using the RPC_C_AUTHN_WINNT authentication service.

Authentication serviceGetKeyFnArgRun-time behavior
RPC_C_AUTHN_DPAIgnoredIgnoredDoes not support
RPC_C_AUTHN_GSS_KERBEROSIgnoredIgnoredDoes not support
RPC_C_AUTHN_GSS_NEGOTIATEIgnoredIgnoredDoes not support
RPC_C_AUTHN_GSS_SCHANNELIgnoredIgnoredDoes not support
RPC_C_AUTHN_MQIgnoredIgnoredDoes not support
RPC_C_AUTHN_MSNIgnoredIgnoredDoes not support
RPC_C_AUTHN_WINNTIgnoredIgnoredDoes not support
RPC_C_AUTHN_DCE_PRIVATENULLNon-nullUses default method of encryption-key acquisition from specified key table; specified argument is passed to default acquisition function.
RPC_C_AUTHN_DCE_PRIVATENon-nullNULLUses specified encryption-key acquisition function to obtain keys from default key table.
RPC_C_AUTHN_DCE_PRIVATENon-nullNon-nullUses specified encryption-key acquisition function to obtain keys from specified key table; specified argument is passed to acquisition function.
RPC_C_AUTHN_DEC_PUBLICIgnoredIgnoredReserved for future use.



The RPC run-time library passes the ServerPrincName parameter value from RpcServerRegisterAuthInfo as the ServerPrincName parameter value to the GetKeyFn acquisition function. The RPC run-time library automatically provides a value for the key version (KeyVer) parameter. For a KeyVer parameter value of zero, the acquisition function must return the most recent key available. The retrieval function returns the authentication key in the Key parameter.

If the acquisition function called from RpcServerRegisterAuthInfo returns a status other than RPC_S_OK, then this function fails and returns an error code to the server application. If the acquisition function called by the RPC run-time library while authenticating a client's remote procedure call request returns a status other than RPC_S_OK, the request fails and the RPC run-time library returns an error code to the client application.


Pointer to a parameter to pass to the GetKeyFn routine, if specified. This parameter can also be used to pass a pointer to an SCHANNEL_CRED structure to specify explicit credentials if the authentication service is set to SCHANNEL.

If the Arg parameter is set to NULL, this function will use the default certificate or credential if it has been set up in the directory service.

Return value


The call succeeded.


The authentication service is unknown.


Note  For a list of valid error codes, see RPC Return Values.


A server application calls RpcServerRegisterAuthInfo to register an authentication service to use for authenticating remote procedure calls. A server calls this routine once for each authentication service the server wants to register. If the server calls this function more than once for a given authentication service, the results are undefined.

The authentication service that a client application specifies (using RpcBindingSetAuthInfo or RpcServerRegisterAuthInfo) must be one of the authentication services specified by the server application. Otherwise, the client's remote procedure call fails and an RPC_S_UNKNOWN_AUTHN_SERVICE status code is returned.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Rpcdce.h (include Rpc.h)





Unicode and ANSI names

RpcServerRegisterAuthInfoW (Unicode) and RpcServerRegisterAuthInfoA (ANSI)

See also