The AcceptSecurityContext function enables the server component of a transport application to establish a security context between the server and a remote client. The remote client uses the InitializeSecurityContext function to start the process of establishing a security context. The server may need one or more reply tokens from the remote client to complete the establishment of the security context.
SECURITY_STATUS AcceptSecurityContext(
PCredHandle phCredential, // handle to the credentials
PCtxtHandle phContext, // handle of partially formed context
PSecBufferDesc pInput, // pointer to the input buffers
ULONG fContextReq, // required context attributes
ULONG TargetDataRep, // data representation on the target
PCtxtHandle phNewContext, // receives the new context handle
PSecBufferDesc pOutput, // pointer to the output buffers
PULONG pfContextAttr, // receives the context attributes
PTimeStamp ptsExpiry // receives the life span of the security
// context
);
ASC_REQ_DELEGATE
ASC_REQ_MUTUAL_AUTH
ASC_REQ_REPLAY_DETECT
ASC_REQ_SEQUENCE_DETECT
ASC_REQ_CONFIDENTIALITY
ASC_REQ_USE_SESSION_KEY
ASC_REQ_ALLOCATE_MEMORY
ASC_REQ_USE_DCE_STYLE
ASC_REQ_DATAGRAM
ASC_REQ_CONNECTION
ASC_REQ_CALL_LEVEL
ASC_REQ_EXTENDED_ERROR
ASC_REQ_STREAM
ASC_REQ_INTEGRITY
ASC_RET_DELEGATE
ASC_RET_MUTUAL_AUTH
ASC_RET_REPLAY_DETECT
ASC_RET_SEQUENCE_DETECT
ASC_RET_CONFIDENTIALITY
ASC_RET_USE_SESSION_KEY
ASC_RET_ALLOCATED_MEMORY
ASC_RET_USED_DCE_STYLE
ASC_RET_DATAGRAM
ASC_RET_CONNECTION
ASC_RET_CALL_LEVE
ASC_RET_THIRD_LEG_FAILED
ASC_RET_EXTENDED_ERROR
ASC_RET_STREAM
ASC_RET_INTEGRITY
If the function succeeds, the return value is one of the following success codes.
Value | Meaning |
---|---|
SEC_E_OK | The security context was successfully established. |
SEC_I_CONTINUE_NEEDED | |
SEC_I_COMPLETE_NEEDED | |
SEC_I_COMPLETE_AND_CONTINUE |
If the function fails, the return value is one of the following error codes.
Value | Meaning |
---|---|
SEC_E_INVALID_TOKEN | The token passed to the function is invalid. |
SEC_E_INVALID_HANDLE | The handle passed to the function is invalid. |
SEC_E_LOGON_DENIED | The logon failed. |
SEC_E_INTERNAL_ERROR | The Local Security Authority cannot be contacted. |
SEC_E_NO_AUTHENTICATING_AUTORITY | No authority could be contacted for authentication. |
The AcceptSecurityContext function is the server counterpart to the InitializeSecurityContext function.
When a request comes in, the server uses the fContextReq parameter to specify what it requires of the session. In this fashion, a server can specify that clients must be capable of using a confidential or integrity-checked session, and it can fail clients that cannot meet that demand. As an alternative, a server can require nothing, and whatever the client can provide or requires is returned in the pfContextAttr parameter.
For a package that supports three-leg mutual authentication, the calling sequence is as follows:
LAN Manager and Windows NT use another authentication style.