You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by sh...@apache.org on 2008/08/20 15:02:14 UTC

svn commit: r687308 [1/3] - in /webservices/rampart/trunk/c: include/ samples/sct_provider/ samples/server/secconv_echo/ src/data/ src/omxmlsec/ src/omxmlsec/c14n/ src/omxmlsec/openssl/ src/omxmlsec/tokens/ src/rahas/ src/secconv/ src/trust/ src/util/

Author: shankar
Date: Wed Aug 20 06:02:13 2008
New Revision: 687308

URL: http://svn.apache.org/viewvc?rev=687308&view=rev
Log:
WS-Trust 1.3, WS-SecConv 1.3 and WS-SecPolicy 1.2 support

Modified:
    webservices/rampart/trunk/c/include/oxs_constants.h
    webservices/rampart/trunk/c/include/oxs_derivation.h
    webservices/rampart/trunk/c/include/oxs_tokens.h
    webservices/rampart/trunk/c/include/rampart_context.h
    webservices/rampart/trunk/c/include/secconv_security_context_token.h
    webservices/rampart/trunk/c/include/trust_constants.h
    webservices/rampart/trunk/c/include/trust_rstr.h
    webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c
    webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c
    webservices/rampart/trunk/c/src/data/rahas_module.xml
    webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c
    webservices/rampart/trunk/c/src/omxmlsec/derivation.c
    webservices/rampart/trunk/c/src/omxmlsec/openssl/hmac.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_binary_security_token.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_c14n_method.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_data.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_value.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_data_reference.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_derived_key_token.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_method.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_value.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_ds_reference.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_embedded.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_header.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_key.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encryption_method.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_generation.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_key_identifier.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_key_info.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_key_name.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_label.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_nonce.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_properties.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_reference.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_reference_list.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_security_token_reference.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_signature.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_signature_confirmation.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_signature_method.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_signature_value.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_signed_info.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_transform.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_transforms.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_x509_certificate.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_x509_data.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_x509_issuer_name.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_x509_issuer_serial.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_x509_serial_number.c
    webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c
    webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c
    webservices/rampart/trunk/c/src/rahas/rahas_request_processor.c
    webservices/rampart/trunk/c/src/secconv/sct_provider_utility.c
    webservices/rampart/trunk/c/src/secconv/security_context_token.c
    webservices/rampart/trunk/c/src/trust/claims.c
    webservices/rampart/trunk/c/src/trust/rstr.c
    webservices/rampart/trunk/c/src/trust/sts_client.c
    webservices/rampart/trunk/c/src/util/rampart_context.c
    webservices/rampart/trunk/c/src/util/rampart_encryption.c
    webservices/rampart/trunk/c/src/util/rampart_handler_util.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
    webservices/rampart/trunk/c/src/util/rampart_signature.c

Modified: webservices/rampart/trunk/c/include/oxs_constants.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_constants.h?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_constants.h (original)
+++ webservices/rampart/trunk/c/include/oxs_constants.h Wed Aug 20 06:02:13 2008
@@ -66,6 +66,7 @@
 #define OXS_EMBEDDED_ID "EmbeddedID"
 #define OXS_DERIVED_ID "DKID"
 #define OXS_SIG_CONF_ID "SigConfID"
+#define OXS_LOCAL_REFERENCE_PREFIX "#"
 
     /****************************************************************
        Global namespaces 
@@ -74,7 +75,8 @@
 #define OXS_ENC_NS                 "http://www.w3.org/2001/04/xmlenc#"
 /*#define OXS_WSSE_NS                "http://schemas.xmlsoap.org/ws/2002/04/secext"*/
 #define OXS_WSSE_NS                "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
-#define OXS_WSC_NS "http://schemas.xmlsoap.org/ws/2005/02/sc"
+#define OXS_WSC_NS_05_02 "http://schemas.xmlsoap.org/ws/2005/02/sc"
+#define OXS_WSC_NS_05_12 "http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512"
 
     /****************************************************************
         DSig Nodes  
@@ -136,7 +138,7 @@
 #define OXS_NODE_NONCE "Nonce"
 #define OXS_NODE_SECURITY_CONTEXT_TOKEN "SecurityContextToken"
 #define OXS_NODE_IDENTIFIER "Identifier"
-#define OXS_VALUE_TYPE_SECURITY_CONTEXT_TOKEN "http://schemas.xmlsoap.org/ws/2005/02/sc/sct"
+#define OXS_VALUE_TYPE_SECURITY_CONTEXT_TOKEN_05_02 "http://schemas.xmlsoap.org/ws/2005/02/sc/sct"
 #define OXS_VALUE_TYPE_SECURITY_CONTEXT_TOKEN_05_12 "http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct"
 
 /************************
@@ -323,8 +325,8 @@
 #define OXS_NAME_SHA512           "sha512"
 #define OXS_HREF_SHA512           "http://www.w3.org/2001/04/xmlenc#sha512"
 
-#define OXS_SC_DK_NAME_P_SHA1    "P_SHA-1"
-#define OXS_SC_DK_HREF_P_SHA1           "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1"
+#define OXS_SC_DK_NAME_P_SHA1     "P_SHA-1"
+#define OXS_SC_DK_HREF_P_SHA1     "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1"
     /****************************************************************
         X509 
     ****************************************************************/

Modified: webservices/rampart/trunk/c/include/oxs_derivation.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_derivation.h?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_derivation.h (original)
+++ webservices/rampart/trunk/c/include/oxs_derivation.h Wed Aug 20 06:02:13 2008
@@ -44,65 +44,77 @@
      * Derive Key depending on the secret key @secret 
      * Caller must free memory for derived key
      * @param env pointer to environment struct
-     * @param secret The secret is the shared secret that is exchanged (note that if two secrets were securely exchanged,\
-     * possible as part of an initial exchange, they are concatenated in the order they were sent/received)
+     * @param secret The secret is the shared secret that is exchanged (note that if two secrets 
+     * were securely exchanged, possible as part of an initial exchange, they are concatenated in 
+     * the order they were sent/received)
      * @param derived_key The derived key. Caller must create and free
-	 * @param build_fresh Whether to build fresh or build using details in derived key(in case of recovering the derive key from xml)
+	 * @param build_fresh Whether to build fresh or build using details in derived key
+     * (in case of recovering the derive key from xml)
      * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
      *
      **/
     AXIS2_EXTERN axis2_status_t AXIS2_CALL
-    oxs_derivation_derive_key(const axutil_env_t *env,
-                         oxs_key_t *secret,
-                         oxs_key_t *derived_key,
-						 axis2_bool_t build_fresh
-                         );
+    oxs_derivation_derive_key(
+        const axutil_env_t *env,
+        oxs_key_t *secret,
+        oxs_key_t *derived_key,
+        axis2_bool_t build_fresh);
+
     /**
-     * Build the <wsse:DerivedKeyToken> depending a given derived key @derived_key
+     * Build the <wsc:DerivedKeyToken> depending a given derived key @derived_key
      * The token will be attached to the parent @parent
      * @param env pointer to environment struct
-     * @derived_key The derived key to be used to get information
-     * @parent The parent node to be attached to
-     * @stref_uri Security Token Reference URI
-     * @stref_val_type Security Token Reference Valut Type
+     * @param derived_key The derived key to be used to get information
+     * @param parent The parent node to be attached to
+     * @param stref_uri Security Token Reference URI
+     * @param stref_val_type Security Token Reference Valut Type
+     * @param wsc_ns_uri namespace uri of ws-secconv version
      * @return the built axiom node
      */
     AXIS2_EXTERN axiom_node_t * AXIS2_CALL
-    oxs_derivation_build_derived_key_token(const axutil_env_t *env,
-    oxs_key_t *derived_key,
-    axiom_node_t *parent,
-    axis2_char_t *stref_uri,
-    axis2_char_t *stref_val_type);
+    oxs_derivation_build_derived_key_token(
+        const axutil_env_t *env,
+        oxs_key_t *derived_key,
+        axiom_node_t *parent,
+        axis2_char_t *stref_uri,
+        axis2_char_t *stref_val_type, 
+        axis2_char_t *wsc_ns_uri);
 
     /**
-     * Build the <wsse:DerivedKeyToken> depending a given derived key @derived_key
+     * Build the <wsc:DerivedKeyToken> depending a given derived key @derived_key
      * The token will be attached to the parent @parent
      * @param env pointer to environment struct
-     * @derived_key The derived key to be used to get information
-     * @parent The parent node to be attached to
-     * @stre Security Toekn Reference element
+     * @param derived_key The derived key to be used to get information
+     * @param parent The parent node to be attached to
+     * @param stre Security Toekn Reference element
+     * @param wsc_ns_uri namespace uri of ws-secconv version
      * @return the built axiom node
      */
     AXIS2_EXTERN axiom_node_t * AXIS2_CALL
