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 mi...@apache.org on 2008/06/10 11:46:14 UTC

svn commit: r666045 - in /webservices/rampart/trunk/c: include/oxs_key_mgr.h src/omxmlsec/key_mgr.c src/util/rampart_context.c

Author: milinda
Date: Tue Jun 10 02:46:14 2008
New Revision: 666045

URL: http://svn.apache.org/viewvc?rev=666045&view=rev
Log:
Moving pkcs12 key store buf to key manager.

Modified:
    webservices/rampart/trunk/c/include/oxs_key_mgr.h
    webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c
    webservices/rampart/trunk/c/src/util/rampart_context.c

Modified: webservices/rampart/trunk/c/include/oxs_key_mgr.h
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_key_mgr.h?rev=666045&r1=666044&r2=666045&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_key_mgr.h (original)
+++ webservices/rampart/trunk/c/include/oxs_key_mgr.h Tue Jun 10 02:46:14 2008
@@ -312,6 +312,17 @@
 		oxs_key_mgr_t *key_mgr,
 		const axutil_env_t *env,
 		pkcs12_keystore_t *key_store);
+        
+        AXIS2_EXTERN void * AXIS2_CALL
+        oxs_key_mgr_get_key_store_buff(
+            oxs_key_mgr_t *key_mgr,
+            const axutil_env_t *env);
+        
+        AXIS2_EXTERN axis2_status_t AXIS2_CALL
+        oxs_key_mgr_set_key_store_buff(
+            oxs_key_mgr_t *key_mgr,
+            const axutil_env_t *env,
+            void *key_store_buf);
 	
     /** @} */
 #ifdef __cplusplus

Modified: webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c?rev=666045&r1=666044&r2=666045&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c Tue Jun 10 02:46:14 2008
@@ -56,6 +56,8 @@
 
     /* PKCS12 Key store */
     pkcs12_keystore_t *key_store;
+    
+    void *pkcs12_buf;
 	
     /* Buffer holding keys and certs */
     void *pem_buf;
@@ -71,19 +73,20 @@
 	key_mgr = AXIS2_MALLOC(env->allocator, sizeof(oxs_key_mgr_t));
 	if (key_mgr)
 	{
-		key_mgr->private_key_file = NULL;		
-		key_mgr->certificate_file = NULL;
-		key_mgr->reciever_certificate_file = NULL;
-		key_mgr->prv_key_password = NULL;
-		key_mgr->prv_key = NULL;
-		key_mgr->prv_key_type = AXIS2_KEY_TYPE_UNKNOWN;
-		key_mgr->certificate = NULL;
-		key_mgr->certificate_type = AXIS2_KEY_TYPE_UNKNOWN;
-		key_mgr->receiver_certificate = NULL;
-		key_mgr->receiver_certificate_type = AXIS2_KEY_TYPE_UNKNOWN;
-		key_mgr->key_store = NULL;                
-		key_mgr->pem_buf = NULL;
-		key_mgr->format = -1;
+            key_mgr->private_key_file = NULL;		
+            key_mgr->certificate_file = NULL;
+            key_mgr->reciever_certificate_file = NULL;
+            key_mgr->prv_key_password = NULL;
+            key_mgr->prv_key = NULL;
+            key_mgr->prv_key_type = AXIS2_KEY_TYPE_UNKNOWN;
+            key_mgr->certificate = NULL;
+            key_mgr->certificate_type = AXIS2_KEY_TYPE_UNKNOWN;
+            key_mgr->receiver_certificate = NULL;
+            key_mgr->receiver_certificate_type = AXIS2_KEY_TYPE_UNKNOWN;
+            key_mgr->key_store = NULL;                
+            key_mgr->pem_buf = NULL;
+            key_mgr->format = -1;
+            key_mgr->pkcs12_buf = NULL;
 	}
 	return key_mgr; 
 }
@@ -898,3 +901,25 @@
     }
     return AXIS2_SUCCESS;
 }
+
+AXIS2_EXTERN void * AXIS2_CALL
+oxs_key_mgr_get_key_store_buff(
+    oxs_key_mgr_t *key_mgr,
+    const axutil_env_t *env)
+{
+    return key_mgr->pkcs12_buf;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_mgr_set_key_store_buff(
+    oxs_key_mgr_t *key_mgr,
+    const axutil_env_t *env,
+    void *key_store_buf)
+{
+    AXIS2_PARAM_CHECK(env->error, key_store_buf, AXIS2_FAILURE);
+        
+    key_mgr->pkcs12_buf = key_store_buf;
+    
+    return AXIS2_SUCCESS;
+}
+

Modified: webservices/rampart/trunk/c/src/util/rampart_context.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_context.c?rev=666045&r1=666044&r2=666045&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Tue Jun 10 02:46:14 2008
@@ -15,6 +15,9 @@
  * limitations under the License.
  */
 
+#include "oxs_key_mgr.h"
+
+
 #include <rampart_context.h>
 #include <rampart_constants.h>
 #include <oxs_axiom.h>
@@ -41,7 +44,6 @@
     axis2_char_t *rd_val;
     int ref;
     oxs_key_mgr_t *key_mgr;
-    void *key_store_buf;
     /****************************/
     /* Set true when the issued token is aquired and set to the rampart conext*/
     issued_token_callback_func aquire_issued_token; 
@@ -191,8 +193,7 @@
 
     rampart_context->key_list = axutil_array_list_create(env, 2);
     rampart_context->key_mgr = oxs_key_mgr_create(env);
-    rampart_context->key_store_buf = NULL;
-
+    
     return rampart_context;
 }
 
@@ -2922,11 +2923,11 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-rampart_context_set_key_mgr(rampart_context_t *rampart_context, 
-							  const axutil_env_t *env, 
-                              oxs_key_mgr_t *key_mgr)  
+rampart_context_set_key_mgr(rampart_context_t *rampart_context,
+    const axutil_env_t *env, 
+    oxs_key_mgr_t *key_mgr)  
 {
-	if (rampart_context->key_mgr)
+    if (rampart_context->key_mgr)
         oxs_key_mgr_free(rampart_context->key_mgr, env);
     
     rampart_context->key_mgr = key_mgr;
@@ -2941,12 +2942,13 @@
 	return rampart_context->key_mgr;
 }
 
+
 AXIS2_EXTERN void * AXIS2_CALL
 rampart_context_get_key_store_buff(
     rampart_context_t *rampart_context,
     const axutil_env_t *env)
 {
-    return rampart_context->key_store_buf;
+    return oxs_key_mgr_get_key_store_buff(rampart_context->key_mgr, env);
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -2956,7 +2958,9 @@
     void *key_store_buf)
 {
     AXIS2_PARAM_CHECK(env->error, key_store_buf, AXIS2_FAILURE);
-    AXIS2_LOG_INFO(env->log, AXIS2_LOG_SI, "[rampart][rampart_context] Seting key store buff.");     
-    rampart_context->key_store_buf = key_store_buf;
+         
+    oxs_key_mgr_set_key_store_buff(rampart_context->key_mgr, env, key_store_buf);
+    
     return AXIS2_SUCCESS;
 }
+