void AXIS2_CALL convert_to_hex()

in util/src/digest_calc.c [22:65]


void AXIS2_CALL convert_to_hex(
    axutil_digest_hash_t bin,
    axutil_digest_hash_hex_t hex);

AXIS2_EXTERN axis2_status_t AXIS2_CALL
axutil_digest_calc_get_h_a1(
    const axutil_env_t *env,
    char *algorithm,
    char *user_name,
    char *realm,
    char *password,
    char *nonce,
    char *cnonce,
    axutil_digest_hash_hex_t session_key)
{
    axutil_md5_ctx_t *ctx;
    axutil_digest_hash_t ha1;

    ctx = axutil_md5_ctx_create(env);
    if(!ctx)
        return AXIS2_FAILURE;
    axutil_md5_update(ctx, env, user_name, strlen(user_name));
    axutil_md5_update(ctx, env, ":", 1);
    axutil_md5_update(ctx, env, realm, strlen(realm));
    axutil_md5_update(ctx, env, ":", 1);
    axutil_md5_update(ctx, env, password, strlen(password));
    axutil_md5_final(ctx, env, ha1);
    axutil_md5_ctx_free(ctx, env);
    if(!axutil_strcasecmp(algorithm, "md5-sess"))
    {
        ctx = axutil_md5_ctx_create(env);
        if(!ctx)
            return AXIS2_FAILURE;
        axutil_md5_update(ctx, env, ha1, AXIS2_DIGEST_HASH_LEN);
        axutil_md5_update(ctx, env, ":", 1);
        axutil_md5_update(ctx, env, nonce, strlen(nonce));
        axutil_md5_update(ctx, env, ":", 1);
        axutil_md5_update(ctx, env, cnonce, strlen(cnonce));
        axutil_md5_final(ctx, env, ha1);
        axutil_md5_ctx_free(ctx, env);
    }
    convert_to_hex(ha1, session_key);
    return AXIS2_SUCCESS;
}