-    oxs_derivation_build_derived_key_token_with_stre(const axutil_env_t *env,
-                                                    oxs_key_t *derived_key,
-                                                    axiom_node_t *parent,    
-                                                    axiom_node_t *stre);
+    oxs_derivation_build_derived_key_token_with_stre(
+        const axutil_env_t *env,
+        oxs_key_t *derived_key,
+        axiom_node_t *parent,    
+        axiom_node_t *stre,
+        axis2_char_t *wsc_ns_uri);
+
     /**
      * Extract information from an AXIOM node of typ <wsse:DerivedKeyToken> and build a key
-     * If the (optional) session_key is NULL then extract it form the refered EncryptedKey. Otherwise use it
-     * to Derive a new key using information available in the dk_token.
+     * If the (optional) session_key is NULL then extract it form the refered EncryptedKey. 
+     * Otherwise use it to Derive a new key using information available in the dk_token.
      * @param env pointer to environment struct
-     * @dk_token The <wsse:DerivedKeyToken> axiom node
-     * @root_node The root node, which the search scope limited to
-     * @session_key The session key, which is the base for the key derivation.
-     * @return the derived key on SUCCESS or NULL on failure
+     * @param dk_token The <wsse:DerivedKeyToken> axiom node
+     * @param root_node The root node, which the search scope limited to
+     * @param session_key The session key, which is the base for the key derivation.
+     * @param return the derived key on SUCCESS or NULL on failure
      * */
     AXIS2_EXTERN oxs_key_t * AXIS2_CALL
-    oxs_derivation_extract_derived_key_from_token(const axutil_env_t *env,
-    axiom_node_t *dk_token,
-    axiom_node_t *root_node,
-    oxs_key_t *session_key);
+    oxs_derivation_extract_derived_key_from_token(
+        const axutil_env_t *env,
+        axiom_node_t *dk_token,
+        axiom_node_t *root_node,
+        oxs_key_t *session_key);
+
     /** @} */
 #ifdef __cplusplus
 }

Modified: webservices/rampart/trunk/c/include/oxs_tokens.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_tokens.h?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_tokens.h (original)
+++ webservices/rampart/trunk/c/include/oxs_tokens.h Wed Aug 20 06:02:13 2008
@@ -18,11 +18,19 @@
 #ifndef OXS_TOKENS_H
 #define OXS_TOKENS_H
 
+#include <axis2_util.h>
+#include <stdio.h>
 #include <axutil_qname.h>
 #include <axis2_defines.h>
 #include <axutil_env.h>
 #include <axiom_node.h>
 #include <axiom_element.h>
+#include <axiom_attribute.h>
+#include <oxs_constants.h>
+#include <rampart_constants.h>
+#include <oxs_utility.h>
+#include <oxs_axiom.h>
+#include <axutil_array_list.h>
 
 /**
 * @file oxs_tokens.h
@@ -278,7 +286,8 @@
 	 */
     AXIS2_EXTERN axis2_char_t * AXIS2_CALL
     oxs_token_get_reference_value_type(
-		const axutil_env_t * env, axiom_node_t * ref_node);
+		const axutil_env_t * env, 
+        axiom_node_t * ref_node);
 
 	/**
 	 * Creates <xenc:ReferenceList> element
@@ -509,95 +518,117 @@
         const axutil_env_t * env,
         axiom_node_t * parent,
         axis2_char_t * id,
-        axis2_char_t * algo);
+        axis2_char_t * algo, 
+        axis2_char_t* wsc_ns_uri);
 
     /**
      * Creates <wsc:Length> element
      */
     AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-    oxs_token_build_length_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     int length);
+    oxs_token_build_length_element(
+        const axutil_env_t *env,
+        axiom_node_t *parent,
+        int length, 
+        axis2_char_t *wsc_ns_uri);
+
 	/**
 	 * Gets value from <wsc:Length> element
 	 */
     AXIS2_EXTERN int AXIS2_CALL
-    oxs_token_get_length_value(const axutil_env_t *env,
-                           axiom_node_t *length_node);
+    oxs_token_get_length_value(
+        const axutil_env_t *env,
+        axiom_node_t *length_node);
+
     /**
      * Creates <wsc:Offset> element
      */
     AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-    oxs_token_build_offset_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     int offset);
+    oxs_token_build_offset_element(
+        const axutil_env_t *env,
+        axiom_node_t *parent,
+        int offset, 
+        axis2_char_t *wsc_ns_uri);
+
 	/**
 	 * Gets value from <wsc:Offset> element
 	 */
     AXIS2_EXTERN int AXIS2_CALL
-    oxs_token_get_offset_value(const axutil_env_t *env,
-                           axiom_node_t *offset_node);
+    oxs_token_get_offset_value(
+        const axutil_env_t *env,
+        axiom_node_t *offset_node);
+
     /**
      * Creates <wsc:Nonce> element
      */
     AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-    oxs_token_build_nonce_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     axis2_char_t* nonce_val);
-	/**
+    oxs_token_build_nonce_element(
+        const axutil_env_t *env,
+        axiom_node_t *parent,
+        axis2_char_t *nonce_val,
+        axis2_char_t *wsc_ns_uri);
+
+    /**
 	 * Gets value from <wsc:Nonce> element
 	 */
     AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-    oxs_token_get_nonce_value(const axutil_env_t *env,
-                           axiom_node_t *nonce_node);
+    oxs_token_get_nonce_value(
+        const axutil_env_t *env,
+        axiom_node_t *nonce_node);
 
 	/**
 	 * Creates <wsc:Label> element
 	 */
 	AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-	oxs_token_build_label_element(const axutil_env_t *env,
-										axiom_node_t *parent,
-										axis2_char_t* label);
+	oxs_token_build_label_element(
+        const axutil_env_t *env,
+		axiom_node_t *parent,
+		axis2_char_t *label, 
+        axis2_char_t *wsc_ns_uri);
+
 	/**
 	 * Gets value from <wsc:Label> element
 	 */
     AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-    oxs_token_get_label_value(const axutil_env_t *env,
-                           axiom_node_t *label_node);
-
-
+    oxs_token_get_label_value(
+        const axutil_env_t *env,
+        axiom_node_t *label_node, 
+        axis2_char_t *wsc_ns_uri);
 
     /**
      * Creates <wsc:Properties> element
      */
     AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-    oxs_token_build_properties_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     axis2_char_t* properties_val);
+    oxs_token_build_properties_element(
+        const axutil_env_t *env,
+        axiom_node_t *parent,
+        axis2_char_t* properties_val, 
+        axis2_char_t *wsc_ns_uri);
 
 	/**
 	 * Gets value from <wsc:Properties> element
 	 */
     AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-    oxs_token_get_properties_value(const axutil_env_t *env,
-                           axiom_node_t *properties_node);
+    oxs_token_get_properties_value(
+        const axutil_env_t *env,
+        axiom_node_t *properties_node);
     
     /**
      * Creates <wsc:Generation> element
      */
     AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-    oxs_token_build_generation_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     axis2_char_t* generation_val);
+    oxs_token_build_generation_element(
+        const axutil_env_t *env,
+        axiom_node_t *parent,
+        axis2_char_t *generation_val, 
+        axis2_char_t *wsc_ns_uri);
     
 	/**
 	 * Gets value from <wsc:Generation> element
 	 */
     AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-    oxs_token_get_generation_value(const axutil_env_t *env,
-                           axiom_node_t *generation_node);
-
-
+    oxs_token_get_generation_value(
+        const axutil_env_t *env,
+        axiom_node_t *generation_node);
 
     /** @} */
 

Modified: webservices/rampart/trunk/c/include/rampart_context.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_context.h?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_context.h (original)
+++ webservices/rampart/trunk/c/include/rampart_context.h Wed Aug 20 06:02:13 2008
@@ -1097,14 +1097,23 @@
      *
      * @param env pointer to environment struct,Must not be NULL.
      * @param token
-     * @returns status of the op.                                                                                                        
-     * AXIS2_SUCCESS on success and AXIS2_FAILURE on error          
+     * @returns whether derived key needed or not                                                                                                        
      */
-
     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
     rampart_context_check_is_derived_keys(
         const axutil_env_t *env,
         rp_property_t *token);
