## LassoWsseUsernameToken

LassoWsseUsernameToken

## Functions

LassoWsseUsernameToken * | lasso_wsse_username_token_new ()
void | lasso_wsse_username_token_reset_nonce ()
void | lasso_wsse_username_token_set_password_kind ()
lasso_error_t | lasso_wsse_username_token_set_password ()
lasso_error_t | lasso_wsse_username_token_check_password ()
guchar * | lasso_wsse_username_token_derive_key ()

## Types and Values

enum | LassoWsseUsernameTokenPasswordType
struct | LassoWsseUsernameToken

## Description

Transmit username and password credential as a WS-Security token. The password can be transmitted as cleartext or using a digest mode. It also allows to derive encryption and HMAC signing keys.

## Functions

### lasso_wsse_username_token_new ()

    LassoWsseUsernameToken *
    lasso_wsse_username_token_new (void);

### lasso_wsse_username_token_reset_nonce ()

    void
    lasso_wsse_username_token_reset_nonce (LassoWsseUsernameToken *wsse_username_token);

Generate a random nonce.

#### Parameters

wsse_username_token | a LassoWsseUsernameToken object |

### lasso_wsse_username_token_set_password_kind ()

    void
    lasso_wsse_username_token_set_password_kind
                                   (LassoWsseUsernameToken *wsse_username_token,
                                    LassoWsseUsernameTokenPasswordType password_type);

Set the way to transmit password, that is either cleartext or digest.

#### Parameters

wsse_username_token | a LassoWsseUsernameToken object |
password_type | a LassoWsseUsernameTokenPasswordType enumeration |

### lasso_wsse_username_token_set_password ()

    lasso_error_t
    lasso_wsse_username_token_set_password
                                   (LassoWsseUsernameToken *wsse_username_token,
                                    char *password);

Set the password using the given UTF-8 string. If password kind is digest, compute the digest SHA1(nonce + created + password), convert to Base64 and set it as the password. If nonce or created are NULL, the empty string is used.

#### Parameters

wsse_username_token | a LassoWsseUsernameToken object |
password | an UTF-8 string |

#### Returns

0 if successfull, an error code otherwise.

### lasso_wsse_username_token_check_password ()

    lasso_error_t
    lasso_wsse_username_token_check_password
                                   (LassoWsseUsernameToken *wsse_username_token,
                                    char *password);

### lasso_wsse_username_token_derive_key ()

    guchar *
    lasso_wsse_username_token_derive_key (LassoWsseUsernameToken *wsse_username_token,
                                          char *password);

Generate a derived 128bit key using the password and setting from the UsernameToken.

#### Parameters

wsse_username_token | a LassoWsseUsernameToken object |
password | the known password |

#### Returns

a 20 byte octet string.

## Types and Values

### enum LassoWsseUsernameTokenPasswordType

#### Members

LASSO_WSSE_USERNAME_TOKEN_PASSWORD_TYPE_UNKNOWN |  |
LASSO_WSSE_USERNAME_TOKEN_PASSWORD_TYPE_TEXT |  |
LASSO_WSSE_USERNAME_TOKEN_PASSWORD_TYPE_DIGEST |  |
LASSO_WSSE_USERNAME_TOKEN_PASSWORD_TYPE_LAST |  |

### struct LassoWsseUsernameToken

    struct LassoWsseUsernameToken {
    	LassoNode parent;

    	char *Id;
    	char *Username;
    	char *Nonce;
    	char *Salt;
    	char *Created;
    	int Iteration;
    	GHashTable *attributes;
    };

#### Members

LassoNode `parent`; |  |
char *`Id`; | the identifier of the UsernameToken |
char *`Username`; | the username |
char *`Nonce`; | a nonce used to compute the digest of the password |
char *`Salt`; | the salt for generating derived key |
char *`Created`; | the timestamp for the generation of the token, also used in the digest of the password |
int `Iteration`; | how many times to apply SHA1 for generating derivated key |
GHashTable *`attributes`; |  |