axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r431558 - in /webservices/axis2/trunk/c/rampart/src: handlers/ omxmlsec/ omxmlsec/openssl/ util/
Date Tue, 15 Aug 2006 09:02:56 GMT
Author: damitha
Date: Tue Aug 15 02:02:55 2006
New Revision: 431558

URL: http://svn.apache.org/viewvc?rev=431558&view=rev
Log:
Applying patch

Modified:
    webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c
    webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_key.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_reference_list.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_action.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_util.c

Modified: webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c (original)
+++ webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c Tue Aug 15 02:02:55 2006
@@ -38,6 +38,7 @@
                          const axis2_env_t *env,
                          struct axis2_msg_ctx *msg_ctx);
 
+
 /**********************end of header functions ****************************/
 
 AXIS2_EXTERN axis2_handler_t *AXIS2_CALL
@@ -96,6 +97,7 @@
 
             if(!param_in_flow_security)
             {
+                /*This check ensures that user doesnt need to have securoty checking in his message flow*/
                 rampart_print_info(env,"No Inflow Security. So nothing to do");
                 return AXIS2_SUCCESS;
             }else
@@ -141,8 +143,19 @@
             while (item != NULL)
             {
                 sec_node = rampart_get_security_token(env, msg_ctx, soap_header);
+                /*If no sec_node return fault*/
+                if(!sec_node){
+                    axis2_array_list_t *sub_codes = NULL;
+                    sub_codes = axis2_array_list_create(env, 1);
+                    if (sub_codes)
+                    {
+                        AXIS2_ARRAY_LIST_ADD(sub_codes, env, RAMPART_FAULT_SECURITY_TOKEN_UNAVAILABLE);
+                    }
+
+                    rampart_create_fault_envelope(env, "wsse:Security", "Security header element is unavailable",sub_codes, msg_ctx);
+                    return AXIS2_FAILURE;
+                }
                 sec_ele = AXIOM_NODE_GET_DATA_ELEMENT(sec_node, env);
-                printf("\n::Items %s -> %s\n", items, item);
 
                 if( 0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_USERNAMETOKEN, AXIS2_STRTRIM(env, item, NULL)) )
                 {
@@ -154,7 +167,14 @@
                             rampart_print_info(env,"I know this user ");
                             status = AXIS2_SUCCESS;
                         }else{
-                            rampart_print_info(env,"I don't know this user ");
+                            axis2_array_list_t *sub_codes = NULL;
+                            sub_codes = axis2_array_list_create(env, 1);
+                            if (sub_codes)
+                            {
+                                AXIS2_ARRAY_LIST_ADD(sub_codes, env, RAMPART_FAULT_FAILED_AUTHENTICATION);
+                            }
+
+                            rampart_create_fault_envelope(env, "wsse:UsernameToken", "Username is not valid",sub_codes, msg_ctx);
                             return AXIS2_FAILURE;
                         }
                     
@@ -166,6 +186,7 @@
                             rampart_print_info(env, "Decryption success");
                             status = AXIS2_SUCCESS;
                         }else{
+                            /*TODO return a fault*/
                             rampart_print_info(env, "Decryption failed");
                             return AXIS2_FAILURE;
                         }
@@ -198,6 +219,7 @@
                             rampart_print_info(env,"Timestamp is valid ");
                             status = AXIS2_SUCCESS;
                         }else{
+                            /*TODO return a fault*/
                             rampart_print_info(env,"Timestamp is not valid");
                             return AXIS2_FAILURE;
                         }   

Modified: webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c (original)
+++ webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c Tue Aug 15 02:02:55 2006
@@ -84,9 +84,6 @@
     return handler;
 }
 
-
-
-
 axis2_status_t AXIS2_CALL
 rampart_out_handler_invoke (struct axis2_handler * handler,
                                const axis2_env_t * env, axis2_msg_ctx_t * msg_ctx)

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c Tue Aug 15 02:02:55 2006
@@ -41,7 +41,7 @@
 
     int ret;
 
-    encoded_str = AXIS2_MALLOC(env->allocator, (unsigned int)axis2_base64_encode_len((char*)(plain_buf->data)));
+    encoded_str = AXIS2_MALLOC(env->allocator, (unsigned int)axis2_base64_encode_len(AXIS2_STRLEN((char*)(plain_buf->data))));
 
     printf("\noxs_base64_encode\nIn Data Size= %d", plain_buf->size);
     ret =  axis2_base64_encode(encoded_str, (char*)(plain_buf->data), plain_buf->size);

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c Tue Aug 15 02:02:55 2006
@@ -37,7 +37,7 @@
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_get_encrypted_key(const axis2_env_t *env,
                             axiom_node_t *enc_key_node,
-                            oxs_key_ptr session_key)
+                            oxs_key_t *session_key)
 {
     axis2_char_t *key_enc_algo = NULL, *encrypted_key_value = NULL;
     axiom_node_t *enc_method_node = NULL, *cd_node = NULL, *cv_node = NULL;
@@ -85,7 +85,7 @@
     decrypted_key_buf = oxs_create_buffer(env, OXS_BUFFER_INITIAL_SIZE);
 
     /*Decrypt the encrypted key*/
-    status  = oxs_prvkey_decrypt_data(env, encrypted_key_buf, decrypted_key_buf, session_key->name);  
+    status  = oxs_prvkey_decrypt_data(env, encrypted_key_buf, decrypted_key_buf, OXS_KEY_GET_NAME(session_key, env));  
     if(status == AXIS2_FAILURE){
         oxs_error(ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
                      "oxs_prvkey_decrypt_data failed");
@@ -93,10 +93,14 @@
     }
     /*Create the session key*/
     /*Trim data to the key size*/
+    OXS_KEY_SET_DATA(session_key, env,(axis2_char_t*) decrypted_key_buf->data);
+    OXS_KEY_SET_SIZE(session_key, env, decrypted_key_buf->size);
+    OXS_KEY_SET_USAGE(session_key, env, OXS_KEY_USAGE_DECRYPT);
+    /*
     session_key->data = AXIS2_STRMEMDUP(decrypted_key_buf->data, decrypted_key_buf->size, env);    
     session_key->size = decrypted_key_buf->size;
     session_key->usage = OXS_KEY_USAGE_DECRYPT;
-     
+    */
     /*printf("\n>>>>>>>>decrypted session_key %s\n", session_key->data);*/
     return AXIS2_SUCCESS;
 }
@@ -199,9 +203,10 @@
     axis2_char_t *cipher_name =  NULL;   
     axis2_char_t *encoded_str=NULL;
     axis2_char_t *in_data = NULL;
-    int ret, enclen, encodedlen;
+    int ret, enclen, encodedlen, decoded_len;
+    /*axis2_char_t *temp = NULL;*/
 
-    /*Safety initializations*/
+    /*Initializations*/
     ret = AXIS2_FAILURE;
     enclen = -1;
     encodedlen = -1;   
@@ -214,13 +219,19 @@
                      "openssl_evp_block_cipher_ctx_create failed");
          return AXIS2_FAILURE;
     }
+
+    /*TODO Get cipher property*/    
+    
+
     /*Set the IV*/   
     /*iv = OPENSSL_DEFAULT_IV16;*/ /*oxs_iv_generate_for_algo(env,  enc_ctx->encmtd_algorithm); */
     iv =(axis2_char_t*)oxs_iv_generate_for_algo(env,  enc_ctx->encmtd_algorithm); 
 
     /*Set the key*/
-    bc_ctx->key = AXIS2_STRDUP(enc_ctx->key->data, env);
+    /* temp =  AXIS2_STRNDUP(OXS_KEY_GET_DATA(enc_ctx->key, env),  24, env);*/
+    bc_ctx->key = AXIS2_STRDUP(OXS_KEY_GET_DATA(enc_ctx->key, env),  env);
     bc_ctx->key_initialized = 1;