+
+    /**
+     * @param env pointer to environment struct,Must not be NULL.
+     * @param token
+     * @returns derived key version. NULL on error.                                                                                                        
+     */
+    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+    rampart_context_get_derived_key_version(
+        const axutil_env_t *env, 
+        rp_property_t *token);
+
     /**
      *
      * @param rampart_context

Modified: webservices/rampart/trunk/c/include/secconv_security_context_token.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/secconv_security_context_token.h?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/secconv_security_context_token.h (original)
+++ webservices/rampart/trunk/c/include/secconv_security_context_token.h Wed Aug 20 06:02:13 2008
@@ -135,6 +135,19 @@
         axis2_char_t *local_id);
 
     /**
+     * Set WS-SecureConversation version 
+     * @param sct Pointer to secuirty context token struct
+     * @param env Pointer to environment struct
+     * @param is_sc10 Boolean denoting whether we need security context token as in WS-SecConv 1.0
+     * @returns AXIS2_SUCCESS if success. AXIS2_FAILURE otherwise.
+     */
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    security_context_token_set_is_sc10(
+        security_context_token_t *sct, 
+        const axutil_env_t * env,
+        axis2_bool_t is_sc10);
+
+    /**
      * Get shared secret as axiom_node. Shared secret will be included inside 
      * 'RequestedProofToken' node. This is acording to WS-Trust specification 
      * @param sct Pointer to secuirty context token struct

Modified: webservices/rampart/trunk/c/include/trust_constants.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/trust_constants.h?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/trust_constants.h (original)
+++ webservices/rampart/trunk/c/include/trust_constants.h Wed Aug 20 06:02:13 2008
@@ -132,7 +132,6 @@
 #define TRUST_WSSE       "wsse"
 #define TRUST_WSSE_XMLNS "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
 #define TRUST_WST        "wst"
-#define TRUST_WST_XMLNS  "http://schemas.xmlsoap.org/ws/2005/02/trust"
 #define TRUST_DS         "ds"
 #define TRUST_DS_XMLNS   "http://www.w3.org/2000/09/xmldsig#"
 #define TRUST_XENC       "xenc"

Modified: webservices/rampart/trunk/c/include/trust_rstr.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/trust_rstr.h?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/trust_rstr.h (original)
+++ webservices/rampart/trunk/c/include/trust_rstr.h Wed Aug 20 06:02:13 2008
@@ -185,7 +185,11 @@
         trust_rstr_t *rstr,
         const axutil_env_t *env,
         int key_size);
-    
+
+    AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+    trust_rstr_get_wst_ns_uri(
+	    trust_rstr_t *rstr,
+	    const axutil_env_t *env);    
      
 
 #ifdef __cplusplus

Modified: webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c (original)
+++ webservices/rampart/trunk/c/samples/sct_provider/sct_provider_stored_key.c Wed Aug 20 06:02:13 2008
@@ -161,6 +161,7 @@
             security_context_token_set_global_identifier(sct, env, axutil_strdup(env, sct_id));
             security_context_token_set_local_identifier(
                 sct, env, axutil_strdup(env, "#sctId-29530019"));
+            security_context_token_set_is_sc10(sct, env, AXIS2_TRUE);
     
             if(free_sctid)
             {

Modified: webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c (original)
+++ webservices/rampart/trunk/c/samples/server/secconv_echo/echo.c Wed Aug 20 06:02:13 2008
@@ -181,7 +181,7 @@
 
     /*check whether rst is valid and can be processed*/
     token_type = trust_rst_get_token_type(rst, env);
-    if((!token_type) || (0 != axutil_strcmp(token_type, OXS_VALUE_TYPE_SECURITY_CONTEXT_TOKEN)))
+    if((!token_type) || (0 != axutil_strcmp(token_type, OXS_VALUE_TYPE_SECURITY_CONTEXT_TOKEN_05_02)))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][secconv_service] token type is not valid");
         return NULL;
@@ -199,7 +199,7 @@
 
     /*create global id, local id, and shared secret*/
     global_id = oxs_util_generate_id(env,"urn:uuid:");
