# Utils
[Rampart Utilities]

## Functions
AXIS2_EXTERN rampart_credentials_t * | rampart_load_credentials_module (const axutil_env_t *env, axis2_char_t *cred_module_name)
AXIS2_EXTERN rampart_credentials_status_t | rampart_call_credentials (const axutil_env_t *env, rampart_credentials_t *cred_module, axis2_msg_ctx_t *ctx, axis2_char_t **username, axis2_char_t **password)
AXIS2_EXTERN rampart_authn_provider_t * | rampart_load_auth_module (const axutil_env_t *env, axis2_char_t *auth_module_name)
AXIS2_EXTERN rampart_replay_detector_t * | rampart_load_replay_detector (const axutil_env_t *env, axis2_char_t *replay_detector_name)
AXIS2_EXTERN rampart_sct_provider_t * | rampart_load_sct_provider (const axutil_env_t *env, axis2_char_t *sct_provider_name)
AXIS2_EXTERN rampart_callback_t * | rampart_load_pwcb_module (const axutil_env_t *env, axis2_char_t *callback_module_name)
AXIS2_EXTERN rampart_authn_provider_status_t | rampart_authenticate_un_pw (const axutil_env_t *env, rampart_authn_provider_t *authp, const axis2_char_t *username, const axis2_char_t *password, const axis2_char_t *nonce, const axis2_char_t *created, const axis2_char_t *password_type, axis2_msg_ctx_t *msg_ctx)
AXIS2_EXTERN axis2_char_t * | rampart_callback_password (const axutil_env_t *env, rampart_callback_t *callback_module, const axis2_char_t *username)
AXIS2_EXTERN axis2_char_t * | rampart_callback_pkcs12_password (const axutil_env_t *env, rampart_callback_t *callback_module, const axis2_char_t *username)
AXIS2_EXTERN axis2_char_t * | rampart_generate_time (const axutil_env_t *env, int ttl, axis2_bool_t with_millisecond)
AXIS2_EXTERN axis2_status_t | rampart_compare_date_time (const axutil_env_t *env, axis2_char_t *dt1, axis2_char_t *dt2)

## Function Documentation

AXIS2_EXTERN rampart_authn_provider_status_t rampart_authenticate_un_pw | ( | const axutil_env_t * | env,
|  | rampart_authn_provider_t * | authp,
|  | const axis2_char_t * | username,
|  | const axis2_char_t * | password,
|  | const axis2_char_t * | nonce,
|  | const axis2_char_t * | created,
|  | const axis2_char_t * | password_type,
|  | axis2_msg_ctx_t * | msg_ctx |
| ) |  |  |

Call auth module

Parameters:

  | env | pointer to environment struct
  | authp | the authentication module
  | username | the username in the UsernameToken
  | password | the password in the UsernameToken
  | nonce | the nonce in the UsernameToken. Can be NULL if plain text password is used.
  | created | created time in UsernameToken. Can be NULL if plain text password is used.
  | password_type | the type of the password. either plain text of digest
  | msg_ctx | the message context

Returns:
  status of the operation

AXIS2_EXTERN rampart_credentials_status_t rampart_call_credentials | ( | const axutil_env_t * | env,
|  | rampart_credentials_t * | cred_module,
|  | axis2_msg_ctx_t * | ctx,
|  | axis2_char_t ** | username,
|  | axis2_char_t ** | password |
| ) |  |  |

Call credentials module User MUST free memory of username and password

Parameters:

  | env | pointer to environment struct
  | cred_module | the credentails module
  | ctx | the message context
  | username | reference to the returned username
  | password | reference to the returned password

Returns:
  the status of the operation

AXIS2_EXTERN axis2_char_t* rampart_callback_password | ( | const axutil_env_t * | env,
|  | rampart_callback_t * | callback_module,
|  | const axis2_char_t * | username |
| ) |  |  |

Gets the password of given user. the environment callback module structure the name of the user to get the password

Returns:
  the password for the user or NULL if failed

AXIS2_EXTERN axis2_char_t* rampart_callback_pkcs12_password | ( | const axutil_env_t * | env,
|  | rampart_callback_t * | callback_module,
|  | const axis2_char_t * | username |
| ) |  |  |

Get the password for pkcs12 key store. pointer to environment struct pointer to rampart callback module name of the pkcs12 owner

Returns:
  the password for the user or NULL if username is incorrect

AXIS2_EXTERN axis2_status_t rampart_compare_date_time | ( | const axutil_env_t * | env,
|  | axis2_char_t * | dt1,
|  | axis2_char_t * | dt2 |
| ) |  |  |

Check if < . if not returns a false

Parameters:

  | env | pointer to environment struct
  | dt1 | date time 1.
  | dt2 | date time 2.

Returns:
  AXIS2_SUCCESS if dt1 < dt2. AXIS2_FALSE otherwise

AXIS2_EXTERN axis2_char_t* rampart_generate_time | ( | const axutil_env_t * | env,
|  | int | ttl,
|  | axis2_bool_t | with_millisecond |
| ) |  |  |

Generates time. User MUST free memory

Parameters:

  | ttl | Time to live. The time difference between created and expired in mili seconds.
  | with_millisecond | shows whether millisecond precision is needed or not

Returns:
  generated time

AXIS2_EXTERN rampart_authn_provider_t* rampart_load_auth_module | ( | const axutil_env_t * | env,
|  | axis2_char_t * | auth_module_name |
| ) |  |  |

Load authentication module User MUST free memory

Parameters:

  | env | pointer to environment struct
  | auth_module_name | name of the authentication module

Returns:
  created athenticaiton module

AXIS2_EXTERN rampart_credentials_t* rampart_load_credentials_module | ( | const axutil_env_t * | env,
|  | axis2_char_t * | cred_module_name |
| ) |  |  |

Load the credentials module User MUST free memory

Parameters:

  | env | pointer to environment struct
  | cred_module_name | name of the credentails module to be loaded

Returns:
  the loaded credentails module

AXIS2_EXTERN rampart_callback_t* rampart_load_pwcb_module | ( | const axutil_env_t * | env,
|  | axis2_char_t * | callback_module_name |
| ) |  |  |

Load the password callback module User MUST free memory

Parameters:

  | env | pointer to environment struct the name of the callback module

Returns:
  the loaded callback module

AXIS2_EXTERN rampart_replay_detector_t* rampart_load_replay_detector | ( | const axutil_env_t * | env,
|  | axis2_char_t * | replay_detector_name |
| ) |  |  |

Load replay detection module User MUST free memory

Parameters:

  | env | pointer to environment struct
  | replay_detector_name | name of the replay detection module

Returns:
  created replay detection module

AXIS2_EXTERN rampart_sct_provider_t* rampart_load_sct_provider | ( | const axutil_env_t * | env,
|  | axis2_char_t * | sct_provider_name |
| ) |  |  |

Load security context token provider User MUST free memory

Parameters:

  | env | pointer to environment struct
  | sct_provider_name | name of the security context token provider

Returns:
  created security context token provider module