# Key
[OMXMLSecurity]

## Defines
#define | OXS_KEY_USAGE_NONE 0
#define | OXS_KEY_USAGE_SESSION 1
#define | OXS_KEY_USAGE_SIGNATURE_SESSION 2
#define | OXS_KEY_USAGE_DERIVED 3
#define | OXS_KEY_DEFAULT_SIZE 64
## Typedefs
typedef struct oxs_key_t | oxs_key_t
## Functions
AXIS2_EXTERN unsigned char * | oxs_key_get_data (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | oxs_key_get_name (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | oxs_key_get_nonce (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN axis2_char_t * | oxs_key_get_label (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN int | oxs_key_get_size (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN int | oxs_key_get_usage (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN int | oxs_key_get_offset (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN int | oxs_key_get_length (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | oxs_key_set_name (oxs_key_t *key, const axutil_env_t *env, axis2_char_t *name)
AXIS2_EXTERN axis2_status_t | oxs_key_set_usage (oxs_key_t *key, const axutil_env_t *env, int usage)
AXIS2_EXTERN axis2_status_t | oxs_key_set_nonce (oxs_key_t *key, const axutil_env_t *env, axis2_char_t *nonce)
AXIS2_EXTERN axis2_status_t | oxs_key_set_label (oxs_key_t *key, const axutil_env_t *env, axis2_char_t *label)
AXIS2_EXTERN axis2_status_t | oxs_key_set_offset (oxs_key_t *key, const axutil_env_t *env, int offset)
AXIS2_EXTERN axis2_status_t | oxs_key_set_length (oxs_key_t *key, const axutil_env_t *env, int length)
AXIS2_EXTERN axis2_status_t | oxs_key_free (oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | oxs_key_populate_with_buf (oxs_key_t *key, const axutil_env_t *env, oxs_buffer_t *buffer, axis2_char_t *name, int usage)
AXIS2_EXTERN axis2_status_t | oxs_key_populate (oxs_key_t *key, const axutil_env_t *env, unsigned char *data, axis2_char_t *name, int size, int usage)
AXIS2_EXTERN axis2_status_t | oxs_key_read_from_file (oxs_key_t *key, const axutil_env_t *env, axis2_char_t *file_name)
AXIS2_EXTERN axis2_status_t | oxs_key_for_algo (oxs_key_t *key, const axutil_env_t *env, rp_algorithmsuite_t *key_algo)
AXIS2_EXTERN oxs_buffer_t * | oxs_key_get_buffer (const oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN oxs_key_t * | oxs_key_dup (oxs_key_t *key, const axutil_env_t *env)
AXIS2_EXTERN oxs_key_t * | oxs_key_create (const axutil_env_t *env)
AXIS2_EXTERN axis2_status_t | oxs_key_set_key_sha (oxs_key_t *key, const axutil_env_t *env, axis2_char_t *key_sha)
AXIS2_EXTERN axis2_char_t * | oxs_key_get_key_sha (const oxs_key_t *key, const axutil_env_t *env)

## Typedef Documentation

typedef struct oxs_key_t oxs_key_t

Type name for struct oxs_key

## Function Documentation

AXIS2_EXTERN axis2_status_t oxs_key_for_algo | ( | oxs_key_t * | key,
|  | const axutil_env_t * | env,
|  | rp_algorithmsuite_t * | key_algo |
| ) |  |  |

Fill the key for the given algo.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_key_free | ( | oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Free function for key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN unsigned char* oxs_key_get_data | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets data of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  data

AXIS2_EXTERN axis2_char_t* oxs_key_get_label | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the label of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  label of the key

AXIS2_EXTERN int oxs_key_get_length | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the length of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  length of the key

AXIS2_EXTERN axis2_char_t* oxs_key_get_name | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the name of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  name of the key

AXIS2_EXTERN axis2_char_t* oxs_key_get_nonce | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the nonce of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  nonce of the key

AXIS2_EXTERN int oxs_key_get_offset | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the offset of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  offset of the key

AXIS2_EXTERN int oxs_key_get_size | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the size of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  size of the key

AXIS2_EXTERN int oxs_key_get_usage | ( | const oxs_key_t * | key,
|  | const axutil_env_t * | env |
| ) |  |  |

Gets the usage of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  usage of the key

AXIS2_EXTERN axis2_status_t oxs_key_populate | ( | oxs_key_t * | key,
|  | const axutil_env_t * | env,
|  | unsigned char * | data,
|  | axis2_char_t * | name,
|  | int | size,
|  | int | usage |
| ) |  |  |

Populate a key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct
  | data | data of the key
  | name | name of the key
  | size | size of the key
  | usage | usage of the key

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_key_read_from_file | ( | oxs_key_t * | key,
|  | const axutil_env_t * | env,
|  | axis2_char_t * | file_name |
| ) |  |  |

Read a key from a file.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_key_set_name | ( | oxs_key_t * | key,
|  | const axutil_env_t * | env,
|  | axis2_char_t * | name |
| ) |  |  |

Sets the name of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct
  | name | name of the key

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE

AXIS2_EXTERN axis2_status_t oxs_key_set_usage | ( | oxs_key_t * | key,
|  | const axutil_env_t * | env,
|  | int | usage |
| ) |  |  |

Set the usage of the key.

Parameters:

  | key | oxs_key ptr to key
  | env | pointer to environment struct
  | usage | usage of the key

Returns:
  AXIS2_SUCCESS on success, else AXIS2_FAILURE