+
     /*Set the IV*/
     bc_ctx->iv =  AXIS2_STRDUP(iv, env);
 
@@ -237,9 +248,17 @@
     if(enc_ctx->operation == oxs_operation_encrypt){
         ret =  openssl_evp_block_cipher_ctx_init(env, bc_ctx,
                             OPENSSL_ENCRYPT, (const unsigned char*)cipher_name);
+        if(ret == AXIS2_FAILURE ){
+            oxs_error(ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
+                     "openssl_evp_block_cipher_ctx_init failed");
+        }
     }else if(enc_ctx->operation == oxs_operation_decrypt){
         ret =  openssl_evp_block_cipher_ctx_init(env, bc_ctx,
                             OPENSSL_DECRYPT, (const unsigned char*)cipher_name);
+        if(ret == AXIS2_FAILURE ){
+            oxs_error(ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
+                     "openssl_evp_block_cipher_ctx_init failed");
+        }
     }else{
         oxs_error(ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
                      "Invalid operation type %d", enc_ctx->operation);
@@ -262,7 +281,12 @@
     /*If this is to decrypt, then we need to base64decode first*/
     }else if(enc_ctx->operation == oxs_operation_decrypt){
         in_data = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len( (char*)(enc_ctx->inputdata)));
-        axis2_base64_decode(in_data, (char*)(enc_ctx->inputdata)); 
+        /*axis2_base64_decode(in_data, (char*)(enc_ctx->inputdata)); */
+        decoded_len = axis2_base64_decode_binary((unsigned char*)in_data, (char*)(enc_ctx->inputdata));
+        if(decoded_len < 0){
+            oxs_error(ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
+                     "base64 decoding failed");
+        }
         enclen = openssl_block_cipher_crypt(env, bc_ctx,
                                          (unsigned char*)in_data,  &out_main_buf, OPENSSL_DECRYPT);
     }else{

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c Tue Aug 15 02:02:55 2006
@@ -28,7 +28,7 @@
                             axis2_char_t *key_algo)
 {
     axis2_char_t* iv = NULL;
-    cipher_prop_ptr cprop = NULL;
+    openssl_cipher_property_t *cprop = NULL;
     int size;
     axis2_char_t *algo_name = NULL; /*This is not the url name*/
 
@@ -39,13 +39,13 @@
             "oxs_get_cipher failed");
         return NULL;
     }
-    cprop = (cipher_prop_ptr)openssl_get_cipher_property(env, algo_name);
+    cprop = (openssl_cipher_property_t *)openssl_get_cipher_property(env, algo_name);
     if(!cprop){
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
             "openssl_get_cipher_property failed");
         return NULL;
     }
-    size = cprop->iv_size;
+    size = OPENSSL_CIPHER_PROPERTY_GET_IV_SIZE(cprop, env);
     
     /*Here we have predefined IVs in the openssl_constants.
       Get the correct one using the size*/ 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c Tue Aug 15 02:02:55 2006
@@ -22,51 +22,342 @@
 #include <oxs_error.h>
 #include <openssl_cipher_property.h>
 
