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 2009/07/17 08:13:33 UTC

svn commit: r794975 - /webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c

Author: shankar
Date: Fri Jul 17 06:13:33 2009
New Revision: 794975

URL: http://svn.apache.org/viewvc?rev=794975&view=rev
Log:
Modifying encryption path to use key_info processor

Modified:
    webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c

Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c?rev=794975&r1=794974&r2=794975&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c Fri Jul 17 06:13:33 2009
@@ -218,6 +218,7 @@
     }
 }
 
+#if 0
 /*Process a KeyInfo and return the key*/
 static oxs_key_t* 
 rampart_shp_get_key_for_key_info(const axutil_env_t* env, 
@@ -361,7 +362,8 @@
 	AXIS2_FREE(env->allocator, id);
     return key;
 }
-    
+#endif
+
 static axis2_bool_t
 rampart_shp_validate_qnames(
     const axutil_env_t *env,
@@ -933,9 +935,20 @@
         if(key_info_node)
         {
             oxs_key_t *key_to_decrypt = NULL;
+            axis2_char_t *token_type = NULL;
+            axis2_char_t *reference_method = NULL;
+            void *cert = NULL;
 
             /*Get the sesison key*/
-            key_to_decrypt = rampart_shp_get_key_for_key_info(env, key_info_node, rampart_context, msg_ctx, AXIS2_FALSE);
+            /*key_to_decrypt = rampart_shp_get_key_for_key_info(env, key_info_node, rampart_context, msg_ctx, AXIS2_FALSE);*/
+            if(rampart_token_process_key_info(env, key_info_node, sec_node, rampart_context,
+                msg_ctx, AXIS2_FALSE, &cert, &key_to_decrypt, &token_type, &reference_method)
+                != AXIS2_SUCCESS)
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                "[rampart]On processing ReferenceList, failed to get the key to decrypt");
+                return AXIS2_FAILURE;
+            }
             
             /*if security context token is used, then store it. It will be used by the server to encrypt the message*/
             rampart_shp_store_token_id(env, key_info_node, rampart_context, sec_node, AXIS2_TRUE, msg_ctx);
@@ -1901,10 +1914,20 @@
 {
     oxs_key_t *session_key = NULL;
     oxs_key_t *derived_key = NULL;
+    axis2_char_t *token_type = NULL;
+    axis2_char_t *reference_method = NULL;
+    void *cert = NULL;
 
     /* Get the session key. */ 
-    session_key = rampart_shp_get_key_for_key_info(
-        env, dk_node, rampart_context, msg_ctx, AXIS2_TRUE);
+    /*session_key = rampart_shp_get_key_for_key_info(
+        env, dk_node, rampart_context, msg_ctx, AXIS2_TRUE);*/
+    if(rampart_token_process_key_info(env, dk_node, sec_node, rampart_context, msg_ctx, AXIS2_TRUE,
+        &cert, &session_key, &token_type, &reference_method) != AXIS2_SUCCESS)
+    {
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "[rampart]Failed to get the session key. Cannot derive the key");
+        return AXIS2_FAILURE;
+    }
     if(!session_key)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,