# trust_util.h File Reference

contains generic operations related to trust module More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <axiom.h>`
`#include <axutil_utils.h>`
`#include <axutil_string.h>`
`#include <trust_constants.h>`

Go to the source code of this file.

## Enumerations
enum | trust_allow_t { TRUST_ALLOW = 0, TRUST_NOT_ALLOW }
enum | trust_ok_t { TRUST_OK = 0, TRUST_NOT_OK }
## Functions
AXIS2_EXTERN axiom_node_t * | trust_util_create_rst_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axis2_char_t *context)
AXIS2_EXTERN axiom_node_t * | trust_util_create_rstr_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axis2_char_t *context)
AXIS2_EXTERN axiom_node_t * | trust_util_create_rstr_collection_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri)
AXIS2_EXTERN axiom_node_t * | trust_util_create_request_type_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *request_type)
AXIS2_EXTERN axiom_node_t * | trust_util_create_token_type_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *token_type)
AXIS2_EXTERN axiom_node_t * | trust_util_create_applies_to_element (const axutil_env_t *env, axiom_node_t *parent_node, const axis2_char_t *address, const axis2_char_t *addressing_ns)
AXIS2_EXTERN axiom_node_t * | trust_util_create_claims_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *dialect_uri)
AXIS2_EXTERN axiom_node_t * | trust_util_create_requested_security_token_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axiom_node_t *sec_token_node)
AXIS2_EXTERN axiom_node_t * | trust_util_create_requsted_proof_token_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axiom_node_t *req_proof_token)
AXIS2_EXTERN axiom_node_t * | trust_util_create_entropy_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node)
AXIS2_EXTERN axiom_node_t * | trust_util_computed_key_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node)
AXIS2_EXTERN axiom_node_t * | trust_util_create_binary_secret_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *enc_secret, axis2_char_t *bin_sec_type)
AXIS2_EXTERN axiom_node_t * | trust_util_create_computed_key_algo_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *algo_id)
AXIS2_EXTERN axiom_node_t * | trust_util_create_key_size_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *key_size)
AXIS2_EXTERN axiom_node_t * | trust_util_create_key_type_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *key_type)
AXIS2_EXTERN axiom_node_t * | trust_util_create_authentication_type_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *authentication_type)
AXIS2_EXTERN axiom_node_t * | trust_util_create_signature_algo_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *signature_algo)
AXIS2_EXTERN axiom_node_t * | trust_util_create_encryption_algo_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *encryption_algo)
AXIS2_EXTERN axiom_node_t * | trust_util_create_canonicalization_algo_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *canonicalization_algo)
AXIS2_EXTERN axiom_node_t * | trust_util_create_computedkey_algo_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *computedkey_algo)
AXIS2_EXTERN axiom_node_t * | trust_util_create_desired_encryption_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axiom_node_t *encryption_key)
AXIS2_EXTERN axiom_node_t * | trust_util_create_proof_encryption_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axiom_node_t *proof_encryption_key)
AXIS2_EXTERN axiom_node_t * | trust_util_create_usekey_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axiom_node_t *usekey_key)
AXIS2_EXTERN axiom_node_t * | trust_util_create_signwith_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *signwith)
AXIS2_EXTERN axiom_node_t * | trust_util_create_encryptwith_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axis2_char_t *encryptwith)
AXIS2_EXTERN axiom_node_t * | trust_util_create_life_time_element (const axutil_env_t *env, axiom_node_t *parent_node, axis2_char_t *wst_ns_uri, int ttl)
AXIS2_EXTERN axiom_node_t * | trust_util_create_req_attached_reference_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node)
AXIS2_EXTERN axiom_node_t * | trust_util_create_req_unattached_reference_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node)
AXIS2_EXTERN axiom_node_t * | trust_util_create_encrypted_data_element (const axutil_env_t *env, axiom_node_t *parent_node, axis2_char_t *enc_data)
AXIS2_EXTERN axiom_node_t * | trust_util_create_renew_traget_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axiom_node_t *token_renew_pending_node)
AXIS2_EXTERN axiom_node_t * | trust_util_create_allow_postdating_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node)
AXIS2_EXTERN axiom_node_t * | trust_util_create_renewing_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, trust_allow_t allow_flag, trust_ok_t ok_flag)
AXIS2_EXTERN axiom_node_t * | trust_util_create_cancel_target_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri, axiom_node_t *parent_node, axiom_node_t *token_cancel_pending_node)
AXIS2_EXTERN axiom_node_t * | trust_util_create_validation_response_element (const axutil_env_t *env, axiom_node_t *parent_node, axis2_char_t *wst_ns_uri, axis2_char_t *code, axis2_char_t *reason)
AXIS2_EXTERN axiom_node_t * | trust_util_create_random_session_key_proof_token_element (const axutil_env_t *env, axis2_char_t *wst_ns_uri)
AXIS2_EXTERN axis2_char_t * | trust_util_get_wst_ns (const axutil_env_t *env, int wst_version)

