## xntlm xntlm — Microsoft NTLM Authentication |

## Synopsis

    GByteArray *        xntlm_negotiate                     (void);
    gboolean            xntlm_parse_challenge               (gpointer challenge,
                                                             gint len,
                                                             gchar **nonce,
                                                             gchar **nt_domain,
                                                             gchar **w2k_domain);
    GByteArray *        xntlm_authenticate                  (const gchar *nonce,
                                                             const gchar *domain,
                                                             const gchar *user,
                                                             const gchar *password,
                                                             const gchar *workstation);

## Description

These functions are the main interface to the xntlm library.

## Details

### xntlm_negotiate ()

    GByteArray *        xntlm_negotiate                     (void);

Creates an NTLM Type 1 (Negotiate) message

Returns : | the message

### xntlm_parse_challenge ()

    gboolean            xntlm_parse_challenge               (gpointer challenge,
                                                             gint len,
                                                             gchar **nonce,
                                                             gchar **nt_domain,
                                                             gchar **w2k_domain);

Attempts to parse the challenge in `challenge`. If `nonce` is non-`NULL`, the 8-byte nonce from `challenge` will be returned in it. Likewise, if `nt_domain` and/or `w2k_domain` are non-`NULL`, the server's domain names will be returned in them. The strings returned must be freed with `g_free()`.

`challenge` : | buffer containing an NTLM Type 2 (Challenge) message
`len` : | the length of `challenge`
`nonce` : | return variable for the challenge nonce, or `NULL`
`nt_domain` : | return variable for the server NT domain, or `NULL`
`w2k_domain` : | return variable for the server W2k domain, or `NULL`
Returns : | `TRUE` if the challenge could be parsed, `FALSE` otherwise.

### xntlm_authenticate ()

    GByteArray *        xntlm_authenticate                  (const gchar *nonce,
                                                             const gchar *domain,
                                                             const gchar *user,
                                                             const gchar *password,
                                                             const gchar *workstation);

Generates an NTLM Type 3 (Authenticate) message from the given data. `workstation` is provided for completeness, but can basically always be left `NULL`.

`nonce` : | the nonce from an NTLM Type 2 (Challenge) message
`domain` : | the NT domain to authenticate against
`user` : | the name of the user in `domain`
`password` : | `user`'s password
`workstation` : | the name of the local workstation authenticated against, or `NULL`.
Returns : | the NTLM Type 3 message