axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r509500 - in /webservices/axis2/trunk/c/rampart: include/ src/omxmlsec/ src/omxmlsec/tokens/ test/omxmlsec/
Date Tue, 20 Feb 2007 10:35:51 GMT
Author: kaushalye
Date: Tue Feb 20 02:35:50 2007
New Revision: 509500

URL: http://svn.apache.org/viewvc?view=rev&rev=509500
Log:
1. Processing transforms in OMXMLSecurity
2. Modified test to use the tranform factory to load transforms.
3. Plus some other minor modifications

Modified:
    webservices/axis2/trunk/c/rampart/include/oxs_constants.h
    webservices/axis2/trunk/c/rampart/include/oxs_error.h
    webservices/axis2/trunk/c/rampart/include/oxs_transform.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_ctx.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_c14n_method.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_transform.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/transform.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/transforms_factory.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c
    webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c

Modified: webservices/axis2/trunk/c/rampart/include/oxs_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_constants.h?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_constants.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_constants.h Tue Feb 20 02:35:50 2007
@@ -178,12 +178,13 @@
 /****************************************************************
    C14N
 ****************************************************************/
-#define OXS_HREF_C14N                   "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
+#define OXS_HREF_XML_C14N                   "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
+#define OXS_HREF_XML_EXC_C14N     "http://www.w3.org/2001/10/xml-exc-c14n#"
 
 /****************************************************************
    Transforms
 ****************************************************************/
-#define OXS_HREF_TRANSFORM_XML_EXC_C14N     "http://www.w3.org/2001/10/xml-exc-c14n#"
+#define OXS_HREF_TRANSFORM_XML_EXC_C14N     OXS_HREF_XML_EXC_C14N
 #define OXS_HREF_TRANSFORM_STR_TRANSFORM     "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform"
 #define OXS_HREF_TRANSFORM_ENVELOPED_SIGNATURE "http://www.w3.org/2000/09/xmldsig#enveloped-signature"
 

Modified: webservices/axis2/trunk/c/rampart/include/oxs_error.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_error.h?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_error.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_error.h Tue Feb 20 02:35:50 2007
@@ -56,7 +56,7 @@
 #define OXS_ERROR_INITIALIZATION_FAILED 9
 #define OXS_ERROR_DATA_CONV_FAILED     10
 #define OXS_ERROR_OPENSSL_FUNC_FAILED  11
-
+#define OXS_ERROR_TRANSFORM_FAILED     12
 
 typedef struct _oxs_error_description oxs_error_description, *oxs_error_description_ptr;
 

Modified: webservices/axis2/trunk/c/rampart/include/oxs_transform.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_transform.h?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_transform.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_transform.h Tue Feb 20 02:35:50 2007
@@ -36,18 +36,18 @@
 
     /*The input or output data type*/
     typedef enum  {
-        OXS_TRANSFORM_TYPE_NODE = 0,
-        OXS_TRANSFORM_TYPE_CHAR
+        OXS_TRANSFORM_TYPE_UNKNOWN = 0,
+        OXS_TRANSFORM_TYPE_CHAR,
+        OXS_TRANSFORM_TYPE_NODE 
     } oxs_tr_dtype_t;
 
 
     /*Function interface for any transform*/
-    typedef axis2_status_t (AXIS2_CALL*
-            tr_func)(const axis2_env_t *env,
+    typedef oxs_tr_dtype_t (AXIS2_CALL*
+            oxs_transform_tr_func)(const axis2_env_t *env,
             void *input,
             oxs_tr_dtype_t input_dtype,
-            void **output,
-            oxs_tr_dtype_t **output_dtype);
+            void **output);
 
     typedef struct oxs_transform_t oxs_transform_t;
 
@@ -63,50 +63,50 @@
 
 
 /**********************Getter functions******************************************/
-axis2_char_t *AXIS2_CALL
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_transform_get_id(
     const oxs_transform_t *transform,
     const axis2_env_t *env);
 
-oxs_tr_dtype_t AXIS2_CALL
+AXIS2_EXTERN oxs_tr_dtype_t AXIS2_CALL
 oxs_transform_get_input_data_type(
     const oxs_transform_t *transform,
     const axis2_env_t *env);
 
-oxs_tr_dtype_t AXIS2_CALL
+AXIS2_EXTERN oxs_tr_dtype_t AXIS2_CALL
 oxs_transform_get_output_data_type(
     const oxs_transform_t *transform,
     const axis2_env_t *env);
 
