axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r475110 - in /webservices/axis2/trunk/c/rampart: include/oxs_asym_ctx.h include/rampart_encryption.h src/handlers/rampart_in_handler.c src/handlers/rampart_out_handler.c src/omxmlsec/asym_ctx.c src/util/rampart_encryption.c
Date Wed, 15 Nov 2006 03:59:08 GMT
Author: kaushalye
Date: Tue Nov 14 19:59:07 2006
New Revision: 475110

URL: http://svn.apache.org/viewvc?view=rev&rev=475110
Log:
Introduced format for the asymmetric context.


Modified:
    webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h
    webservices/axis2/trunk/c/rampart/include/rampart_encryption.h
    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/asym_ctx.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c

Modified: webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h?view=diff&rev=475110&r1=475109&r2=475110
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h Tue Nov 14 19:59:07 2006
@@ -38,6 +38,10 @@
  * @{
  */
 
+    typedef enum  {
+        OXS_ASYM_CTX_FORMAT_PEM,
+        OXS_ASYM_CTX_FORMAT_PKCS12
+    }oxs_asym_ctx_format_t;
 
     typedef enum  {
         OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT,
@@ -73,6 +77,12 @@
                     const axis2_env_t *env
                     );
 
+        axis2_char_t *(AXIS2_CALL *
+        get_format)(
+                    const oxs_asym_ctx_t *ctx,
+                    const axis2_env_t *env
+                    );
+
         oxs_certificate_t *(AXIS2_CALL *
         get_certificate)(
                     const oxs_asym_ctx_t *ctx,
@@ -100,6 +110,13 @@
                     );
 
         axis2_status_t (AXIS2_CALL *
+        set_format)(
+                    oxs_asym_ctx_t *ctx,
+                    const axis2_env_t *env,
+                    axis2_char_t *format
+                    );
+
+        axis2_status_t (AXIS2_CALL *
         set_certificate)(
                     oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env,
@@ -139,6 +156,10 @@
                     const axis2_env_t *env);
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_asym_ctx_get_format(const oxs_asym_ctx_t *ctx,
+                    const axis2_env_t *env);
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_asym_ctx_get_algorithm(const oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env);
 
@@ -154,6 +175,11 @@
 oxs_asym_ctx_set_file_name(oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env,
                     axis2_char_t *file_name);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_asym_ctx_set_format(oxs_asym_ctx_t *ctx,
+                    const axis2_env_t *env,
+                    axis2_char_t *format);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_asym_ctx_set_algorithm(oxs_asym_ctx_t *ctx,

Modified: webservices/axis2/trunk/c/rampart/include/rampart_encryption.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_encryption.h?view=diff&rev=475110&r1=475109&r2=475110
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_encryption.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_encryption.h Tue Nov 14 19:59:07 2006
@@ -20,7 +20,8 @@
 #include <axiom_soap.h>
 #include <axis2_msg_ctx.h>
 #include <rampart_action.h>
-
+#include <oxs_asym_ctx.h>
+#include <oxs_xml_encryption.h>
 /**
   * @file rampart_encryption.h
   * @brief 

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?view=diff&rev=475110&r1=475109&r2=475110
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c (original)
+++ webservices/axis2/trunk/c/rampart/src/handlers/rampart_in_handler.c Tue Nov 14 19:59:07
2006
@@ -214,7 +214,7 @@
                 {
                     /*Do useful to verify encrypt*/
                     AXIS2_LOG_INFO(env->log, "[rampart][rampart_in_handler] Decryption...
NOT IMPLEMENTED YET.. SORRY");
-
+                    
 
                     /*Signature*/
                 }

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?view=diff&rev=475110&r1=475109&r2=475110
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c (original)
+++ webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c Tue Nov 14 19:59:07
2006
@@ -269,6 +269,8 @@
                 {
 
                     AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Encrypting
we do not support yet");
+                    /*rampart_enc_encrypt_message(env, msg_ctx, actions, soap_envelope, sec_node);*/
+                    
                     /*Signature*/
                 }
                 else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_SIGNATURE,

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c?view=diff&rev=475110&r1=475109&r2=475110
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c Tue Nov 14 19:59:07 2006
@@ -25,6 +25,7 @@
     oxs_asym_ctx_t asym_ctx;
     
     axis2_char_t *file_name;
+    axis2_char_t *format;
     axis2_char_t *algorithm;
     oxs_asym_ctx_operation_t operation;   
     oxs_certificate_t *certificate;
@@ -54,6 +55,11 @@
     const axis2_env_t *env);
 
 axis2_char_t *AXIS2_CALL
+oxs_asym_ctx_get_format_impl(
+    const oxs_asym_ctx_t *asym_ctx,
+    const axis2_env_t *env);
+
+axis2_char_t *AXIS2_CALL
 oxs_asym_ctx_get_algorithm_impl(
     const oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env);
@@ -75,6 +81,12 @@
     axis2_char_t *file_name);
 
 axis2_status_t AXIS2_CALL
