# oxs_key_mgr.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_MGR_H
    00019 #define OXS_KEY_MGR_H
    00020
    00021
    00032 #include <axis2_defines.h>
    00033 #include <oxs_ctx.h>
    00034 #include <oxs_asym_ctx.h>
    00035 #include <axutil_env.h>
    00036 #include <axutil_qname.h>
    00037 #include <oxs_x509_cert.h>
    00038 #include <openssl_pkey.h>
    00039 #include <openssl_x509.h>
    00040 #include <openssl_pkcs12.h>
    00041 #include <axis2_key_type.h>
    00042 #include <openssl_pkcs12.h>
    00043 #include <openssl_pkcs12_keystore.h>
    00044
    00045 #ifdef __cplusplus
    00046 extern "C"
    00047 {
    00048 #endif
    00049
    00050         typedef struct oxs_key_mgr_t oxs_key_mgr_t;
    00051         /* Enum which is used to specify the key format. */
    00052         typedef enum  {
    00053                 OXS_KEY_MGR_FORMAT_UNKNOWN=0,
    00054                 OXS_KEY_MGR_FORMAT_PEM,
    00055                 OXS_KEY_MGR_FORMAT_PKCS12
    00056         }oxs_key_mgr_format_t;
    00057
    00058 #if 0
    00059
    00066     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00067         oxs_key_mgr_load_key(
    00068                 oxs_key_mgr_t *key_mgr,
    00069                 const axutil_env_t *env,
    00070             oxs_asym_ctx_t *ctx);
    00071
    00072 #endif
    00073
    00084     AXIS2_EXTERN openssl_pkey_t* AXIS2_CALL
    00085     oxs_key_mgr_load_private_key_from_string(const axutil_env_t *env,
    00086             axis2_char_t *pem_buf, /*in PEM format*/
    00087             axis2_char_t *password);
    00095     AXIS2_EXTERN openssl_pkey_t* AXIS2_CALL
    00096     oxs_key_mgr_load_private_key_from_pem_file(const axutil_env_t *env,
    00097             axis2_char_t *file_name,
    00098             axis2_char_t *password);
    00099
    00109     AXIS2_EXTERN oxs_x509_cert_t* AXIS2_CALL
    00110     oxs_key_mgr_load_x509_cert_from_string(const axutil_env_t *env,
    00111                                            axis2_char_t *pem_buf);
    00112
    00119     AXIS2_EXTERN oxs_x509_cert_t* AXIS2_CALL
    00120     oxs_key_mgr_load_x509_cert_from_pem_file(const axutil_env_t *env,
    00121             axis2_char_t *filename);
    00122
    00132     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00133     oxs_key_mgr_read_pkcs12_key_store(const axutil_env_t *env,
    00134                                       axis2_char_t *pkcs12_file,
    00135                                       axis2_char_t *password,
    00136                                       oxs_x509_cert_t **cert,
    00137                                       openssl_pkey_t **prv_key);
    00138
    00144         AXIS2_EXTERN oxs_key_mgr_t * AXIS2_CALL
    00145         oxs_key_mgr_create(const axutil_env_t *env);
    00146
    00153         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00154         oxs_key_mgr_free(oxs_key_mgr_t *key_mgr,
    00155                                         const axutil_env_t *env);
    00156
    00164         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00165         oxs_key_mgr_set_prv_key_password(
    00166                 oxs_key_mgr_t *key_mgr,
    00167                 const axutil_env_t *env,
    00168                 axis2_char_t *password);
    00169
    00176         AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00177         oxs_key_mgr_get_prv_key_password(
    00178                 oxs_key_mgr_t *key_mgr,
    00179                 const axutil_env_t *env);
    00180
    00187         AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00188         oxs_key_mgr_get_private_key_file(
    00189                 oxs_key_mgr_t *key_mgr,
    00190                 const axutil_env_t *env);
    00191
    00192         AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00193         oxs_key_mgr_get_certificate_file(
    00194                 oxs_key_mgr_t *key_mgr,
    00195                 const axutil_env_t *env);
    00196
    00197         AXIS2_EXTERN axis2_char_t *AXIS2_CALL
    00198         oxs_key_mgr_get_reciever_certificate_file(
    00199                 oxs_key_mgr_t *key_mgr,
    00200                 const axutil_env_t *env);
    00201
    00202         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00203         oxs_key_mgr_set_private_key_file(
    00204                 oxs_key_mgr_t *key_mgr,
    00205                 const axutil_env_t *env,
    00206                 axis2_char_t *file_name);
    00207
    00208         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00209         oxs_key_mgr_set_certificate_file(
    00210                 oxs_key_mgr_t *key_mgr,
    00211                 const axutil_env_t *env,
    00212                 axis2_char_t *file_name);
    00213
    00214         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00215         oxs_key_mgr_set_reciever_certificate_file(
    00216                 oxs_key_mgr_t *key_mgr,
    00217                 const axutil_env_t *env,
    00218                 axis2_char_t *file_name);
    00219
    00220
    00221         AXIS2_EXTERN void *AXIS2_CALL
    00222         oxs_key_mgr_get_certificate(
    00223                 oxs_key_mgr_t *key_mgr,
    00224                 const axutil_env_t *env);
    00225
    00226         AXIS2_EXTERN axis2_key_type_t AXIS2_CALL
    00227         oxs_key_mgr_get_certificate_type(
    00228                 oxs_key_mgr_t *key_mgr,
    00229                 const axutil_env_t *env);
    00230
    00231         AXIS2_EXTERN void *AXIS2_CALL
    00232         oxs_key_mgr_get_prv_key(
    00233                 oxs_key_mgr_t *key_mgr,
    00234                 const axutil_env_t *env);
    00235
    00236         AXIS2_EXTERN axis2_key_type_t AXIS2_CALL
    00237         oxs_key_mgr_get_prv_key_type(
    00238                 oxs_key_mgr_t *key_mgr,
    00239                 const axutil_env_t *env);
    00240
    00241         AXIS2_EXTERN void *AXIS2_CALL
    00242         oxs_key_mgr_get_receiver_certificate(
    00243                 oxs_key_mgr_t *key_mgr,
    00244                 const axutil_env_t *env);
    00245
    00246         AXIS2_EXTERN axis2_key_type_t AXIS2_CALL
    00247         oxs_key_mgr_get_receiver_certificate_type(
    00248                 oxs_key_mgr_t *key_mgr,
    00249                 const axutil_env_t *env);
    00250
    00251         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00252         oxs_key_mgr_set_certificate(
    00253                 oxs_key_mgr_t *key_mgr,
    00254                 const axutil_env_t *env,
    00255                 void *certificate);
    00256
    00257         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00258         oxs_key_mgr_set_certificate_type(
    00259                 oxs_key_mgr_t *key_mgr,
    00260                 const axutil_env_t *env,
    00261                 axis2_key_type_t type);
    00262
    00263         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00264         oxs_key_mgr_set_prv_key(
    00265                 oxs_key_mgr_t *key_mgr,
    00266                 const axutil_env_t *env,
    00267                 void *key);
    00268
    00269         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00270         oxs_key_mgr_set_prv_key_type(
    00271                 oxs_key_mgr_t *key_mgr,
    00272                 const axutil_env_t *env,
    00273                 axis2_key_type_t type);
    00274
    00275         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00276         oxs_key_mgr_set_receiver_certificate(
    00277                 oxs_key_mgr_t *key_mgr,
    00278                 const axutil_env_t *env,
    00279                 void *certificate);
    00280
    00281         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00282         oxs_key_mgr_set_receiver_certificate_type(
    00283                 oxs_key_mgr_t *key_mgr,
    00284                 const axutil_env_t *env,
    00285                 axis2_key_type_t type);
    00286
    00287         AXIS2_EXTERN oxs_key_mgr_format_t AXIS2_CALL
    00288         oxs_key_mgr_get_format(
    00289                 oxs_key_mgr_t *key_mgr,
    00290                 const axutil_env_t *env);
    00291
    00292         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00293         oxs_key_mgr_set_format(
    00294                 oxs_key_mgr_t *key_mgr,
    00295                 const axutil_env_t *env,
    00296                 oxs_key_mgr_format_t format);
    00297
    00298         AXIS2_EXTERN void * AXIS2_CALL
    00299         oxs_key_mgr_get_pem_buf(
    00300                 oxs_key_mgr_t *key_mgr,
    00301                 const axutil_env_t *env);
    00302
    00303         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00304         oxs_key_mgr_set_pem_buf(
    00305                 oxs_key_mgr_t *key_mgr,
    00306                 const axutil_env_t *env,
    00307                 void *pem_buf);
    00308
    00309         AXIS2_EXTERN pkcs12_keystore_t* AXIS2_CALL
    00310         oxs_key_mgr_get_key_store(
    00311                 oxs_key_mgr_t *key_mgr,
    00312                 const axutil_env_t *env);
    00313
    00314         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00315         oxs_key_mgr_set_key_store(
    00316                 oxs_key_mgr_t *key_mgr,
    00317                 const axutil_env_t *env,
    00318                 pkcs12_keystore_t *key_store);
    00319
    00320         AXIS2_EXTERN void * AXIS2_CALL
    00321         oxs_key_mgr_get_key_store_buff(
    00322             oxs_key_mgr_t *key_mgr,
    00323             const axutil_env_t *env);
    00324
    00325         AXIS2_EXTERN oxs_x509_cert_t * AXIS2_CALL
    00326         oxs_key_mgr_get_receiver_certificate_from_ski(
    00327             oxs_key_mgr_t *key_mgr,
    00328             const axutil_env_t *env,
    00329             axis2_char_t *ski);
    00330
    00331         AXIS2_EXTERN oxs_x509_cert_t * AXIS2_CALL
    00332         oxs_key_mgr_get_receiver_certificate_from_issuer_serial(
    00333             oxs_key_mgr_t *key_mgr,
    00334             const axutil_env_t *env,
    00335             axis2_char_t *issuer,
    00336             int serial);
    00337
    00338         AXIS2_EXTERN int AXIS2_CALL
    00339         oxs_key_mgr_get_key_store_buff_len(
    00340             oxs_key_mgr_t *key_mgr,
    00341             const axutil_env_t *env);
    00342
    00343         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00344         oxs_key_mgr_set_key_store_buff(
    00345             oxs_key_mgr_t *key_mgr,
    00346             const axutil_env_t *env,
    00347             void *key_store_buf,
    00348             int len);
    00349
    00350         AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00351         oxs_key_mgr_increment_ref(
    00352             oxs_key_mgr_t *key_mgr,
    00353             const axutil_env_t *env);
    00354
    00355
    00357 #ifdef __cplusplus
    00358 }
    00359 #endif
    00360
    00361 #endif                          /* OXS_KEY_MGR_H */