-AXIS2_EXTERN oxs_key_ptr AXIS2_CALL
-oxs_key_create_key(const axis2_env_t *env,
-                    axis2_char_t *name,
-                    unsigned char *data,
-                    int size,
-                    int usage
-                    )
+
+typedef struct oxs_key_impl{
+    oxs_key_t key;
+
+    axis2_char_t *data;
+    axis2_char_t *name;
+    int            size;
+    int            usage;
+}
+oxs_key_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(oxs_key) ((oxs_key_impl_t *)oxs_key)
+
+/******** function headers ***************/
+
+/*private functions*/
+static void
+oxs_key_init_ops(
+    oxs_key_t *key);
+
+/*Public functions*/
+axis2_char_t *AXIS2_CALL
+oxs_key_get_data(
+    const oxs_key_t *key,
+    const axis2_env_t *env);
+
+axis2_char_t *AXIS2_CALL
+oxs_key_get_name(
+    const oxs_key_t *key,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+oxs_key_get_size(
+    const oxs_key_t *key,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+oxs_key_get_usage(
+    const oxs_key_t *key,
+    const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_data(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    axis2_char_t *data);
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_name(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    axis2_char_t *name);
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_size(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    int size);
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_usage(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    int usage);
+
+axis2_status_t AXIS2_CALL
+oxs_key_free(
+    oxs_key_t *key,
+    const axis2_env_t *env
+    );
+
+axis2_status_t AXIS2_CALL
+oxs_key_populate(
+        oxs_key_t *key,
+        const axis2_env_t *env,
+        axis2_char_t *data,
+        axis2_char_t *name,
+        int size,
+        int usage);
+
+axis2_status_t AXIS2_CALL
+oxs_key_read_from_file(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    axis2_char_t *file_name);
+
+axis2_status_t AXIS2_CALL
+oxs_key_for_algo(oxs_key_t *key,
+        const axis2_env_t *env,
+        axis2_char_t *key_algo);
+
+/******************** end of function headers *****************/
+
+axis2_char_t *AXIS2_CALL
+oxs_key_get_data(
+    const oxs_key_t *key,
+    const axis2_env_t *env)
 {
-    oxs_key_ptr key = NULL;
-    key = (oxs_key_ptr)AXIS2_MALLOC(env->allocator,sizeof(oxs_key)); 
-    
-    key->name = name;
-    key->data = data;
-    key->size = size;
-    key->usage = usage;
-    
-    return key;
+    oxs_key_impl_t *key_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    return key_impl->data;
+
+}
+
+axis2_char_t *AXIS2_CALL
+oxs_key_get_name(
+    const oxs_key_t *key,
+    const axis2_env_t *env)
+{
+    oxs_key_impl_t *key_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    return key_impl->name;
+
+}
+
+int AXIS2_CALL
+oxs_key_get_size(
+    const oxs_key_t *key,
+    const axis2_env_t *env)
+{
+    oxs_key_impl_t *key_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    return key_impl->size;
+
+}
+
+int AXIS2_CALL
+oxs_key_get_usage(
+    const oxs_key_t *key,
+    const axis2_env_t *env)
+{
+    oxs_key_impl_t *key_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    return key_impl->usage;
+
+}
+
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_data(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    axis2_char_t *data)
+{
+    oxs_key_impl_t *oxs_key_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    oxs_key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    if (oxs_key_impl->data){
+        AXIS2_FREE(env->allocator, oxs_key_impl->data);
+        oxs_key_impl->data = NULL;
+    }
+    oxs_key_impl->data = (axis2_char_t *)data;
+    return AXIS2_SUCCESS;
+
+}
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_name(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    axis2_char_t *name)
+{
+    oxs_key_impl_t *oxs_key_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    oxs_key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    if (oxs_key_impl->name){
+        AXIS2_FREE(env->allocator, oxs_key_impl->name);
+        oxs_key_impl->name = NULL;
+    }
+    oxs_key_impl->name = (axis2_char_t *)name;
+    return AXIS2_SUCCESS;
+
+}
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_size(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    int size)
+{
+    oxs_key_impl_t *oxs_key_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    oxs_key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    oxs_key_impl->size = size;
+    return AXIS2_SUCCESS;
+
+}
+
+axis2_status_t AXIS2_CALL
+oxs_key_set_usage(
+    oxs_key_t *key,
+    const axis2_env_t *env,
+    int usage)
+{
+    oxs_key_impl_t *oxs_key_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    oxs_key_impl = AXIS2_INTF_TO_IMPL(key);
+
+    oxs_key_impl->usage = usage;
+    return AXIS2_SUCCESS;
+
+}
+
+
+
+static void
+oxs_key_init_ops(
+        oxs_key_t *key)
+{
+    key->ops->get_data  = oxs_key_get_data ;
+    key->ops->get_name  = oxs_key_get_name;
+    key->ops->get_size  = oxs_key_get_size;
+    key->ops->get_usage = oxs_key_get_usage;
+    key->ops->set_data  = oxs_key_set_data ;
+    key->ops->set_name  = oxs_key_set_name;
+    key->ops->set_size  = oxs_key_set_size;
+    key->ops->set_usage = oxs_key_set_usage;
+    key->ops->free      = oxs_key_free;
+    key->ops->populate  = oxs_key_populate;
+    key->ops->read_from_file = oxs_key_read_from_file;
+    key->ops->for_algo  = oxs_key_for_algo;
+}
+
+
+AXIS2_EXTERN oxs_key_t *AXIS2_CALL
+oxs_key_create_key(const axis2_env_t *env)
+{
+    oxs_key_impl_t *key_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    key_impl = AXIS2_MALLOC( env->allocator, sizeof(oxs_key_impl_t));
+    if (!key_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    key_impl->data = NULL;
+    key_impl->name = NULL;
+    key_impl->size = -1;
+    key_impl->usage = -1;
+
+    key_impl->key.ops =  AXIS2_MALLOC(env->allocator,sizeof(oxs_key_ops_t));
+    if (!key_impl->key.ops)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        oxs_key_free(&(key_impl->key), env);
+        return NULL;
+    }
+
+    oxs_key_init_ops(&(key_impl->key));
+
+    return &(key_impl->key);
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_free(oxs_key_t *key,
+    const axis2_env_t *env )
+{
+    oxs_key_impl_t *key_impl= NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    key_impl = AXIS2_INTF_TO_IMPL(key);
 
+    key_impl->data = NULL;
+    key_impl->name = NULL;
+
+    AXIS2_FREE(env->allocator,  key_impl);
+    key_impl = NULL;
+
+    return AXIS2_SUCCESS;
 }
 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_populate(oxs_key_t *key,
+        const axis2_env_t *env,
+        axis2_char_t *data,
+        axis2_char_t *name,
+        int size,
+        int usage)
+{
+    int ret;   
 
+    ret = OXS_KEY_SET_DATA(key, env, data); 
+    ret = OXS_KEY_SET_NAME(key, env, name); 
+    ret = OXS_KEY_SET_SIZE(key, env, size); 
+    ret = OXS_KEY_SET_USAGE(key, env, usage);
+ 
+    return AXIS2_SUCCESS;
+}
 
-AXIS2_EXTERN oxs_key_ptr AXIS2_CALL
-oxs_key_read_from_file(const axis2_env_t *env,
-                        axis2_char_t *file_name)
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_read_from_file(oxs_key_t *key,
+        const axis2_env_t *env,
+        axis2_char_t *file_name)
 {
     oxs_buffer_ptr buf = NULL;
-    oxs_key_ptr key = NULL;
-    int ret;
-    
+    axis2_status_t ret;
+    int reti;
+ 
     buf = oxs_create_buffer(env, OXS_KEY_DEFAULT_SIZE);
-    ret = oxs_buffer_read_file(env, buf, file_name);
-    
-    key = oxs_key_create_key(env, file_name, buf->data, buf->size, OXS_KEY_USAGE_NONE);
-    return key; 
+    reti = oxs_buffer_read_file(env, buf, file_name);
+   
+    ret = OXS_KEY_POPULATE(key, env, (axis2_char_t*)buf->data, file_name,  buf->size, OXS_KEY_USAGE_NONE);
+     
+    return ret; 
     
 }
 
-AXIS2_EXTERN oxs_key_ptr AXIS2_CALL
-oxs_key_generate_for_algo(const axis2_env_t *env,
-                            axis2_char_t *key_algo)
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_for_algo(oxs_key_t *key,
+        const axis2_env_t *env,
+        axis2_char_t *key_algo)
 {
-    oxs_key_ptr key = NULL;
     oxs_buffer_ptr key_buf = NULL;
-    cipher_prop_ptr cprop = NULL;
+    openssl_cipher_property_t * cprop = NULL;
     axis2_status_t ret = AXIS2_FAILURE;
     int size;
     axis2_char_t *algo_name = NULL; /*This is not the url name*/
@@ -76,26 +367,26 @@
     if(!algo_name){
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
             "oxs_get_cipher failed");
-        return NULL;
+        return AXIS2_FAILURE;
     }
-    cprop = openssl_get_cipher_property(env, algo_name);
+    cprop = (openssl_cipher_property_t *)openssl_get_cipher_property(env, algo_name);
     if(!cprop){
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
             "openssl_get_cipher_property failed");
-        return NULL;
+        return AXIS2_FAILURE;
     }
-    size = cprop->key_size;
-    
+
+    size = OPENSSL_CIPHER_PROPERTY_GET_KEY_SIZE(cprop, env);
 
     key_buf = oxs_create_buffer(env, size);    
     ret = generate_random_key(env, key_buf, size);    
     if(ret == AXIS2_FAILURE){
          oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
             "generate_random_key failed");
-         return NULL;
+         return AXIS2_FAILURE;
     }
+    
+    ret = OXS_KEY_POPULATE(key, env,(axis2_char_t*) key_buf->data, NULL, key_buf->size, OXS_KEY_USAGE_NONE);
 
-    key = oxs_key_create_key(env, NULL, key_buf->data, size, OXS_KEY_USAGE_NONE);
-
-    return key;
+    return ret;
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c Tue Aug 15 02:02:55 2006
@@ -48,21 +48,24 @@
     return AXIS2_SUCCESS;
 }
 
-AXIS2_EXTERN int  AXIS2_CALL  
+AXIS2_EXTERN axis2_status_t  AXIS2_CALL  
 openssl_evp_block_cipher_ctx_init(const axis2_env_t *env,
                              openssl_evp_block_cipher_ctx_ptr bc_ctx,
                              int encrypt,
                              const unsigned char* cipher_name)
 {
     
-    int iv_len;
-    int ret;
+    /*int iv_len;*/
+    axis2_status_t ret =  AXIS2_FAILURE;
 
     
     /*If bc_ctx is NULL create a new one*/
     if(!bc_ctx){
+        printf("Given bc_ctx is NULL. Creating a new one\n");
         bc_ctx = openssl_evp_block_cipher_ctx_create(env);
-        if(!bc_ctx) return (-1); 
+        if(!bc_ctx){
+             return AXIS2_FAILURE;
+        } 
     }    
     printf("\nCreating cipher ctx for %s", cipher_name);
     /*Set the cipher. TODO Support more ciphers later*/
@@ -86,7 +89,7 @@
     bc_ctx->cipher =  (EVP_CIPHER*)openssl_get_evp_cipher_by_name(env, (axis2_char_t*)cipher_name);
 
     /*Sets the IV if not set. Well..How we convey this IV to decrypt*/
-    if(!(bc_ctx->iv)){
+    /*if(!(bc_ctx->iv)){
         iv_len = EVP_CIPHER_iv_length(bc_ctx->cipher);
         ret = RAND_bytes(bc_ctx->iv, iv_len);
         if(ret != 1) {
@@ -94,21 +97,23 @@
         }
     }else{
         iv_len =  AXIS2_STRLEN((axis2_char_t*)bc_ctx->iv);
-    }
+    }*/
 
     /*Key supposed to be set before this */
-    if(!bc_ctx->key) return (-1);
+    if(!bc_ctx->key){
+         return AXIS2_FAILURE;
+    };
        
     /*Check if key and IV sizes are not applicable for the cipher*/
-#if 0
-    if(EVP_CIPHER_key_length(bc_ctx->cipher) != strlen(bc_ctx->key) ){
-        printf("Key size is not applicable for the cipher %d = %d\n", EVP_CIPHER_key_length(bc_ctx->cipher),  strlen(bc_ctx->key)  );
-        return (-1);
+#if 1
+    if(EVP_CIPHER_key_length(bc_ctx->cipher) != strlen((char*)bc_ctx->key) ){
+        printf("WARNING : Key size is not applicable for the cipher %d = %d\n", EVP_CIPHER_key_length(bc_ctx->cipher),  strlen((char*)bc_ctx->key)  );
+        
     }  
 
-    if(EVP_CIPHER_iv_length(bc_ctx->cipher) != strlen(bc_ctx->iv) ){
-        printf("IV size is not applicable for the cipher %d = %d\n", EVP_CIPHER_iv_length(bc_ctx->cipher) , strlen(bc_ctx->iv) );
-        return (-1);
+    if(EVP_CIPHER_iv_length(bc_ctx->cipher) != strlen((char*)bc_ctx->iv) ){
+        printf("WARNING : IV size is not applicable for the cipher %d = %d\n", EVP_CIPHER_iv_length(bc_ctx->cipher) , strlen((char*)bc_ctx->iv) );
+        
     }  
 #endif
 
@@ -120,10 +125,18 @@
     /* We finished modifying parameters so now we can set key and IV */
     ret  = EVP_CipherInit_ex(&(bc_ctx->cipher_ctx), NULL, NULL, bc_ctx->key, bc_ctx->iv, encrypt);
     
-    if(ret < 0 ) return (-1);
+    if(ret < 0 ){
+         return AXIS2_FAILURE;
+    }
     
     bc_ctx->ctx_initialized = 1;
       
-    return 0;
+    return AXIS2_SUCCESS;
 }
+/*
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_evp_block_cipher_ctx_free(const axis2_env_t *env, openssl_evp_block_cipher_ctx_ptr bc_ctx)
+{
+    
 
+}*/

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c Tue Aug 15 02:02:55 2006
@@ -22,36 +22,306 @@
 #include <openssl/evp.h>
 #include <openssl/rand.h>
 
-/**
-* Create a fresh block cipher property
-*@return cipher_prop_ptr
-*/
-AXIS2_EXTERN cipher_prop_ptr AXIS2_CALL
-openssl_cipher_property_create(const axis2_env_t *env)
+
+typedef struct openssl_cipher_property_impl {
+    openssl_cipher_property_t   cprop;
+
+    EVP_CIPHER                  *cipher;
+    axis2_char_t                *name;
+    int                         key_size;
+    int                         block_size;
+    int                         iv_size;
+}
+openssl_cipher_property_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(openssl_cipher_property) ((openssl_cipher_property_impl_t *)openssl_cipher_property)
+
+/*private functions*/
+static void
+openssl_cipher_property_init_ops(
+    openssl_cipher_property_t *cprop);
+
+/*public functions*/
+EVP_CIPHER * AXIS2_CALL
+openssl_cipher_property_get_cipher(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+axis2_char_t * AXIS2_CALL
+openssl_cipher_property_get_name(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+openssl_cipher_property_get_key_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+openssl_cipher_property_get_block_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+int AXIS2_CALL
+openssl_cipher_property_get_iv_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_cipher(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    EVP_CIPHER *cipher);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_name(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    axis2_char_t *name);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_key_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int   key_size);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_block_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int  block_size);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_iv_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int   iv_size);
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_free(openssl_cipher_property_t * cprop, const axis2_env_t *env);
+
+/********* end of function headers ******************/
+
+EVP_CIPHER * AXIS2_CALL
+openssl_cipher_property_get_cipher(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env)
 {
-    cipher_prop_ptr cprop = NULL;
-    cprop = (cipher_prop_ptr) AXIS2_MALLOC(env->allocator,sizeof(cipher_prop));
-    openssl_cipher_property_reset(env, cprop);
-    return cprop;
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    return cprop_impl->cipher;
 }
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-openssl_cipher_property_reset(const axis2_env_t *env, cipher_prop_ptr cprop)
+axis2_char_t * AXIS2_CALL
+openssl_cipher_property_get_name(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env)
 {
-    cprop->cipher = NULL;
-    cprop->name = NULL;
-    cprop->key_size = -1;
-    cprop->block_size = -1;
-    cprop->iv_size = -1;
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
 
+    return cprop_impl->name;
+}
+
+int AXIS2_CALL
+openssl_cipher_property_get_key_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env)
+{
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    return cprop_impl->key_size;
+}
+
+int AXIS2_CALL
+openssl_cipher_property_get_block_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env)
+{
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    return cprop_impl->block_size;
+}
+
+int AXIS2_CALL
+openssl_cipher_property_get_iv_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env)
+{
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    return cprop_impl->iv_size;
+}
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_cipher(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    EVP_CIPHER *cipher)
+{
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    if (cprop_impl->cipher){
+        AXIS2_FREE(env->allocator, cprop_impl->cipher);
+        cprop_impl->cipher = NULL;
+    }
+    cprop_impl->cipher = cipher;
     return AXIS2_SUCCESS;
 }
 