+oxs_asym_ctx_set_format_impl(
+    oxs_asym_ctx_t *asym_ctx,
+    const axis2_env_t *env,
+    axis2_char_t *file_name);
+
+axis2_status_t AXIS2_CALL
 oxs_asym_ctx_set_algorithm_impl(
     oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env,
@@ -108,6 +120,18 @@
 }
 
 axis2_char_t *AXIS2_CALL
+oxs_asym_ctx_get_format_impl(
+    const oxs_asym_ctx_t *asym_ctx,
+    const axis2_env_t *env)
+{
+    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
+
+    return asym_ctx_impl->format;
+}
+
+axis2_char_t *AXIS2_CALL
 oxs_asym_ctx_get_algorithm_impl(
     const oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env)
@@ -165,6 +189,27 @@
 }
 
 axis2_status_t AXIS2_CALL
+oxs_asym_ctx_set_format_impl(
+    oxs_asym_ctx_t *asym_ctx,
+    const axis2_env_t *env,
+    axis2_char_t *format)
+{
+    oxs_asym_ctx_impl_t *oxs_asym_ctx_impl = NULL;
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, format, AXIS2_FAILURE);
+    oxs_asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
+
+    if (oxs_asym_ctx_impl->format)
+    {
+        AXIS2_FREE(env->allocator, oxs_asym_ctx_impl->format);
+        oxs_asym_ctx_impl->format = NULL;
+    }
+    oxs_asym_ctx_impl->format = AXIS2_STRDUP(format, env);
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
 oxs_asym_ctx_set_algorithm_impl(
     oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env,
@@ -228,10 +273,12 @@
     oxs_asym_ctx_t *asym_ctx)
 {
     asym_ctx->ops->get_file_name  = oxs_asym_ctx_get_file_name_impl;
+    asym_ctx->ops->get_format  = oxs_asym_ctx_get_format;
     asym_ctx->ops->get_algorithm  = oxs_asym_ctx_get_algorithm_impl;
     asym_ctx->ops->get_operation  = oxs_asym_ctx_get_operation_impl;
     asym_ctx->ops->get_certificate  = oxs_asym_ctx_get_certificate_impl;
     asym_ctx->ops->set_file_name   = oxs_asym_ctx_set_file_name_impl;
+    asym_ctx->ops->set_format   = oxs_asym_ctx_set_format;
     asym_ctx->ops->set_algorithm  = oxs_asym_ctx_set_algorithm_impl;
     asym_ctx->ops->set_operation  = oxs_asym_ctx_set_operation_impl;
     asym_ctx->ops->set_certificate  = oxs_asym_ctx_set_certificate_impl;
@@ -240,7 +287,7 @@
 
 
 AXIS2_EXTERN oxs_asym_ctx_t *AXIS2_CALL
-oxs_asym_ctx_create_asym_ctx(const axis2_env_t *env)
+oxs_asym_ctx_create(const axis2_env_t *env)
 {
     oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
 
@@ -254,6 +301,7 @@
     }
 
     asym_ctx_impl->file_name= NULL;
+    asym_ctx_impl->format= NULL;
     asym_ctx_impl->algorithm = NULL;
     asym_ctx_impl->operation = -1;
     asym_ctx_impl->certificate = NULL;
@@ -289,6 +337,12 @@
         asym_ctx_impl->file_name = NULL;
     }
 
