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/04/25 07:34:16 UTC

svn commit: r651489 - in /webservices/rampart/scratch/c/pkcs/c: samples/ samples/callback/ samples/keys/ahome/ samples/keys/bhome/ samples/secpolicy/scenario3/ src/util/

Author: milinda
Date: Thu Apr 24 22:34:05 2008
New Revision: 651489

URL: http://svn.apache.org/viewvc?rev=651489&view=rev
Log:
PKCS12 support.

Modified:
    webservices/rampart/scratch/c/pkcs/c/samples/build.sh
    webservices/rampart/scratch/c/pkcs/c/samples/callback/pwcb.c
    webservices/rampart/scratch/c/pkcs/c/samples/keys/ahome/Makefile.am
    webservices/rampart/scratch/c/pkcs/c/samples/keys/bhome/Makefile.am
    webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/client-policy.xml
    webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/services.xml
    webservices/rampart/scratch/c/pkcs/c/src/util/rampart_engine.c

Modified: webservices/rampart/scratch/c/pkcs/c/samples/build.sh
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/samples/build.sh?rev=651489&r1=651488&r2=651489&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/samples/build.sh (original)
+++ webservices/rampart/scratch/c/pkcs/c/samples/build.sh Thu Apr 24 22:34:05 2008
@@ -1,6 +1,6 @@
 #!/bin/bash
 ./autogen.sh
-./configure --prefix=${AXIS2C_HOME} --enable-static=no --with-axis2=${AXIS2C_HOME}/include/axis2-1.3.0
+./configure --prefix=${AXIS2C_HOME} --enable-static=no --with-axis2=${AXIS2C_HOME}/include/axis2-1.3.1
 make
 make install
 cd client/sec_echo