-/*TODO write the free function*/
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-openssl_cipher_property_free(const axis2_env_t *env )
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_name(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    axis2_char_t *name)
+{
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    if (cprop_impl->name){
+        AXIS2_FREE(env->allocator, cprop_impl->name);
+        cprop_impl->name = NULL;
+    }
+    cprop_impl->name = name;
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_key_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int   key_size)
 {
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    cprop_impl->key_size = key_size;
     return AXIS2_SUCCESS;
 }
 
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_block_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int  block_size)
+{
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    cprop_impl->block_size = block_size;
+    return AXIS2_SUCCESS;
+}
+
+
+axis2_status_t AXIS2_CALL
+openssl_cipher_property_set_iv_size(
+    const openssl_cipher_property_t *cprop,
+    const axis2_env_t *env,
+    int   iv_size)
+{
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    cprop_impl->iv_size = iv_size;
+    return AXIS2_SUCCESS;
+}
+
+
+
+static void
+openssl_cipher_property_init_ops(
+        openssl_cipher_property_t *cprop)
+{
+    cprop->ops->get_cipher =openssl_cipher_property_get_cipher ;
+    cprop->ops->get_name = openssl_cipher_property_get_name;
+    cprop->ops->get_key_size = openssl_cipher_property_get_key_size;
+    cprop->ops->get_block_size = openssl_cipher_property_get_block_size;
+    cprop->ops->get_iv_size = openssl_cipher_property_get_iv_size;
+    cprop->ops->set_cipher = openssl_cipher_property_set_cipher;
+    cprop->ops->set_name = openssl_cipher_property_set_name;
+    cprop->ops->set_key_size = openssl_cipher_property_set_key_size;
+    cprop->ops->set_block_size = openssl_cipher_property_set_block_size;
+    cprop->ops->set_iv_size = openssl_cipher_property_set_iv_size;
+    cprop->ops->free = openssl_cipher_property_free;
+
+}
+
+AXIS2_EXTERN openssl_cipher_property_t *AXIS2_CALL
+openssl_cipher_property_create(const axis2_env_t *env)
+{
+    
+    openssl_cipher_property_impl_t *cprop_impl = NULL;
+    
+    AXIS2_ENV_CHECK(env, NULL);
+
+    cprop_impl = AXIS2_MALLOC( env->allocator, sizeof(openssl_cipher_property_impl_t));
+    if (!cprop_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    cprop_impl->cipher = NULL;
+    cprop_impl->name = NULL;
+    cprop_impl->key_size = -1;
+    cprop_impl->block_size = -1;
+    cprop_impl->iv_size = -1;
+   
+    cprop_impl->cprop.ops =  AXIS2_MALLOC(env->allocator,sizeof(openssl_cipher_property_ops_t));
+    if (!cprop_impl->cprop.ops)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        openssl_cipher_property_free(&(cprop_impl->cprop), env);
+        return NULL;
+    } 
+
+    openssl_cipher_property_init_ops(&(cprop_impl->cprop));
+
+    return &(cprop_impl->cprop);
+
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_cipher_property_free(openssl_cipher_property_t * cprop, const axis2_env_t *env)
+{
+    openssl_cipher_property_impl_t *cprop_impl= NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    cprop_impl = AXIS2_INTF_TO_IMPL(cprop);
+
+    if (cprop_impl->cipher){
+        AXIS2_FREE(env->allocator, cprop_impl->cipher);
+        cprop_impl->cipher = NULL;
+    }
+   
+    if(cprop_impl->name){
+        AXIS2_FREE(env->allocator, cprop_impl->name); 
+        cprop_impl->name = NULL;
+    }
+
+    AXIS2_FREE(env->allocator,  cprop_impl);
+    cprop_impl = NULL;
+
+    return AXIS2_SUCCESS;
+}
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c Tue Aug 15 02:02:55 2006
@@ -25,12 +25,12 @@
 #include <openssl/rand.h>
 
 
-AXIS2_EXTERN cipher_prop_ptr  AXIS2_CALL
+AXIS2_EXTERN openssl_cipher_property_t *AXIS2_CALL
 openssl_get_cipher_property(const axis2_env_t *env, axis2_char_t *cipher_name)
 {
     EVP_CIPHER* cipher;
     EVP_CIPHER_CTX ctx;
-    cipher_prop_ptr cprop = NULL;
+    openssl_cipher_property_t * cprop = NULL;
     
    
     cipher = (EVP_CIPHER*)openssl_get_evp_cipher_by_name(env, cipher_name); 
@@ -47,16 +47,15 @@
     /*Create a cipher property and populate it*/
     cprop = openssl_cipher_property_create(env);
     
+    OPENSSL_CIPHER_PROPERTY_SET_CIPHER(cprop, env, cipher);
+    OPENSSL_CIPHER_PROPERTY_SET_NAME(cprop, env, cipher_name);
+    OPENSSL_CIPHER_PROPERTY_SET_KEY_SIZE(cprop, env, EVP_CIPHER_CTX_key_length(&ctx));
+    OPENSSL_CIPHER_PROPERTY_SET_BLOCK_SIZE(cprop, env, EVP_CIPHER_CTX_block_size(&ctx));
+    OPENSSL_CIPHER_PROPERTY_SET_IV_SIZE(cprop, env, EVP_CIPHER_CTX_iv_length(&ctx));
 
-    cprop->cipher = cipher;
-    cprop->name = cipher_name;
-    cprop->key_size = EVP_CIPHER_CTX_key_length(&ctx);
-    cprop->block_size = EVP_CIPHER_CTX_block_size(&ctx);
-    cprop->iv_size = EVP_CIPHER_CTX_iv_length(&ctx);
+    /*free ctx*/
+    EVP_CIPHER_CTX_cleanup(&ctx);
 
-    printf("\n openssl get Cipher prop\n------\n name=%s, bs=%d, ks=%d, ivs=%d\n", cipher_name , cprop->key_size, cprop->block_size, cprop->iv_size);
-
-    /*EVP_CIPHER_CTX_cleanup(&ctx);*/
     return cprop;
 }
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c Tue Aug 15 02:02:55 2006
@@ -28,7 +28,6 @@
 {
     axiom_node_t *cipher_data_node = NULL;
     axiom_element_t *cipher_data_ele = NULL;
-    axis2_status_t ret; 
     axiom_namespace_t *ns_obj = NULL;
 
     ns_obj = axiom_namespace_create (env, OXS_EncNs,

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c Tue Aug 15 02:02:55 2006
@@ -27,7 +27,7 @@
 {
     /*TODO Verification*/
     axis2_char_t *cv = NULL;
-    cv = oxs_axiom_get_node_content(env, cv_node);
+    cv = (axis2_char_t*)oxs_axiom_get_node_content(env, cv_node);
     return cv;
 
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_key.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_key.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_key.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_key.c Tue Aug 15 02:02:55 2006
@@ -29,7 +29,6 @@
 {
     axiom_node_t *encrypted_key_node = NULL;
     axiom_element_t *encrypted_key_ele = NULL;
-    int ret; 
     axiom_namespace_t *ns_obj = NULL;
 
     ns_obj = axiom_namespace_create (env, OXS_EncNs,

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c Tue Aug 15 02:02:55 2006
@@ -28,7 +28,6 @@
 {
     axiom_node_t *key_info_node = NULL;
     axiom_element_t *key_info_ele = NULL;
-    axis2_status_t ret; 
     axiom_namespace_t *ns_obj = NULL;
 
     ns_obj = axiom_namespace_create (env, OXS_DSigNs,

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_reference_list.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_reference_list.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_reference_list.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_reference_list.c Tue Aug 15 02:02:55 2006
@@ -29,7 +29,6 @@
 {
     axiom_node_t *reference_list_node = NULL;
     axiom_element_t *reference_list_ele = NULL;
-    axis2_status_t ret; 
     axiom_namespace_t *ns_obj = NULL;
 
     ns_obj = axiom_namespace_create (env, OXS_EncNs,

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_action.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_action.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_action.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_action.c Tue Aug 15 02:02:55 2006
@@ -24,53 +24,799 @@
 #include <rampart_constants.h>
 
 
-AXIS2_EXTERN actions_ptr AXIS2_CALL
-oxs_ctx_create_actions_ptr(const axis2_env_t *env)
+
+typedef struct rampart_actions_impl{
+        rampart_actions_t actions ;
+        
+        axis2_char_t *encryption_user  ;
+        axis2_char_t *encryption_sym_algorithm  ;
+        axis2_char_t *encryption_key_transport_algorithm  ;
+
+        axis2_char_t *items  ;
+        axis2_char_t *user  ;
+        axis2_char_t *password_callback_class  ;
+        axis2_char_t *encryption_prop_file;
+        axis2_char_t *signature_prop_file ;
+        axis2_char_t *signature_key_identifier  ;
+        axis2_char_t *encryption_key_identifier  ;
+        axis2_char_t *signature_parts  ;
+        axis2_char_t *encryption_parts  ;
+    
+}
+rampart_actions_impl_t;
+
+/** Interface to implementation conversion macro */
+#define AXIS2_INTF_TO_IMPL(rampart_actions) ((rampart_actions_impl_t *)rampart_actions)
+
+/******************* function headers ******************************/
+/* private functions */
+static void
+rampart_actions_init_ops(
+    rampart_actions_t *actions);
+
+/*public functions*/
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_user(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_sym_algorithm (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_key_transport_algorithm (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_items (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_user (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_password_callback_class (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_prop_file (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_signature_prop_file(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_signature_key_identifier (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_key_identifier (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+  
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_signature_parts (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+  
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_parts (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_user(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_user
+                    );
+
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_sym_algorithm(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_sym_algorithm
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_key_transport_algorithm(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_key_transport_algorithm
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_items(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *items
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_user(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *user
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_password_callback_class(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *password_callback_class
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_prop_file(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_prop_file
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_signature_prop_file(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *signature_prop_file
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_signature_key_identifier(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *signature_key_identifier
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_key_identifier(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_key_identifier
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_signature_parts(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *signature_parts
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_parts(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_parts
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_reset(
+                    rampart_actions_t *actions, 
+                    const axis2_env_t *env
+                    );
+
+axis2_status_t AXIS2_CALL
+rampart_actions_free(   
+                    rampart_actions_t *actions, 
+                    const axis2_env_t *env
+                    );
+
+axis2_status_t AXIS2_CALL
+rampartactions_populate(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env, 
+                    axis2_param_t *param_action  
+                    );
+
+/******************* end of function headers ******************************/
+
+
+AXIS2_EXTERN rampart_actions_t *AXIS2_CALL
+rampart_actions_create(const axis2_env_t *env)
 {
-    actions_ptr actions= NULL;
-    actions = (actions_ptr) AXIS2_MALLOC(env->allocator,sizeof(actionss));
-    oxs_ctx_reset_actions_ptr(env, actions);
-    return actions;
+    AXIS2_ENV_CHECK(env, NULL);
+
+    rampart_actions_impl_t * actions_impl= NULL;
+    actions_impl = AXIS2_MALLOC(env->allocator,sizeof(rampart_actions_impl_t));
+    if (!actions_impl)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+ 
+    actions_impl->encryption_user   = NULL;
+    actions_impl->encryption_sym_algorithm = NULL ;
+    actions_impl->encryption_key_transport_algorithm = NULL ;
+    actions_impl->items = NULL; 
+    actions_impl->user = NULL; 
+    actions_impl->password_callback_class = NULL; 
+    actions_impl->encryption_prop_file = NULL; 
+    actions_impl->signature_prop_file = NULL; 
+    actions_impl->signature_key_identifier = NULL; 
+    actions_impl->encryption_key_identifier = NULL; 
+    actions_impl->signature_parts = NULL; 
+    actions_impl->encryption_parts = NULL; 
+
+    actions_impl->actions.ops =  AXIS2_MALLOC(env->allocator,sizeof(rampart_actions_ops_t));
+    if (!actions_impl->actions.ops)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        rampart_actions_free(&(actions_impl->actions), env);
+        return NULL;
+    }
+
+    rampart_actions_init_ops(&(actions_impl->actions));
+    
+    return &(actions_impl->actions);    
+
 }
 
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_user(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
 
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_ctx_reset_actions_ptr(const axis2_env_t *env, actions_ptr actions)
+    return actions_impl->encryption_user;
+}
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_sym_algorithm (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->encryption_sym_algorithm ;
+}
+
+axis2_char_t *AXIS2_CALL 
+rampart_actions_get_encryption_key_transport_algorithm (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
 {
-    actions->encryption_user = NULL;
-    actions->encryption_sym_algorithm = NULL; 
-    actions->encryption_key_transport_algorithm = NULL;
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->encryption_key_transport_algorithm ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_items (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->items ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_user (
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->user ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_password_callback_class(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->password_callback_class ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_encryption_prop_file(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->encryption_prop_file ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_signature_prop_file(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->signature_prop_file ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_signature_key_identifier(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->signature_key_identifier ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_encryption_key_identifier(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->encryption_key_identifier ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_signature_parts(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->signature_parts ;
+}
+
+axis2_char_t *AXIS2_CALL
+rampart_actions_get_encryption_parts(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    return actions_impl->encryption_parts ;
+}
+
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_user(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_user
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->encryption_user){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_user);
+        actions_impl->encryption_user = NULL;
+    }
+
+    actions_impl->encryption_user = encryption_user;
+
     return AXIS2_SUCCESS;
+}
 
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_sym_algorithm(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_sym_algorithm
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->encryption_sym_algorithm){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_sym_algorithm);
+        actions_impl->encryption_sym_algorithm = NULL;
+    }
+    actions_impl->encryption_sym_algorithm = encryption_sym_algorithm;
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_key_transport_algorithm(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_key_transport_algorithm
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->encryption_key_transport_algorithm){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_key_transport_algorithm);
+        actions_impl->encryption_key_transport_algorithm = NULL;
+    }
+    actions_impl->encryption_key_transport_algorithm = encryption_key_transport_algorithm;
+
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+rampart_actions_set_items(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *items
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->items){
+        AXIS2_FREE(env->allocator, actions_impl->items);
+        actions_impl->items = NULL;
+    }
+    actions_impl->items = items ;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_user(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *user
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->user){
+        AXIS2_FREE(env->allocator, actions_impl->user);
+        actions_impl->user = NULL;
+    }
+    actions_impl->user =user ;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_password_callback_class(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *password_callback_class
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->password_callback_class){
+        AXIS2_FREE(env->allocator, actions_impl->password_callback_class);
+        actions_impl->password_callback_class = NULL;
+    }
+    actions_impl->password_callback_class =password_callback_class ;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_prop_file(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_prop_file
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->encryption_prop_file){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_prop_file);
+        actions_impl->encryption_prop_file = NULL;
+    }
+    actions_impl->encryption_prop_file =encryption_prop_file ;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_signature_prop_file(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *signature_prop_file
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->signature_prop_file){
+        AXIS2_FREE(env->allocator, actions_impl->signature_prop_file);
+        actions_impl->signature_prop_file = NULL;
+    }
+    actions_impl->signature_prop_file = signature_prop_file ;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_signature_key_identifier(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *signature_key_identifier
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->signature_key_identifier){
+        AXIS2_FREE(env->allocator, actions_impl->signature_key_identifier);
+        actions_impl->signature_key_identifier = NULL;
+    }
+    actions_impl->signature_key_identifier = signature_key_identifier;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_key_identifier(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_key_identifier
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->encryption_key_identifier){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_key_identifier);
+        actions_impl->encryption_key_identifier = NULL;
+    }
+    actions_impl-> encryption_key_identifier=encryption_key_identifier ;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_signature_parts(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *signature_parts
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->signature_parts){
+        AXIS2_FREE(env->allocator, actions_impl->signature_parts);
+        actions_impl->signature_parts = NULL;
+    }
+    actions_impl->signature_parts = signature_parts;
+
+    return AXIS2_SUCCESS;
+}
+axis2_status_t AXIS2_CALL
+rampart_actions_set_encryption_parts(
+                    rampart_actions_t *actions,
+                    const axis2_env_t *env,
+                    axis2_char_t *encryption_parts
+                    )
+{
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+    if (actions_impl->encryption_parts){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_parts);
+        actions_impl->encryption_parts = NULL;
+    }
+    actions_impl->encryption_parts =encryption_parts ;
+
+    return AXIS2_SUCCESS;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_ctx_free_actions_ptr(const axis2_env_t *env, actions_ptr actions)
+rampart_actions_reset( rampart_actions_t * actions, const axis2_env_t *env)
 {
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    actions_impl->encryption_user = NULL;
+    actions_impl->encryption_sym_algorithm = NULL; 
+    actions_impl->encryption_key_transport_algorithm = NULL;
+    actions_impl->items = NULL;
+    actions_impl->user = NULL;
+    actions_impl->password_callback_class = NULL;
+    actions_impl->encryption_prop_file = NULL;
+    actions_impl->signature_prop_file = NULL;
+    actions_impl->signature_key_identifier = NULL;
+    actions_impl->encryption_key_identifier = NULL;
+    actions_impl->signature_parts = NULL;
+    actions_impl->encryption_parts = NULL; 
+
     return AXIS2_SUCCESS;
 }
 
-/*TODO populate all if found*/
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_ctx_populate_actions_ptr(const axis2_env_t *env, actions_ptr actions, axis2_param_t *param_action  )
+rampart_actions_free( rampart_actions_t * actions, const axis2_env_t *env)
 {
-    if(!actions){
-        actions = oxs_ctx_create_actions_ptr(env);
-    }   
-    if(!param_action){
-        /*error*/
-        return AXIS2_FAILURE;
-    }
-    actions->encryption_user =(axis2_char_t*) rampart_get_action_params(env, param_action, 
-                                RAMPART_ACTION_ENCRYPTION_USER );
-    actions->encryption_sym_algorithm =(axis2_char_t*) rampart_get_action_params(env, param_action, 
-                                RAMPART_ACTION_ENCRYPTION_SYM_ALGORITHM );
-    actions->encryption_key_transport_algorithm =(axis2_char_t*) rampart_get_action_params(env, param_action, 
-                                RAMPART_ACTION_ENCRYPTION_KEY_TRANSFORM_ALGORITHM );
+    rampart_actions_impl_t * actions_impl= NULL;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    actions_impl = AXIS2_INTF_TO_IMPL(actions);
+
+    if (actions_impl->encryption_user){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_user);
+        actions_impl->encryption_user = NULL;
+    }
+
+    if (actions_impl->encryption_sym_algorithm){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_sym_algorithm);
+        actions_impl->encryption_sym_algorithm = NULL;
+    }
+
+    if (actions_impl->encryption_key_transport_algorithm){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_key_transport_algorithm);
+        actions_impl->encryption_key_transport_algorithm = NULL;
+    }
+    
+    if (actions_impl->items){
+        AXIS2_FREE(env->allocator, actions_impl->items);
+        actions_impl->items= NULL;
+    }
+
+    if (actions_impl->user){
+        AXIS2_FREE(env->allocator, actions_impl->user);
+        actions_impl->user = NULL;
+    }
+
+    if (actions_impl->password_callback_class){
+        AXIS2_FREE(env->allocator, actions_impl->password_callback_class);
+        actions_impl->password_callback_class = NULL;
+    }
+
+    if (actions_impl->encryption_prop_file){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_prop_file);
+        actions_impl->encryption_prop_file = NULL;
+    }
 
+    if (actions_impl->signature_prop_file){
+        AXIS2_FREE(env->allocator, actions_impl->signature_prop_file);
+        actions_impl->signature_prop_file = NULL;
+    }
+
+    if (actions_impl->signature_key_identifier){
+        AXIS2_FREE(env->allocator, actions_impl->signature_key_identifier);
+        actions_impl->signature_key_identifier = NULL;
+    }
+
+    if (actions_impl->encryption_key_identifier){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_key_identifier);
+        actions_impl->encryption_key_identifier = NULL;
+    }
+
+    if (actions_impl->signature_parts){
+        AXIS2_FREE(env->allocator, actions_impl->signature_parts);
+        actions_impl->signature_parts = NULL;
+    }
+
+    if (actions_impl->encryption_parts){
+        AXIS2_FREE(env->allocator, actions_impl->encryption_parts);
+        actions_impl->encryption_parts = NULL;
+    }
+        
+    AXIS2_FREE(env->allocator, actions_impl);
+    actions_impl = NULL;
 
     return AXIS2_SUCCESS;
 }
 
+/*TODO populate all if found*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_actions_populate (rampart_actions_t *actions, 
+						const axis2_env_t *env, axis2_param_t *param_action  )
+{
+    axis2_status_t ret = AXIS2_FAILURE;
+
+    AXIS2_PARAM_CHECK(env->error, param_action, AXIS2_FAILURE); 
+
+    ret = RAMPART_ACTIONS_SET_ENC_USER(actions, env, 
+            (axis2_char_t *)rampart_get_action_params(
+                            env, param_action, RAMPART_ACTION_ENCRYPTION_USER));
+    
+    ret = RAMPART_ACTIONS_SET_ENC_SYM_ALGO(actions, env, 
+            (axis2_char_t *)rampart_get_action_params(
+                            env, param_action, RAMPART_ACTION_ENCRYPTION_SYM_ALGORITHM));
+    
+    ret = RAMPART_ACTIONS_SET_ENC_KT_ALGO(actions, env,
+            (axis2_char_t *)rampart_get_action_params(
+                            env, param_action, RAMPART_ACTION_ENCRYPTION_KEY_TRANSFORM_ALGORITHM));    
 
+    return ret;
+}
+
+static void
+rampart_actions_init_ops(
+    rampart_actions_t * actions)
+{
+    actions->ops->get_encryption_user = rampart_actions_get_encryption_user;
+    actions->ops->set_encryption_user = rampart_actions_set_encryption_user;
+    actions->ops->get_encryption_sym_algorithm = rampart_actions_get_encryption_sym_algorithm;
+    actions->ops->set_encryption_sym_algorithm = rampart_actions_set_encryption_sym_algorithm;
+    actions->ops->get_encryption_key_transport_algorithm = rampart_actions_get_encryption_key_transport_algorithm;
+    actions->ops->set_encryption_key_transport_algorithm = rampart_actions_set_encryption_key_transport_algorithm;
+
+    actions->ops->get_items = rampart_actions_get_items;
+    actions->ops->set_items = rampart_actions_set_items;
+    actions->ops->get_user = rampart_actions_get_user;
+    actions->ops->set_user = rampart_actions_set_user;
+    actions->ops->get_password_callback_class = rampart_actions_get_password_callback_class;
+    actions->ops->set_password_callback_class = rampart_actions_set_password_callback_class;
+    actions->ops->get_encryption_prop_file = rampart_actions_get_encryption_prop_file;
+    actions->ops->set_encryption_prop_file = rampart_actions_set_encryption_prop_file;
+    actions->ops->get_signature_prop_file = rampart_actions_get_signature_prop_file;
+    actions->ops->set_signature_prop_file = rampart_actions_set_signature_prop_file;
+    actions->ops->get_signature_key_identifier = rampart_actions_get_signature_key_identifier;
+    actions->ops->set_signature_key_identifier = rampart_actions_set_signature_key_identifier;
+    actions->ops->get_encryption_key_identifier = rampart_actions_get_encryption_key_identifier;
+    actions->ops->set_encryption_key_identifier = rampart_actions_set_encryption_key_identifier;
+    actions->ops->get_signature_parts = rampart_actions_get_signature_parts;
+    actions->ops->set_signature_parts = rampart_actions_set_signature_parts;
+    actions->ops->get_encryption_parts = rampart_actions_get_encryption_parts;
+    actions->ops->set_encryption_parts = rampart_actions_set_encryption_parts;
+    
+    actions->ops->reset = rampart_actions_reset;
+    actions->ops->free = rampart_actions_free;
+    actions->ops->populate = rampart_actions_populate;
+}

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c Tue Aug 15 02:02:55 2006
@@ -53,7 +53,7 @@
     axis2_char_t *decrypted_data = NULL;
     enc_ctx_ptr enc_ctx = NULL;
     axiom_node_t *enc_key_node = NULL; 
-    oxs_key_ptr session_key = NULL;
+    oxs_key_t *session_key = NULL;
     axis2_array_list_t *uuid_list = NULL;
     /*axis2_array_list_t *enc_data_node_list = NULL;*/
 
@@ -70,7 +70,9 @@
     enc_key_node =  oxs_axiom_get_first_child_node_by_name(env, sec_node, OXS_NodeEncryptedKey, NULL, NULL);
 
     /*We support only one Encrypted Key element at the moment*/   
-    session_key = oxs_key_create_key(env, "keys/rsakey.pem", NULL, 0, OXS_KEY_USAGE_DECRYPT);
+    session_key = oxs_key_create_key(env);
+    ret = OXS_KEY_POPULATE(session_key, env, NULL, "keys/rsakey.pem", 0, OXS_KEY_USAGE_DECRYPT);
+
     ret = oxs_get_encrypted_key(env, enc_key_node, session_key); 
     if(ret == AXIS2_FAILURE){
         oxs_error(ERROR_LOCATION, OXS_ERROR_DECRYPT_FAILED,
@@ -122,6 +124,7 @@
                       axiom_soap_envelope_t *soap_envelope ,
                       axiom_node_t *sec_node)
 {
+    
     /*axis2_char_t *key = NULL, *key_name = NULL;*/
     axis2_status_t ret = AXIS2_FAILURE;
     axiom_node_t *node_to_enc = NULL, *body_node = NULL, *header_node = NULL;
@@ -135,28 +138,34 @@
     axiom_soap_header_t *header = NULL;
     axis2_char_t *str_to_enc = NULL;
     enc_ctx_ptr enc_ctx = NULL;
-    actions_ptr actions= NULL;
-    oxs_key_ptr sessionkey = NULL;
+    rampart_actions_t *actions= NULL;
+    oxs_key_t *sessionkey = NULL;
     oxs_buffer_ptr session_key_buf_plain = NULL, session_key_buf_encrypted = NULL;    
     axis2_char_t* uuid = NULL;
 
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
     /*Populate actions*/ 
-    actions = oxs_ctx_create_actions_ptr(env);
-    ret = oxs_ctx_populate_actions_ptr(env, actions, param_action);   
+    actions = rampart_actions_create(env);
+    ret = RAMPART_ACTIONS_POPULATE( actions,env,  param_action);   
     if(ret == AXIS2_FAILURE){
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
-            "Actions failure");
+            "Reading rampart actions failed");
         return AXIS2_FAILURE;
     }
 
     /*Generate the session key*/
-    sessionkey = oxs_key_generate_for_algo(env,actions->encryption_sym_algorithm);
+    sessionkey = oxs_key_create_key(env);
     if(!sessionkey){
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
             "Session key generate failed");
         return AXIS2_FAILURE;
     }
-    sessionkey->name = "sessionkey";
+    /*Generate a random key for the encryption session*/
+    ret = OXS_KEY_FOR_ALGO(sessionkey, env,  RAMPART_ACTIONS_GET_ENC_SYM_ALGO(actions, env));
+    ret = OXS_KEY_SET_NAME(sessionkey, env, "session_key");
+    ret = OXS_KEY_SET_USAGE(sessionkey, env, OXS_KEY_USAGE_ENCRYPT);
+
     /*printf("\nsession_key for encryption = %s\n", sessionkey->data);*/
 
     body = AXIOM_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
@@ -185,9 +194,9 @@
                         AXIOM_NODE_GET_PARENT(node_to_enc, env),
                         OXS_TypeEncElement,
                         uuid );
-    enc_mtd_node = oxs_token_build_encryption_method_element(env, enc_data_node, actions->encryption_sym_algorithm);
+    enc_mtd_node = oxs_token_build_encryption_method_element(env, enc_data_node, RAMPART_ACTIONS_GET_ENC_SYM_ALGO(actions, env));
     key_info_node = oxs_token_build_key_info_element(env, enc_data_node);
-    key_name_node = oxs_token_build_key_name_element(env, key_info_node, sessionkey->name );
+    key_name_node = oxs_token_build_key_name_element(env, key_info_node, OXS_KEY_GET_NAME(sessionkey, env));
     cd_node = oxs_token_build_cipher_data_element(env, enc_data_node);
     cv_node = oxs_token_build_cipher_value_element(env,  cd_node, NULL); /*We pass NULL here OMXMLSEC will populate this*/
 
@@ -195,7 +204,7 @@
     enc_ctx = oxs_ctx_create_ctx(env); 
     
     /*Set the key*/
-    enc_ctx->key = oxs_key_create_key(env, sessionkey->name, (unsigned char*)sessionkey->data, sessionkey->size, OXS_KEY_USAGE_ENCRYPT);
+    enc_ctx->key = sessionkey; 
 
     /*Hand the template over to OMXMLSEC*/
     ret = oxs_enc_encrypt_template(env, enc_data_node, str_to_enc, enc_ctx);
@@ -207,10 +216,9 @@
         /*printf("Encryption template is \n %s", AXIOM_NODE_TO_STRING(enc_data_node, env));*/
     }
 
-    /*Here u have the key file name or the key store name. Right now we support only the key file name*/
-    session_key_buf_plain = oxs_string_to_buffer(env, (axis2_char_t*)sessionkey->data);
+    /*Here u have the public key file name or the key store name. Right now we support only the key file name*/
+    session_key_buf_plain = oxs_string_to_buffer(env, OXS_KEY_GET_DATA(sessionkey, env));
     session_key_buf_encrypted = oxs_create_buffer(env, (int)OXS_BUFFER_INITIAL_SIZE);
-
     ret = oxs_pubkey_encrypt_data(env, session_key_buf_plain, session_key_buf_encrypted, "keys/rsapub.pem");
     if(ret == AXIS2_FAILURE){
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
@@ -220,7 +228,7 @@
 
     /*Create the key info*/
     enc_key_node = oxs_token_build_encrypted_key_element(env,sec_node );
-    enc_key_enc_mtd_node = oxs_token_build_encryption_method_element(env, enc_key_node, actions->encryption_key_transport_algorithm);
+    enc_key_enc_mtd_node = oxs_token_build_encryption_method_element(env, enc_key_node, RAMPART_ACTIONS_GET_ENC_KT_ALGO(actions, env));
     enc_key_key_info_node = oxs_token_build_key_info_element(env, enc_key_node );
     enc_key_key_name_node = oxs_token_build_key_name_element(env, enc_key_key_info_node,"hard-coded-key-name" );
     enc_key_cd_node = oxs_token_build_cipher_data_element(env, enc_key_node);

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c Tue Aug 15 02:02:55 2006
@@ -54,6 +54,13 @@
                      axis2_char_t *callback_module_name,
                      const axis2_char_t *username);
 
+AXIS2_EXTERN void AXIS2_CALL
+rampart_create_fault_envelope(const axis2_env_t *env,
+        const axis2_char_t *header_name,
+        const axis2_char_t *description,
+        axis2_array_list_t *sub_codes,
+        axis2_msg_ctx_t *msg_ctx);
+
 /**********************end of header functions ****************************/
 
 
@@ -237,3 +244,33 @@
 
     return password;
 }
+
+
+AXIS2_EXTERN void AXIS2_CALL
+rampart_create_fault_envelope(const axis2_env_t *env,
+        const axis2_char_t *header_name,
+        const axis2_char_t *description,
+        axis2_array_list_t *sub_codes,
+        axis2_msg_ctx_t *msg_ctx)
+{
+    axiom_soap_envelope_t *envelope = NULL;
+    int soap_version = AXIOM_SOAP12;
+    axiom_node_t* text_om_node = NULL;
+    axiom_element_t * text_om_ele = NULL;
+    axiom_namespace_t *ns1 = NULL;
+
+    ns1 = axiom_namespace_create (env, RAMPART_WSSE_XMLNS, RAMPART_WSSE);
+    text_om_ele = axiom_element_create(env, NULL, "ProblemSecurityHeader", ns1, &text_om_node);
+    AXIOM_ELEMENT_SET_TEXT(text_om_ele, env, header_name, text_om_node);
+
+    envelope = axiom_soap_envelope_create_default_soap_fault_envelope(env,
+            "soapenv:Sender",
+            description,
+            soap_version, sub_codes, text_om_node);
+    
+    AXIS2_MSG_CTX_SET_FAULT_SOAP_ENVELOPE(msg_ctx, env, envelope);
+    return;
+}
+
+
+

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_util.c?rev=431558&r1=431557&r2=431558&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_util.c Tue Aug 15 02:02:55 2006
@@ -76,6 +76,8 @@
 AXIS2_EXTERN axis2_status_t AXIS2_CALL 
 rampart_print_info(const axis2_env_t *env, axis2_char_t* info)
 {
+    #ifdef PRINTINFO
     printf("[rampart]: %s\n", info);
+    #endif
     return AXIS2_SUCCESS;
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message