-    local_id = axutil_stracat(env, "#", oxs_util_generate_id(env, "sctId"));
+    local_id = axutil_stracat(env, OXS_LOCAL_REFERENCE_PREFIX, oxs_util_generate_id(env, "sctId"));
     shared_secret = oxs_buffer_create(env);
     if(requester_entropy)
     {
@@ -209,6 +209,7 @@
 
     /*create security context token and populate it*/
     sct = security_context_token_create(env);
+    security_context_token_set_is_sc10(sct, env, AXIS2_TRUE);
     security_context_token_set_global_identifier(sct, env, global_id);
     security_context_token_set_local_identifier(sct, env, local_id);
     

Modified: webservices/rampart/trunk/c/src/data/rahas_module.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/data/rahas_module.xml?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/data/rahas_module.xml (original)
+++ webservices/rampart/trunk/c/src/data/rahas_module.xml Wed Aug 20 06:02:13 2008
@@ -46,4 +46,45 @@
 		</wsp:Policy>
 	</operation>
 
+	<operation name="SecConv13Issue">
+		<actionMapping>http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/SCT</actionMapping>
+		<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+			<wsp:ExactlyOne>
+				<wsp:All>
+					<sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+						<wsp:Policy>
+							<sp:InitiatorToken>
+								<wsp:Policy>
+									<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+										<wsp:Policy>
+											<sp:WssX509V3Token10/>
+										</wsp:Policy>
+									</sp:X509Token>
+								</wsp:Policy>
+							</sp:InitiatorToken>
+							<sp:RecipientToken>
+								<wsp:Policy>
+									<sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+										<wsp:Policy>
+											<sp:WssX509V3Token10/>
+										</wsp:Policy>
+									</sp:X509Token>
+								</wsp:Policy>
+							</sp:RecipientToken>
+							<sp:Layout>
+								<wsp:Policy>
+									<sp:Strict/>
+								</wsp:Policy>
+							</sp:Layout>
+							<sp:IncludeTimestamp/>
+						</wsp:Policy>
+					</sp:AsymmetricBinding>
+					<rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+						<rampc:TimeToLive>360</rampc:TimeToLive>
+					</rampc:RampartConfig>
+				</wsp:All>
+			</wsp:ExactlyOne>
+		</wsp:Policy>
+	</operation>
+
 </module>

Modified: webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/c14n/c14n.c Wed Aug 20 06:02:13 2008
@@ -659,7 +659,7 @@
 oxs_c14n_apply(
     const axutil_env_t *env,
     const axiom_document_t *doc,
-    axis2_bool_t comments,
+    const axis2_bool_t comments,
     axis2_char_t **outbuf,
     const axis2_bool_t exclusive,
     const axutil_array_list_t *ns_prefixes,
@@ -773,7 +773,7 @@
 
 static axis2_status_t
 c14n_apply_on_element(
-    const axiom_node_t const *node,
+    const axiom_node_t *node,
     const c14n_ctx_t *ctx
 )
 {

Modified: webservices/rampart/trunk/c/src/omxmlsec/derivation.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/derivation.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/derivation.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/derivation.c Wed Aug 20 06:02:13 2008
@@ -25,6 +25,7 @@
 #include <oxs_tokens.h>
 #include <openssl_hmac.h>
 
+#if 0
 /*Remove this funciton if not in use*/
 AXIS2_EXTERN oxs_key_t* AXIS2_CALL
 oxs_derivation_get_the_referenced_base_key(const axutil_env_t *env,
@@ -56,9 +57,11 @@
     
     return NULL;
 }
+#endif
 
 AXIS2_EXTERN oxs_key_t* AXIS2_CALL
-oxs_derivation_extract_derived_key_from_token(const axutil_env_t *env,
+oxs_derivation_extract_derived_key_from_token(
+    const axutil_env_t *env,
     axiom_node_t *dk_token_node,
     axiom_node_t *root_node,
     oxs_key_t *session_key)
@@ -71,81 +74,125 @@
     axis2_status_t status = AXIS2_FAILURE;
     axis2_char_t *nonce = NULL;
     axis2_char_t *id = NULL;
-    /*Default values*/
+    axiom_element_t *dk_token_element = NULL;
+    axis2_char_t *wsc_ns_uri = NULL;
+    
+    /* Default values */
     int offset = 0;
     int length = 0;
 
 
-    /*If the session_key is NULL then extract it form the refered EncryptedKey. Otherwise use it*/
-    if(!session_key){
-        /*TODO Lots of work including decrypting the EncryptedKey*/
-    }else{
+    /* If the session_key is NULL then extract it form the refered EncryptedKey. Otherwise use it */
+    if(!session_key)
+    {
+        /* TODO Lots of work including decrypting the EncryptedKey */
+    }
+    else
+    {
         base_key = session_key;
     }
 
-    /*Get offset value*/
-    offset_node = oxs_axiom_get_first_child_node_by_name(env, dk_token_node, OXS_NODE_OFFSET, OXS_WSC_NS, NULL);  
-    if(offset_node){
+    dk_token_element =(axiom_element_t *) axiom_node_get_data_element(dk_token_node, env);
+    if (dk_token_element)
+    {
+        axis2_char_t *ns = NULL;
+        axutil_qname_t *node_qname = NULL;
+        node_qname = axiom_element_get_qname(dk_token_element, env, dk_token_node);
+        if(!node_qname)
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                "[rampart] Cannot get qname from dervied key token.");
+            return NULL;
+        }
+
+        wsc_ns_uri = axutil_qname_get_uri(node_qname, env);
+    }
+
+    if(!wsc_ns_uri)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart] Cannot get namespace from dervied key token.");
+        return NULL;
+    }
+
+
+    /* Get offset value */
+    offset_node = oxs_axiom_get_first_child_node_by_name(
+        env, dk_token_node, OXS_NODE_OFFSET, wsc_ns_uri, NULL);  
+    if(offset_node)
+    {
         offset = oxs_token_get_offset_value(env, offset_node);
     }
     
-    /*Get length value*/
-    length_node = oxs_axiom_get_first_child_node_by_name(env, dk_token_node, OXS_NODE_LENGTH, OXS_WSC_NS, NULL);
-    if(length_node){
+    /* Get length value */
+    length_node = oxs_axiom_get_first_child_node_by_name(
+        env, dk_token_node, OXS_NODE_LENGTH, wsc_ns_uri, NULL);
+    if(length_node)
+    {
         length = oxs_token_get_length_value(env, length_node);
     }
 
-    /*Get nonce value*/
-    nonce_node = oxs_axiom_get_first_child_node_by_name(env, dk_token_node, OXS_NODE_NONCE, OXS_WSC_NS, NULL);
-    if(nonce_node){
+    /* Get nonce value */
+    nonce_node = oxs_axiom_get_first_child_node_by_name(
+        env, dk_token_node, OXS_NODE_NONCE, wsc_ns_uri, NULL);
+    if(nonce_node)
+    {
         nonce = oxs_token_get_nonce_value(env, nonce_node);
     }
 
-
-    /*Create a new(empty) key as the derived key*/
+    /* Create a new(empty) key as the derived key */
     derived_key = oxs_key_create(env);
     oxs_key_set_offset(derived_key, env, offset);
     oxs_key_set_nonce(derived_key, env, nonce);
     oxs_key_set_length(derived_key, env, length);
 
-    /*Now derive the key using the base_key and other parematers*/
+    /* Now derive the key using the base_key and other parematers */
     status = oxs_derivation_derive_key(env, base_key, derived_key, AXIS2_FALSE);     
-    if(AXIS2_FAILURE == status){
-        oxs_error(env, OXS_ERROR_LOCATION, OXS_ERROR_INVALID_DATA, "Cannot derive the key from given element");
+    if(status != AXIS2_SUCCESS)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]Cannot derive the key from given element.");
         oxs_key_free(derived_key, env);
         derived_key = NULL;
     }
-    /*We need to set the name of the derived key*/
-    id = oxs_axiom_get_attribute_value_of_node_by_name(env, dk_token_node, OXS_ATTR_ID, OXS_WSU_XMLNS); 
+
+    /* We need to set the name of the derived key */
+    id = oxs_axiom_get_attribute_value_of_node_by_name(
+        env, dk_token_node, OXS_ATTR_ID, OXS_WSU_XMLNS); 
     oxs_key_set_name(derived_key, env, id);
     
-    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[oxs][derivation] DK=%s derived from Sk=%s ", id , oxs_key_get_name(base_key, env) );
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+        "[rampart] DK=%s derived from Sk=%s ", id , oxs_key_get_name(base_key, env) );
     return derived_key;
 }
 
 AXIS2_EXTERN axiom_node_t * AXIS2_CALL
-oxs_derivation_build_derived_key_token(const axutil_env_t *env,
+oxs_derivation_build_derived_key_token(
+    const axutil_env_t *env,
     oxs_key_t *derived_key,
     axiom_node_t *parent,
     axis2_char_t *stref_uri,
-    axis2_char_t *stref_val_type)
+    axis2_char_t *stref_val_type, 
+    axis2_char_t *wsc_ns_uri)
 {
     axiom_node_t *str_token = NULL;
     axiom_node_t *ref_token = NULL;
     axis2_char_t *uri = NULL;
 
-    uri = axutil_stracat(env, "#", stref_uri);
+    uri = axutil_stracat(env, OXS_LOCAL_REFERENCE_PREFIX, stref_uri);
     str_token = oxs_token_build_security_token_reference_element(env, NULL); 
     ref_token = oxs_token_build_reference_element(env, str_token, uri, stref_val_type); 
     AXIS2_FREE(env->allocator, uri);
-    return oxs_derivation_build_derived_key_token_with_stre(env, derived_key, parent, str_token); 
+    return oxs_derivation_build_derived_key_token_with_stre(
+        env, derived_key, parent, str_token, wsc_ns_uri); 
 }
 
 AXIS2_EXTERN axiom_node_t * AXIS2_CALL
 oxs_derivation_build_derived_key_token_with_stre(const axutil_env_t *env,
     oxs_key_t *derived_key,
     axiom_node_t *parent,    
-    axiom_node_t *stre)
+    axiom_node_t *stre, 
+    axis2_char_t *wsc_ns_uri)
 {
     axiom_node_t *dk_token = NULL;
     axiom_node_t *nonce_token = NULL;
@@ -163,42 +210,50 @@
     dk_name = oxs_key_get_name(derived_key, env);
     dk_id = axutil_string_substring_starting_at(dk_name, 1);
 	
-    dk_token = oxs_token_build_derived_key_token_element(env, parent, dk_id, NULL);
+    dk_token = oxs_token_build_derived_key_token_element(env, parent, dk_id, NULL, wsc_ns_uri);
     axiom_node_add_child(dk_token, env, stre);
 
-    /*Create offset*/
+    /* Create offset */
     offset = oxs_key_get_offset(derived_key, env);
-    if(offset > -1){
-        offset_token = oxs_token_build_offset_element(env, dk_token, offset);
+    if(offset > -1)
+    {
+        offset_token = oxs_token_build_offset_element(env, dk_token, offset, wsc_ns_uri);
     }
-    /*Create length*/
+
+    /* Create length */
     length = oxs_key_get_length(derived_key, env);
-    if(length > 0){
-        length_token = oxs_token_build_length_element(env, dk_token, length);
+    if(length > 0)
+    {
+        length_token = oxs_token_build_length_element(env, dk_token, length, wsc_ns_uri);
     }
-    /*Create nonce*/
+    
+    /* Create nonce */
     nonce = oxs_key_get_nonce(derived_key, env);
-    if(nonce){
-        nonce_token = oxs_token_build_nonce_element(env, dk_token, nonce);
+    if(nonce)
+    {
+        nonce_token = oxs_token_build_nonce_element(env, dk_token, nonce, wsc_ns_uri);
     }
-    /*Create label. Hmm we dont need to send the label. Use the default.*/
+
+    /* Create label. Hmm we dont need to send the label. Use the default. */
     label = oxs_key_get_label(derived_key, env);
-    /*if(label){
-        label_token = oxs_token_build_label_element(env, dk_token, label);
+    /*if(label)
+    {
+        label_token = oxs_token_build_label_element(env, dk_token, label, wsc_ns_uri);
     }*/
    
     return dk_token; 
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_derivation_derive_key(const axutil_env_t *env,
-                         oxs_key_t *secret,
-                         oxs_key_t *derived_key,
-						 axis2_bool_t build
-                         )
+oxs_derivation_derive_key(
+    const axutil_env_t *env,
+    oxs_key_t *secret,
+    oxs_key_t *derived_key,
+    axis2_bool_t build)
 {
     axis2_status_t status = AXIS2_FAILURE;
-    /*TODO check for derivation algorithm*/
+
+    /* TODO check for derivation algorithm */
 
 	if (build)
 	{
@@ -206,7 +261,8 @@
 	}
 	else
 	{
-		status = openssl_p_sha1(env, secret, oxs_key_get_label(derived_key, env), oxs_key_get_nonce(derived_key, env), derived_key);
+		status = openssl_p_sha1(env, secret, oxs_key_get_label(derived_key, env), 
+            oxs_key_get_nonce(derived_key, env), derived_key);
 	}
     return status;
 }

Modified: webservices/rampart/trunk/c/src/omxmlsec/openssl/hmac.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/openssl/hmac.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/openssl/hmac.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/openssl/hmac.c Wed Aug 20 06:02:13 2008
@@ -237,7 +237,7 @@
                             output, key_len);
 	/*output = (unsigned char*)axutil_string_substring_starting_at((axis2_char_t*)output, offset);*/
 	dk_id = (axis2_char_t*)oxs_util_generate_id(env, (axis2_char_t*)OXS_DERIVED_ID);
-	dk_name = axutil_stracat(env, "#", dk_id);
+	dk_name = axutil_stracat(env, OXS_LOCAL_REFERENCE_PREFIX, dk_id);
 
 	status = status && oxs_key_populate(derived_key, env, (unsigned char*)(output+offset), dk_name, length, OXS_KEY_USAGE_DERIVED);
 	AXIS2_FREE(env->allocator, output);

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_binary_security_token.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_binary_security_token.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_binary_security_token.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_binary_security_token.c Wed Aug 20 06:02:13 2008
@@ -15,22 +15,19 @@
  * limitations under the License.
  */
 
-#include <axis2_util.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <oxs_utility.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-#include <rampart_constants.h>
 
+/**
+ * Creates <wsse:BinarySecurityToken> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_binary_security_token_element(const axutil_env_t *env,
-        axiom_node_t *parent,
-        axis2_char_t* id,
-        axis2_char_t* encoding_type,
-        axis2_char_t* value_type,
-        axis2_char_t* data)
+oxs_token_build_binary_security_token_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* id,
+    axis2_char_t* encoding_type,
+    axis2_char_t* value_type,
+    axis2_char_t* data)
 {
     axiom_node_t *binary_security_token_node = NULL;
     axiom_node_t *first_child_of_parent = NULL;
@@ -42,49 +39,57 @@
     axiom_namespace_t *ns_obj = NULL;
     axiom_namespace_t *ns = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS,
-                                    OXS_WSSE);
-
+    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS, OXS_WSSE);
     ns = axiom_namespace_create(env,RAMPART_WSU_XMLNS,OXS_WSU);
 
-    binary_security_token_ele = axiom_element_create(env, parent, OXS_NODE_BINARY_SECURITY_TOKEN, ns_obj, &binary_security_token_node);
+    binary_security_token_ele = axiom_element_create(
+        env, parent, OXS_NODE_BINARY_SECURITY_TOKEN, ns_obj, &binary_security_token_node);
     if (!binary_security_token_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating Binary Security Token element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]Error creating %s element.", OXS_NODE_BINARY_SECURITY_TOKEN);
+        axiom_namespace_free(ns_obj, env);
+        axiom_namespace_free(ns, env);
         return NULL;
     }
 
-    /*Binary security token must be added as the first child of the paretn*/
+    /* Binary security token must be added as the first child of the paretn */
     binary_security_token_node = axiom_node_detach(binary_security_token_node, env);
     first_child_of_parent = axiom_node_get_first_element(parent, env);
-    if(first_child_of_parent){
-        /*If there is a child add bst before it*/
+    if(first_child_of_parent)
+    {
+        /* If there is a child add bst before it */
         axiom_node_insert_sibling_before(first_child_of_parent, env, binary_security_token_node);
-    }else{
-        /*If there are no children just add the bst*/
+    }
+    else
+    {
+        /* If there are no children just add the bst */
         axiom_node_add_child(parent, env, binary_security_token_node);
     }
-    if (!id)
+
+    if(!id)
     {
         id = oxs_util_generate_id(env,(axis2_char_t*)OXS_CERT_ID);
     }
 
-
     id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id,ns);
     encoding_type_att =  axiom_attribute_create(env, OXS_ATTR_ENCODING_TYPE, encoding_type, NULL);
     value_type_att =  axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE, value_type, NULL);
 
-    ret = axiom_element_add_attribute(binary_security_token_ele, env, id_attr, binary_security_token_node);
-    ret = axiom_element_add_attribute(binary_security_token_ele, env, encoding_type_att, binary_security_token_node);
-    ret = axiom_element_add_attribute(binary_security_token_ele, env, value_type_att, binary_security_token_node);
+    ret = axiom_element_add_attribute(
+        binary_security_token_ele, env, id_attr, binary_security_token_node);
+    ret = axiom_element_add_attribute(
+        binary_security_token_ele, env, encoding_type_att, binary_security_token_node);
+    ret = axiom_element_add_attribute(
+        binary_security_token_ele, env, value_type_att, binary_security_token_node);
 
-    if(data){
-        ret  = axiom_element_set_text(binary_security_token_ele, env, data, binary_security_token_node);
+    if(data)
+    {
+        ret = axiom_element_set_text(
+            binary_security_token_ele, env, data, binary_security_token_node);
     }
 
     return binary_security_token_node;
-
 }
 
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_c14n_method.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_c14n_method.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_c14n_method.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_c14n_method.c Wed Aug 20 06:02:13 2008
@@ -15,19 +15,17 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
-#include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
 
+#include <oxs_tokens.h>
 
+/**
+ * Creates <ds:CanonicalizationMethod> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_c14n_method_element(const axutil_env_t *env,
-                                    axiom_node_t *parent,
-                                    axis2_char_t* algorithm
-                                   )
+oxs_token_build_c14n_method_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* algorithm)
 {
     axiom_node_t *c14n_method_node = NULL;
     axiom_element_t *c14n_method_ele = NULL;
@@ -35,56 +33,59 @@
     int ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
-                                    OXS_DS);
-
-    c14n_method_ele = axiom_element_create(env, parent, OXS_NODE_CANONICALIZATION_METHOD, ns_obj, &c14n_method_node);
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS, OXS_DS);
+    c14n_method_ele = axiom_element_create(
+        env, parent, OXS_NODE_CANONICALIZATION_METHOD, ns_obj, &c14n_method_node);
+    
     if (!c14n_method_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating c14n method element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]Error creating %s Token element.", OXS_NODE_CANONICALIZATION_METHOD);
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
-    /*If c14n algorithm is NULL then use the default*/
-    if (!algorithm)
+    
+    /* If c14n algorithm is NULL then use the default */
+    if(!algorithm)
     {
         algorithm = (axis2_char_t*)OXS_HREF_XML_EXC_C14N;
     }
 
     algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);
-
     ret = axiom_element_add_attribute(c14n_method_ele, env, algo_attr, c14n_method_node);
-
     return c14n_method_node;
-
 }
 
 
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-oxs_token_get_c14n_method(const axutil_env_t *env, axiom_node_t *c14n_mtd_node)
+oxs_token_get_c14n_method(
+    const axutil_env_t *env, 
+    axiom_node_t *c14n_mtd_node)
 {
     axis2_char_t *c14n_mtd = NULL;
     axiom_element_t *c14n_mtd_ele = NULL;
 
-    if(!c14n_mtd_node){
+    if(!c14n_mtd_node)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]CanonicalizationMethod node is not valid.");
         return NULL;
     }
 
     c14n_mtd_ele = axiom_node_get_data_element(c14n_mtd_node, env);
     if (!c14n_mtd_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving c14n method element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error retrieving c14n method element.");
         return NULL;
     }
 
     c14n_mtd = axiom_element_get_attribute_value_by_name(c14n_mtd_ele, env, OXS_ATTR_ALGORITHM);