## Detailed Description

contains generic operations related to trust module

## Function Documentation

AXIS2_EXTERN axiom_node_t* trust_util_computed_key_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node |
| ) |  |  |

Create the ComputedKey Element for Issuance binding. <wst:ComputedKey> .... </wst:ComputedKey> User must set the inside content for this node.

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | parent_node | parent axiom node

Returns:
  RequestedSecurityToken axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_allow_postdating_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node |
| ) |  |  |

Create AllowPostdating element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node

Returns:
  AllowPostdating element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_applies_to_element | ( | const axutil_env_t * | env,
|  | axiom_node_t * | parent_node,
|  | const axis2_char_t * | address,
|  | const axis2_char_t * | addressing_ns |
| ) |  |  |

Create the AppliesTo Element for Issuance binding. AppliesTo element Specifies the scope for which the security token is desired. Same as TokenType. AppliesTo is higher in precedence than TokenType <wsp:AppliesTo> <wsa:EndpointReference> <wsa:Address> ... </wsa:Address> </wsa:EndpointReference> </wsp:AppliesTo>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | parent_node | parent axiom node
  | token_type | string representing token type

Returns:
  TokenType axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_binary_secret_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | enc_secret,
|  | axis2_char_t * | bin_sec_type |
| ) |  |  |

Create BinarySecret element. This contains base64 encoded binary secret or key. And also contain attribute.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | enc_secret | string representing encoded secret
  | bin_sec_type | Type of the binary secret

Returns:
  BinarySecret element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_cancel_target_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axiom_node_t * | token_cancel_pending_node |
| ) |  |  |

Create CancelTarget element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | token_cancel_pending_node |

Returns:
  CancelTarget element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_claims_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | dialect_uri |
| ) |  |  |

Claims :Requests a set of specific claims. These claims are identified by using the service's policy :URI to indicate the syntax of the claims

AXIS2_EXTERN axiom_node_t* trust_util_create_computed_key_algo_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | algo_id |
| ) |  |  |

Create ComputedKeyAlgorithm element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | algo_id | Algorithm identifier

Returns:
  ComputedKeyAlgorithm element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_encrypted_data_element | ( | const axutil_env_t * | env,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | enc_data |
| ) |  |  |

Create EncryptedData element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | enc_data | encrypted data string

Returns:
  EncryptedData element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_entropy_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node |
| ) |  |  |

Create the Entropy Element for Issuance binding. User must set the content. <wst:Entropy> .... </wst:Entropy> Entropy element specifies the entropy that is to be used for creating the key according to the service's policy.

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | parent_node | parent axiom node

Returns:
  Entropy axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_key_size_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | key_size |
| ) |  |  |

Create KeySize element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | key_size | Key size string

Returns:
  KeySize element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_key_type_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | key_type |
| ) |  |  |

Create KeyType element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | key_type | Key type string