+    if (asym_ctx_impl->format)
+    {
+        AXIS2_FREE(env->allocator, asym_ctx_impl->format);
+        asym_ctx_impl->format = NULL;
+    }
+
     if (asym_ctx_impl->algorithm)
     {
         AXIS2_FREE(env->allocator, asym_ctx_impl->algorithm);
@@ -324,6 +378,13 @@
 }
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_asym_ctx_get_format(const oxs_asym_ctx_t *ctx,
+                    const axis2_env_t *env)
+{
+     return  ctx->ops->get_format(ctx, env);
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_asym_ctx_get_algorithm(const oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env)
 {
@@ -350,6 +411,14 @@
                     axis2_char_t *file_name)
 {
      return  ctx->ops->set_file_name(ctx, env,file_name );
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_asym_ctx_set_format(oxs_asym_ctx_t *ctx,
+                    const axis2_env_t *env,
+                    axis2_char_t *format)
+{
+     return  ctx->ops->set_format(ctx, env,format );
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c?view=diff&rev=475110&r1=475109&r2=475110
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c Tue Nov 14 19:59:07 2006
@@ -97,11 +97,13 @@
         enc_ctx = oxs_ctx_create(env);
         /*Set the key*/
         OXS_CTX_SET_KEY(enc_ctx, env, session_key);
+        /*Set the algorithm*/
+        OXS_CTX_SET_ENC_MTD_ALGORITHM(enc_ctx, env, enc_sym_algo);
         /*Create an empty EncryptedDataNode*/
         parent_of_node_to_enc = AXIOM_NODE_GET_PARENT(node_to_enc, env);
         id = oxs_util_generate_id(env,(axis2_char_t*)OXS_ENCDATA_ID);
         enc_data_node = oxs_token_build_encrypted_data_element(env, parent_of_node_to_enc,
OXS_TYPE_ENC_ELEMENT, id );
-        enc_status = oxs_xml_enc_encrypt_node(env, enc_ctx, node_to_enc, enc_data_node);
+        enc_status = oxs_xml_enc_encrypt_node(env, enc_ctx, node_to_enc, &enc_data_node);
         AXIS2_ARRAY_LIST_ADD(id_list, env, id);
         if(AXIS2_FAILURE == enc_status){
             return AXIS2_FAILURE;
@@ -148,15 +150,18 @@
 
     /*Get encryption parts*/
     encryption_parts =  AXIS2_STRDUP(RAMPART_ACTIONS_GET_ENCRYPTION_PARTS(actions, env),
env);
-    /*If no encryption parts are specified use body as default*/
+    /*If no encryption parts are specified use body as default... 
+     * Well...hmmm.. the child of the body infact*/
     if((!encryption_parts) || (0 == AXIS2_STRCMP(encryption_parts, " "))){
         axiom_soap_body_t *body = NULL;
         axiom_node_t *body_node = NULL;
+        axiom_node_t *body_child_node = NULL;
 
         AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] No encryption parts specified.
Using the body as default");
         body = AXIOM_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
         body_node = AXIOM_SOAP_BODY_GET_BASE_NODE(body, env);
-        AXIS2_ARRAY_LIST_ADD(nodes_to_encrypt, env, body_node);
+        body_child_node = AXIOM_NODE_GET_FIRST_CHILD(body_node, env);
+        AXIS2_ARRAY_LIST_ADD(nodes_to_encrypt, env, body_child_node);
         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