---
product: Chilkat
product_version: 11.7.0
language: c
language_label: C
class: Ntlm
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/c_CkNtlmRef.html
---
# Chilkat Ntlm — C — v11.7.0

> Chilkat 11.7.0 · language=c · class=Ntlm
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/Ntlm.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/c/guide.md`.

## Purpose

**Generate, parse, and verify NTLM authentication messages.**

`Chilkat.Ntlm` implements the NTLM challenge/response message workflow. It can generate Type 1, Type 2, and Type 3 NTLM messages, parse those messages for inspection, compare Type 3 responses on the server side, and control key authentication inputs such as username, password, domain, workstation, target name, client challenge, server challenge, NTLM version, encoding mode, and negotiate flags.

**Type 1 negotiate message**

Generate the client-to-server message that begins the NTLM exchange and advertises supported options.

**Type 2 challenge message**

Generate the server challenge response, including target name, server challenge, and optional target-info fields.

**Type 3 authenticate message**

Generate the final client response using the username and password without sending the password itself.

**Server-side verification**

Load a received Type 3 message, extract embedded fields, recompute the response, and compare the result with `CompareType3`.

**Challenges and encoding**

Set or inspect 8-byte client and server challenges using encodings such as hex, Base64, Base32, quoted-printable, URL encoding, and others.

**Version, flags, and diagnostics**

Select NTLMv1 or NTLMv2, adjust negotiate flags when required, parse messages for readable diagnostics, and check `LastErrorText`.

**Common pattern:** The client calls `GenType1` and sends the Type 1 message to the server. The server calls `GenType2` and sends the Type 2 challenge back. The client sets `UserName` and `Password`, calls `GenType3`, and sends the Type 3 message. The server calls `LoadType3`, looks up the user's password, recomputes the Type 3 response, and uses `CompareType3` to verify authentication.

**Flag guidance:** The default `Flags` value is intended for normal use. Only modify negotiate flags with `SetFlag` or by setting `Flags` directly when the application has specific NTLM protocol requirements and the meaning of the affected flags is understood.

## Object creation, unlocking and error handling

**Create/Dispose**

```c
HCkNtlm instance = CkNtlm_Create();
// ...
CkNtlm_Dispose(instance);
```

`HCkNtlm CkNtlm_Create(void);`

Creates an instance of the HCkNtlm object and returns a handle ("void \*" pointer). The handle is passed in the 1st argument for the functions listed on this page.

`void CkNtlm_Dispose(HCkNtlm handle);`

Objects created by calling CkNtlm_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkNtlm_Dispose.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in C.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `void CkNtlm_getDebugLogFilePath(HCkNtlm cHandle, HCkString retval); void CkNtlm_putDebugLogFilePath(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_debugLogFilePath(HCkNtlm cHandle);` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `void CkNtlm_getLastErrorHtml(HCkNtlm cHandle, HCkString retval); const char *CkNtlm_lastErrorHtml(HCkNtlm cHandle);` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `void CkNtlm_getLastErrorText(HCkNtlm cHandle, HCkString retval); const char *CkNtlm_lastErrorText(HCkNtlm cHandle);` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `void CkNtlm_getLastErrorXml(HCkNtlm cHandle, HCkString retval); const char *CkNtlm_lastErrorXml(HCkNtlm cHandle);` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `BOOL CkNtlm_getLastMethodSuccess(HCkNtlm cHandle); void CkNtlm_putLastMethodSuccess(HCkNtlm cHandle, BOOL newVal);` | read/write | Indicates the success or failure of the most recent method call: `TRUE` means success, `FALSE` means failure. |
| `Utf8` | `BOOL CkNtlm_getUtf8(HCkNtlm cHandle); void CkNtlm_putUtf8(HCkNtlm cHandle, BOOL newVal);` | read/write | When set to `TRUE`, all `const char *` arguments and return values are interpreted as UTF-8 strings. |
| `VerboseLogging` | `BOOL CkNtlm_getVerboseLogging(HCkNtlm cHandle); void CkNtlm_putVerboseLogging(HCkNtlm cHandle, BOOL newVal);` | read/write | If set to `TRUE`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `void CkNtlm_getVersion(HCkNtlm cHandle, HCkString retval); const char *CkNtlm_version(HCkNtlm cHandle);` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `ClientChallenge` | property, read/write | `void CkNtlm_getClientChallenge(HCkNtlm cHandle, HCkString retval); void CkNtlm_putClientChallenge(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_clientChallenge(HCkNtlm cHandle);` |
| `DnsComputerName` | property, read/write | `void CkNtlm_getDnsComputerName(HCkNtlm cHandle, HCkString retval); void CkNtlm_putDnsComputerName(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_dnsComputerName(HCkNtlm cHandle);` |
| `DnsDomainName` | property, read/write | `void CkNtlm_getDnsDomainName(HCkNtlm cHandle, HCkString retval); void CkNtlm_putDnsDomainName(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_dnsDomainName(HCkNtlm cHandle);` |
| `Domain` | property, read/write | `void CkNtlm_getDomain(HCkNtlm cHandle, HCkString retval); void CkNtlm_putDomain(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_domain(HCkNtlm cHandle);` |
| `EncodingMode` | property, read/write | `void CkNtlm_getEncodingMode(HCkNtlm cHandle, HCkString retval); void CkNtlm_putEncodingMode(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_encodingMode(HCkNtlm cHandle);` |
| `Flags` | property, read/write | `void CkNtlm_getFlags(HCkNtlm cHandle, HCkString retval); void CkNtlm_putFlags(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_flags(HCkNtlm cHandle);` |
| `NetBiosComputerName` | property, read/write | `void CkNtlm_getNetBiosComputerName(HCkNtlm cHandle, HCkString retval); void CkNtlm_putNetBiosComputerName(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_netBiosComputerName(HCkNtlm cHandle);` |
| `NetBiosDomainName` | property, read/write | `void CkNtlm_getNetBiosDomainName(HCkNtlm cHandle, HCkString retval); void CkNtlm_putNetBiosDomainName(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_netBiosDomainName(HCkNtlm cHandle);` |
| `NtlmVersion` | property, read/write | `int CkNtlm_getNtlmVersion(HCkNtlm cHandle); void CkNtlm_putNtlmVersion(HCkNtlm cHandle, int newVal);` |
| `OemCodePage` | property, read/write | `int CkNtlm_getOemCodePage(HCkNtlm cHandle); void CkNtlm_putOemCodePage(HCkNtlm cHandle, int newVal);` |
| `Password` | property, read/write | `void CkNtlm_getPassword(HCkNtlm cHandle, HCkString retval); void CkNtlm_putPassword(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_password(HCkNtlm cHandle);` |
| `ServerChallenge` | property, read/write | `void CkNtlm_getServerChallenge(HCkNtlm cHandle, HCkString retval); void CkNtlm_putServerChallenge(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_serverChallenge(HCkNtlm cHandle);` |
| `TargetName` | property, read/write | `void CkNtlm_getTargetName(HCkNtlm cHandle, HCkString retval); void CkNtlm_putTargetName(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_targetName(HCkNtlm cHandle);` |
| `UserName` | property, read/write | `void CkNtlm_getUserName(HCkNtlm cHandle, HCkString retval); void CkNtlm_putUserName(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_userName(HCkNtlm cHandle);` |
| `Workstation` | property, read/write | `void CkNtlm_getWorkstation(HCkNtlm cHandle, HCkString retval); void CkNtlm_putWorkstation(HCkNtlm cHandle, const char *newVal); const char *CkNtlm_workstation(HCkNtlm cHandle);` |
| `CompareType3` | method | `BOOL CkNtlm_CompareType3(HCkNtlm cHandle, const char *msg1, const char *msg2);` |
| `GenType1` | method | `BOOL CkNtlm_GenType1(HCkNtlm cHandle, HCkString outStr); const char *CkNtlm_genType1(HCkNtlm cHandle);` |
| `GenType2` | method | `BOOL CkNtlm_GenType2(HCkNtlm cHandle, const char *type1Msg, HCkString outStr); const char *CkNtlm_genType2(HCkNtlm cHandle, const char *type1Msg);` |
| `GenType3` | method | `BOOL CkNtlm_GenType3(HCkNtlm cHandle, const char *type2Msg, HCkString outStr); const char *CkNtlm_genType3(HCkNtlm cHandle, const char *type2Msg);` |
| `LoadType3` | method | `BOOL CkNtlm_LoadType3(HCkNtlm cHandle, const char *type3Msg);` |
| `ParseType1` | method | `BOOL CkNtlm_ParseType1(HCkNtlm cHandle, const char *type1Msg, HCkString outStr); const char *CkNtlm_parseType1(HCkNtlm cHandle, const char *type1Msg);` |
| `ParseType2` | method | `BOOL CkNtlm_ParseType2(HCkNtlm cHandle, const char *type2Msg, HCkString outStr); const char *CkNtlm_parseType2(HCkNtlm cHandle, const char *type2Msg);` |
| `ParseType3` | method | `BOOL CkNtlm_ParseType3(HCkNtlm cHandle, const char *type3Msg, HCkString outStr); const char *CkNtlm_parseType3(HCkNtlm cHandle, const char *type3Msg);` |
| `SetFlag` | method | `BOOL CkNtlm_SetFlag(HCkNtlm cHandle, const char *flagLetter, BOOL onOrOff);` |

## Properties

### Ntlm.ClientChallenge

`Chilkat 11.7.0 · c · Ntlm · ClientChallenge · property · read/write`

```c
void CkNtlm_getClientChallenge(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putClientChallenge(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_clientChallenge(HCkNtlm cHandle);
```

Specifies the 8-byte client challenge used when generating the Type 3 authenticate message. Because this property is a string, the bytes are represented using `EncodingMode`. For example, when `EncodingMode` is `hex`, set this property to exactly 16 hexadecimal characters.

Setting this property is optional. If it is empty when `GenType3` is called, Chilkat generates eight random bytes automatically.

**Security note:** A client challenge is a nonce, not a password or encryption key. Use a fresh unpredictable value for each authentication exchange; do not deliberately reuse a fixed challenge in production.

### Ntlm.DnsComputerName

`Chilkat 11.7.0 · c · Ntlm · DnsComputerName · property · read/write`

```c
void CkNtlm_getDnsComputerName(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putDnsComputerName(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_dnsComputerName(HCkNtlm cHandle);
```

Specifies the server's DNS computer name for inclusion in the `MsvAvDnsComputerName` entry of the Type 2 message's `TargetInfo` block.

This property is optional and is used by server-side code when constructing the `TargetInfo` AV-pair sequence in a Type 2 challenge message.

If any of the optional target-information name properties are supplied, Chilkat requires both `NetBiosComputerName` and `NetBiosDomainName` to be set.

**NTLMv2 background:** Target information is sent by the server and incorporated into the NTLMv2 response. The values should describe the actual authentication target; they are not arbitrary client-supplied labels.

### Ntlm.DnsDomainName

`Chilkat 11.7.0 · c · Ntlm · DnsDomainName · property · read/write`

```c
void CkNtlm_getDnsDomainName(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putDnsDomainName(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_dnsDomainName(HCkNtlm cHandle);
```

Specifies the server's DNS domain name for inclusion in the `MsvAvDnsDomainName` entry of the Type 2 message's `TargetInfo` block.

This property is optional and is used by server-side code when constructing the `TargetInfo` AV-pair sequence in a Type 2 challenge message.

If any of the optional target-information name properties are supplied, Chilkat requires both `NetBiosComputerName` and `NetBiosDomainName` to be set.

**NTLMv2 background:** Target information is sent by the server and incorporated into the NTLMv2 response. The values should describe the actual authentication target; they are not arbitrary client-supplied labels.

### Ntlm.Domain

`Chilkat 11.7.0 · c · Ntlm · Domain · property · read/write`

```c
void CkNtlm_getDomain(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putDomain(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_domain(HCkNtlm cHandle);
```

Specifies the client's domain or workgroup name. When provided, it can be included in the Type 1 negotiate message and is used as the domain component of the identity in the Type 3 authenticate message.

For a domain account, use the account's Windows domain name. For a local account, the expected value depends on the authenticating server and protocol.

**Identity note:** `Domain` is separate from `TargetName`. `Domain` identifies the account's domain in the client identity, whereas `TargetName` is supplied by the server in the Type 2 challenge.

### Ntlm.EncodingMode

`Chilkat 11.7.0 · c · Ntlm · EncodingMode · property · read/write`

```c
void CkNtlm_getEncodingMode(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putEncodingMode(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_encodingMode(HCkNtlm cHandle);
```

Controls the textual encoding used when Chilkat exposes binary NTLM values as strings or accepts them from strings. This includes generated and parsed NTLM message tokens and binary-valued properties such as `ClientChallenge` and `ServerChallenge`.

The mode name is case-insensitive. Supported values include `base64`, `modBase64`, `base32`, `UU`, `QP`, `URL`, `hex`, `Q`, `B`, `url_oauth`, `url_rfc1738`, `url_rfc2396`, and `url_rfc3986`.

**Interoperability:** NTLM tokens carried in HTTP `Authorization` or `WWW-Authenticate` headers are conventionally Base64 encoded. Use the same `EncodingMode` for both the producer and consumer of a token.

### Ntlm.Flags

`Chilkat 11.7.0 · c · Ntlm · Flags · property · read/write`

```c
void CkNtlm_getFlags(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putFlags(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_flags(HCkNtlm cHandle);
```

Specifies the NTLM negotiate flags as a compact string in which each letter represents one bit. The flags advertise or select character encoding, target information, session security, and other protocol capabilities.

The default is `ABCHMQ`, which enables Unicode, OEM compatibility, target-name request, NTLM authentication, always-sign behavior, and extended session security.

| Letter | Bit value | Microsoft flag name |
| :--- | :--- | :--- |
| `A` | `0x00000001` | `NTLMSSP_NEGOTIATE_UNICODE` |
| `B` | `0x00000002` | `NTLM_NEGOTIATE_OEM` |
| `C` | `0x00000004` | `NTLMSSP_REQUEST_TARGET` |
| `D` | `0x00000010` | `NTLMSSP_NEGOTIATE_SIGN` |
| `E` | `0x00000020` | `NTLMSSP_NEGOTIATE_SEAL` |
| `F` | `0x00000040` | `NTLMSSP_NEGOTIATE_DATAGRAM` |
| `G` | `0x00000080` | `NTLMSSP_NEGOTIATE_LM_KEY` |
| `H` | `0x00000200` | `NTLMSSP_NEGOTIATE_NTLM` |
| `I` | `0x00000400` | `Reserved / unused` |
| `J` | `0x00000800` | `NTLMSSP_NEGOTIATE_ANONYMOUS` |
| `K` | `0x00001000` | `NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED` |
| `L` | `0x00002000` | `NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED` |
| `M` | `0x00008000` | `NTLMSSP_NEGOTIATE_ALWAYS_SIGN` |
| `N` | `0x00010000` | `NTLMSSP_TARGET_TYPE_DOMAIN` |
| `O` | `0x00020000` | `NTLMSSP_TARGET_TYPE_SERVER` |
| `P` | `0x00040000` | `Reserved / unused` |
| `Q` | `0x00080000` | `NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY` |
| `R` | `0x00100000` | `NTLMSSP_NEGOTIATE_IDENTIFY` |
| `S` | `0x00400000` | `NTLMSSP_REQUEST_NON_NT_SESSION_KEY` |
| `T` | `0x00800000` | `NTLMSSP_NEGOTIATE_TARGET_INFO` |
| `U` | `0x02000000` | `NTLMSSP_NEGOTIATE_VERSION` |
| `V` | `0x20000000` | `NTLMSSP_NEGOTIATE_128` |
| `W` | `0x40000000` | `NTLMSSP_NEGOTIATE_KEY_EXCH` |
| `X` | `0x80000000` | `NTLMSSP_NEGOTIATE_56` |

**Compatibility warning:** Leave this property at its default unless a specific protocol peer requires different flags and the consequences are understood. Some bits are mutually dependent, some are meaningful only in particular message types, and reserved bits should remain clear. Prefer `SetFlag` when changing a single option.

### Ntlm.NetBiosComputerName

`Chilkat 11.7.0 · c · Ntlm · NetBiosComputerName · property · read/write`

```c
void CkNtlm_getNetBiosComputerName(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putNetBiosComputerName(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_netBiosComputerName(HCkNtlm cHandle);
```

Specifies the server's NetBIOS computer name for inclusion in the `MsvAvNbComputerName` entry of the Type 2 message's `TargetInfo` block.

This property is optional and is used by server-side code when constructing the `TargetInfo` AV-pair sequence in a Type 2 challenge message.

If any of the optional target-information name properties are supplied, Chilkat requires both `NetBiosComputerName` and `NetBiosDomainName` to be set.

**NTLMv2 background:** Target information is sent by the server and incorporated into the NTLMv2 response. The values should describe the actual authentication target; they are not arbitrary client-supplied labels.

### Ntlm.NetBiosDomainName

`Chilkat 11.7.0 · c · Ntlm · NetBiosDomainName · property · read/write`

```c
void CkNtlm_getNetBiosDomainName(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putNetBiosDomainName(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_netBiosDomainName(HCkNtlm cHandle);
```

Specifies the server's NetBIOS domain name for inclusion in the `MsvAvNbDomainName` entry of the Type 2 message's `TargetInfo` block.

This property is optional and is used by server-side code when constructing the `TargetInfo` AV-pair sequence in a Type 2 challenge message.

If any of the optional target-information name properties are supplied, Chilkat requires both `NetBiosComputerName` and `NetBiosDomainName` to be set.

**NTLMv2 background:** Target information is sent by the server and incorporated into the NTLMv2 response. The values should describe the actual authentication target; they are not arbitrary client-supplied labels.

### Ntlm.NtlmVersion

`Chilkat 11.7.0 · c · Ntlm · NtlmVersion · property · read/write`

```c
int CkNtlm_getNtlmVersion(HCkNtlm cHandle);
void CkNtlm_putNtlmVersion(HCkNtlm cHandle, int newVal);
```

Selects the challenge-response algorithm used to generate and verify the authentication response.

| Value | Behavior |
| :--- | :--- |
| `1` | Use NTLMv1. This is the default for backward compatibility. |
| `2` | Use NTLMv2. |

The client and server must use compatible response algorithms. This setting is not negotiated by the three NTLM messages.

**Security recommendation:** Set this property to `2` for modern deployments. NTLMv1 is obsolete and has been removed from Windows 11 version 24H2 and Windows Server 2025. Use NTLM only where compatibility requires it; Kerberos through Negotiate is preferred in Active Directory environments.

### Ntlm.OemCodePage

`Chilkat 11.7.0 · c · Ntlm · OemCodePage · property · read/write`

```c
int CkNtlm_getOemCodePage(HCkNtlm cHandle);
void CkNtlm_putOemCodePage(HCkNtlm cHandle, int newVal);
```

Specifies the OEM code page used to encode NTLM text fields when Unicode negotiation is disabled. The default is the local computer's OEM code page.

This property applies only when flag `A` (`NTLMSSP_NEGOTIATE_UNICODE`) is clear and OEM encoding is selected. With the default flags, Unicode is used and this setting has no effect.

**Interoperability:** Both sides must interpret OEM-encoded fields using compatible code pages. Retaining Unicode negotiation avoids locale-dependent corruption of usernames, domains, and workstation names.

### Ntlm.Password

`Chilkat 11.7.0 · c · Ntlm · Password · property · read/write`

```c
void CkNtlm_getPassword(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putPassword(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_password(HCkNtlm cHandle);
```

Specifies the password for `UserName`. Client-side code must set it before calling `GenType3`. Server-side verification code sets it after `LoadType3`, typically after looking up the account identified by the loaded username and domain.

The password itself is not placed in the Type 3 message. It is used to derive the challenge-response proof.

**Sensitive value:** Treat this property as credential material. Do not log it, persist it in plain text, or retain it longer than necessary. NTLM challenge-response still depends on password-derived secrets and does not make weak passwords safe.

### Ntlm.ServerChallenge

`Chilkat 11.7.0 · c · Ntlm · ServerChallenge · property · read/write`

```c
void CkNtlm_getServerChallenge(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putServerChallenge(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_serverChallenge(HCkNtlm cHandle);
```

Specifies the 8-byte server challenge carried in the Type 2 challenge message. Because this property is a string, the bytes are represented using `EncodingMode`. For example, with `EncodingMode` set to `hex`, provide exactly 16 hexadecimal characters.

Setting this property is optional. If it is empty when `GenType2` is called, Chilkat generates eight random bytes automatically. Server-side verification must use the same challenge that was sent to the client.

**Security note:** Generate a fresh unpredictable server challenge for each authentication exchange. Reusing challenges increases exposure to replay and precomputation attacks.

### Ntlm.TargetName

`Chilkat 11.7.0 · c · Ntlm · TargetName · property · read/write`

```c
void CkNtlm_getTargetName(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putTargetName(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_targetName(HCkNtlm cHandle);
```

Specifies the server-provided authentication target placed in the Type 2 challenge message. Depending on the target-type flags, it commonly identifies a Windows domain or the server handling local-account authentication.

This is not the client account's domain; use `Domain` for that purpose.

**Protocol note:** The target name helps describe the authentication realm advertised by the server. It does not by itself authenticate the server or prevent NTLM relay attacks.

### Ntlm.UserName

`Chilkat 11.7.0 · c · Ntlm · UserName · property · read/write`

```c
void CkNtlm_getUserName(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putUserName(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_userName(HCkNtlm cHandle);
```

Specifies the account name to authenticate. Client-side code must set it before calling `GenType3`. After server-side code calls `LoadType3`, this property contains the username extracted from the received Type 3 message.

Use `Domain` separately when the account belongs to a Windows domain or workgroup.

**Server-side rule:** Treat the username and domain from a received Type 3 message as untrusted input until the challenge response has been verified.

### Ntlm.Workstation

`Chilkat 11.7.0 · c · Ntlm · Workstation · property · read/write`

```c
void CkNtlm_getWorkstation(HCkNtlm cHandle, HCkString retval);
void CkNtlm_putWorkstation(HCkNtlm cHandle, const char *newVal);
const char *CkNtlm_workstation(HCkNtlm cHandle);
```

Specifies the optional client workstation name. When supplied, Chilkat can include it in the Type 1 negotiate message and the Type 3 authenticate message. After `LoadType3`, it contains the workstation value reported by the client.

**Identity note:** The workstation field is descriptive client-supplied metadata. It is not proof of the client's computer identity and should not be used as an authorization decision by itself.

## Methods

### Ntlm.CompareType3

`Chilkat 11.7.0 · c · Ntlm · CompareType3 · method`

```c
BOOL CkNtlm_CompareType3(HCkNtlm cHandle, const char *msg1, const char *msg2);
```

Compares two encoded Type 3 authenticate messages and returns `TRUE` when their LM and NT challenge-response fields match. A server commonly passes the Type 3 message received from the client as one argument and the expected Type 3 message recomputed with `GenType3` as the other.

The messages must use the encoding selected by `EncodingMode`. Other Type 3 metadata, such as username or workstation text, is not the basis of this comparison.

**Authentication workflow:** A matching response is meaningful only when the expected message was generated from the original Type 2 challenge, the correct account password, the same NTLM version, and the relevant loaded client fields. A `FALSE` result means the response fields do not match; inspect `LastMethodSuccess` and `LastErrorText` if malformed input or another processing error is possible.

### Ntlm.GenType1

`Chilkat 11.7.0 · c · Ntlm · GenType1 · method`

```c
BOOL CkNtlm_GenType1(HCkNtlm cHandle, HCkString outStr);
const char *CkNtlm_genType1(HCkNtlm cHandle);
```

Generates the client-to-server Type 1 *Negotiate* message that starts an NTLM authentication exchange. The message advertises the capabilities in `Flags` and can include the optional `Domain` and `Workstation` values.

The returned token is encoded according to `EncodingMode`. Check `LastMethodSuccess` before using the returned string.

**Message flow:** Type 1 contains negotiation metadata; it does not contain the user's password or challenge response.

Returns TRUE for success, FALSE for failure.

### Ntlm.GenType2

`Chilkat 11.7.0 · c · Ntlm · GenType2 · method`

```c
BOOL CkNtlm_GenType2(HCkNtlm cHandle, const char *type1Msg, HCkString outStr);
const char *CkNtlm_genType2(HCkNtlm cHandle, const char *type1Msg);
```

Generates the server-to-client Type 2 *Challenge* message from the encoded Type 1 message in `type1Msg`. Before calling, server-side code normally sets `TargetName` and may set `ServerChallenge` and the target-information name properties.

If `ServerChallenge` is empty, Chilkat generates a random 8-byte challenge. The input and returned token use `EncodingMode`. Check `LastMethodSuccess` before sending the result.

**State requirement:** Preserve the Type 2 message—or at minimum all state needed to reproduce it—for the later server-side verification of Type 3. The expected response is bound to the challenge and target information sent in this message.

Returns TRUE for success, FALSE for failure.

### Ntlm.GenType3

`Chilkat 11.7.0 · c · Ntlm · GenType3 · method`

```c
BOOL CkNtlm_GenType3(HCkNtlm cHandle, const char *type2Msg, HCkString outStr);
const char *CkNtlm_genType3(HCkNtlm cHandle, const char *type2Msg);
```

Generates the client-to-server Type 3 *Authenticate* message from the encoded Type 2 message in `type2Msg`. Client-side code must set `UserName` and `Password`; set `Domain` and `Workstation` when required by the account and peer.

Chilkat computes the response using `NtlmVersion`, the server challenge and target information from Type 2, and the client challenge. If `ClientChallenge` is empty, Chilkat generates it automatically. The password itself is not transmitted.

The input and returned token use `EncodingMode`. Check `LastMethodSuccess` before using the returned string.

**Security limitation:** NTLM proves knowledge of password-derived material but does not by itself authenticate the server. Deploy it only inside a transport and protocol configuration that addresses relay, channel protection, and server identity.

Returns TRUE for success, FALSE for failure.

### Ntlm.LoadType3

`Chilkat 11.7.0 · c · Ntlm · LoadType3 · method`

```c
BOOL CkNtlm_LoadType3(HCkNtlm cHandle, const char *type3Msg);
```

Parses an encoded Type 3 authenticate message received by server-side code and loads its client-supplied fields into this object. On success, `UserName`, `Domain`, `Workstation`, and `ClientChallenge` are populated from the message.

This method parses the message; it does not authenticate the client. After loading, look up the account's password, set `Password`, recompute the expected Type 3 response with `GenType3` using the original Type 2 message, and compare the response fields with `CompareType3`.

**Do not trust parsed identity fields yet:** Values extracted from Type 3 are controlled by the remote client. Use them only to locate the candidate account until the challenge response has been verified.

Returns TRUE for success, FALSE for failure.

### Ntlm.ParseType1

`Chilkat 11.7.0 · c · Ntlm · ParseType1 · method`

```c
BOOL CkNtlm_ParseType1(HCkNtlm cHandle, const char *type1Msg, HCkString outStr);
const char *CkNtlm_parseType1(HCkNtlm cHandle, const char *type1Msg);
```

Parses an encoded Type 1 negotiate message and returns human-readable XML describing its fields, including negotiation flags and any supplied domain or workstation information.

The input token is decoded according to `EncodingMode`. The returned text is diagnostic XML intended for inspection and troubleshooting; parsing a message does not verify its authenticity. Check `LastMethodSuccess` before using the returned string.

Returns TRUE for success, FALSE for failure.

### Ntlm.ParseType2

`Chilkat 11.7.0 · c · Ntlm · ParseType2 · method`

```c
BOOL CkNtlm_ParseType2(HCkNtlm cHandle, const char *type2Msg, HCkString outStr);
const char *CkNtlm_parseType2(HCkNtlm cHandle, const char *type2Msg);
```

Parses an encoded Type 2 challenge message and returns human-readable XML describing its fields, including flags, target name, server challenge, and target-information AV pairs when present.

The input token is decoded according to `EncodingMode`. The returned text is diagnostic XML intended for inspection and troubleshooting; parsing a message does not verify its authenticity. Check `LastMethodSuccess` before using the returned string.

**Diagnostic sensitivity:** A Type 2 message contains a live server challenge and target metadata. Avoid exposing diagnostic output unnecessarily while an authentication exchange is active.

Returns TRUE for success, FALSE for failure.

### Ntlm.ParseType3

`Chilkat 11.7.0 · c · Ntlm · ParseType3 · method`

```c
BOOL CkNtlm_ParseType3(HCkNtlm cHandle, const char *type3Msg, HCkString outStr);
const char *CkNtlm_parseType3(HCkNtlm cHandle, const char *type3Msg);
```

Parses an encoded Type 3 authenticate message and returns human-readable XML describing its fields, including the reported username, domain, workstation, and challenge-response data.

The input token is decoded according to `EncodingMode`. The returned text is diagnostic XML intended for inspection and troubleshooting; parsing a message does not verify its authenticity. Check `LastMethodSuccess` before using the returned string.

**Sensitive diagnostic data:** The password is not present, but Type 3 contains account identifiers and password-derived response material that may be useful to an attacker. Do not place parsed output in public or long-lived logs.

Returns TRUE for success, FALSE for failure.

### Ntlm.SetFlag

`Chilkat 11.7.0 · c · Ntlm · SetFlag · method`

```c
BOOL CkNtlm_SetFlag(HCkNtlm cHandle, const char *flagLetter, BOOL onOrOff);
```

Turns one Chilkat flag letter on or off in `Flags`. `flagLetter` is a single letter listed in the `Flags` table, and `onOrOff` is `TRUE` to set the bit or `FALSE` to clear it.

Returns `TRUE` when the flag letter is accepted and the value is updated; otherwise returns `FALSE`.

**Use with care:** NTLM flags have dependencies and message-specific meanings. Modify them only for a known interoperability requirement, and avoid enabling reserved letters.

Returns TRUE for success, FALSE for failure.

