You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/01/22 06:42:51 UTC

svn commit: r498532 - in /webservices/axis2/trunk/c/rampart: include/ samples/client/enc_echo/ src/handlers/ src/omxmlsec/openssl/ src/util/

Author: kaushalye
Date: Sun Jan 21 21:42:49 2007
New Revision: 498532

URL: http://svn.apache.org/viewvc?view=rev&rev=498532
Log:
1. Seperating handler specific logic with rampart core logic [JIRA-509]
2. Adding header comments


Added:
    webservices/axis2/trunk/c/rampart/include/rampart_sec_header_builder.h
    webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_builder.c
Modified:
    webservices/axis2/trunk/c/rampart/include/openssl_crypt.h
    webservices/axis2/trunk/c/rampart/include/oxs_buffer.h
    webservices/axis2/trunk/c/rampart/include/oxs_cipher.h
    webservices/axis2/trunk/c/rampart/include/oxs_ctx.h
    webservices/axis2/trunk/c/rampart/include/oxs_encryption.h
    webservices/axis2/trunk/c/rampart/include/oxs_error.h
    webservices/axis2/trunk/c/rampart/include/oxs_iv.h
    webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h
    webservices/axis2/trunk/c/rampart/include/oxs_utility.h
    webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h
    webservices/axis2/trunk/c/rampart/include/oxs_xml_encryption.h
    webservices/axis2/trunk/c/rampart/include/rampart_action.h
    webservices/axis2/trunk/c/rampart/include/rampart_authn_provider.h
    webservices/axis2/trunk/c/rampart/include/rampart_callback.h
    webservices/axis2/trunk/c/rampart/include/rampart_constants.h
    webservices/axis2/trunk/c/rampart/include/rampart_credentials.h
    webservices/axis2/trunk/c/rampart/include/rampart_crypto_util.h
    webservices/axis2/trunk/c/rampart/include/rampart_encryption.h
    webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h
    webservices/axis2/trunk/c/rampart/include/rampart_sec_header_processor.h
    webservices/axis2/trunk/c/rampart/include/rampart_sec_processed_result.h
    webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h
    webservices/axis2/trunk/c/rampart/include/rampart_username_token.h
    webservices/axis2/trunk/c/rampart/include/rampart_util.h
    webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt
    webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
    webservices/axis2/trunk/c/rampart/src/util/Makefile.am
    webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c

Modified: webservices/axis2/trunk/c/rampart/include/openssl_crypt.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_crypt.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_crypt.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_crypt.h Sun Jan 21 21:42:49 2007
@@ -34,19 +34,25 @@
  * @ingroup
  * @{
  */
-AXIS2_EXTERN int AXIS2_CALL openssl_bc_crypt(const axis2_env_t *env,
+
+/**
+ * Encrypt or decrypts data in the @input_buf and place the result in the @output_buf.
+ * This function works for block ciphers AES-128, AES-192, AES-256 and 3-DES
+ * The key and the cipher name must be specified in the cipher context.
+ * @env pointer to environment struct
+ * @oc_ctx  openssl block cipher context
+ * @input_buf the input buffer to en/decrypt
+ * @output_buf the output buffer to place en/decrypted result
+ * @encrypt For encryption encrypt=OPENSSL_ENCRYPT and for decryption encrypt=OPENSSL_DECRYPT
+ * @return the length of the en/decrypted result OR -1 if failed
+ */
+
+AXIS2_EXTERN int AXIS2_CALL 
+openssl_bc_crypt(const axis2_env_t *env,
         openssl_cipher_ctx_t *oc_ctx,
         oxs_buffer_t *input_buf,
         oxs_buffer_t *output_buf,
         int encrypt);
-/**
-*   
-*@param bc_ctx block cipher context
-*@param in_buf buffer to en/decrypt
-*@param out_buf buffer to place the en/decrypted data
-*@param do_encrypt 1 to encrypt 0 to decrypt
-*@return -1 if failed
-*/
 
 
 

Modified: webservices/axis2/trunk/c/rampart/include/oxs_buffer.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_buffer.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_buffer.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_buffer.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file oxs_buffer.h
-  * @brief 
+  * @brief The buffer representation in OMXMLSecurity. 
   */
 
 #include <axis2_defines.h>

Modified: webservices/axis2/trunk/c/rampart/include/oxs_cipher.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_cipher.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_cipher.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_cipher.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file oxs_cipher.h
-  * @brief 
+  * @brief Cipher related functions in OMXMLSecurity 
   */
 
 #include <axis2_defines.h>
@@ -33,29 +33,32 @@
 {
 #endif
 
-/**Get the cipher property  for the given url
-* @env pointer to environment struct
-* @url 	 the url as a string
-* @return the property 
-*/ 
+/**
+ * Get the cipher property  for the given url
+ * @env pointer to environment struct
+ * @url 	 the url as a string
+ * @return the property 
+ */ 
 AXIS2_EXTERN openssl_cipher_property_t *AXIS2_CALL
 oxs_get_cipher_property_for_url(const axis2_env_t *env,
                      axis2_char_t *url);
 
-/**Get the cipher name for the given url
-* @env pointer to environment struct
-* @url 	 the url as a string
-* @return the name as a string	
-*/ 
+/**
+ * Get the cipher name for the given url
+ * @env pointer to environment struct
+ * @url 	 the url as a string
+ * @return the name as a string	
+ */ 
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_get_cipher_name_for_url(const axis2_env_t *env,
                      axis2_char_t *url);
 
-/**Get the cipher url for the given name
-	*@env pointer to environment struct
-	*@name the name as a string
-	*@return the url as a string
-	*/
+/**
+ * Get the cipher url for the given name
+ *@env pointer to environment struct
+ *@name the name as a string
+ *@return the url as a string
+ */
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_get_cipher_url_for_name(const axis2_env_t *env,
                      axis2_char_t *name);

Modified: webservices/axis2/trunk/c/rampart/include/oxs_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_ctx.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_ctx.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_ctx.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file oxs_ctx.h
-  * @brief 
+  * @brief Keeps configurations for the OMXMLSecurity 
   */
 
 #include <axis2_defines.h>
@@ -56,108 +56,211 @@
 
     /** Type name for struct oxs_ctx_ops */
     typedef struct oxs_ctx_ops oxs_ctx_ops_t;
+
     /** Type name for struct oxs_ctx */
     typedef struct oxs_ctx oxs_ctx_t;
 
 
     struct oxs_ctx_ops
     {
-
+        /**
+         * Free function of the context
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         free)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * Returns the mode of the context
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return mode of the context 
+         */
         oxs_ctx_mode_t (AXIS2_CALL *
         get_mode)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return operation of the context 
+         */
         oxs_ctx_operation_t (AXIS2_CALL *
         get_operation)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         oxs_key_t *(AXIS2_CALL *
         get_key)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_id)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_type)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_mime_type)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_encoding)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_recipient)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_carried_key_name)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_enc_mtd_algorithm)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axis2_char_t *(AXIS2_CALL *
         get_input_data)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axiom_node_t *(AXIS2_CALL *
         get_enc_data_node)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axiom_node_t *(AXIS2_CALL *
         get_enc_method_node)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axiom_node_t *(AXIS2_CALL *
         get_key_info_node)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @return of the context 