-    if((!c14n_mtd) ||(0 == axutil_strcmp("", c14n_mtd))){
+    if((!c14n_mtd) ||(!axutil_strcmp("", c14n_mtd)))
+    {
         return NULL;
     }
 
     return c14n_mtd;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_data.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_data.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_data.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_data.c Wed Aug 20 06:02:13 2008
@@ -15,31 +15,28 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <axiom_element.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <oxs_axiom.h>
-
 
+/**
+ * Creates <xenc:CipherData> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_cipher_data_element(const axutil_env_t *env,
-                                    axiom_node_t *parent
-                                   )
+oxs_token_build_cipher_data_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent)
 {
     axiom_node_t *cipher_data_node = NULL;
     axiom_element_t *cipher_data_ele = NULL;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
-                                    OXS_XENC);
-
-    cipher_data_ele = axiom_element_create(env, parent, OXS_NODE_CIPHER_DATA, ns_obj, &cipher_data_node);
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC);
+    cipher_data_ele = axiom_element_create(
+        env, parent, OXS_NODE_CIPHER_DATA, ns_obj, &cipher_data_node);
+    
     if (!cipher_data_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating cipher data element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating cipher data element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
@@ -47,17 +44,25 @@
 }
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-oxs_token_get_cipher_value_from_cipher_data(const axutil_env_t *env,
-        axiom_node_t *cd_node)
+oxs_token_get_cipher_value_from_cipher_data(
+    const axutil_env_t *env,
+    axiom_node_t *cd_node)
 {
     axiom_node_t *cv_node = NULL;
     axis2_char_t *value = NULL;
-    /*First check direct <CipherValue>*/
-    cv_node = oxs_axiom_get_first_child_node_by_name(env, cd_node, OXS_NODE_CIPHER_VALUE, OXS_ENC_NS, OXS_XENC);
-    if(cv_node){
+    
+    /* First check direct <CipherValue> */
+    cv_node = oxs_axiom_get_first_child_node_by_name(
+        env, cd_node, OXS_NODE_CIPHER_VALUE, OXS_ENC_NS, OXS_XENC);
+    
+    if(cv_node)
+    {
         value = oxs_token_get_cipher_value(env, cv_node);
-    }else{
-        /*If not then check for <CipherReference URI?>*/
+    }
+    else
+    {
+        /* If not then check for <CipherReference URI?> */
+        /* TODO */
     }
 
     return value;

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_value.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_value.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_value.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_cipher_value.c Wed Aug 20 06:02:13 2008
@@ -15,44 +15,43 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_element.h>
-#include <oxs_axiom.h>
-
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-oxs_token_get_cipher_value(const axutil_env_t *env,
-                           axiom_node_t *cv_node)
+oxs_token_get_cipher_value(
+    const axutil_env_t *env,
+    axiom_node_t *cv_node)
 {
     axis2_char_t *cv = NULL;
-    /*TODO Verification*/
+    
+    /* TODO Verification */
+
     cv = (axis2_char_t*)oxs_axiom_get_node_content(env, cv_node);
     return cv;
-
 }
 
+/**
+ * Creates <xenc:CipherValue> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_cipher_value_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     axis2_char_t* cipher_val
-                                    )
+oxs_token_build_cipher_value_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* cipher_val)
 {
     axiom_node_t *cipher_value_node = NULL;
     axiom_element_t *cipher_value_ele = NULL;
     axis2_status_t ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
-                                    OXS_XENC);
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC);
 
-    cipher_value_ele = axiom_element_create(env, parent, OXS_NODE_CIPHER_VALUE, ns_obj, &cipher_value_node);
-    if (!cipher_value_ele)
+    cipher_value_ele = axiom_element_create(
+        env, parent, OXS_NODE_CIPHER_VALUE, ns_obj, &cipher_value_node);
+    if(!cipher_value_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating cipher value element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating cipher value element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
@@ -62,6 +61,5 @@
     }
 
     return cipher_value_node;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_data_reference.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_data_reference.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_data_reference.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_data_reference.c Wed Aug 20 06:02:13 2008
@@ -15,18 +15,16 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-
 
+/**
+ * Creates <xenc:DataReference> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_data_reference_element(const axutil_env_t *env,
-                                       axiom_node_t *parent,
-                                       axis2_char_t *data_ref)
+oxs_token_build_data_reference_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t *data_ref)
 {
     axiom_node_t *data_reference_node = NULL;
     axiom_element_t *data_reference_ele = NULL;
@@ -34,31 +32,31 @@
     int ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
-                                    OXS_XENC);
-
-    data_reference_ele = axiom_element_create(env, parent, OXS_NODE_DATA_REFERENCE, ns_obj, &data_reference_node);
-    if (!data_reference_ele)
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC);
+    data_reference_ele = axiom_element_create(
+        env, parent, OXS_NODE_DATA_REFERENCE, ns_obj, &data_reference_node);
+    if(!data_reference_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating data reference element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating data reference element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
-    /*attach empty string*/
-    if (!data_ref)
+
+    if(!data_ref)
     {
+        /* attach empty string */
         data_ref = "";
     }
 
     data_ref_attr =  axiom_attribute_create(env, OXS_ATTR_URI , data_ref, NULL);
-
     ret = axiom_element_add_attribute(data_reference_ele, env, data_ref_attr, data_reference_node);
-
     return data_reference_node;
 }
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-oxs_token_get_data_reference(const axutil_env_t *env, axiom_node_t *data_ref_node)
+oxs_token_get_data_reference(
+    const axutil_env_t *env, 
+    axiom_node_t *data_ref_node)
 {
     axis2_char_t *data_ref = NULL;
     axiom_element_t *data_reference_ele = NULL;
@@ -66,13 +64,11 @@
     data_reference_ele = axiom_node_get_data_element(data_ref_node, env);
     if (!data_reference_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving data reference element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart]Error retrieving data reference element.");
         return NULL;
     }
 
     data_ref = axiom_element_get_attribute_value_by_name(data_reference_ele, env, OXS_ATTR_URI);
     return data_ref;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_derived_key_token.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_derived_key_token.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_derived_key_token.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_derived_key_token.c Wed Aug 20 06:02:13 2008
@@ -15,20 +15,18 @@
  * limitations under the License.
  */
 
-#include <axis2_util.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <oxs_utility.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-#include <rampart_constants.h>
 
+/**
+ * Creates <wsc:DerivedKeyToken> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_derived_key_token_element(const axutil_env_t *env,
-        axiom_node_t *parent,
-        axis2_char_t* id,
-        axis2_char_t* algo)
+oxs_token_build_derived_key_token_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* id,
+    axis2_char_t* algo, 
+    axis2_char_t* wsc_ns_uri)
 {
     axiom_node_t *derived_key_token_node = NULL;
     axiom_element_t *derived_key_token_ele = NULL;
@@ -38,22 +36,33 @@
     axiom_namespace_t *ns_obj = NULL;
     axiom_namespace_t *ns = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_WSC_NS,
-                                    OXS_WSC);
+    if(!wsc_ns_uri)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]Error creating %s Token element. SecConv namespace uri is not valid.", 
+            OXS_NODE_DERIVED_KEY_TOKEN);
+        return NULL;
+    }
 
+    ns_obj = axiom_namespace_create(env, wsc_ns_uri, OXS_WSC);
     ns = axiom_namespace_create(env, RAMPART_WSU_XMLNS, OXS_WSU);
 
-    derived_key_token_ele = axiom_element_create(env, parent, OXS_NODE_DERIVED_KEY_TOKEN, ns_obj, &derived_key_token_node);
+    derived_key_token_ele = axiom_element_create(
+        env, parent, OXS_NODE_DERIVED_KEY_TOKEN, ns_obj, &derived_key_token_node);
     if (!derived_key_token_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating %s Token element", OXS_NODE_DERIVED_KEY_TOKEN);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]Error creating %s Token element", OXS_NODE_DERIVED_KEY_TOKEN);
+        axiom_namespace_free(ns_obj, env);
+        axiom_namespace_free(ns, env);
         return NULL;
     }
 
-    if(algo){
+    if(algo)
+    {
         algo_att =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algo, NULL);
-        ret = axiom_element_add_attribute(derived_key_token_ele, env, algo_att, derived_key_token_node);
+        ret = axiom_element_add_attribute(
+            derived_key_token_ele, env, algo_att, derived_key_token_node);
     }
 
     if (!id)
@@ -61,11 +70,8 @@
         id = oxs_util_generate_id(env,(axis2_char_t*)OXS_DERIVED_ID);
     }
 
-
     id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id,ns);
-
     ret = axiom_element_add_attribute(derived_key_token_ele, env, id_attr, derived_key_token_node);
-
     return derived_key_token_node;
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_method.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_method.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_method.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_method.c Wed Aug 20 06:02:13 2008
@@ -15,19 +15,16 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-
 
+/**
+ * Creates <ds:DigestMethod> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_digest_method_element(const axutil_env_t *env,
-                                      axiom_node_t *parent,
-                                      axis2_char_t* algorithm
-                                     )
+oxs_token_build_digest_method_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* algorithm)
 {
     axiom_node_t *digest_method_node = NULL;
     axiom_element_t *digest_method_ele = NULL;
@@ -35,56 +32,57 @@
     int ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
-                                    OXS_DS);
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS, OXS_DS);
+    digest_method_ele = axiom_element_create(
+        env, parent, OXS_NODE_DIGEST_METHOD, ns_obj, &digest_method_node);
 
-    digest_method_ele = axiom_element_create(env, parent, OXS_NODE_DIGEST_METHOD, ns_obj, &digest_method_node);
     if (!digest_method_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating digest method element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating digest method element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
-    /*If digest algorithm is NULL then use the default*/
-    if (!algorithm)
+
+    /* If digest algorithm is NULL then use the default */
+    if(!algorithm)
     {
         algorithm = (axis2_char_t*)OXS_HREF_SHA1;
     }
 
     algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);
