Authentication functions are categorized according to usage as follows:
SSPI Functions
Security Support Provider Interface (SSPI) functions fall into the following major categories.
Package Management
SSPI package management functions initiate a security package, enumerate available packages, and query the attributes of a security package.
The following SSPI functions provide management services for security packages.
| Function | Description |
| EnumerateSecurityPackages | Lists available security packages and their capabilities. |
| InitSecurityInterface | Retrieves a pointer to a security support provider (SSP) dispatch table. |
| QuerySecurityPackageInfo | Queries an individual security package for its capabilities, including authentication, transport, and message integrity- and privacy-related capabilities. |
Credential Management
SSPI credential management functions provide a credentials handle, a reference to an opaque security object, for accessing a principal. The security object is opaque because the application has access only to the handle and not to the actual contents of the structure.
All references to the contents of a credential context are through the object's handle and the security package dereferences the handle to access the specifics of credentials. A credential handle is a 64-bit value between {0x00000000, 0x00000000} and {0xFFFFFFFF, 0xFFFFFFFE}.
Applications use the credentials handle with
context management functions to create a security context.
Credential management functions also release credential handles and query the attributes of credentials. At present, the name associated with a credential is the only attribute that can be queried.
The following functions are used with credentials management.
Context Management
SSPI context management functions create and use security contexts.
In a communication link, the client and server cooperate to create a shared security context. The client and server both use the security context with
message support functions to ensure message integrity and privacy during the connection.
Security contexts are opaque security objects. Information in the security context is not available to the application. Context management functions create and use context handles and the security package dereferences the context handle to access its security content.
A context handle is a 64-bit value between {0x00000000, 0x00000000} and {0xFFFFFFFF, 0xFFFFFFFE}.
The following functions are used with context management.
Message Support
SSPI message support functions enable an application to transmit and receive tamper-resistant messages and to encrypt and decrypt messages. These functions work with one or more buffers that contain a message and with a security context created by the
context management functions. The functions' behavior differs based on whether a connection, datagram, or stream context is in use. For a description of these differences, see
SSPI Context Semantics.
The following functions provide security support for messages.
Functions Implemented by SSP/APs
The following functions are implemented by
security packages contained in Security Support Provider/Authentication Packages (SSP/APs).
In the following tables, the first set of functions is implemented by Windows XP and Windows 2000 SSP/AP security packages. The second set of functions is implemented by SSP/AP security packages only.
The Local Security Authority (LSA) accesses these functions by using the
SECPKG_FUNCTION_TABLE structure provided by the SSP/AP's
SpLsaModeInitialize function.
The following functions are implemented by all authentication packages.
The following additional functions are implemented by SSP/AP security packages.
Functions Implemented by User-mode SSP/APs
The following functions are implemented by security support provider/authentication packages (SSP/APs) that can be loaded into client/server applications.
An SSP/AP indicates that it implements the user-mode functions by returning TRUE in the MappedContext parameter of the
SpInitLsaModeContext and
SpAcceptLsaModeContext functions. The SpInitLsaModeContext function is used by the client side of a transport level application, while SpAcceptLsaModeContext is used by the server side.
Loading an SSP/AP into the client process or server process is handled by the security provider DLL, either Security.dll or Secur32.dll. The security provider DLL loads the SSP/AP by locating the address of the
SpUserModeInitialize function implemented by the SSP/AP and calling it. This function returns a set of tables that contain pointers to the user-mode functions implemented in each security package.
After the SSP/AP is loaded into the client or server process, the Local Security Authority (LSA) will copy the security context information (returned by
SpInitLsaModeContext or
SpAcceptLsaModeContext) and any additional context-related data to the process and call the security package's
SpInitUserModeContext function.
Client/server applications access user-mode functionality by calling
Security Support Provider Interface (SSPI) functions. The SSPI functions are mapped by the security provider DLL by using the
SECPKG_USER_FUNCTION_TABLE supplied by the package.
LSA Functions Called by SSP/APs
The Local Security Authority (LSA) provides the following functions to security packages deployed in security support provider/authentication packages (SSP/APs). The functions are available in the
LSA_SECPKG_FUNCTION_TABLE structure and can be called while the SSP/AP is loaded into the LSA's process space. The following functions are available to all APs.
The following functions are available to SSP/APs.
LSA Functions Called By User-mode SSP/APs
A security package in a security support provider/authentication package (SSP/AP) executing in a user-mode process can use the pointers in the
SECPKG_DLL_FUNCTIONS table to access the following functions.
| Function | PSDK status |
| AllocateHeap | Allocates memory for buffers that are returned to the Local Security Authority (LSA). |
| FreeHeap | Frees memory that was previously allocated by using AllocateHeap. |
| RegisterCallback | Registers a callback function that can be called from LSA-mode. |
GINA Export Functions
A GINA DLL must export the following functions.
Logon User Functions
The following functions provide the ability to log on a user.
| Function | Description |
| LogonUser | Attempts to log a user on to the local computer. |
| LogonUserEx | Attempts to log a user on to the local computer. This function is an extended version of the LogonUser function and retrieves information about the logged-on user's security identifier (SID), profile, and quota limits. |
| LogonUserExExW | The LogonUserExExW function attempts to log a user on to the local computer. This function is not declared in a public header and has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Advapi32.dll. |
Winlogon Support Functions
GINA DLLs can call the following Winlogon support functions.
Network Provider Functions
The following topics provide reference information for the network provider functions.
Functions Implemented by Network Providers
The following functions can be implemented by network providers. The only function that network providers are required to support is NPGetCaps.
| Function | Description |
| NPAddConnection | Connects a local device to a network resource. |
| NPAddConnection3 | Connects a local device to a network resource and lets you specify the type of connection and the window that will own any messages or dialog boxes. |
| NPCancelConnection | Disconnects a network connection. |
| NPCloseEnum | Closes an enumeration. |
| NPDeviceMode | Sets the parent window of a device. This window owns any dialog boxes that originate from the device. |
| NPDirectoryNotify | Notifies the network provider of certain directory operations. |
| NPEnumResource | Enumerates network resources or existing connections. |
| NPFormatNetworkName | Formats the network name in a provider-specific format. |
| NPGetCaps | Queries a provider for supported capabilities. Returns the capabilities supported by the provider. |
| NPGetConnection | Retrieves information about a network connection. |
| NPGetConnection3 | Retrieves information about a network connection, even if it is currently disconnected. |
| NPGetConnectionPerformance | Retrieves performance information about a network connection. |
| NPGetDirectoryType | Retrieves a value that indicates whether a special icon should be displayed for a directory. |
| NPGetPropertyText | Adds buttons to a property dialog box for a network resource. |
| NPGetResourceInformation | Retrieves information about a network resource. |
| NPGetResourceParent | Retrieves the parent of the specified network resource. |
| NPGetUniversalName | Retrieves the universal name. |
| NPGetUser | Retrieves the user name of the current user. |
| NPOpenEnum | Opens an enumeration of network resources or existing connections. |
| NPPropertyDialog | Handles the event that occurs when a user clicks a button added by using NPGetPropertyText. |
| NPSearchDialog | Performs a network-specific search. |
Support Functions
The following function is implemented by the operating system and can be called by network providers.
Connection Notification Functions
The following functions are implemented by applications that need to receive notification from the Multiple Provider Router (MPR) when a network resource is connected or disconnected. For more information about how to write an application that receives such notifications, see
Receiving Connection Notifications.
LSA Logon Functions
The following Local Security Authority (LSA) authentication functions authenticate and log on users, and they provide logon session information.
Functions Implemented by Authentication Packages
Custom authentication packages must implement these functions, which are called by the Local Security Authority (LSA). These functions are implemented by the MSV1_0 and Kerberos authentication packages provided by Microsoft.
| Function | Description |
| LsaApCallPackage | Called when the authentication package's identifier has been specified in a call to LsaCallAuthenticationPackage by an application that is using a trusted connection.
This function provides a way for logon applications to communicate directly with authentication packages.
|
| LsaApCallPackagePassthrough | Called when the authentication package's identifier has been specified in a call to LsaCallAuthenticationPackage for a pass-through logon request. |
| LsaApCallPackageUntrusted | Called when the authentication package's identifier has been specified in a call to LsaCallAuthenticationPackage by an application using an untrusted connection. This function is used for communicating with processes that do not have the SeTcbPrivilege privilege. |
| LsaApInitializePackage | Called during system initialization to permit the authentication package to perform initialization tasks. |
| LsaApLogonTerminated | Called when a logon session ends to permit the authentication package to free any resources allocated for the logon session. |
| LsaApLogonUser | Called when the authentication package has been specified in a call to LsaLogonUser. This function authenticates a security principal's logon data. |
| LsaApLogonUserEx | Identical to LsaApLogonUser except that it returns the workstation name for audit purposes.
An authentication package can implement LsaApLogonUser, LsaApLogonUserEx, or LsaApLogonUserEx2. It does not need to implement them all.
|
| LsaApLogonUserEx2 | Identical to LsaApLogonUserEx except that it returns the security principal's primary and supplemental credentials. An authentication package can implement LsaApLogonUser, LsaApLogonUserEx, or LsaApLogonUserEx2. It does not need to implement them all. |
LSA Functions Called by Authentication Packages
The following Local Security Authority (LSA) functions can be called from a custom authentication package. When the LSA calls
LsaApInitializePackage to initialize the package, it passes a table of support functions.
| Function | Description |
| AddCredential | Associates credentials, such as user name and password, with a logon session. |
| AllocateClientBuffer | Allocates a buffer within the calling client's process. |
| AllocateLsaHeap | Allocates buffers that must be returned from the authentication package to the LSA. |
| CopyFromClientBuffer | Copies the contents of a buffer in the client's address space into a local buffer. |
| CopyToClientBuffer | Copies the contents of a local buffer into the client's address space. |
| CreateLogonSession | Used by authentication packages to create a logon session. |
| DeleteCredential | Removes credentials previously cached by AddCredential. |
| DeleteLogonSession | Frees extraneous logon sessions created while authenticating a security principal. |
| FreeClientBuffer | Frees client buffers previously allocated with the AllocateClientBuffer function. |
| FreeLsaHeap | Frees buffers previously allocated by using the AllocateLsaHeap function. |
| GetCredentials | Retrieves credentials previously cached by AddCredential. |
Subauthentication Functions
The following subauthentication functions can be called by Microsoft-provided authentication packages to provide additional, user-created logon authentication.
Credentials Management Functions
The following topics provide reference information for the credentials management functions.
Credentials Management UI Functions
The following are credentials management UI functions.
Low-level Credentials Management Functions
The following are low-level credentials management functions.
| Function | Description |
| CredDelete | Delete a credential from a user's credentials set. |
| CredEnumerate | List the credentials in a user's credentials set. |
| CredFindBestCredential | Searches the Credentials Management (CredMan) database for the set of generic credentials that are associated with the current logon session and that best match the specified target resource. |
| CredFree | Free the memory used for a buffer returned by any of the credentials management functions. |
| CredGetSessionTypes | Retrieve the maximum persistence supported by the current logon session. |
| CredGetTargetInfo | Retrieve all known target name information for a named resource. |
| CredIsProtected | Specifies whether the specified credentials are encrypted by a previous call to the CredProtect function. |
| CredMarshalCredential | Transform a credential into a text string. |
| CredPackAuthenticationBuffer | Converts a string user name and password into an authentication buffer. |
| CredProtect | Encrypts the specified credentials so that only the current security context can decrypt them. |
| CredRead | Read a credential from a user's credentials set. |
| CredReadDomainCredentials | Read the domain credentials from a user's credentials set. |
| CredRename | Rename a credential from a user's credentials set. |
| CredUnmarshalCredential | Transform a marshaled credential string back into its nonmarshaled form. |
| CredUnPackAuthenticationBuffer | Converts an authentication buffer returned by a call to the CredUIPromptForWindowsCredentials function into a string user name and password. |
| CredUnprotect | Decrypts credentials that were previously encrypted by using the CredProtect function. |
| CredWrite | Create a new credential or modify an existing credential in a user's credentials set. |
| CredWriteDomainCredentials | Write domain credentials to a user's credentials set. |
Credential Management Notification Functions
The following functions are implemented by credential managers to receive notifications when authentication information changes.
| Function | Description |
| NPLogonNotify | Notifies the credential manager of a logon event. |
| NPPasswordChangeNotify | Notifies a credential manager provider when the password of an account changes. |
Smart Card Functions
The Smart Card SDK provides the following functions.
SASL Functions
The Simple Authentication and Security Layer (SASL) provides the following functions.
Send comments about this topic to Microsoft
Build date: 6/26/2009