+         */
         axiom_node_t *(AXIS2_CALL *
         get_cipher_value_node)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param mode the mode of operation, EncryptedData/EncryptedKey
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_mode)(
                     oxs_ctx_t *ctx,
@@ -165,6 +268,13 @@
                     oxs_ctx_mode_t mode
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param operation the operation Encrypt/Decrypt/Sign/Verify
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_operation)(
                     oxs_ctx_t *ctx,
@@ -172,12 +282,26 @@
                     oxs_ctx_operation_t operation
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param key the key used
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_key)(
                     oxs_ctx_t *ctx,
                     const axis2_env_t *env,
                     oxs_key_t *key
                     );
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param id the id of the context 
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_id)(
                     oxs_ctx_t *ctx,
@@ -185,6 +309,13 @@
                     axis2_char_t *id
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param type ???Depricated?
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_type)(
                     oxs_ctx_t *ctx,
@@ -192,6 +323,13 @@
                     axis2_char_t *type
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param mime_type the mime type used
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_mime_type)(
                     oxs_ctx_t *ctx,
@@ -199,6 +337,13 @@
                     axis2_char_t *mime_type
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param encoding the encoding used
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_encoding)(
                     oxs_ctx_t *ctx,
@@ -206,6 +351,13 @@
                     axis2_char_t *encoding
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param recipient name of recipient
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_recipient)(
                     oxs_ctx_t *ctx,
@@ -213,6 +365,13 @@
                     axis2_char_t *recipient
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param carried_key_name the key name 
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_carried_key_name)(
                     oxs_ctx_t *ctx,
@@ -220,6 +379,13 @@
                     axis2_char_t *carried_key_name
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param enc_mtd_algorithm the encryption method algorithm
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_enc_mtd_algorithm)(
                     oxs_ctx_t *ctx,
@@ -227,6 +393,13 @@
                     axis2_char_t *enc_mtd_algorithm
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param input_data the input data
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_input_data)(
                     oxs_ctx_t *ctx,
@@ -234,6 +407,13 @@
                     axis2_char_t *input_data
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param enc_data_node  reference to the EncryptionData node 
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_enc_data_node)(
                     oxs_ctx_t *ctx,
@@ -241,6 +421,13 @@
                     axiom_node_t *enc_data_node
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param enc_method_node  reference to the EncryptionMethod node 
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_enc_method_node)(
                     oxs_ctx_t *ctx,
@@ -248,6 +435,13 @@
                     axiom_node_t *enc_method_node
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param key_info_node  reference to the KeyInfo node  
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_key_info_node)(
                     oxs_ctx_t *ctx,
@@ -255,6 +449,13 @@
                     axiom_node_t *key_info_node
                     );
 