Modified: webservices/rampart/scratch/c/pkcs/c/samples/callback/pwcb.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/samples/callback/pwcb.c?rev=651489&r1=651488&r2=651489&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/samples/callback/pwcb.c (original)
+++ webservices/rampart/scratch/c/pkcs/c/samples/callback/pwcb.c Thu Apr 24 22:34:05 2008
@@ -1,4 +1,4 @@
-/*
+ /*
  * 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.
@@ -88,6 +88,12 @@
     		0 == axutil_strcmp((axis2_char_t*)param, RAMPART_PKCS))
     {
     	pw = "hello";
+    }
+    else if (param != NULL && 
+    		0 == axutil_strcmp(username, "Bob") && 
+    		0 == axutil_strcmp((axis2_char_t*)param, RAMPART_PKCS))
+    {
+    	pw = "bobpkcs";
     }
     else
     {

Modified: webservices/rampart/scratch/c/pkcs/c/samples/keys/ahome/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/samples/keys/ahome/Makefile.am?rev=651489&r1=651488&r2=651489&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/samples/keys/ahome/Makefile.am (original)
+++ webservices/rampart/scratch/c/pkcs/c/samples/keys/ahome/Makefile.am Thu Apr 24 22:34:05 2008
@@ -1,3 +1,3 @@
 resdir=$(prefix)/bin/samples/rampart/keys/ahome
-res_DATA= a_key.pem  a_req.pem b_cert.cert a_cert.cert alice_key.pem alice_cert.cert bob_cert.cert
-EXTRA_DIST= a_key.pem  a_req.pem b_cert.cert a_cert.cert alice_key.pem alice_cert.cert bob_cert.cert
+res_DATA= a_key.pem  a_req.pem b_cert.cert a_cert.cert alice_key.pem alice_cert.cert bob_cert.cert alice_keystore.p12
+EXTRA_DIST= a_key.pem  a_req.pem b_cert.cert a_cert.cert alice_key.pem alice_cert.cert bob_cert.cert alice_keystore.p12

Modified: webservices/rampart/scratch/c/pkcs/c/samples/keys/bhome/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/samples/keys/bhome/Makefile.am?rev=651489&r1=651488&r2=651489&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/samples/keys/bhome/Makefile.am (original)
+++ webservices/rampart/scratch/c/pkcs/c/samples/keys/bhome/Makefile.am Thu Apr 24 22:34:05 2008
@@ -1,3 +1,3 @@
 resdir=$(prefix)/bin/samples/rampart/keys/bhome
-res_DATA= a_cert.cert  b_key.pem  b_req.pem  b_cert.cert alice_cert.cert bob_cert.cert bob_key.pem
-EXTRA_DIST= a_cert.cert  b_key.pem  b_req.pem  b_cert.cert alice_cert.cert bob_cert.cert bob_key.pem
+res_DATA= a_cert.cert  b_key.pem  b_req.pem  b_cert.cert alice_cert.cert bob_cert.cert bob_key.pem bob_keystore.p12
+EXTRA_DIST= a_cert.cert  b_key.pem  b_req.pem  b_cert.cert alice_cert.cert bob_cert.cert bob_key.pem bob_keystore.p12

Modified: webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/client-policy.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/client-policy.xml?rev=651489&r1=651488&r2=651489&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/client-policy.xml (original)
+++ webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/client-policy.xml Thu Apr 24 22:34:05 2008
@@ -48,9 +48,7 @@
                 <rampc:EncryptionUser>a</rampc:EncryptionUser>
                 <rampc:PasswordType>Digest</rampc:PasswordType>
                 <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
-                <rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert</rampc:ReceiverCertificate>
-                <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert</rampc:Certificate>
-                <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem</rampc:PrivateKey>
+				<rampc:PKCS12KeyStore>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_kstore.p12</rampc:PKCS12KeyStore>                
             </rampc:RampartConfig>
         </wsp:All>
     </wsp:ExactlyOne>

Modified: webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/services.xml
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/services.xml?rev=651489&r1=651488&r2=651489&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/services.xml (original)
+++ webservices/rampart/scratch/c/pkcs/c/samples/secpolicy/scenario3/services.xml Thu Apr 24 22:34:05 2008
@@ -60,10 +60,7 @@
                     <rampc:EncryptionUser>b</rampc:EncryptionUser>
                     <rampc:PasswordType>Digest</rampc:PasswordType>
                     <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
-                    <rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/alice_cert.cert</rampc:ReceiverCertificate>
-                    <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_cert.cert</rampc:Certificate>
-                    <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_key.pem</rampc:PrivateKey>
-                </rampc:RampartConfig>
+                    <rampc:PKCS12KeyStore>AXIS2C_HOME/bin/samples/rampart/keys/bhome/bob_kstore.p12</rampc:PKCS12KeyStore>
             </wsp:All>
         </wsp:ExactlyOne>
     </wsp:Policy>

Modified: webservices/rampart/scratch/c/pkcs/c/src/util/rampart_engine.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/pkcs/c/src/util/rampart_engine.c?rev=651489&r1=651488&r2=651489&view=diff
==============================================================================
--- webservices/rampart/scratch/c/pkcs/c/src/util/rampart_engine.c (original)
+++ webservices/rampart/scratch/c/pkcs/c/src/util/rampart_engine.c Thu Apr 24 22:34:05 2008
@@ -191,7 +191,14 @@
 					password = rampart_callback_password(env, password_callback, enc_user);
 					if((pkcs12_file = rampart_context_get_pkcs12_file_name(rampart_context, env)))
 					{
-						pkcs12_password = RAMPART_CALLBACK_CALLBACK_PASSWORD(password_callback, env, enc_user, RAMPART_PKCS);						
+						pkcs12_password = RAMPART_CALLBACK_CALLBACK_PASSWORD(password_callback, env, enc_user, RAMPART_PKCS);
+						key_store = pkcs12_keystore_create(env, pkcs12_file, pkcs12_password);
+				        if(!key_store)
+				        {
+				        	AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+				        							"[rampart][engine] PKCS12 KeyStore creation failed.");
+				        	return NULL;	
+				        }
 					}
                 }
             }
@@ -203,15 +210,8 @@
 			AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
 						"[rampart][engine] Key mgr creation failed.");
 			return NULL;
-		}
+		}		
 		
-		key_store = pkcs12_keystore_create(env, pkcs12_file, pkcs12_password);
-        if(!key_store)
-        {
-        	AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-        							"[rampart][engine] PKCS12 KeyStore creation failed.");
-        	return NULL;	
-        }
         oxs_key_mgr_set_key_store(key_mgr, env, key_store);
 		        
 		if (password)