Returns:
  KeySize element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_life_time_element | ( | const axutil_env_t * | env,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | wst_ns_uri,
|  | int | ttl |
| ) |  |  |

Create LifeTime element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node

Returns:
  LifeTime element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_renew_traget_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axiom_node_t * | token_renew_pending_node |
| ) |  |  |

Create RenewTarget element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | token_renew_pending_node |

Returns:
  RenewTarget element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_renewing_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | trust_allow_t | allow_flag,
|  | trust_ok_t | ok_flag |
| ) |  |  |

Create Renewing element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | allow_flag |
  | ok_flag |

Returns:
  Renewing element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_req_attached_reference_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node |
| ) |  |  |

Create RequestedAttachedReference element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node

Returns:
  RequestedAttachedReference element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_req_unattached_reference_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node |
| ) |  |  |

Create RequestedUnAttachedReference element.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node

Returns:
  RequestedUnAttachedReference element or NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_request_type_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | request_type |
| ) |  |  |

Create the RequestType Element for Issuance binding. <wst:RequestType> .... </wst:RequestType>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | parent_node | parent axiom node
  | request_type | string representing request type

Returns:
  RequestType axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_requested_security_token_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axiom_node_t * | sec_token_node |
| ) |  |  |

Create the RequestedSecurityToken Element for Issuance binding. <wst:RequestedSecurityToken> .... </wst:RequestedSecurityToken>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | parent_node | parent axiom node

Returns:
  RequestedSecurityToken axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_requsted_proof_token_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axiom_node_t * | req_proof_token |
| ) |  |  |

Create the RequestedProofToken Element for Issuance binding. <wst:RequestedProofToken> .... </wst:RequestedProofToken>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | parent_node | parent axiom node

Returns:
  RequestedSecurityToken axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_rst_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axis2_char_t * | context |
| ) |  |  |

Create the RST Element for Issuance binding. <wst:RequestSecurityToken> ... ... </wst:RequestSecurityToken>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | context | string representing contest of the request, can be NULL

Returns:
  RST axiom node, NULL if error occurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_rstr_collection_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri |
| ) |  |  |

Create the RSTRC Element for Issuance binding. <wst:RequestSecurityTokenResponseCollection> ... ... </wst:RequestSecurityTokenResponseCollection>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version

Returns:
  RSTRC axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_rstr_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axis2_char_t * | context |
| ) |  |  |

Create the RSTR Element for Issuance binding. <wst:RequestSecurityTokenResponse> ... ... </wst:RequestSecurityTokenResponse>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | context | string representing contest of the request, can be NULL

Returns:
  RSTR axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_token_type_element | ( | const axutil_env_t * | env,
|  | axis2_char_t * | wst_ns_uri,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | token_type |
| ) |  |  |

Create the TokenType Element for Issuance binding. <wst:TokenType> .... </wst:TokenType>

Parameters:

  | env | pointer to environment struct
  | wst_verson | integer representing wst version
  | parent_node | parent axiom node
  | token_type | string representing token type

Returns:
  TokenType axiom node, NULL if error ocurred.

AXIS2_EXTERN axiom_node_t* trust_util_create_validation_response_element | ( | const axutil_env_t * | env,
|  | axiom_node_t * | parent_node,
|  | axis2_char_t * | wst_ns_uri,
|  | axis2_char_t * | code,
|  | axis2_char_t * | reason |
| ) |  |  |

Create Status element for validation response.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version
  | parent_node | pointer to parent axiom node
  | token_cancel_pending_node |

Returns:
  Status element or NULL if error occurred.

AXIS2_EXTERN axis2_char_t* trust_util_get_wst_ns | ( | const axutil_env_t * | env,
|  | int | wst_version |
| ) |  |  |

Returns the namespace uri of WST according to the version.

Parameters:

  | env | pointer to environment struct
  | wst_version | integer representing wst version

Returns:
  namespace uri according to version.