+        /**
+         * 
+         * @param ctx The OMXMLSecurity context 
+         * @param env pointer to environment struct
+         * @param cipher_value_node reference to the cipherValue node 
+         * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+         */
         axis2_status_t (AXIS2_CALL *
         set_cipher_value_node)(
                     oxs_ctx_t *ctx,
@@ -369,33 +570,6 @@
 #define OXS_CTX_SET_CIPHER_VALUE_NODE(ctx, env, cipher_value_node) \
         ((ctx)->ops->set_cipher_value_node(ctx, env, cipher_value_node) )
     
-
-/**
-  <complexType name='EncryptedType' abstract='true'>
-    <sequence>
-      <element name='EncryptionMethod' type='xenc:EncryptionMethodType' 
-               minOccurs='0'/>
-      <element ref='ds:KeyInfo' minOccurs='0'/>
-      <element ref='xenc:CipherData'/>
-      <element ref='xenc:EncryptionProperties' minOccurs='0'/>
-    </sequence>
-    <attribute name='Id' type='ID' use='optional'/>
-    <attribute name='Type' type='anyURI' use='optional'/>
-    <attribute name='MimeType' type='string' use='optional'/>
-    <attribute name='Encoding' type='anyURI' use='optional'/> 
-   </complexType>
-
-  <complexType name='EncryptionMethodType' mixed='true'>
-    <sequence>
-      <element name='KeySize' minOccurs='0' type='xenc:KeySizeType'/>
-      <element name='OAEPparams' minOccurs='0' type='base64Binary'/>
-      <any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
-    </sequence>
-    <attribute name='Algorithm' type='anyURI' use='required'/>
-  </complexType>
-
-
-*/
 
 
 

Modified: webservices/axis2/trunk/c/rampart/include/oxs_encryption.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_encryption.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_encryption.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_encryption.h Sun Jan 21 21:42:49 2007
@@ -37,16 +37,16 @@
 {
 #endif
 /**
-*En/Decrypts given data buffer depending on the information avalable in the encryption context using
-*a symmetric key.
-*The resulted data will be placed on the result buffer.
-*Data are not valid only if the method returns 	AXIS2_SUCCESS
-*@enc_ctx pointer to the OMXMLSec symmetric encryption context struct
-*@env pointer to environment struct
-*@input the input buffer	
-*@result the ouput or the ressulted data buffer		
-*@return AXIS2_SUCCESS on success, else AXIS2_FAILURE	
-*/	
+ * En/Decrypts given data buffer depending on the information avalable in the encryption context using
+ * a symmetric key.
+ * The resulted data will be placed on the result buffer.
+ * Data are not valid only if the method returns 	AXIS2_SUCCESS
+ * @enc_ctx pointer to the OMXMLSec symmetric encryption context struct
+ * @env pointer to environment struct
+ * @input the input buffer	
+ * @result the ouput or the ressulted data buffer		
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE	
+ */	
 AXIS2_EXTERN  axis2_status_t AXIS2_CALL
 oxs_encryption_symmetric_crypt(const axis2_env_t *env,
     oxs_ctx_t * enc_ctx,
@@ -54,16 +54,16 @@
     oxs_buffer_t *result);
 	
 /**
-*En/Decrypts given data buffer deoending on the information avalable in the encryption context using an
-*asymmetric key, which can be a publik key extracted from a certificate or a private key. 
-*The resulted data will be placed on the result buffer.
-*Data are not valid only if the method returns 	AXIS2_SUCCESS
-*@enc_ctx pointer to the OMXMLSec asymmetric encryption context struct
-*@env pointer to environment struct
-*@input the input buffer	
-*@result the ouput or the ressulted data buffer			
-*@return AXIS2_SUCCESS on success, else AXIS2_FAILURE	
-*/	
+ * En/Decrypts given data buffer deoending on the information avalable in the encryption context using an
+ * asymmetric key, which can be a publik key extracted from a certificate or a private key. 
+ * The resulted data will be placed on the result buffer.
+ * Data are not valid only if the method returns 	AXIS2_SUCCESS
+ * @enc_ctx pointer to the OMXMLSec asymmetric encryption context struct
+ * @env pointer to environment struct
+ * @input the input buffer	
+ * @result the ouput or the ressulted data buffer			
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE	
+ */	
 AXIS2_EXTERN  axis2_status_t AXIS2_CALL
 oxs_encryption_asymmetric_crypt(const axis2_env_t *env,
     oxs_asym_ctx_t * enc_ctx,

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=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_error.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_error.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file oxs_error.h
-  * @brief 
+  * @brief Represents an Error occured during the OMXMLSecurity execution 
   */
 
 #include <axis2_defines.h>
@@ -92,7 +92,7 @@
 oxs_errors_get_code(unsigned int pos);
 
 /**
- * Prints the error message
+ * Print/log the error message
  * @file:      file name
  * @line:      line number 
  * @func:      function 

Modified: webservices/axis2/trunk/c/rampart/include/oxs_iv.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_iv.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_iv.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_iv.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file oxs_key.h
-  * @brief 
+  * @brief Initial Vector related functionalities 
   */
 
 #include <axis2_defines.h>
@@ -37,7 +37,13 @@
 
 #define OXS_IV_DEFAULT    OPENSSL_DEFAULT_IV16
 
-
+/*TODO: Remove. No longer in use????*/
+/**
+ * Generates an Initial Vector(IV) for the given algorithm
+ * @param env pointer to environment struct
+ * @param key_algo the algorithm
+ * @return the generated IV 
+ */
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_iv_generate_for_algo(const axis2_env_t *env, 
                             axis2_char_t *key_algo);

Modified: webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h Sun Jan 21 21:42:49 2007
@@ -20,8 +20,8 @@
 
 
 /**
-  * @file oxs_encryption.h
-  * @brief 
+  * @file oxs_key_mgr.h
+  * @brief the Key Manager responsible for loading keys for OMXMLSecurity
   */
 
 #include <axis2_defines.h>
@@ -40,12 +40,12 @@
 #endif
 	
 /**
-*Loads keys/certificates from a keystore or a PEm file depending on information available in the @ctx
-*@ctx pointer to the OMXMLSec asymmetric encryption context struct
-*@env pointer to environment struct
-*@password the password for the key store
-*@return AXIS2_SUCCESS on success, else AXIS2_FAILURE	
-*/	
+ * Loads keys/certificates from a keystore or a PEm file depending on information available in the @ctx
+ * @ctx pointer to the OMXMLSec asymmetric encryption context struct
+ * @env pointer to environment struct
+ * @password the password for the key store
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE	
+ */	
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_key_mgr_load_key(const axis2_env_t *env,
     oxs_asym_ctx_t *ctx,

Modified: webservices/axis2/trunk/c/rampart/include/oxs_utility.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_utility.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_utility.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_utility.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file oxs_utilty.h
-  * @brief 
+  * @brief The utility module for OMXMLSecurity 
   */
 
 #include <axis2_defines.h>
@@ -32,15 +32,24 @@
 extern "C"
 {
 #endif
-/* Generates an id for an element.
+
+/**
+ * Generates an id for an element.
  * Specially used in xml encryption and signature references.
- * */
+ * @param env pointer to environment struct
+ * @param prefix the prefix of the id. For ex: EncDataID-1u343yrcarwqe
+ * @return the generated id
+ **/
 AXIS2_EXTERN axis2_char_t* AXIS2_CALL
 oxs_util_generate_id(const axis2_env_t *env,
         axis2_char_t *prefix);
 
-/*Given the filename returns the format of the file.
-These formats are defined in asym_ctx.h*/
+/**
+ * Given the filename returns the format of the file.
+ * These formats are defined in asym_ctx.h
+ * @param env pointer to environment struct
+ * @param file_name the file name 
+ **/
 AXIS2_EXTERN oxs_asym_ctx_format_t AXIS2_CALL
 oxs_util_get_format_by_file_extension(const axis2_env_t *env,
         axis2_char_t *file_name);

Modified: webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h Sun Jan 21 21:42:49 2007
@@ -20,8 +20,8 @@
 
 
 /**
-  * @file oxs_certificate.h
-  * @brief 
+  * @file oxs_x509_cert.h
+  * @brief the OMXMLSecurity representation of an X509 certificate
   */
 
 #include <axis2_defines.h>
@@ -39,102 +39,224 @@
  * @{
  */
 
-/**
- * issuer
- * subject
- * dates
- * hash
- * fingerprint
- */
 
 typedef struct oxs_x509_cert_t oxs_x509_cert_t;
-/*Create*/
+
+/**
+ * Create function of the X509 certificate 
+ * @param env pointer to environment struct
+ * @return created X509 certificate
+ **/
 AXIS2_EXTERN oxs_x509_cert_t *AXIS2_CALL
 oxs_x509_cert_create( const axis2_env_t *env);
 
-/*Free*/
+/**
+ * Free function of the X509 certificate 
+ * @param x509_cert the X509 certificate to be freed
+ * @param env pointer to environment struct
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ **/
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_free(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
 /*Getters*/
+/**
+ * Get the serial number of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the serial number of X509 certificate
+ */
 AXIS2_EXTERN int AXIS2_CALL
 oxs_x509_cert_get_serial_number(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the subject of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the subject of X509 certificate
+ */
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_x509_cert_get_subject(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the issuer of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the issuer of X509 certificate
+ */
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_x509_cert_get_issuer(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the key identifier of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the key identifier of X509 certificate
+ */
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_x509_cert_get_key_identifier(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the finger print  of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the finger print of X509 certificate
+ */
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_x509_cert_get_fingerprint(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the expiration date  of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the expiration date of X509 certificate
+ */
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_x509_cert_get_date(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the hash of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the hash of X509 certificate
+ */
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_x509_cert_get_hash(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the data of X509 Certificate
+ * This is the base64 encoded string in between the  --BEGIN CERTIFICATE- --END CERTIFICATE-- lines
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the data of X509 certificate
+ */
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 oxs_x509_cert_get_data(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
+/**
+ * Get the public key of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @return the public key of X509 certificate
+ */
 AXIS2_EXTERN openssl_pkey_t *AXIS2_CALL
 oxs_x509_cert_get_public_key(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env);
 
 /*Setters*/
+/**
+ * Set the serial number of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value  the serial number of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_serial_number(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     int value);
 
+/**
+ * Set the issuer of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value  the issuer of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_issuer(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     axis2_char_t *value);
 
+/**
+ * Set the key identifier of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value  the key identifier of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_key_identifier(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     axis2_char_t *value);
 
+/**
+ * Set the subject of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value  the subject of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_subject(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     axis2_char_t *value);
 
+/**
+ * Set the finger print of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value  the fingerprint of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_fingerprint(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     axis2_char_t *value);
 
+/**
+ * Set the expiration date of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value  the expiration date of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_date(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     axis2_char_t *value);
 
+/**
+ * Set the hash of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value   the hash of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_hash(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     axis2_char_t *value);
 
+/**
+ * Set the data of X509 Certificate. 
+ * This is the base64 encoded string in between the  --BEGIN CERTIFICATE- --END CERTIFICATE-- lines
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param value  the data of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_data(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,
     axis2_char_t *value);
 
+/**
+ * Set the public key of X509 Certificate
+ * @param x509_cert the X509 certificate
+ * @param env pointer to environment struct
+ * @param public_key public key of X509 Certificate
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_x509_cert_set_public_key(oxs_x509_cert_t *x509_cert,
     const axis2_env_t *env,

Modified: webservices/axis2/trunk/c/rampart/include/oxs_xml_encryption.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_xml_encryption.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_xml_encryption.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_xml_encryption.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file oxs_xml_enc.h
-  * @brief 
+  * @brief Does the XML encryption for OMXMLSecurity  
   */
 
 #include <axis2_defines.h>
@@ -36,30 +36,76 @@
 {
 #endif
 
+/**
+ * Encrypts a given node as specified in the @enc_ctx. 
+ * A reference is taken for the EncryptedData to place the encrypted data.
+ * @param env pointer to environment struct
+ * @param enc_ctx encryption context
+ * @param node the node tobe encrypted
+ * @param enc_type_node reference to the EncryptedData node
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_xml_enc_encrypt_node(const axis2_env_t *env,
                             oxs_ctx_t * enc_ctx,
                             axiom_node_t *node,
                             axiom_node_t **enc_type_node);
 
+/**
+ * Decrypts a node as specified in the @enc_ctx.
+ * A reference is taken to assign the address of the decrypted node
+ * @param env pointer to environment struct
+ * @param enc_ctx encryption context
+ * @param enc_type_node the EncryptedData node which needs to be decrypted
+ * @param decrypted_node reference to the decrypted node
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_xml_enc_decrypt_node(const axis2_env_t *env,
                             oxs_ctx_t * enc_ctx,
                             axiom_node_t *enc_type_node,
                             axiom_node_t **decrypted_node);
 
+/**
+ * Encrypts data or the content of the @content_buf as specified in the @enc_ctx.
+ * A reference is taken for the EncryptedData to place the encrypted data
+ * @param env pointer to environment struct
+ * @param enc_ctx encryption context
+ * @param content_buf the content to be encrypted. 
+ * @param enc_type_node reference to the EncryptedData node
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_xml_enc_encrypt_data(const axis2_env_t *env,
                             oxs_ctx_t * enc_ctx,
                             oxs_buffer_t *content_buf,
                             axiom_node_t **enc_type_node);
 
+/**
+ * Decrypts @enc_type_node and places the data inside the @result_buf
+ * The name of the method is bit tricky as it doesn't exactly decrypts a data buffer.
+ * @param env pointer to environment struct
+ * @param enc_ctx encryption context
+ * @param enc_type_node the EncryptedData node which needs to be decrypted
+ * @param result_buf the buffer to keep the decrypted content
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_xml_enc_decrypt_data(const axis2_env_t *env,
                             oxs_ctx_t * enc_ctx,
                             axiom_node_t *enc_type_node,
                             oxs_buffer_t *result_buf);
 
+/**
+ * Encrypts a key/data in asymmetric way as specified in @asym_ctx.
+ * This method is specifically written to support the key encryption in WS-Secruity
+ * @param env pointer to environment struct
+ * @param enc_ctx encryption context
+ * @param parent parent of the EncryptedKey node
+ * @param sym_key, the symmetric key that needs to be encrypted
+ * @param id_list the list of nodes that are encrypted by this particular key
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_xml_enc_encrypt_key(const axis2_env_t *env,
                             oxs_asym_ctx_t * asym_ctx,
@@ -67,6 +113,16 @@
                             oxs_key_t *sym_key,
                             axis2_array_list_t *id_list);
 
+/**
+ * Decrypts  a key/data in asymmetric way as specified in @asym_ctx.
+ * This method is specifically written to support the key decryption in WS-Secruity
+ * @param env pointer to environment struct
+ * @param enc_ctx encryption context
+ * @param parent parent of the EncryptedKey node
+ * @param encrypted_key_node the EncryptedKey node
+ * @param key, the key which holds the decrypted key data
+ * @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+ */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_xml_enc_decrypt_key(const axis2_env_t *env,
                             oxs_asym_ctx_t * asym_ctx,

Modified: webservices/axis2/trunk/c/rampart/include/rampart_action.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_action.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_action.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_action.h Sun Jan 21 21:42:49 2007
@@ -20,8 +20,8 @@
 
 
 /**
-  * @file oxs_ctx.h
-  * @brief 
+  * @file rampart_action.h
+  * @brief Defines a single action of Rampart life cycle. Serves as the configuration module of the rampart.
   */
 
 #include <axis2_defines.h>

Modified: webservices/axis2/trunk/c/rampart/include/rampart_authn_provider.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_authn_provider.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_authn_provider.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_authn_provider.h Sun Jan 21 21:42:49 2007
@@ -18,6 +18,11 @@
 #ifndef RAMPART_AUTHN_PROVIDER_H
 #define RAMPART_AUTHN_PROVIDER_H
 
+/**
+  * @file rampart_authn_provider.h
+  * @brief The authentication interface of rampart. Validates a username and password pair.
+  */
+
 #include <axis2_defines.h>
 #include <axis2_error.h>
 #include <axis2_env.h>

Modified: webservices/axis2/trunk/c/rampart/include/rampart_callback.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_callback.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_callback.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_callback.h Sun Jan 21 21:42:49 2007
@@ -18,6 +18,11 @@
 #ifndef RAMPART_CALLBACK_H
 #define RAMPART_CALLBACK_H
 
+/**
+  * @file rampart_callack.h
+  * @brief The callback module for a password 
+  */
+
 
 #ifdef __cplusplus
 extern "C"

Modified: webservices/axis2/trunk/c/rampart/include/rampart_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_constants.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_constants.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_constants.h Sun Jan 21 21:42:49 2007
@@ -19,6 +19,11 @@
 #ifndef RAMPART_CONSTANTS_H
 #define RAMPART_CONSTANTS_H
 
+/**
+  * @file rampart_constants.h
+  * @brief Holds constants for rampart
+  */
+
 #ifdef __cplusplus
 extern "C"
 {

Modified: webservices/axis2/trunk/c/rampart/include/rampart_credentials.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_credentials.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_credentials.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_credentials.h Sun Jan 21 21:42:49 2007
@@ -24,6 +24,11 @@
 #include <axis2_utils.h>
 #include <axis2_msg_ctx.h>
 
+/**
+  * @file rampart_credentials.h
+  * @brief The credentials interface for rampart. To retrieve a username and password pair.
+  */
+
 #ifdef __cplusplus
 extern "C"
 {

Modified: webservices/axis2/trunk/c/rampart/include/rampart_crypto_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_crypto_util.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_crypto_util.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_crypto_util.h Sun Jan 21 21:42:49 2007
@@ -21,7 +21,7 @@
 
 /**
   * @file rampart_crypto_util.h
-  * @brief RAMPART-UTIL Crypto
+  * @brief Crypto related utility module
   */
 #ifndef RAMPART_CRYPTO_UTIL
 #define RAMPART_CRYPTO_UTIL

Modified: webservices/axis2/trunk/c/rampart/include/rampart_encryption.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_encryption.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_encryption.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_encryption.h Sun Jan 21 21:42:49 2007
@@ -24,7 +24,7 @@
 #include <oxs_xml_encryption.h>
 /**
   * @file rampart_encryption.h
-  * @brief 
+  * @brief encrypts a SOAP message 
   */
 #ifndef RAMPART_ENCRYPTION_H
 #define RAMPART_ENCRYPTION_H

Modified: webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_handler_util.h Sun Jan 21 21:42:49 2007
@@ -35,6 +35,10 @@
 #ifndef RAMPART_HANDLER_UTIL_H
 #define RAMPART_HANDLER_UTIL_H
 
+/**
+  * @file rampart_handler_util.h
+  * @brief Utilities related to handlers 
+  */
 
 #ifdef __cplusplus
 extern "C"

Added: webservices/axis2/trunk/c/rampart/include/rampart_sec_header_builder.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_sec_header_builder.h?view=auto&rev=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_sec_header_builder.h (added)
+++ webservices/axis2/trunk/c/rampart/include/rampart_sec_header_builder.h Sun Jan 21 21:42:49 2007
@@ -0,0 +1,56 @@
+/*
+ *   Copyright 2003-2004 The Apache Software Foundation.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+#include <axis2_utils_defines.h>
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axiom_soap.h>
+#include <axis2_msg_ctx.h>
+#include <rampart_action.h>
+#include <oxs_asym_ctx.h>
+#include <oxs_xml_encryption.h>
+/**
+  * @file rampart_sec_header_builder.h
+  * @brief 
+  */
+#ifndef RAMPART_SEC_HEADER_BUILDER_H
+#define RAMPART_SEC_HEADER_BUILDER_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+* Build a message depending on configurations.
+* @param env pointer to environment struct
+* @param msg_ctx message context
+* @param actions actions defined in the descriptor file
+* @param soap_envelope the SOAP envelope
+* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
+*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_shb_build_message(const axis2_env_t *env,
+    axis2_msg_ctx_t *msg_ctx,
+    rampart_actions_t *actions,
+    axiom_soap_envelope_t *soap_envelope);
+
+
+/* @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif    /* !RAMPART_SEC_HEADER_BUILDER_H */

Modified: webservices/axis2/trunk/c/rampart/include/rampart_sec_header_processor.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_sec_header_processor.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_sec_header_processor.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_sec_header_processor.h Sun Jan 21 21:42:49 2007
@@ -23,8 +23,8 @@
 #include <oxs_asym_ctx.h>
 #include <oxs_xml_encryption.h>
 /**
-  * @file rampart_encryption.h
-  * @brief 
+  * @file rampart_sec_header_processor.h
+  * @brief Processes a message depending on it's security related claims 
   */
 #ifndef RAMPART_SEC_HEADER_PROCESSOR_H
 #define RAMPART_SEC_HEADER_PROCESSOR_H
@@ -35,7 +35,7 @@
 
 /**
 * Processes a message depending on it's security related claims.
-* This is th emain module in the infow of a message if rampart is enabled.
+* This is the main module in the infow of a message if rampart is enabled.
 * Processing is depending on the order of tokens apear in the @sec_node
 * Also the module will check for the InflowSecurity Settings	
 * @param env pointer to environment struct

Modified: webservices/axis2/trunk/c/rampart/include/rampart_sec_processed_result.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_sec_processed_result.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_sec_processed_result.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_sec_processed_result.h Sun Jan 21 21:42:49 2007
@@ -22,7 +22,7 @@
 
 /**
   * @file rampart_sec_processed_result.h
-  * @brief RAMPART-UTIL 
+  * @brief The module to keep  the results after processing the message 
   */
 #ifndef RAMPART_SEC_PROCESSED_RESULT
 #define RAMPART_SEC_PROCESSED_RESULT

Modified: webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h Sun Jan 21 21:42:49 2007
@@ -15,10 +15,13 @@
  * limitations under the License.
  */
 
-#ifndef TIMESTAMP_TOKEN_H
-#define TIMESTAMP_TOKEN_H
-
+#ifndef RAMPART_TIMESTAMP_TOKEN_H
+#define RAMPART_TIMESTAMP_TOKEN_H
 
+/**
+  * @file rampart_timestamp.h
+  * @brief Timestamp token 
+  */
 #ifdef __cplusplus
 extern "C"
 {
@@ -108,4 +111,4 @@
 #endif
 
 
-#endif /*TIMESTAMP_TOKEN_H*/
+#endif /*RAMPART_TIMESTAMP_TOKEN_H*/

Modified: webservices/axis2/trunk/c/rampart/include/rampart_username_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_username_token.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_username_token.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_username_token.h Sun Jan 21 21:42:49 2007
@@ -15,9 +15,13 @@
  * limitations under the License.
  */
 
-#ifndef USERNAME_TOKEN_H
-#define USERNAME_TOKEN_H
+#ifndef RAMPART_USERNAME_TOKEN_H
+#define RAMPART_USERNAME_TOKEN_H
 
+/**
+  * @file rampart_username_token.h
+  * @brief The Usernametoken
+  */
 
 #ifdef __cplusplus
 extern "C"
@@ -112,4 +116,4 @@
 #endif
 
 
-#endif /*USERNAME_TOKEN_H*/
+#endif /*RAMPART_USERNAME_TOKEN_H*/

Modified: webservices/axis2/trunk/c/rampart/include/rampart_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_util.h?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_util.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_util.h Sun Jan 21 21:42:49 2007
@@ -24,7 +24,7 @@
 #include <rampart_authn_provider.h>
 /**
   * @file rampart_util.h
-  * @brief RAMPART-UTIL 
+  * @brief Utilities of rampart 
   */
 #ifndef RAMPART_UTIL_H
 #define RAMPART_UTIL_H

Modified: webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt (original)
+++ webservices/axis2/trunk/c/rampart/samples/client/enc_echo/README.txt Sun Jan 21 21:42:49 2007
@@ -12,7 +12,7 @@
 Start server in port 8080 
      ./axis2_http_server -p8080
 
-3. HOW TO CONFIGURE TCPMONITOR (To view messages)
+3. HOW TO CONFIGURE TCP MONITOR (To view messages)
 ------------------------------
     Listen port: 9090 [specified as in the client argument]
     Target port: 8080 [server port]
@@ -36,7 +36,7 @@
     the SOAP message in the TCP Monitor.
 
 NOTE:
-You need to change the passwordCallbackClass and the en/decryptionPropFile
+You need to change the passwordCallbackClass/authnModule and the en/decryptionPropFile
 in rampart/samples/client/enc_echo/data/client.axis2.xml and
 rampart/samples/server/sec_echo/services.xml to suit your environment.
 

Modified: webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c (original)
+++ webservices/axis2/trunk/c/rampart/src/handlers/rampart_out_handler.c Sun Jan 21 21:42:49 2007
@@ -29,6 +29,7 @@
 #include <rampart_timestamp_token.h>
 #include <rampart_action.h>
 #include <rampart_encryption.h>
+#include <rampart_sec_header_builder.h>
 
 /*********************** Function headers *********************************/
 
@@ -98,7 +99,6 @@
     axis2_param_t *param_out_flow_security = NULL;
     axis2_array_list_t *action_list = NULL;
     axis2_param_t *param_action = NULL;
-    axis2_char_t *items = NULL;
     rampart_actions_t *actions = NULL;
     axis2_status_t status = AXIS2_FAILURE;
 
@@ -125,8 +125,6 @@
     /*if the soap header is available then add the security header*/
     if (soap_header)
     {
-        axiom_soap_header_block_t *sec_header_block = NULL;
-        axiom_namespace_t *sec_ns_obj = NULL;
         soap_header_node = AXIOM_SOAP_HEADER_GET_BASE_NODE(soap_header, env);
         soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(
 							soap_header_node, env);
@@ -186,134 +184,13 @@
          *in the msg_ctx as as a parameter.*/
         status = RAMPART_ACTIONS_POPULATE_FROM_CTX(actions, env, ctx);
 
-        items = AXIS2_STRDUP(RAMPART_ACTIONS_GET_ITEMS(actions, env), env);
-
-        if (!items)
-        {
-            AXIS2_LOG_INFO(env->log, 
-				"[rampart][rampart_out_handler] No action items defined. Nothing to do");
-            return AXIS2_SUCCESS;
-        }
-
-        sec_ns_obj =  axiom_namespace_create(env, RAMPART_WSSE_XMLNS,
-                RAMPART_WSSE);
-
-        sec_header_block = AXIOM_SOAP_HEADER_ADD_HEADER_BLOCK(soap_header,
-                env, RAMPART_SECURITY, sec_ns_obj);
-
-        /*Set mustUnderstand=1*/
-        AXIOM_SOAP_HEADER_BLOCK_SET_MUST_UNDERSTAND_WITH_BOOL(sec_header_block, 
-				env, AXIS2_TRUE);
-
-        if (sec_header_block)
-        {
-            axis2_char_t* item = NULL;
-            axiom_node_t *sec_node =  NULL;
-            axiom_element_t *sec_ele = NULL;
-            axis2_array_list_t *string_list = NULL;
-            int i = 0, size = 0;
-
-            sec_node = AXIOM_SOAP_HEADER_BLOCK_GET_BASE_NODE(sec_header_block, env);
-            sec_ele = (axiom_element_t *)
-                    AXIOM_NODE_GET_DATA_ELEMENT(sec_node, env);
-
-            /*Get action items seperated by spaces*/
-            string_list = axis2_tokenize(env, items, ' ');
-            if (string_list)
-            {
-                size = AXIS2_ARRAY_LIST_SIZE(string_list, env);
-            }
-
-            /*Iterate thru items. Eg. Usernmaetoken, Timestamp, Encrypt, Signature*/
-            for (i = 0; i < size; i++)
-            {
-                item = AXIS2_ARRAY_LIST_GET(string_list, env, i);
-                /*Username token*/
-                if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_USERNAMETOKEN ,
-                        AXIS2_STRTRIM(env, item, NULL)))
-                {
-                    rampart_username_token_t *username_token = NULL;
-                    username_token = rampart_username_token_create(env);
-
-                    AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler]  building UsernmaeToken");
-                    status = RAMPART_USERNAME_TOKEN_BUILD(username_token,
-                            env,
-                            ctx,
-                            actions,
-                            sec_node,
-                            sec_ns_obj);
-                    if (status == AXIS2_FAILURE)
-                    {
-                        AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] UsernmaeToken build failed. ERROR");
-                        return AXIS2_FAILURE;
-                    }
-                    /*TODO free*/
-                    /*Timestamp token*/
-                }
-                else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_TIMESTAMP,
-                        AXIS2_STRTRIM(env, item, NULL)))
-                {
-                    rampart_timestamp_token_t *timestamp_token = NULL;
-                    axis2_char_t *ttl_str = NULL;
-                    int ttl = -1;
-
-                    AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler]  building Timestamp Token");
-                    ttl_str = RAMPART_ACTIONS_GET_TIME_TO_LIVE(actions, env);
-                    /*Check for the ttl. If not specified use the default*/
-                    if(!ttl_str)
-					{
-                        AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler]  Using default timeToLive value %d",
-                                RAMPART_TIMESTAMP_TOKEN_DEFAULT_TIME_TO_LIVE);
-                        ttl = RAMPART_TIMESTAMP_TOKEN_DEFAULT_TIME_TO_LIVE;
-                    }
-					else
-					{
-                        ttl = atoi(RAMPART_ACTIONS_GET_TIME_TO_LIVE(actions, env));
-                    }
-
-                    timestamp_token = rampart_timestamp_token_create(env);
-                    status = RAMPART_TIMESTAMP_TOKEN_BUILD(timestamp_token, env,
-                            ctx, sec_node, sec_ns_obj, ttl);
-                    if (status == AXIS2_FAILURE)
-                    {
-                        AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Timestamp Token build failed. ERROR");
-                        return AXIS2_FAILURE;
-                    }
-                    /*Encrypt*/
-                }
-                else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_ENCRYPT,
-                        AXIS2_STRTRIM(env, item, NULL)))
-                {
-
-                    AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Encrypting we do not support yet");
-                    status = rampart_enc_encrypt_message(env, msg_ctx, actions, soap_envelope, sec_node);   
-                    if (status == AXIS2_FAILURE)
-                    {
-                        AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Message encryption failed. ERROR");
-                        return AXIS2_FAILURE;
-                    }
- 
-                    /*Signature*/
-                }
-                else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_SIGNATURE,
-                        AXIS2_STRTRIM(env, item, NULL)))
-                {
-                    AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Signing message. We do not support yet");
-
-                    /*Any other type of action*/
-                }
-                else
-                {
-                    AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] We do not support %s item yet" , item);
-                }
-            }/*End of for*/
-
-        }
-        else
-        {
-            AXIS2_LOG_INFO(env->log, "[rampart][rampart_out_handler] Security header block is NULL");
+        /*We call the security header builder*/
+        status = rampart_shb_build_message(env, msg_ctx, actions, soap_envelope);
+        if(AXIS2_FAILURE == status){
+                AXIS2_LOG_INFO(env->log, 
+					"[rampart][rampart_out_handler] Security header building failed ERROR");
+            return AXIS2_FAILURE;
         }
-
     }
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c Sun Jan 21 21:42:49 2007
@@ -26,7 +26,8 @@
 
 #define BUFSIZE 64
 
-AXIS2_EXTERN int AXIS2_CALL openssl_bc_crypt(const axis2_env_t *env,
+AXIS2_EXTERN int AXIS2_CALL
+openssl_bc_crypt(const axis2_env_t *env,
         openssl_cipher_ctx_t *oc_ctx,
         oxs_buffer_t *input_buf,
         oxs_buffer_t *output_buf,
@@ -41,9 +42,13 @@
     int last = 0;
     axis2_status_t status = AXIS2_FAILURE;
 
-    /**Init******************************************************************************/
+    /********************************Initialize*****************************************************/
+
     iv_length = EVP_CIPHER_iv_length(OPENSSL_CIPHER_CTX_GET_CIPHER(oc_ctx, env));
+
+    /*Get the IV. If encrypt, we need to generate the IV else we need to get it from the input buffer*/
     if(encrypt){
+        /*Generate IV*/
         ret = RAND_bytes(iv, iv_length);
         /*IV to the output*/
         status = OXS_BUFFER_APPEND(output_buf, env, iv, iv_length);
@@ -61,19 +66,19 @@
     okey = OPENSSL_CIPHER_CTX_GET_KEY(oc_ctx, env);
     memcpy(key,  OXS_KEY_GET_DATA(okey, env), OXS_KEY_GET_SIZE(okey, env));
 
-    /*Set iv */
+    /*Set the IV */
     ret = EVP_CipherInit(&ctx, (EVP_CIPHER *)OPENSSL_CIPHER_CTX_GET_CIPHER(oc_ctx, env), key, iv, encrypt);
 #ifndef OXS_OPENSSL_096
     EVP_CIPHER_CTX_set_padding(&ctx, 0);
 #endif
 
+    /*Get the block length of the cipher*/
     block_length = EVP_CIPHER_block_size((EVP_CIPHER *)OPENSSL_CIPHER_CTX_GET_CIPHER(oc_ctx, env));
 
-    /**Update****************************************************************************/
+    /*********************************Update***********************************************************/
     for(;;){/*Loop untill all the data are encrypted*/
         unsigned char *out_buf = NULL;
         int  in_size =0, out_size =0, fixed=0, out_length = 0;
-        oxs_buffer_t *temp_in = NULL;
 
         if (0 == OXS_BUFFER_GET_SIZE(input_buf, env)) {
             last = 1;            
@@ -86,9 +91,6 @@
         }else{
             in_size = OXS_BUFFER_GET_SIZE(input_buf, env);
         }
-        /*Create a temp buffer and populate only data size of BUFSIZE*/
-        temp_in = oxs_buffer_create(env);
-        status = OXS_BUFFER_POPULATE(temp_in, env, OXS_BUFFER_GET_DATA(input_buf, env), in_size);        
 
         out_size = OXS_BUFFER_GET_SIZE(output_buf, env);
         
@@ -110,9 +112,10 @@
         }
 #endif
         /* encrypt or decrypt */
-        ret = EVP_CipherUpdate(&ctx, out_buf, &out_length, OXS_BUFFER_GET_DATA(temp_in, env), in_size);
+        ret = EVP_CipherUpdate(&ctx, out_buf, &out_length, OXS_BUFFER_GET_DATA(input_buf, env), in_size);
 
-#ifndef OXS_OPENSSL_096    
+#ifndef OXS_OPENSSL_096   
+        /*If decrypt, we copy data from the out_buf to the ctx.final*/
         if(!ctx.encrypt) {
             if (block_length > 1 && !ctx.buf_len) {
                 out_length -= block_length;
@@ -136,14 +139,11 @@
         if(AXIS2_FAILURE == status){
             return -1;
         }
-        
-        /*Free temp buf*/
-        OXS_BUFFER_FREE(temp_in, env);
-        temp_in = NULL;
- 
+         
     }/*End of for loop*/
 
-    /**Final****************************************************************************/
+    /********************************Finalize*****************************************************/
+
     /* by now there should be no input */
     if(last == 1){
         unsigned char pad[EVP_MAX_BLOCK_LENGTH];

Modified: webservices/axis2/trunk/c/rampart/src/util/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/Makefile.am?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/src/util/Makefile.am Sun Jan 21 21:42:49 2007
@@ -4,7 +4,8 @@
 
 librampart_util_la_SOURCES = rampart_action.c rampart_crypto_util.c \
 							rampart_util.c rampart_handler_util.c username_token.c  timestamp_token.c \
-							rampart_encryption.c rampart_sec_header_processor.c rampart_sec_processed_result.c
+							rampart_encryption.c rampart_sec_header_processor.c rampart_sec_processed_result.c \
+							rampart_sec_header_builder.c
 
 
 librampart_util_la_LIBADD  = -lssl \

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c?view=diff&rev=498532&r1=498531&r2=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c Sun Jan 21 21:42:49 2007
@@ -87,6 +87,7 @@
         size = AXIS2_ARRAY_LIST_SIZE(str_list, env);
         for(i=0 ; i < size ; i++ ){
             local_name = AXIS2_ARRAY_LIST_GET(str_list, env, i);
+            /*We do not encrypt the security header*/
             if(0 == AXIS2_STRCMP(local_name, "Security")){
                 AXIS2_LOG_INFO(env->log, "[rampart][rampart_encryption] We do not encrypt %s", local_name);
                 continue;

Added: webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_builder.c?view=auto&rev=498532
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_builder.c (added)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_builder.c Sun Jan 21 21:42:49 2007
@@ -0,0 +1,210 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <rampart_encryption.h>
+#include <rampart_action.h>
+#include <rampart_constants.h>
+#include <rampart_sec_header_builder.h>
+#include <rampart_username_token.h>
+#include <rampart_timestamp_token.h>
+#include <rampart_util.h>
+#include <rampart_sec_processed_result.h>
+#include <rampart_handler_util.h>
+#include <oxs_ctx.h>
+#include <oxs_error.h>
+#include <oxs_utility.h>
+#include <oxs_token_encrypted_data.h>
+#include <oxs_token_encrypted_key.h>
+#include <oxs_token_encryption_method.h>
+#include <oxs_token_data_reference.h>
+#include <oxs_token_cipher_data.h>
+#include <oxs_token_cipher_value.h>
+#include <oxs_token_key_info.h>
+#include <oxs_token_key_name.h>
+#include <oxs_key.h>
+#include <oxs_axiom.h>
+#include <oxs_asym_ctx.h>
+#include <oxs_token_reference_list.h>
+#include <axis2_utils.h>
+#include <axis2_array_list.h>
+
+/*Private functions*/
+
+
+/*Public functions*/
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_shb_build_message(const axis2_env_t *env,
+    axis2_msg_ctx_t *msg_ctx,
+    rampart_actions_t *actions,
+    axiom_soap_envelope_t *soap_envelope)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
+
+    /*We need a SOAP envelope.*/
+    if(soap_envelope){
+        axis2_ctx_t *ctx = NULL;
+        axiom_soap_header_t *soap_header = NULL;
+        axiom_node_t *soap_header_node = NULL;
+        axiom_element_t *soap_header_ele = NULL;
+        axis2_char_t *items = NULL;
+        axiom_soap_header_block_t *sec_header_block = NULL;
+        axiom_namespace_t *sec_ns_obj = NULL;
+
+/*>>*/
+        /*We are checking for the soap header element*/
+        soap_header  = AXIOM_SOAP_ENVELOPE_GET_HEADER(soap_envelope, env);
+        soap_header_node = AXIOM_SOAP_HEADER_GET_BASE_NODE(soap_header, env);
+        soap_header_ele = (axiom_element_t *)AXIOM_NODE_GET_DATA_ELEMENT(
+                            soap_header_node, env);
+
+/*<<*/
+        items = AXIS2_STRDUP(RAMPART_ACTIONS_GET_ITEMS(actions, env), env);
+
+        if (!items)
+        {
+            AXIS2_LOG_INFO(env->log,
+                "[rampart][shb] No action items defined. Nothing to do");
+            return AXIS2_SUCCESS;
+        }
+
+        sec_ns_obj =  axiom_namespace_create(env, RAMPART_WSSE_XMLNS,
+                RAMPART_WSSE);
+
+        sec_header_block = AXIOM_SOAP_HEADER_ADD_HEADER_BLOCK(soap_header,
+                env, RAMPART_SECURITY, sec_ns_obj);
+
+        /*Set mustUnderstand=1*/
+        AXIOM_SOAP_HEADER_BLOCK_SET_MUST_UNDERSTAND_WITH_BOOL(sec_header_block,
+                env, AXIS2_TRUE);
+
+        if (sec_header_block)
+        {
+            axis2_char_t* item = NULL;
+            axiom_node_t *sec_node =  NULL;
+            axiom_element_t *sec_ele = NULL;
+            axis2_array_list_t *string_list = NULL;
+            int i = 0, size = 0;
+
+            sec_node = AXIOM_SOAP_HEADER_BLOCK_GET_BASE_NODE(sec_header_block, env);
+            sec_ele = (axiom_element_t *)
+                    AXIOM_NODE_GET_DATA_ELEMENT(sec_node, env);
+
+            /*Get action items seperated by spaces*/
+            string_list = axis2_tokenize(env, items, ' ');
+            if (string_list)
+            {
+                size = AXIS2_ARRAY_LIST_SIZE(string_list, env);
+            }
+
+            ctx = AXIS2_MSG_CTX_GET_BASE(msg_ctx, env);
+            /*Iterate thru items. Eg. Usernmaetoken, Timestamp, Encrypt, Signature*/
+            for (i = 0; i < size; i++)
+            {
+                item = AXIS2_ARRAY_LIST_GET(string_list, env, i);
+                /*Username token*/
+                if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_USERNAMETOKEN ,
+                        AXIS2_STRTRIM(env, item, NULL)))
+                {
+                    rampart_username_token_t *username_token = NULL;
+                    username_token = rampart_username_token_create(env);
+
+                    AXIS2_LOG_INFO(env->log, "[rampart][shb]  building UsernmaeToken");
+                    status = RAMPART_USERNAME_TOKEN_BUILD(username_token,
+                            env,
+                            ctx,
+                            actions,
+                            sec_node,
+                            sec_ns_obj);
+                    if (status == AXIS2_FAILURE)
+                    {
+                        AXIS2_LOG_INFO(env->log, "[rampart][shb] UsernmaeToken build failed. ERROR");
+                        return AXIS2_FAILURE;
+                    }
+                    /*TODO free*/
+                    /*Timestamp token*/
+                }
+                else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_TIMESTAMP,
+                        AXIS2_STRTRIM(env, item, NULL)))
+                {
+                    rampart_timestamp_token_t *timestamp_token = NULL;
+                    axis2_char_t *ttl_str = NULL;
+                    int ttl = -1;
+
+                    AXIS2_LOG_INFO(env->log, "[rampart][shb]  building Timestamp Token");
+                    ttl_str = RAMPART_ACTIONS_GET_TIME_TO_LIVE(actions, env);
+                    /*Check for the ttl. If not specified use the default*/
+                    if(!ttl_str){
+                        AXIS2_LOG_INFO(env->log, "[rampart][shb]  Using default timeToLive value %d",
+                                RAMPART_TIMESTAMP_TOKEN_DEFAULT_TIME_TO_LIVE);
+                        ttl = RAMPART_TIMESTAMP_TOKEN_DEFAULT_TIME_TO_LIVE;
+                    }else {
+                        ttl = atoi(RAMPART_ACTIONS_GET_TIME_TO_LIVE(actions, env));
+                    }
+
+                    timestamp_token = rampart_timestamp_token_create(env);
+                    status = RAMPART_TIMESTAMP_TOKEN_BUILD(timestamp_token, env,
+                            ctx, sec_node, sec_ns_obj, ttl);
+                    if (status == AXIS2_FAILURE){
+                        AXIS2_LOG_INFO(env->log, "[rampart][shb] Timestamp Token build failed. ERROR");
+                        return AXIS2_FAILURE;
+                    }
+                    /*Encrypt*/
+                }
+                else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_ENCRYPT,
+                        AXIS2_STRTRIM(env, item, NULL)))
+                {
+
+                    AXIS2_LOG_INFO(env->log, "[rampart][shb] Encrypting we do not support yet");
+                    status = rampart_enc_encrypt_message(env, msg_ctx, actions, soap_envelope, sec_node);
+                    if (status == AXIS2_FAILURE)
+                    {
+                        AXIS2_LOG_INFO(env->log, "[rampart][shb] Message encryption failed. ERROR");
+                        return AXIS2_FAILURE;
+                    }
+
+                    /*Signature*/
+                }
+                else if (0 == AXIS2_STRCMP(RAMPART_ACTION_ITEMS_SIGNATURE,
+                        AXIS2_STRTRIM(env, item, NULL)))
+                {
+                    AXIS2_LOG_INFO(env->log, "[rampart][shb] Signing message. We do not support yet");
+
+                    /*Any other type of action*/
+                }
+                else
+                {
+                    AXIS2_LOG_INFO(env->log, "[rampart][shb] We do not support %s item yet" , item);
+                }
+            }/*End of for*/
+
+        }
+        else
+        {
+            AXIS2_LOG_INFO(env->log, "[rampart][shb] Security header block is NULL");
+        }
+    }else{/*No SOAP message*/
+        return AXIS2_FAILURE;
+    }
+
+    
+    return AXIS2_SUCCESS;
+}
+



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