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 su...@apache.org on 2008/04/09 07:41:58 UTC

svn commit: r646192 - in /webservices/rampart/scratch/c/pkcs/c: build/win32/makefile samples/secpolicy/run_all.js src/omxmlsec/key_mgr.c src/util/rampart_signature.c

Author: supun
Date: Tue Apr  8 22:41:56 2008
New Revision: 646192

URL: http://svn.apache.org/viewvc?rev=646192&view=rev
Log: (empty)

Modified:
    webservices/rampart/scratch/c/pkcs/c/build/win32/makefile
    webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/run_all.js
    webservices/rampart/scratch/c/pkcs/c/src/omxmlsec/key_mgr.c
    webservices/rampart/scratch/c/pkcs/c/src/util/rampart_signature.c

Modified: webservices/rampart/scratch/c/pkcs/c/build/win32/makefile
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/build/win32/makefile?rev=646192&r1=646191&r2=646192&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/build/win32/makefile (original)
+++ webservices/rampart/scratch/c/pkcs/c/build/win32/makefile Tue Apr  8 22:41:56 2008
@@ -43,7 +43,7 @@
 
 CC = @cl.exe 
 CFLAGS = /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "AXIS2_DECLARE_EXPORT"   \
-	 /D "AXIS2_SVR_MULTI_THREADED" /W4 /nologo $(AXIS2_INCLUDE_PATH) 
+	 /D "AXIS2_SVR_MULTI_THREADED" /w /nologo $(AXIS2_INCLUDE_PATH) 
 
 ################### linker options
 

Modified: webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/run_all.js
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/run_all.js?rev=646192&r1=646191&r2=646192&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/run_all.js (original)
+++ webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/run_all.js Tue Apr  8 22:41:56 2008
@@ -1,6 +1,6 @@
 var WshShell = new ActiveXObject("WScript.Shell");
 var fso = new ActiveXObject("Scripting.FileSystemObject");
-var server_port = 9090;
+var server_port = 7070;
 
 var f, s, re, ss, r;
 var ForReading = 1, ForWriting = 2;

Modified: webservices/rampart/scratch/c/pkcs/c/src/omxmlsec/key_mgr.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/src/omxmlsec/key_mgr.c?rev=646192&r1=646191&r2=646192&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/src/omxmlsec/key_mgr.c (original)
+++ webservices/rampart/scratch/c/pkcs/c/src/omxmlsec/key_mgr.c Tue Apr  8 22:41:56 2008
@@ -200,6 +200,62 @@
     oxs_key_mgr_t *key_mgr,
     const axutil_env_t *env)
 {
+	void *key_buf = NULL;
+    axis2_key_type_t type = 0;
+    oxs_x509_cert_t *cert = NULL;
+    axis2_char_t *certificate_file = NULL;
+    
+	if (key_mgr->certificate)
+	{
+		return key_mgr->certificate;
+	}
+	/*key_buf = oxs_key_mgr_get_pem_buf(key_mgr, env);
+    if(key_buf)
+    {
+        type = oxs_key_mgr_get_certificate_type(key_mgr, env);
+        if(type == AXIS2_KEY_TYPE_PEM)
+        {
+            cert = oxs_key_mgr_load_x509_cert_from_string(env,
+                    (axis2_char_t *)key_buf);
+            if(!cert)
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                                "[rampart][rampart_signature] Certificate cannot be loaded from the buffer.");
+                return NULL;
+            }
+            else
+            {
+                return cert;
+            }
+        }
+        else
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "[rampart][rampart_signature] Key file type unknown.");
+            return NULL;
+        }
+    }
+    else
+    {*/
+        certificate_file = oxs_key_mgr_get_certificate_file(key_mgr, env);
+        if(certificate_file)
+        {
+            cert = oxs_key_mgr_load_x509_cert_from_pem_file(env, certificate_file);
+            if(!cert)
+            {
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                                "[rampart][rampart_signature] Certificate cannot be loaded from the file.");
+                return NULL;
+            }
+        }
+        else
+        {
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                            "[rampart][rampart_signature] Public key certificate file is not specified.");
+            return NULL;
+        }
+    /*}*/
+	key_mgr->certificate = cert;
 	return key_mgr->certificate;
 }
 
@@ -316,6 +372,7 @@
 			cert = oxs_key_mgr_load_x509_cert_from_pem_file(env, key_mgr->reciever_certificate_file);
 		}
 	}
+	key_mgr->receiver_certificate = cert;
 	return cert;
 }
 

Modified: webservices/rampart/scratch/c/pkcs/c/src/util/rampart_signature.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/src/util/rampart_signature.c?rev=646192&r1=646191&r2=646192&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/src/util/rampart_signature.c (original)
+++ webservices/rampart/scratch/c/pkcs/c/src/util/rampart_signature.c Tue Apr  8 22:41:56 2008
@@ -183,7 +183,7 @@
     axiom_node_t *key_info_node = NULL;
     /*axis2_bool_t is_direct_reference = AXIS2_TRUE;*/
     axis2_status_t status = AXIS2_FAILURE;
-
+	oxs_key_mgr_t *key_mgr = NULL;
     /*Now we must build the Key Info element*/
     key_info_node = oxs_token_build_key_info_element(env, sig_node);
     
@@ -217,8 +217,8 @@
     else
     {
         oxs_x509_cert_t *cert = NULL;
-        
-        cert = rampart_sig_get_cert(env, rampart_context);
+		key_mgr = rampart_context_get_key_mgr(rampart_context, env);	
+        cert = oxs_key_mgr_get_certificate(key_mgr, env);
         if(!cert)
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
@@ -820,12 +820,14 @@
     oxs_x509_cert_t *cert = NULL;
     axiom_node_t *bst_node = NULL;    
     axis2_char_t *bst_data = NULL;
-    
+    oxs_key_mgr_t *key_mgr = NULL;
+
+	key_mgr = rampart_context_get_key_mgr(rampart_context, env);
     /* 
      * If the requirement is to include the token we should build the binary security
      * token element here.
      */
-    cert = rampart_sig_get_cert(env, rampart_context);
+    cert = oxs_key_mgr_get_certificate(key_mgr, env);
     if (!cert)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,