-
     ret = axiom_element_add_attribute(digest_method_ele, env, algo_attr, digest_method_node);
-
     return digest_method_node;
-
 }
 
 
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-oxs_token_get_digest_method(const axutil_env_t *env, axiom_node_t *digest_mtd_node)
+oxs_token_get_digest_method(
+    const axutil_env_t *env, 
+    axiom_node_t *digest_mtd_node)
 {
     axis2_char_t *digest_mtd = NULL;
     axiom_element_t *digest_mtd_ele = NULL;
 
-    if(!digest_mtd_node){
+    if(!digest_mtd_node)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error retrieving digest method node.");
         return NULL;
     }
 
     digest_mtd_ele = axiom_node_get_data_element(digest_mtd_node, env);
-    if (!digest_mtd_ele)
+    if(!digest_mtd_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving digest method element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error retrieving digest method element.");
         return NULL;
     }
 
     digest_mtd = axiom_element_get_attribute_value_by_name(digest_mtd_ele, env, OXS_ATTR_ALGORITHM);
-    if((!digest_mtd) ||(0 == axutil_strcmp("", digest_mtd))){
+    if((!digest_mtd) ||(!axutil_strcmp("", digest_mtd)))
+    {
         return NULL;
     }
 
     return digest_mtd;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_value.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_value.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_value.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_digest_value.c Wed Aug 20 06:02:13 2008
@@ -15,53 +15,50 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_element.h>
-#include <oxs_axiom.h>
-
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-oxs_token_get_digest_value(const axutil_env_t *env,
-                           axiom_node_t *digest_val_node)
+oxs_token_get_digest_value(
+    const axutil_env_t *env,
+    axiom_node_t *digest_val_node)
 {
     axis2_char_t *digest_val = NULL;
-    /*TODO Verification*/
+
+    /* TODO Verification */
     digest_val = (axis2_char_t*)oxs_axiom_get_node_content(env, digest_val_node);
     return digest_val;
-
 }
 
+/**
+ * Creates <ds:DigestValue> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_digest_value_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     axis2_char_t* digest_val
-                                    )
+oxs_token_build_digest_value_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* digest_val)
 {
     axiom_node_t *digest_value_node = NULL;
     axiom_element_t *digest_value_ele = NULL;
     axis2_status_t ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
-                                    OXS_DS);
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS, OXS_DS);
 
-    digest_value_ele = axiom_element_create(env, parent, OXS_NODE_DIGEST_VALUE, ns_obj, &digest_value_node);
-    if (!digest_value_ele)
+    digest_value_ele = axiom_element_create(
+        env, parent, OXS_NODE_DIGEST_VALUE, ns_obj, &digest_value_node);
+    if(!digest_value_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating digest value element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating digest value element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
-    if (digest_val)
+    if(digest_val)
     {
         ret  = axiom_element_set_text(digest_value_ele, env, digest_val, digest_value_node);
     }
 
     return digest_value_node;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_ds_reference.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_ds_reference.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_ds_reference.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_ds_reference.c Wed Aug 20 06:02:13 2008
@@ -15,50 +15,51 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-
 
+/**
+ * Creates <ds:Reference> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_ds_reference_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     axis2_char_t *id,
-                                     axis2_char_t *uri,
-                                     axis2_char_t *type)
+oxs_token_build_ds_reference_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t *id,
+    axis2_char_t *uri,
+    axis2_char_t *type)
 {
     axiom_node_t *ds_reference_node = NULL;
     axiom_element_t *ds_reference_ele = NULL;
     int ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
-                                    OXS_DS);
-
-    ds_reference_ele = axiom_element_create(env, parent, OXS_NODE_REFERENCE, ns_obj, &ds_reference_node);
-    if (!ds_reference_ele)
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS, OXS_DS);
+    ds_reference_ele = axiom_element_create(
+        env, parent, OXS_NODE_REFERENCE, ns_obj, &ds_reference_node);
+    
+    if(!ds_reference_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating ds:Reference element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating ds:Reference element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
-    if(id){
+    if(id)
+    {
         axiom_attribute_t *id_attr = NULL;
         id_attr =  axiom_attribute_create(env, OXS_ATTR_ID , id, NULL);
         ret = axiom_element_add_attribute(ds_reference_ele, env, id_attr, ds_reference_node);
     }
 
-    if(uri){
+    if(uri)
+    {
         axiom_attribute_t *uri_attr = NULL;
         uri_attr =  axiom_attribute_create(env, OXS_ATTR_URI , uri, NULL);
         ret = axiom_element_add_attribute(ds_reference_ele, env, uri_attr, ds_reference_node);
     }
 
-    if(type){
+    if(type)
+    {
         axiom_attribute_t *type_attr = NULL;
         type_attr =  axiom_attribute_create(env, OXS_ATTR_TYPE , type, NULL);
         ret = axiom_element_add_attribute(ds_reference_ele, env, type_attr, ds_reference_node);
@@ -68,7 +69,9 @@
 }
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-oxs_token_get_ds_reference(const axutil_env_t *env, axiom_node_t *ref_node)
+oxs_token_get_ds_reference(
+    const axutil_env_t *env, 
+    axiom_node_t *ref_node)
 {
     axis2_char_t *ref = NULL;
     axiom_element_t *reference_ele = NULL;
@@ -76,14 +79,12 @@
     reference_ele = axiom_node_get_data_element(ref_node, env);
     if (!reference_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving data reference element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart]Error retrieving data reference element.");
         return NULL;
     }
 
     ref = axiom_element_get_attribute_value_by_name(reference_ele, env, OXS_ATTR_URI);
     return ref;
-
 }
 
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_embedded.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_embedded.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_embedded.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_embedded.c Wed Aug 20 06:02:13 2008
@@ -15,21 +15,16 @@
  * limitations under the License.
  */
 
-#include <axis2_util.h>
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-#include <oxs_utility.h>
-
-
 
+/**
+ * Creates <wsse:Embedded> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_embedded_element(const axutil_env_t *env,
-                                 axiom_node_t *parent,
-                                 axis2_char_t* id)
+oxs_token_build_embedded_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* id)
 {
     axiom_node_t *embedded_node = NULL;
     axiom_element_t *embedded_ele = NULL;
@@ -37,47 +32,42 @@
     int ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS,
-                                    OXS_WSSE);
-
+    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS, OXS_WSSE);
     embedded_ele = axiom_element_create(env, parent, OXS_NODE_EMBEDDED, ns_obj, &embedded_node);
-    if (!embedded_ele)
+   
+    if(!embedded_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating embedded element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating embedded element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
-    if (!id)
+
+    if(!id)
     {
         id = oxs_util_generate_id(env,(axis2_char_t*)OXS_EMBEDDED_ID);
     }
 
     id_attr =  axiom_attribute_create(env, OXS_ATTR_ID, id, NULL);
-
     ret = axiom_element_add_attribute(embedded_ele, env, id_attr, embedded_node);
-
     return embedded_node;
-
 }
 
-
-
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-oxs_token_get_embedded_id(const axutil_env_t *env, axiom_node_t *embedded_node)
+oxs_token_get_embedded_id(
+    const axutil_env_t *env, 
+    axiom_node_t *embedded_node)
 {
     axis2_char_t *embedded = NULL;
     axiom_element_t *embedded_ele = NULL;
 
     embedded_ele = axiom_node_get_data_element(embedded_node, env);
-    if (!embedded_ele)
+    if(!embedded_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving embedded element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error retrieving embedded element.");
         return NULL;
     }
 
     embedded = axiom_element_get_attribute_value_by_name(embedded_ele, env, OXS_ATTR_ID);
     return embedded;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_data.c Wed Aug 20 06:02:13 2008
@@ -15,22 +15,17 @@
  * limitations under the License.
  */
 
-#include <axis2_util.h>
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-#include <oxs_utility.h>
-
 
+/**
+ * Creates <xenc:EncryptedData> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_encrypted_data_element(const axutil_env_t *env,
-                                       axiom_node_t *parent,
-                                       axis2_char_t* type_attribute,
-                                       axis2_char_t* id
-                                      )
+oxs_token_build_encrypted_data_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* type_attribute,
+    axis2_char_t* id)
 {
     axiom_node_t *encrypted_data_node = NULL;
     axiom_element_t *encrypted_data_ele = NULL;
@@ -39,14 +34,13 @@
     axiom_namespace_t *ns_obj = NULL;
     int ret;
 
-    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
-                                    OXS_XENC);
-
-    encrypted_data_ele = axiom_element_create(env, parent, OXS_NODE_ENCRYPTED_DATA, ns_obj, &encrypted_data_node);
-    if (!encrypted_data_ele)
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC);
+    encrypted_data_ele = axiom_element_create(
+        env, parent, OXS_NODE_ENCRYPTED_DATA, ns_obj, &encrypted_data_node);
+    if(!encrypted_data_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating encrypted data element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating encrypted data element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
@@ -56,15 +50,13 @@
         ret = axiom_element_add_attribute(encrypted_data_ele, env, type_attr, encrypted_data_node);
     }
 
-
-
-    if(!id){
+    if(!id)
+    {
         id = oxs_util_generate_id(env, (axis2_char_t*)OXS_ENCDATA_ID);
     }
     id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, NULL );
     ret = axiom_element_add_attribute(encrypted_data_ele, env, id_attr, encrypted_data_node);
 
     return encrypted_data_node;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_header.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_header.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_header.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_header.c Wed Aug 20 06:02:13 2008
@@ -15,19 +15,16 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-
-
 
+/**
+* Creates <wss11:EncryptedHeader> element
+*/
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_enc_header_element(const axutil_env_t *env,
-                                  axiom_node_t *parent,
-                                  axis2_char_t* id)
+oxs_token_build_enc_header_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* id)
 {
     axiom_node_t *enc_header_node = NULL;
     axiom_element_t *enc_header_ele = NULL;
@@ -35,25 +32,22 @@
     axiom_namespace_t *ns_obj = NULL;
     int ret;
 
-    ns_obj = axiom_namespace_create(env, OXS_WSSE_11_XMLNS,
-                                    OXS_WSSE_11);
-
-    enc_header_ele = axiom_element_create(env, parent, OXS_NODE_SIGNATURE, ns_obj, &enc_header_node);
-    if (!enc_header_ele)
+    ns_obj = axiom_namespace_create(env, OXS_WSSE_11_XMLNS, OXS_WSSE_11);
+    enc_header_ele = axiom_element_create(
+        env, parent, OXS_NODE_ENCRYPTED_HEADER, ns_obj, &enc_header_node);
+    if(!enc_header_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating wss11:EncryptedHeader element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating EncryptedHeader element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
-    /*If id is not NULL then add it as an attribute*/
-    if (id)
+    if(id)
     {
         id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, NULL);
         ret = axiom_element_add_attribute(enc_header_ele, env, id_attr, enc_header_node);
     }
 
     return enc_header_node;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_key.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_key.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_key.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encrypted_key.c Wed Aug 20 06:02:13 2008
@@ -15,47 +15,41 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-
-/*TODO These names should be changed to oxs_token_build_XXX_node*/
 
+/**
+ * Creates <xenc:EncryptedKey> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_encrypted_key_element(const axutil_env_t *env,
-                                      axiom_node_t *parent)
+oxs_token_build_encrypted_key_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent)
 {
     axiom_node_t *encrypted_key_node = NULL;
     axiom_element_t *encrypted_key_ele = NULL;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
-                                    OXS_XENC);
-
-    encrypted_key_ele = axiom_element_create(env, parent, OXS_NODE_ENCRYPTED_KEY, ns_obj, &encrypted_key_node);
-    if (!encrypted_key_ele)
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC);
+    encrypted_key_ele = axiom_element_create(
+        env, parent, OXS_NODE_ENCRYPTED_KEY, ns_obj, &encrypted_key_node);
+    if(!encrypted_key_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating encrypted key element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating encrypted key element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
-
-
     return encrypted_key_node;
-
 }
 
 
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_get_encrypted_key_node(const axutil_env_t *env,
-                                 axiom_node_t *parent)
+oxs_token_get_encrypted_key_node(
+    const axutil_env_t *env,
+    axiom_node_t *parent)
 {
     axiom_node_t *enc_key_node = NULL;
 
-    /*TODO*/
+    /* TODO */
     return enc_key_node;
 }

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encryption_method.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encryption_method.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encryption_method.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_encryption_method.c Wed Aug 20 06:02:13 2008
@@ -15,19 +15,16 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-
 
+/**
+* Creates <xenc:EncryptionMethod> element
+*/
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_encryption_method_element(const axutil_env_t *env,
-        axiom_node_t *parent,
-        axis2_char_t* algorithm
-                                         )
+oxs_token_build_encryption_method_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* algorithm)
 {
     axiom_node_t *encryption_method_node = NULL;
     axiom_element_t *encryption_method_ele = NULL;
@@ -35,55 +32,57 @@
     int ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
-                                    OXS_XENC);
-
-    encryption_method_ele = axiom_element_create(env, parent, OXS_NODE_ENCRYPTION_METHOD, ns_obj, &encryption_method_node);
-    if (!encryption_method_ele)
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS, OXS_XENC);
+    encryption_method_ele = axiom_element_create(
+        env, parent, OXS_NODE_ENCRYPTION_METHOD, ns_obj, &encryption_method_node);
+    if(!encryption_method_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating encryption method element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "[rampart]Error creating encryption method element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
-    /*Fixed bug. If kt algorithm is NULL then use the default*/
-    if (!algorithm)
+
+    /* If kt algorithm is NULL then use the default */
+    if(!algorithm)
     {
         algorithm = (axis2_char_t*)OXS_DEFAULT_KT_ALGO_HREF;
     }
 
     algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);