-tr_func *AXIS2_CALL
+AXIS2_EXTERN oxs_transform_tr_func AXIS2_CALL
     oxs_transform_get_transform_function(
     const oxs_transform_t *transform,
     const axis2_env_t *env);
 
 /**********************Setter functions******************************************/
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_transform_set_id(
     oxs_transform_t *transform,
     const axis2_env_t *env,
     axis2_char_t *id);
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_transform_set_input_data_type(
     oxs_transform_t *transform,
     const axis2_env_t *env,
     oxs_tr_dtype_t input_data_type);
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_transform_set_output_data_type(
     oxs_transform_t *transform,
     const axis2_env_t *env,
     oxs_tr_dtype_t output_data_type);
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_transform_set_transform_func(
     oxs_transform_t *transform,
     const axis2_env_t *env,
-    tr_func *transform_func);
+    oxs_transform_tr_func transform_func);
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c Tue Feb 20 02:35:50 2007
@@ -34,6 +34,7 @@
         {OXS_ERROR_INVALID_SIZE , "invalid size"},
         {OXS_ERROR_INVALID_FORMAT , "invalid format"},
         {OXS_ERROR_ELEMENT_FAILED , "element failed"},
+        {OXS_ERROR_TRANSFORM_FAILED , "Transformation failed"},
     };
 
 AXIS2_EXTERN const char* AXIS2_CALL

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_ctx.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_ctx.c Tue Feb 20 02:35:50 2007
@@ -33,7 +33,7 @@
 /*Public functions*/
 
 
-axis2_char_t *AXIS2_CALL
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_sign_ctx_get_sign_mtd_algo(
     const oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env)
@@ -41,7 +41,7 @@
     return sign_ctx->sign_mtd_algo;
 }
 
-axis2_char_t *AXIS2_CALL
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_sign_ctx_get_c14n_mtd(
     const oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env)
@@ -50,7 +50,7 @@
 }
 
 
-axis2_array_list_t *AXIS2_CALL
+AXIS2_EXTERN axis2_array_list_t *AXIS2_CALL
 oxs_sign_ctx_get_sign_parts(
     const oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env)
@@ -58,7 +58,7 @@
     return sign_ctx->sign_parts;
 }
 
-oxs_x509_cert_t *AXIS2_CALL
+AXIS2_EXTERN oxs_x509_cert_t *AXIS2_CALL
 oxs_sign_ctx_get_certificate(
     const oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env)
@@ -66,7 +66,7 @@
     return sign_ctx->certificate ;
 }
 
-openssl_pkey_t *AXIS2_CALL
+AXIS2_EXTERN openssl_pkey_t *AXIS2_CALL
 oxs_sign_ctx_get_private_key(
     const oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env)
@@ -74,7 +74,7 @@
     return sign_ctx->prv_key ;
 }
 
-openssl_pkey_t *AXIS2_CALL
+AXIS2_EXTERN openssl_pkey_t *AXIS2_CALL
 oxs_sign_ctx_get_public_key(
     const oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env)
