# oxs_key.h

Go to the documentation of this file.

    00001 /*
    00002  * Licensed to the Apache Software Foundation (ASF) under one or more
    00003  * contributor license agreements.  See the NOTICE file distributed with
    00004  * this work for additional information regarding copyright ownership.
    00005  * The ASF licenses this file to You under the Apache License, Version 2.0
    00006  * (the "License"); you may not use this file except in compliance with
    00007  * the License.  You may obtain a copy of the License at
    00008  *
    00009  *      http://www.apache.org/licenses/LICENSE-2.0
    00010  *
    00011  * Unless required by applicable law or agreed to in writing, software
    00012  * distributed under the License is distributed on an "AS IS" BASIS,
    00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  * See the License for the specific language governing permissions and
    00015  * limitations under the License.
    00016  */
    00017
    00018 #ifndef OXS_KEY_H
    00019 #define OXS_KEY_H
    00020
    00021
    00032 #include <axis2_defines.h>
    00033 #include <oxs_constants.h>
    00034 #include <oxs_buffer.h>
    00035 #include <axutil_env.h>
    00036 #include <rp_algorithmsuite.h>
    00037
    00038 #ifdef __cplusplus
    00039 extern "C"
    00040 {
    00041 #endif
    00042
    00043     /*Key usage is not specified yet*/
    00044 #define OXS_KEY_USAGE_NONE              0
    00045     /*Key is a session key */
    00046 #define OXS_KEY_USAGE_SESSION           1
    00047     /*Key is a signature session key*/
    00048 #define OXS_KEY_USAGE_SIGNATURE_SESSION 2
    00049     /*Key is a derived key */
    00050 #define OXS_KEY_USAGE_DERIVED           3
    00051
    00052 #define OXS_KEY_DEFAULT_SIZE            64
    00053
    00055     typedef struct oxs_key_t oxs_key_t;
    00056
    00064     AXIS2_EXTERN unsigned char *AXIS2_CALL
    00065     oxs_key_get_data(
    00066         const oxs_key_t *key,
    00067         const axutil_env_t *env);
    00074     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00075     oxs_key_get_name(
    00076         const oxs_key_t *key,
    00077         const axutil_env_t *env);
    00084     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00085     oxs_key_get_nonce(
    00086         const oxs_key_t *key,
    00087         const axutil_env_t *env);
    00088
    00095     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00096     oxs_key_get_label(
    00097         const oxs_key_t *key,
    00098         const axutil_env_t *env);
    00099
    00106     AXIS2_EXTERN int AXIS2_CALL
    00107     oxs_key_get_size(
    00108         const oxs_key_t *key,
    00109         const axutil_env_t *env);
    00116     AXIS2_EXTERN int AXIS2_CALL
    00117     oxs_key_get_usage(
    00118         const oxs_key_t *key,
    00119         const axutil_env_t *env);
    00120
    00127     AXIS2_EXTERN int AXIS2_CALL
    00128     oxs_key_get_offset(
    00129         const oxs_key_t *key,
    00130         const axutil_env_t *env);
    00131
    00138     AXIS2_EXTERN int AXIS2_CALL
    00139     oxs_key_get_length(
    00140         const oxs_key_t *key,
    00141         const axutil_env_t *env);
    00142
    00150     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00151     oxs_key_set_name(
    00152         oxs_key_t *key,
    00153         const axutil_env_t *env,
    00154         axis2_char_t *name);
    00155
    00156
    00164     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00165     oxs_key_set_usage(
    00166         oxs_key_t *key,
    00167         const axutil_env_t *env,
    00168         int usage);
    00169
    00170     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00171     oxs_key_set_nonce(
    00172         oxs_key_t *key,
    00173         const axutil_env_t *env,
    00174         axis2_char_t *nonce);
    00175
    00176     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00177     oxs_key_set_label(
    00178         oxs_key_t *key,
    00179         const axutil_env_t *env,
    00180         axis2_char_t *label);
    00181
    00182     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00183     oxs_key_set_offset(
    00184         oxs_key_t *key,
    00185         const axutil_env_t *env,
    00186         int offset);
    00187
    00188     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00189     oxs_key_set_length(
    00190         oxs_key_t *key,
    00191         const axutil_env_t *env,
    00192         int length);
    00199     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00200     oxs_key_free(
    00201         oxs_key_t *key,
    00202         const axutil_env_t *env
    00203     );
    00204
    00205     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00206     oxs_key_populate_with_buf(oxs_key_t *key,
    00207                               const axutil_env_t *env,
    00208                               oxs_buffer_t *buffer,
    00209                               axis2_char_t *name,
    00210                               int usage);
    00211
    00222     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00223     oxs_key_populate(
    00224         oxs_key_t *key,
    00225         const axutil_env_t *env,
    00226         unsigned char *data,
    00227         axis2_char_t *name,
    00228         int size,
    00229         int usage);
    00230
    00237     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00238     oxs_key_read_from_file(
    00239         oxs_key_t *key,
    00240         const axutil_env_t *env,
    00241         axis2_char_t *file_name);
    00242
    00249     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00250     oxs_key_for_algo(oxs_key_t *key,
    00251                      const axutil_env_t *env,
    00252                      rp_algorithmsuite_t *key_algo);
    00253
    00254
    00255     AXIS2_EXTERN oxs_buffer_t *AXIS2_CALL
    00256     oxs_key_get_buffer(const oxs_key_t *key,
    00257                        const axutil_env_t *env);
    00258
    00259     AXIS2_EXTERN oxs_key_t *AXIS2_CALL
    00260     oxs_key_dup(oxs_key_t *key,
    00261                 const axutil_env_t *env);
    00262
    00263     AXIS2_EXTERN oxs_key_t *AXIS2_CALL
    00264     oxs_key_create(const axutil_env_t *env);
    00265
    00266     /* once the key_sha is given, ownership is assumed */
    00267     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00268     oxs_key_set_key_sha(
    00269         oxs_key_t *key,
    00270         const axutil_env_t *env,
    00271         axis2_char_t *key_sha);
    00272
    00273     AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00274     oxs_key_get_key_sha(
    00275         const oxs_key_t *key,
    00276         const axutil_env_t *env);
    00277
    00278
    00279 #ifdef __cplusplus
    00280 }
    00281 #endif
    00282
    00283 #endif                          /* OXS_KEY_H */