-
     ret = axiom_element_add_attribute(encryption_method_ele, env, algo_attr, encryption_method_node);
-
     return encryption_method_node;
-
 }
 
 
 
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
-oxs_token_get_encryption_method(const axutil_env_t *env, axiom_node_t *enc_mtd_node)
+oxs_token_get_encryption_method(
+    const axutil_env_t *env, 
+    axiom_node_t *enc_mtd_node)
 {
     axis2_char_t *enc_mtd = NULL;
     axiom_element_t *enc_mtd_ele = NULL;
 
-    if(!enc_mtd_node){
+    if(!enc_mtd_node)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,"[rampart]Error retrieving encryption method node.");
         return NULL;
     }
 
     enc_mtd_ele = axiom_node_get_data_element(enc_mtd_node, env);
-    if (!enc_mtd_ele)
+    if(!enc_mtd_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving encryption method element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "[rampart]Error retrieving encryption method element.");
         return NULL;
     }
 
     enc_mtd = axiom_element_get_attribute_value_by_name(enc_mtd_ele, env, OXS_ATTR_ALGORITHM);
-    if((!enc_mtd) ||(0 == axutil_strcmp("", enc_mtd))){
+    if((!enc_mtd) ||(!axutil_strcmp("", enc_mtd)))
+    {
         return NULL;
     }
     return enc_mtd;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_generation.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_generation.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_generation.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_generation.c Wed Aug 20 06:02:13 2008
@@ -15,43 +15,49 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_element.h>
-#include <oxs_axiom.h>
-
 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-oxs_token_get_generation_value(const axutil_env_t *env,
-                           axiom_node_t *generation_node)
+oxs_token_get_generation_value(
+    const axutil_env_t *env,
+    axiom_node_t *generation_node)
 {
     axis2_char_t *value = NULL;
     value = (axis2_char_t*)oxs_axiom_get_node_content(env, generation_node);
     return value;
-
 }
 
+/**
+ * Creates <wsc:Generation> element
+ */
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_generation_element(const axutil_env_t *env,
-                                     axiom_node_t *parent,
-                                     axis2_char_t* generation_val
-                                    )
+oxs_token_build_generation_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t *generation_val, 
+    axis2_char_t *wsc_ns_uri)
 {
     axiom_node_t *generation_node = NULL;
     axiom_element_t *generation_ele = NULL;
     axis2_status_t ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_WSC_NS,
-                                    OXS_WSC);
-
-    generation_ele = axiom_element_create(env, parent, OXS_NODE_OFFSET, ns_obj, &generation_node);
+    if(!wsc_ns_uri)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]Error creating %s Token element. SecConv namespace uri is not valid.", 
+            OXS_NODE_GENERATION);
+        return NULL;
+    }
+    
+    ns_obj = axiom_namespace_create(env, wsc_ns_uri, OXS_WSC);
+    generation_ele = axiom_element_create(
+        env, parent, OXS_NODE_GENERATION, ns_obj, &generation_node);
     if (!generation_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating %s element", OXS_NODE_OFFSET);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+            "[rampart]Error creating %s Token element.", OXS_NODE_GENERATION);
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
@@ -59,8 +65,6 @@
     {
         ret  = axiom_element_set_text(generation_ele, env, generation_val, generation_node);
     }
-
     return generation_node;
-
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_key_identifier.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_key_identifier.c?rev=687308&r1=687307&r2=687308&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_key_identifier.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_key_identifier.c Wed Aug 20 06:02:13 2008
@@ -15,20 +15,18 @@
  * limitations under the License.
  */
 
-#include <stdio.h>
-#include <oxs_constants.h>
-#include <oxs_error.h>
 #include <oxs_tokens.h>
-#include <axiom_attribute.h>
-#include <axiom_element.h>
-
 
+/**
+* Creates <wsse:KeyIdentifier> element
+*/
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
-oxs_token_build_key_identifier_element(const axutil_env_t *env,
-                                       axiom_node_t *parent,
-                                       axis2_char_t* encoding_type,
-                                       axis2_char_t* value_type,
-                                       axis2_char_t* value  )
+oxs_token_build_key_identifier_element(
+    const axutil_env_t *env,
+    axiom_node_t *parent,
+    axis2_char_t* encoding_type,
+    axis2_char_t* value_type,
+    axis2_char_t* value  )
 {
     axiom_node_t *ki_node = NULL;
     axiom_element_t *ki_ele = NULL;
@@ -37,35 +35,33 @@
     int ret;
     axiom_namespace_t *ns_obj = NULL;
 
-    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS,
-                                    OXS_WSSE);
-
+    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS, OXS_WSSE);
     ki_ele = axiom_element_create(env, parent, OXS_NODE_KEY_IDENTIFIER, ns_obj, &ki_node);
-    if (!ki_ele)
+    if(!ki_ele)
     {
-        oxs_error(env, OXS_ERROR_LOCATION,
-                  OXS_ERROR_ELEMENT_FAILED, "Error creating KeyIdentifier element");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart]Error creating KeyIdentifier element.");
+        axiom_namespace_free(ns_obj, env);
         return NULL;
     }
 
-    if (encoding_type)
+    if(encoding_type)
     {
-        encoding_type_att =  axiom_attribute_create(env, OXS_ATTR_ENCODING_TYPE, encoding_type, NULL);
+        encoding_type_att = axiom_attribute_create(
+            env, OXS_ATTR_ENCODING_TYPE, encoding_type, NULL);
         ret = axiom_element_add_attribute(ki_ele, env, encoding_type_att, ki_node);
     }
-    if (value_type)
+
+    if(value_type)
     {
         value_type_att =  axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE, value_type, NULL);
         ret = axiom_element_add_attribute(ki_ele, env, value_type_att, ki_node);
     }
 
-    if (value)
+    if(value)
     {
         ret  = axiom_element_set_text(ki_ele, env, value, ki_node);
     }
 
-
     return ki_node;
-
 }