@@ -83,7 +83,7 @@
 }
 
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_ctx_set_certificate(
     oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env,
@@ -97,7 +97,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_ctx_set_private_key(
     oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env,
@@ -111,7 +111,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_ctx_set_public_key(
     oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env,
@@ -125,7 +125,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_ctx_set_sign_mtd_algo(
     oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env,
@@ -141,7 +141,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_ctx_set_c14n_mtd(
     oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env,
@@ -158,7 +158,7 @@
 }
 
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_ctx_set_sign_parts(
     oxs_sign_ctx_t *sign_ctx,
     const axis2_env_t *env,
@@ -196,7 +196,7 @@
 }
 
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_ctx_free(oxs_sign_ctx_t *sign_ctx,
         const axis2_env_t *env)
 {

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c Tue Feb 20 02:35:50 2007
@@ -30,7 +30,7 @@
 
 
 /*Public functions*/
-axis2_char_t *AXIS2_CALL
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_sign_part_get_id(
     const oxs_sign_part_t *sign_part,
     const axis2_env_t *env)
@@ -38,7 +38,7 @@
     return sign_part->id;
 }
 
-axis2_char_t *AXIS2_CALL
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_sign_part_get_digest_mtd(
     const oxs_sign_part_t *sign_part,
     const axis2_env_t *env)
@@ -46,7 +46,7 @@
     return sign_part->digest_mtd;
 }
 
-axiom_node_t *AXIS2_CALL
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
 oxs_sign_part_get_node(
     const oxs_sign_part_t *sign_part,
     const axis2_env_t *env)
@@ -54,7 +54,7 @@
     return sign_part->node;
 }
 
-axis2_array_list_t *AXIS2_CALL
+AXIS2_EXTERN axis2_array_list_t *AXIS2_CALL
 oxs_sign_part_get_transforms(
     const oxs_sign_part_t *sign_part,
     const axis2_env_t *env)
@@ -62,7 +62,7 @@
     return sign_part->transforms;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_part_set_id(
     oxs_sign_part_t *sign_part,
     const axis2_env_t *env,
@@ -78,7 +78,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_part_set_digest_mtd(
     oxs_sign_part_t *sign_part,
     const axis2_env_t *env,
@@ -94,7 +94,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_part_set_node(
     oxs_sign_part_t *sign_part,
     const axis2_env_t *env,
@@ -107,7 +107,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_part_set_transforms(
     oxs_sign_part_t *sign_part,
     const axis2_env_t *env,
@@ -143,7 +143,7 @@
 }
 
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_sign_part_free(oxs_sign_part_t *sign_part,
         const axis2_env_t *env)
 {

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c Tue Feb 20 02:35:50 2007
@@ -25,6 +25,7 @@
 #include <oxs_signature.h>
 #include <oxs_buffer.h>
 #include <openssl_rsa.h>
+#include <openssl_sign.h>
 #include <openssl_digest.h>
 #include <openssl_sign.h>
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_c14n_method.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_c14n_method.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_c14n_method.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_c14n_method.c Tue Feb 20 02:35:50
2007
@@ -48,7 +48,7 @@
     /*If c14n algorithm is NULL then use the default*/
     if (!algorithm)
     {
-        algorithm = (axis2_char_t*)OXS_HREF_C14N;
+        algorithm = (axis2_char_t*)OXS_HREF_XML_EXC_C14N;
     }
 
     algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_transform.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_transform.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_transform.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/tokens/token_transform.c Tue Feb 20 02:35:50
2007
@@ -48,7 +48,7 @@
     /*If transform algorithm is NULL then use the default*/
     if (!algorithm)
     {
-        algorithm = (axis2_char_t*)OXS_HREF_C14N;
+        algorithm = (axis2_char_t*)OXS_HREF_XML_EXC_C14N;
     }
 
     algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/transform.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/transform.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/transform.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/transform.c Tue Feb 20 02:35:50 2007
@@ -26,10 +26,10 @@
     axis2_char_t *id ;
     oxs_tr_dtype_t input_data_type;
     oxs_tr_dtype_t output_data_type;
-    tr_func *transform_func; /*The function to implement the transform*/
+    oxs_transform_tr_func transform_func; /*The function to implement the transform*/
 };
 
-axis2_char_t *AXIS2_CALL
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_transform_get_id(
     const oxs_transform_t *transform,
     const axis2_env_t *env)
@@ -37,7 +37,7 @@
     return transform->id;
 }
 
-oxs_tr_dtype_t AXIS2_CALL
+AXIS2_EXTERN oxs_tr_dtype_t AXIS2_CALL
 oxs_transform_get_input_data_type(
     const oxs_transform_t *transform,
     const axis2_env_t *env)
@@ -45,7 +45,7 @@
     return transform->input_data_type;
 }
 
-oxs_tr_dtype_t AXIS2_CALL
+AXIS2_EXTERN oxs_tr_dtype_t AXIS2_CALL
 oxs_transform_get_output_data_type(
     const oxs_transform_t *transform,
     const axis2_env_t *env)
@@ -53,7 +53,7 @@
     return transform->output_data_type;
 }
 
-tr_func *AXIS2_CALL
+AXIS2_EXTERN oxs_transform_tr_func AXIS2_CALL
 oxs_transform_get_transform_function(
     const oxs_transform_t *transform,
     const axis2_env_t *env)
@@ -61,7 +61,7 @@
     return transform->transform_func;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_transform_set_id(
     oxs_transform_t *transform,
     const axis2_env_t *env,
@@ -77,7 +77,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_transform_set_input_data_type(
     oxs_transform_t *transform,
     const axis2_env_t *env,
@@ -87,7 +87,7 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_transform_set_output_data_type(
     oxs_transform_t *transform,
     const axis2_env_t *env,
@@ -97,11 +97,11 @@
     return AXIS2_SUCCESS;
 }
 
-axis2_status_t AXIS2_CALL
-oxs_transform_set_transform_function(
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_transform_set_transform_func(
     oxs_transform_t *transform,
     const axis2_env_t *env,
-    tr_func *transform_func)
+    oxs_transform_tr_func transform_func)
 {
     transform->transform_func = transform_func;
     return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/transforms_factory.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/transforms_factory.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/transforms_factory.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/transforms_factory.c Tue Feb 20 02:35:50
2007
@@ -23,19 +23,30 @@
 #include <oxs_transform.h>
 #include <oxs_transforms_factory.h>
 #include <oxs_buffer.h>
+#include <oxs_c14n.h>
 
 /*Functions that implements transforms*/
-axis2_status_t AXIS2_CALL
+oxs_tr_dtype_t AXIS2_CALL
 oxs_transforms_exc_c14n(const axis2_env_t *env,
             axiom_node_t *input,
             oxs_tr_dtype_t input_dtype,
-            axis2_char_t **output,
-            oxs_tr_dtype_t **output_dtype)
+            axis2_char_t **output)
 {
-    *output= "SAMPLE-SAMPLE-SAMPLE";
-    /*output_dtype = OXS_TRANSFORM_TYPE_CHAR;*/
+    axiom_document_t *doc = NULL;
+    axis2_char_t *c14nized = NULL;
+    oxs_tr_dtype_t output_dtype = OXS_TRANSFORM_TYPE_UNKNOWN;
 
-    return AXIS2_SUCCESS;
+    if(input_dtype != OXS_TRANSFORM_TYPE_NODE){
+       oxs_error(env, ERROR_LOCATION, OXS_ERROR_TRANSFORM_FAILED,"Transform expects a NODE.");
+       return OXS_TRANSFORM_TYPE_UNKNOWN;
+    }
+    doc = axiom_node_get_document((axiom_node_t*)input, env);
+    
+    oxs_c14n_apply(env, doc, AXIS2_FALSE, &c14nized, AXIS2_TRUE, NULL, (axiom_node_t*)input);
+
+    *output= c14nized;
+    output_dtype = OXS_TRANSFORM_TYPE_CHAR;
+    return output_dtype;
 }
 
 /*Public functions*/
@@ -51,7 +62,7 @@
         oxs_transform_set_id(tr, env, id);
         oxs_transform_set_input_data_type(tr, env, OXS_TRANSFORM_TYPE_NODE);
         oxs_transform_set_output_data_type(tr, env, OXS_TRANSFORM_TYPE_CHAR);
-        /*oxs_transform_set_transform_func(tr, env, oxs_transforms_exc_c14n);*/
+        oxs_transform_set_transform_func(tr, env, (oxs_transform_tr_func)oxs_transforms_exc_c14n);
         return tr;
     }else{
         /*Error we do not support*/

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c Tue Feb 20 02:35:50 2007
@@ -28,6 +28,7 @@
 #include <oxs_sign_part.h>
 #include <oxs_xml_signature.h>
 #include <oxs_signature.h>
+#include <oxs_transform.h>
 #include <oxs_token_ds_reference.h>
 #include <oxs_token_digest_method.h>
 #include <oxs_token_digest_value.h>
@@ -103,18 +104,59 @@
     
     if((transforms) && (0 < AXIS2_ARRAY_LIST_SIZE(transforms, env))){
         axiom_node_t *transforms_node = NULL;
+        oxs_tr_dtype_t output_dtype = OXS_TRANSFORM_TYPE_UNKNOWN;/*This will always be the
current dtype*/
+        void *tr_output = NULL;
+        output_dtype = OXS_TRANSFORM_TYPE_NODE; /*We always begin with a node*/
+        
+        tr_output = node; /*The first transformation is applied to the node*/
+
         /*Add ds:Transforms element*/
         transforms_node = oxs_token_build_transforms_element(env, reference_node);
         /*LOOP: Apply transforms. For example exclusive C14N*/
         for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(transforms, env); i++){
-            /*Apply transform*/
+            oxs_transform_t *tr = NULL;
+            oxs_transform_tr_func tr_func = NULL;
+            oxs_tr_dtype_t input_dtype = OXS_TRANSFORM_TYPE_UNKNOWN;
+            void *tr_input = NULL;
+            axis2_char_t *tr_id = NULL;
+
+            /*Get the ith transform*/
+            tr = (oxs_transform_t*)AXIS2_ARRAY_LIST_GET(transforms, env, i);
+            tr_id = oxs_transform_get_id(tr, env);
+            tr_func = oxs_transform_get_transform_function(tr, env);
+            input_dtype = oxs_transform_get_input_data_type(tr, env);
+            
+            /*Prepare the input*/
+            /*If the required input type is CHAR and what we have is a NODE*/
+            if((input_dtype == OXS_TRANSFORM_TYPE_CHAR) && (output_dtype == OXS_TRANSFORM_TYPE_NODE)){
+                /*Serialize*/
+                tr_input = axiom_node_to_string((axiom_node_t*)tr_output, env);
+            /*If the required input type is NODE and what we have is a CHAR*/
+            }else if((input_dtype == OXS_TRANSFORM_TYPE_NODE) && (output_dtype ==
OXS_TRANSFORM_TYPE_CHAR)){
+                /*TODO De-serialize*/
+            }else{
+                /*Let it go as it is. */
+                tr_input = tr_output;
+            }
 
-            /*Add to ds:Transforms*/
+            /*Apply transform*/
+            if(tr_func){
+                output_dtype = (*tr_func)(env, tr_input, input_dtype, &tr_output);
+            }else{
+                oxs_error(env, ERROR_LOCATION, OXS_ERROR_TRANSFORM_FAILED,"Cannot get the
transform implementation for %s", tr_id);
+            }
+            /*If the output data type is unknown OR the output is NULL its an error*/
+            if((output_dtype == OXS_TRANSFORM_TYPE_UNKNOWN) || (!tr_output)){
+                oxs_error(env, ERROR_LOCATION, OXS_ERROR_TRANSFORM_FAILED,"Transform failed
for %s", tr_id);
+                /*return AXIS2_FAILURE*/
+            }
+            /*Add to ds:Transforms element*/
+            oxs_token_build_transform_element(env, transforms_node, tr_id);
         }
     }
     /*Serialize node*/
     serialized_node = AXIOM_NODE_TO_STRING(node, env);
-    printf("serialized_node %s\n", serialized_node);
+    
     /*Make digest.*/
     digest_mtd = oxs_sign_part_get_digest_mtd(sign_part, env);
     digest = openssl_sha1(env, serialized_node, axis2_strlen(serialized_node)); 
@@ -151,7 +193,6 @@
     
     /*Then serialize <SignedInfo>*/
     serialized_signed_info = c14nized; /*AXIOM_NODE_TO_STRING(signed_info_node, env);*/
-    printf("serialized_signed_info %s\n",serialized_signed_info); 
 
     /*Make the input and out put buffers*/
     input_buf = oxs_buffer_create(env);

Modified: webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c?view=diff&rev=509500&r1=509499&r2=509500
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c (original)
+++ webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c Tue Feb 20 02:35:50 2007
@@ -29,6 +29,8 @@
 #include <oxs_key_mgr.h>
 #include <openssl_pkey.h>
 #include <oxs_error.h>
+#include <oxs_transform.h>
+#include <oxs_transforms_factory.h>
 #include <oxs_xml_signature.h>
 #include <oxs_sign_ctx.h>
 #include <oxs_sign_part.h>
@@ -75,7 +77,9 @@
     axiom_node_t *tmpl = NULL;
     oxs_sign_part_t *sign_part = NULL;
     oxs_sign_ctx_t *sign_ctx = NULL;
+    oxs_transform_t *tr = NULL;
     axis2_array_list_t *sign_parts = NULL;
+    axis2_array_list_t *tr_list = NULL;
     FILE *outf;
 
     env = axis2_env_create_all("echo.log", AXIS2_LOG_LEVEL_TRACE);
@@ -99,8 +103,16 @@
     /*Sign specific*/
     sign_part = oxs_sign_part_create(env);
     status = AXIS2_FAILURE;
+
+    tr_list = axis2_array_list_create(env, 1);
+    /*We need C14N transform*/
+    tr = oxs_transforms_factory_produce_transform(env, OXS_HREF_TRANSFORM_XML_EXC_C14N);
+    axis2_array_list_add(tr_list, env, tr);
+    oxs_sign_part_set_transforms(sign_part, env, tr_list);
+    /*We need to sign this node*/
     status = oxs_sign_part_set_node(sign_part, env, axiom_node_get_first_element(tmpl, env));
 
+
     sign_parts = axis2_array_list_create(env, 1);
     axis2_array_list_add(sign_parts, env, sign_part);
     sign_ctx = oxs_sign_ctx_create(env);
@@ -125,7 +137,7 @@
         /*Set sig algo*/
         oxs_sign_ctx_set_sign_mtd_algo(sign_ctx, env, OXS_HREF_RSA_SHA1);
         /*Set C14N method*/
-        oxs_sign_ctx_set_c14n_mtd(sign_ctx, env, OXS_HREF_C14N);
+        oxs_sign_ctx_set_c14n_mtd(sign_ctx, env, OXS_HREF_XML_EXC_C14N);
         /*Set sig parts*/
         oxs_sign_ctx_set_sign_parts(sign_ctx, env, sign_parts);
         /*Sign*/



---------------------------------------------------------------------
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