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 2007/11/06 04:44:47 UTC

svn commit: r592251 [2/2] - in /webservices/rampart/scratch/c/saml: ./ include/ src/ test/

Modified: webservices/rampart/scratch/c/saml/src/response.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/src/response.c?rev=592251&r1=592250&r2=592251&view=diff
==============================================================================
--- webservices/rampart/scratch/c/saml/src/response.c (original)
+++ webservices/rampart/scratch/c/saml/src/response.c Mon Nov  5 19:44:45 2007
@@ -215,6 +215,8 @@
 		response->sig_ctx = NULL;
 		response->status = saml_status_create(env);
 		response->saml_assertions = axutil_array_list_create(env, SAML_ARRAY_LIST_DEF);
+		response->signature = NULL;
+		response->original_xml = NULL;
 	}
 	return response;
 }
@@ -267,6 +269,8 @@
 		}
 		axutil_array_list_free(response->saml_assertions, env);
 	}
+	response->original_xml = NULL;
+	response->signature = NULL;
 	AXIS2_FREE(env->allocator, response);
 	response = NULL;
 }
@@ -306,7 +310,7 @@
 			axiom_attribute_t *attr = (axiom_attribute_t*)v;			
 			attr_val = axiom_attribute_get_value(attr, env);
 
-			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_RESPONCE_ID))
+			if(!axutil_strcmp(axiom_attribute_get_localname(attr, env), SAML_RESPONSE_ID))
 			{
 				response->response_id=  attr_val;
 			}
@@ -400,7 +404,7 @@
 		{
 			if(!response->response_id)
 				response->response_id = saml_id_generate_random_bytes(env);
-			attr = axiom_attribute_create(env, SAML_RESPONCE_ID, response->response_id, NULL);
+			attr = axiom_attribute_create(env, SAML_RESPONSE_ID, response->response_id, NULL);
 			axiom_element_add_attribute(e, env, attr, n);
 			
 			attr = axiom_attribute_create(env, SAML_MAJORVERSION, SAML_MAJOR_VERSION, NULL);
@@ -416,6 +420,7 @@
 		{
 			return NULL;
 		}
+		t = axiom_node_to_string(n, env);
 		if(response->request_response_id && response->recepient)
 		{
 			attr = axiom_attribute_create(env, SAML_IN_RESPONSE_TO, response->request_response_id, NULL);
@@ -424,16 +429,22 @@
 			axiom_element_add_attribute(e, env, attr, n);
 		
 		}
+		t = axiom_node_to_string(n, env);
+
 		if(response->saml_assertions)
 		{
 			size = axutil_array_list_size(response->saml_assertions, env);
 
 			for(i = 0 ; i < size ; i++)
 			{
-				saml_assertion_to_om((saml_assertion_t*)axutil_array_list_get(response->saml_assertions, env, i), n, env);
+				assertion = (saml_assertion_t*)axutil_array_list_get(response->saml_assertions, env, i);
+				if(assertion)
+					saml_assertion_to_om(assertion, n, env);
 
 			}
 		}
+		t = axiom_node_to_string(n, env);
+
 		if(response->status)
 		{
 			saml_status_to_om(response->status, n, env);
@@ -441,7 +452,7 @@
 		t = axiom_node_to_string(n, env);
 		if(response->sig_ctx)
 		{
-			saml_response_sign(response, &n, env);		
+			saml_response_sign(response, n, env);		
 		}
 		t = axiom_node_to_string(n, env);
 	}
@@ -614,7 +625,7 @@
 	response->sig_ctx = NULL;
 	return AXIS2_SUCCESS;
 }
-AXIS2_EXTERN int AXIS2_CALL saml_response_sign(saml_response_t *response, axiom_node_t **node, axutil_env_t *env)
+AXIS2_EXTERN int AXIS2_CALL saml_response_sign(saml_response_t *response, axiom_node_t *node, axutil_env_t *env)
 {
 	 axiom_node_t *n= NULL, *sig_node = NULL;
 	 axis2_char_t *id = NULL;	 
@@ -631,30 +642,27 @@
 			sig_part = axutil_array_list_get(sig_parts, env, i);
 			if(sig_part)
 			{
-				oxs_sign_part_set_node(sig_part, env, *node);
+				oxs_sign_part_set_node(sig_part, env, node);
 			}
 		 }
 	 }
+	id = axiom_node_to_string(node, env);
+	 oxs_xml_sig_sign(env, response->sig_ctx, node, &n);
+	id = axiom_node_to_string(node, env);
+	id = axiom_node_to_string(n, env);
 
-	 oxs_xml_sig_sign(env, response->sig_ctx, *node, &n);
      /*Finally build KeyInfo*/
 	 oxs_xml_key_info_build(env, n, oxs_sign_ctx_get_certificate(response->sig_ctx, env), OXS_KIBP_X509DATA_X509CERTIFICATE);
 	 return AXIS2_SUCCESS;
 }
 AXIS2_EXTERN void AXIS2_CALL saml_response_set_default_signature(saml_response_t *response, axutil_env_t *env, oxs_sign_ctx_t *sig_ctx)
 {
-	oxs_sign_part_t* sig_part = NULL;
-	oxs_transform_t *tr = NULL;	
-	axutil_array_list_t *sig_parts = NULL, *trans = NULL;
-	axiom_attribute_t* att = NULL;
-	axiom_element_t *test = NULL;
-	
 	if(response->sig_ctx)
 	{
 		oxs_sign_ctx_free(response->sig_ctx, env);
 	}
 	response->sig_ctx = sig_ctx;
-	saml_util_set_sig_ctx_defaults(response->sig_ctx, env);
+	saml_util_set_sig_ctx_defaults(response->sig_ctx, env, SAML_RESPONSE_ID);
 }
 AXIS2_EXTERN int AXIS2_CALL saml_status_set_status_code(saml_status_t *status, axis2_char_t *code, axutil_env_t *env)
 {
@@ -666,29 +674,29 @@
 	return AXIS2_SUCCESS;
 }
 
-AXIS2_EXTERN int AXIS2_CALL
-saml_response_signature_verify(saml_response_t *response, axutil_env_t *env)
-{			
-	return oxs_xml_sig_verify(env, response->sig_ctx, response->signature, response->original_xml);
-}
-
-AXIS2_EXTERN int AXIS2_CALL
-saml_response_is_sign_set(saml_response_t *response, axutil_env_t *env)
-{
-	if (response->sig_ctx)
-	{
-		return AXIS2_TRUE;
-	}
-	return AXIS2_FALSE;
-}
-
-AXIS2_EXTERN int AXIS2_CALL
-saml_response_is_signed(saml_response_t *response, axutil_env_t *env)
-{
-	if (response->signature)
-	{
-		return AXIS2_TRUE;
-	}
-	return AXIS2_FALSE;
-}
+AXIS2_EXTERN int AXIS2_CALL
+saml_response_signature_verify(saml_response_t *response, axutil_env_t *env)
+{			
+	return oxs_xml_sig_verify(env, response->sig_ctx, response->signature, response->original_xml);
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+saml_response_is_sign_set(saml_response_t *response, axutil_env_t *env)
+{
+	if (response->sig_ctx)
+	{
+		return AXIS2_TRUE;
+	}
+	return AXIS2_FALSE;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+saml_response_is_signed(saml_response_t *response, axutil_env_t *env)
+{
+	if (response->signature)
+	{
+		return AXIS2_TRUE;
+	}
+	return AXIS2_FALSE;
+}
 

Added: webservices/rampart/scratch/c/saml/test/assertion.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/test/assertion.c?rev=592251&view=auto
==============================================================================
--- webservices/rampart/scratch/c/saml/test/assertion.c (added)
+++ webservices/rampart/scratch/c/saml/test/assertion.c Mon Nov  5 19:44:45 2007
@@ -0,0 +1,256 @@
+#include <SAML.h>
+#include <axutil_env.h>
+#include "saml_test.h"
+#include "saml_test.h"
+#include"saml_test_pr.h"
+
+int main()
+{	
+	axiom_element_t *e = NULL;
+	axiom_node_t *n = NULL, *assertion_node = NULL;	
+	axis2_char_t *a_text = NULL, *b_text = NULL;
+	saml_assertion_t *assertion = NULL;
+	axutil_env_t *env = NULL;
+	axutil_date_time_t *time = NULL;	
+	axiom_xml_reader_t *reader = NULL;
+	axiom_stax_builder_t *builder = NULL;
+	axiom_document_t *document = NULL;
+	axiom_xml_writer_t *writer = NULL;
+	saml_request_t *req = NULL;
+	saml_response_t *res = NULL;
+	axiom_node_t *req_node1 = NULL,*req_node2 = NULL, *res_node1 = NULL, *res_node2 = NULL;
+	axis2_char_t *res_text = NULL, *req_text = NULL;
+	FILE *fp = NULL;
+
+	env = axutil_env_create_all("SAML_TEST.log", AXIS2_LOG_LEVEL_DEBUG);
+
+	/* assertions */
+	assertion = saml_test_assertion(env);
+	axiom_element_create(env, NULL, "TEST_ASSERTION", NULL, &n);
+	saml_assertion_to_om(assertion, n, env);
+	a_text = axiom_node_to_string(n, env);
+	saml_assertion_free(assertion, env);		
+
+	/* from file */
+	/*reader = axiom_xml_reader_create_for_file(env, "test.xml", NULL);
+	builder = axiom_stax_builder_create(env, reader);
+	document = axiom_stax_builder_get_document(builder, env);*/
+  /*assertion_node = axiom_document_build_all(document, env);
+	assertion = saml_assertion_create(env);
+	a_text = axiom_node_to_string(assertion_node, env);
+	saml_assertion_build(assertion, assertion_node, env);
+	assertion_node = saml_assertion_to_om(assertion, NULL, env);  
+	b_text = axiom_node_to_string(assertion_node, env);*/
+
+
+
+	//	saml request response test
+	/*req = saml_request_test(env);
+	res = saml_response_test(env);*/
+
+   res = saml_response_test_with_sign(env);
+   req = saml_request_test_with_sign(env);
+
+	req_node1 = saml_request_to_om(req, NULL, env);
+	res_node1 = saml_response_to_om(res, NULL, env);
+	
+	req_text = axiom_node_to_string(req_node1, env);
+	res_text = axiom_node_to_string(res_node1, env);
+
+	printf("%s \n",req_text);
+
+	fp = fopen("request.xml", "w");
+	fprintf(fp,"%s", req_text);
+	fclose(fp);
+
+	fp = fopen("response.xml", "w");
+	fprintf(fp,"%s", res_text);
+	fclose(fp);
+
+	AXIS2_FREE(env->allocator, req_text);
+	AXIS2_FREE(env->allocator, res_text);
+
+	saml_request_free(req, env);
+	saml_response_free(res, env);	
+	//axiom_node_free_tree(req_node1, env);
+	//axiom_node_free_tree(res_node, env);
+
+	reader = axiom_xml_reader_create_for_file(env, "request.xml", NULL);
+	builder = axiom_stax_builder_create(env, reader);
+	document = axiom_stax_builder_get_document(builder, env);
+	req_node2 = axiom_document_build_all(document, env);
+
+	reader = axiom_xml_reader_create_for_file(env, "response.xml", NULL);
+	builder = axiom_stax_builder_create(env, reader);
+	document = axiom_stax_builder_get_document(builder, env);
+	res_node2 = axiom_document_build_all(document, env);
+
+	req = saml_request_create(env);
+	res = saml_response_create(env);
+
+
+	saml_request_set_default_signature(req, env, saml_load_default_sign(env, "key.pem","cert.pem",""));
+	saml_response_set_default_signature(res, env, saml_load_default_sign(env, "key.pem","cert.pem",""));
+
+	if(!req_node2)
+		saml_request_build(req, req_node1, env);
+	else
+		saml_request_build(req, req_node2, env);
+
+	if(!res_node2)
+		saml_response_build(res, res_node1, env);
+	else
+		saml_response_build(res, res_node2, env);
+
+	if(saml_request_is_signed(req, env))
+		if(saml_request_signature_verify(req, env) == AXIS2_SUCCESS)
+			printf("verifying success\n");
+
+
+
+	return 0;
+}
+
+saml_assertion_t * AXIS2_CALL saml_test_assertion(axutil_env_t *env)
+{
+	axutil_date_time_t *time = NULL;
+	saml_assertion_t *assertion = NULL;
+	time = axutil_date_time_create(env);
+	assertion = saml_assertion_create(env);
+	if (assertion)	
+	{
+		saml_assertion_set_minor_version(assertion, env, 1);		
+		saml_assertion_set_issue_instant(assertion, env, time);
+		saml_assertion_set_issuer(assertion, env, "http://ws.apache.org/rampart/c");	
+		saml_assertion_add_condition(assertion, env, saml_test_condition(env));
+		saml_assertion_set_not_before(assertion, env, axutil_date_time_create(env));
+		saml_assertion_add_statement(assertion, env, saml_test_auth_statement(env));
+		saml_assertion_add_statement(assertion, env, saml_test_attr_statement(env));
+		saml_assertion_add_statement(assertion, env, saml_test_auth_des_statement(env));		
+	}
+	return assertion;
+}
+
+saml_condition_t * AXIS2_CALL saml_test_condition(axutil_env_t *env)
+{
+	saml_audi_restriction_cond_t *arc = NULL;
+	axis2_char_t *audience = NULL, *c_to_om = NULL;
+	axis2_char_t *cond_text = NULL;
+	axiom_element_t *e = NULL;
+	axiom_node_t *n = NULL;	
+	saml_condition_t *condition = AXIS2_MALLOC(env->allocator, sizeof(saml_condition_t));	
+	arc = saml_audi_restriction_cond_create(env);
+	saml_audi_restriction_cond_add_audience(arc, env, "www.samle.com");
+
+	axiom_element_create(env, NULL, "TEST_COND", NULL, &n);
+	/*saml_condition_to_om(condition, n, env);
+	cond_text = axiom_node_to_string(n, env);*/
+	return condition;
+}
+
+saml_stmt_t * AXIS2_CALL saml_test_auth_statement(axutil_env_t *env)
+{
+	saml_auth_stmt_t *a_stmt = NULL;	
+	saml_stmt_t *stmt = saml_stmt_create(env);
+	a_stmt = saml_auth_stmt_create(env);
+	saml_stmt_set_stmt(stmt, env, a_stmt, SAML_STMT_AUTHENTICATIONSTATEMENT);
+
+	saml_auth_stmt_set_auth_method(a_stmt, env, SAML_AUTH_METHOD_URI_PASSWORD);
+	saml_auth_stmt_set_auth_instant(a_stmt, env, axutil_date_time_create(env));
+	
+	saml_auth_stmt_set_subject(a_stmt, env, saml_test_subject(env));	
+	saml_auth_stmt_set_subject_dns(a_stmt, env,  "192.148.5.8");
+	saml_auth_stmt_set_subject_ip(a_stmt, env,  "128.5.6.4");
+	saml_auth_stmt_add_auth_binding(a_stmt, env, saml_test_autherity_binding(env));
+	return stmt;	
+}
+
+saml_stmt_t * AXIS2_CALL saml_test_auth_des_statement(axutil_env_t *env)
+{	
+	saml_auth_desicion_stmt_t *d_stmt = NULL;
+	saml_stmt_t *stmt = NULL;
+	d_stmt = saml_auth_desicion_stmt_create(env);
+	stmt = saml_stmt_create(env);
+	saml_stmt_set_stmt(stmt, env, d_stmt, SAML_STMT_AUTHORIZATIONDECISIONSTATEMENT);
+	
+	saml_auth_desicion_stmt_set_subject(d_stmt, env, saml_test_subject(env)); 
+	saml_auth_desicion_stmt_set_resource(d_stmt, env, "http://cse.mrt.ac.lk/cs420/gruop7");
+	saml_auth_desicion_stmt_set_desicion(d_stmt, env, "Permit");
+	saml_auth_desicion_stmt_add_action(d_stmt, env, saml_test_action(env, SAML_ACTION_READ));
+	saml_auth_desicion_stmt_add_action(d_stmt, env, saml_test_action(env, SAML_ACTION_WRITE));
+	return stmt;
+}
+
+saml_action_t * AXIS2_CALL saml_test_action(axutil_env_t *env, axis2_char_t *act)
+{
+	saml_action_t *action = NULL;
+	action = saml_action_create(env);
+	saml_action_set_namespace(action, env, SAML_ACTION_URI_RWEDC);
+	saml_action_set_data(action, env, act);
+	return action;
+}
+
+
+saml_auth_binding_t * AXIS2_CALL saml_test_autherity_binding(axutil_env_t *env)
+{
+	saml_auth_binding_t *bind = NULL;
+	bind = saml_auth_binding_create(env);
+	saml_auth_binding_set_authority_kind(bind, env, "abc:aa:aa");
+	saml_auth_binding_set_binding(bind, env, "SOAP");
+	saml_auth_binding_set_location(bind, env, "http://myhome.com/sevices/echo");
+	return bind;
+}
+
+
+saml_subject_t * AXIS2_CALL saml_test_subject(axutil_env_t *env)
+{
+	saml_subject_t *subject = NULL;
+	saml_named_id_t *id = NULL;		
+	subject = saml_subject_create(env);
+	
+	id = saml_named_id_create(env);
+	saml_named_id_set_name(id, env, "Computer Science Engineering Department");
+	saml_named_id_set_format(id, env, SAML_EMAIL_ADDRESS);
+	saml_named_id_set_name_qualifier(id, env, "University of Moratuwa");
+	saml_subject_set_named_id(subject, env, id);
+
+	saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_ARTIFACT);
+	saml_subject_add_confirmation(subject, env, SAML_SUB_CONFIRMATION_BEARER);	
+	return subject;
+}
+
+saml_stmt_t * AXIS2_CALL saml_test_attr_statement(axutil_env_t *env)
+{
+	axiom_node_t *n = NULL;
+	axiom_element_t *e = NULL;	
+	axis2_char_t *text = NULL;
+	saml_attr_stmt_t *attr_stmt = NULL;	
+	saml_stmt_t *stmt = saml_stmt_create(env);
+	attr_stmt = saml_attr_stmt_create(env);
+
+	/* set the specific statement to the saml_stmt_t */
+	saml_stmt_set_stmt(stmt, env, attr_stmt, SAML_STMT_ATTRIBUTESTATEMENT);
+	
+	/*Now set the properties of the attr_stmt */
+	saml_attr_stmt_set_subject(attr_stmt, env, saml_test_subject(env));									
+
+	saml_attr_stmt_add_attribute(attr_stmt, env, saml_test_attribute(env));  	
+	return stmt;
+}
+
+saml_attr_t *AXIS2_CALL saml_test_attribute(axutil_env_t *env)
+{
+	saml_attr_t *attr = NULL;	
+	axiom_namespace_t *ns = NULL;	
+	axiom_node_t *n = NULL;
+	axiom_element_t *e = NULL;
+	attr = saml_attr_create(env);
+	ns = axiom_namespace_create(env, "http://cse.mrt.ac.lk", "mora");
+	e = axiom_element_create(env, NULL, "CS420", ns, &n);
+	saml_attr_add_value(attr, env, n);
+
+	saml_attr_set_name(attr, env, "Projects");
+	saml_attr_set_namespace(attr, env, "mora:http://cse.mrt.ac.lk");	
+	return attr;
+}
+

Added: webservices/rampart/scratch/c/saml/test/cert.pem
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/test/cert.pem?rev=592251&view=auto
==============================================================================
--- webservices/rampart/scratch/c/saml/test/cert.pem (added)
+++ webservices/rampart/scratch/c/saml/test/cert.pem Mon Nov  5 19:44:45 2007
@@ -0,0 +1,62 @@
+Certificate:
+    Data:
+        Version: 3 (0x2)
+        Serial Number:
+            dc:83:fa:3c:1e:93:11:ae
+        Signature Algorithm: sha1WithRSAEncryption
+        Issuer: C=SL, ST=WP, O=WS, OU=C, CN=Kaushalye/emailAddress=kaus@wso2.com
+        Validity
+            Not Before: Dec  6 10:27:18 2006 GMT
+            Not After : Dec  6 10:27:18 2007 GMT
+        Subject: C=SL, ST=WP, L=Katubedda, O=WS, OU=C, CN=Aaa/emailAddress=aaa@ws.com
+        Subject Public Key Info:
+            Public Key Algorithm: rsaEncryption
+            RSA Public Key: (1024 bit)
+                Modulus (1024 bit):
+                    00:c7:e1:d8:5c:ef:16:dd:5d:05:95:c8:16:7c:2f:
+                    f5:13:15:b4:7a:0c:c8:fb:95:c8:03:db:3d:a8:41:
+                    5d:70:75:ce:27:15:e2:a3:ef:87:24:38:5a:ee:72:
+                    ea:70:c2:45:44:b5:dd:46:ca:51:60:15:ac:51:c3:
+                    59:af:a8:17:85:af:cd:77:74:87:b2:4b:ab:13:e0:
+                    00:82:2f:2a:d0:6b:12:7d:09:dc:52:dc:16:10:58:
+                    46:38:74:c7:cf:98:96:e3:58:ce:8a:c8:31:fa:77:
+                    6c:69:65:dc:a1:4c:38:e7:b0:9e:dc:64:06:ae:aa:
+                    13:90:23:62:84:14:c0:9e:31
+                Exponent: 65537 (0x10001)
+        X509v3 extensions:
+            X509v3 Basic Constraints: 
+                CA:FALSE
+            Netscape Comment: 
+                OpenSSL Generated Certificate
+            X509v3 Subject Key Identifier: 
+                67:B7:BC:8C:22:29:1E:17:58:C6:43:91:A6:FB:82:E7:11:77:62:D6
+            X509v3 Authority Key Identifier: 
+                keyid:D7:27:10:74:4B:F8:2F:44:0B:BC:C7:9E:04:EF:22:5B:15:18:21:CC
+
+    Signature Algorithm: sha1WithRSAEncryption
+        4d:36:00:f0:51:10:44:72:73:5f:09:e4:fe:ad:f4:5b:a0:48:
+        5f:50:50:d7:bb:bb:2a:98:b3:b7:d7:54:9e:57:6d:d2:cd:de:
+        d5:d5:30:4d:c7:03:09:b4:7d:d8:72:17:f7:c6:e8:72:69:89:
+        b9:bc:91:5a:a8:c8:9e:ee:76:0b:c2:ae:c2:65:59:94:5b:fe:
+        a2:30:bf:aa:49:25:b1:42:bc:6d:c4:0a:99:aa:2d:17:14:d8:
+        8d:19:cd:75:22:84:51:22:55:4e:e1:9e:50:1f:c6:c2:57:e1:
+        4b:58:87:d5:73:c1:69:fd:25:dd:3d:50:ee:0e:9f:6a:9a:13:
+        52:45
+-----BEGIN CERTIFICATE-----
+MIICzjCCAjegAwIBAgIJANyD+jwekxGuMA0GCSqGSIb3DQEBBQUAMGUxCzAJBgNV
+BAYTAlNMMQswCQYDVQQIEwJXUDELMAkGA1UEChMCV1MxCjAIBgNVBAsTAUMxEjAQ
+BgNVBAMTCUthdXNoYWx5ZTEcMBoGCSqGSIb3DQEJARYNa2F1c0B3c28yLmNvbTAe
+Fw0wNjEyMDYxMDI3MThaFw0wNzEyMDYxMDI3MThaMHAxCzAJBgNVBAYTAlNMMQsw
+CQYDVQQIEwJXUDESMBAGA1UEBxMJS2F0dWJlZGRhMQswCQYDVQQKEwJXUzEKMAgG
+A1UECxMBQzEMMAoGA1UEAxMDQWFhMRkwFwYJKoZIhvcNAQkBFgphYWFAd3MuY29t
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDH4dhc7xbdXQWVyBZ8L/UTFbR6
+DMj7lcgD2z2oQV1wdc4nFeKj74ckOFrucupwwkVEtd1GylFgFaxRw1mvqBeFr813
+dIeyS6sT4ACCLyrQaxJ9CdxS3BYQWEY4dMfPmJbjWM6KyDH6d2xpZdyhTDjnsJ7c
+ZAauqhOQI2KEFMCeMQIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQf
+Fh1PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUZ7e8jCIp
+HhdYxkORpvuC5xF3YtYwHwYDVR0jBBgwFoAU1ycQdEv4L0QLvMeeBO8iWxUYIcww
+DQYJKoZIhvcNAQEFBQADgYEATTYA8FEQRHJzXwnk/q30W6BIX1BQ17u7Kpizt9dU
+nldt0s3e1dUwTccDCbR92HIX98bocmmJubyRWqjInu52C8KuwmVZlFv+ojC/qkkl
+sUK8bcQKmaotFxTYjRnNdSKEUSJVTuGeUB/GwlfhS1iH1XPBaf0l3T1Q7g6fapoT
+UkU=
+-----END CERTIFICATE-----

Added: webservices/rampart/scratch/c/saml/test/key.pem
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/test/key.pem?rev=592251&view=auto
==============================================================================
--- webservices/rampart/scratch/c/saml/test/key.pem (added)
+++ webservices/rampart/scratch/c/saml/test/key.pem Mon Nov  5 19:44:45 2007
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICWwIBAAKBgQDH4dhc7xbdXQWVyBZ8L/UTFbR6DMj7lcgD2z2oQV1wdc4nFeKj
+74ckOFrucupwwkVEtd1GylFgFaxRw1mvqBeFr813dIeyS6sT4ACCLyrQaxJ9CdxS
+3BYQWEY4dMfPmJbjWM6KyDH6d2xpZdyhTDjnsJ7cZAauqhOQI2KEFMCeMQIDAQAB
+AoGAQIrSvJ+PeIdTCFyFtjAeKL13e3mpZGOnJGek7zG8JFZF7SUJ+/maX726zwhY
+X3S7vUYkX3lw8V/ONtCnoyrZ/QQBqvUPUGg2XJI+NDYDrc3RR9YHTBFiYt791iXX
+2/hpQJV7Fj2K40AxAgcDmOmsjhMROhc52cERXNUTvqo+sIECQQD+WbS0NQL4kcRZ
+kELonmCHNAFA+vYvfB82RCspctNbfoZUAUPn/BMWTf9jZms89mDGfzaWKP5xd9aB
+Hi7sTp4JAkEAyS204Q36vnbDh5Dzz5YkJNFTdgyrLTBIQ5r4ax+K1i6V/Mwq07Zw
+SCvdDaTiBHOSaVJSHE38iwZZxUsWAs6I6QJADGFlcFgcOukte4aQGy6KWEppvTX6
+Abmy8ztCNpRGQW/ZLgGZwpL8gtttEPONSLxdXYwXpht8tx00LbjAY/Q3sQJAHqEg
+2ur/9COs3WUKWd6oHhrotB51qWmidviPPfANeVKab2S+WIF8UuCqxTsHVloqPnLU
+IY8WFiyfWlR2Q3MikQJASXg8KPM8C8Jp17iBbF5f09V18iA1fAbQSaLk3Lcbp1/h
+0VsiOHjW05LvI8zIHMX2Ops7qAjxixK1T/2ec9qhuQ==
+-----END RSA PRIVATE KEY-----

Added: webservices/rampart/scratch/c/saml/test/protocol.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/test/protocol.c?rev=592251&view=auto
==============================================================================
--- webservices/rampart/scratch/c/saml/test/protocol.c (added)
+++ webservices/rampart/scratch/c/saml/test/protocol.c Mon Nov  5 19:44:45 2007
@@ -0,0 +1,149 @@
+#include<SAML.h>
+#include"saml_test.h"
+#include"saml_test_pr.h"
+
+saml_request_t* AXIS2_CALL saml_request_test(axutil_env_t *env)
+{
+	saml_request_t *request = NULL;
+	axutil_date_time_t *time = NULL;
+	axutil_array_list_t *id_ref = NULL;
+	saml_query_t *q1 = NULL, *q2 = NULL, *q3 = NULL;
+	axutil_qname_t *qname = NULL;
+	saml_artifact_t *artifact1 = NULL, *artifact2 = NULL;
+
+	qname = axutil_qname_create_from_string(env,"saml:AuthorizationDecisionQuery");
+	request = saml_request_create(env);
+	time = axutil_date_time_create(env);
+	artifact1 = saml_artifact_create(env);
+	artifact2 = saml_artifact_create(env);
+
+	saml_artifact_set_data(artifact1, env, "ID178AE");
+	saml_artifact_set_data(artifact2, env, "ID278AB");
+
+	q1 = saml_query_create(env);
+	saml_query_set_subject(q1, saml_test_subject(env), env);
+	saml_query_set_type(q1, SAML_AUTHORIZATION_DECISION_QUERY, env);
+	saml_query_set_query(q1, saml_autho_decision_query_test(env), SAML_AUTHORIZATION_DECISION_QUERY, env);
+
+	saml_request_set_issue_instant(request, time, env);
+	saml_request_set_minor_version(request, 1, env);
+	saml_request_set_query(request, q1, env);
+
+	saml_request_add_artifact(request, artifact1, env);
+	saml_request_add_id_refs(request, "bc1cbaf00742737c2299f1baa88290eb", env);
+	saml_request_add_artifact(request, artifact2, env);
+	saml_request_add_id_refs(request, "bc2cbaf00742737c2299f1baa88290ec", env);
+	saml_request_add_respond_with(request, qname, env);
+	return request;
+
+}
+saml_response_t* AXIS2_CALL saml_response_test(axutil_env_t *env)
+{
+	saml_response_t *res = NULL;
+	axutil_date_time_t *time = NULL;
+	time = axutil_date_time_create(env);
+	res = saml_response_create(env);
+	saml_response_set_issue_instant(res, time, env);
+	saml_response_set_minor_version(res, 1, env);
+	saml_response_set_recepient(res, "www.webex.com", env);
+	saml_response_set_status(res, saml_status_test(env), env);
+	saml_response_set_in_reponses_to(res, "d0aac0fb9e6b4ffda4576e7a15e55b5d", env);
+	saml_response_add_assertion(res, saml_test_assertion(env), env);
+	saml_response_add_assertion(res, saml_test_assertion(env), env);
+	saml_response_add_assertion(res, saml_test_assertion(env), env);
+
+	return res;
+}
+saml_status_t* AXIS2_CALL saml_status_test(axutil_env_t *env)
+{
+	saml_status_t *st = NULL;
+	axiom_node_t *n_det = NULL;
+	axutil_qname_t *qname = NULL;
+
+	qname = axutil_qname_create_from_string(env, "samlp:Success");
+	n_det = axiom_node_create(env);
+	st = saml_status_create(env);
+	saml_status_set_status_msg(st, "Success", env);
+	saml_status_set_status_detail(st, n_det, env);
+	saml_status_set_status_value(st, qname, env);
+	saml_status_set_status_code(st, "SAML1.567A", env);
+	return st;
+}
+
+saml_subject_query_t* AXIS2_CALL saml_subject_query_test(axutil_env_t *env)
+{
+	saml_subject_query_t *subj_q = NULL;
+	subj_q = saml_subject_query_create(env);
+	return subj_q;
+}
+
+saml_attr_query_t* AXIS2_CALL saml_attr_query_test(axutil_env_t *env)
+{
+	saml_attr_query_t *attr_q = NULL;
+	saml_attr_desig_t *desig = NULL;
+		
+	attr_q = saml_attr_query_create(env);
+	desig = saml_attr_desig_create(env);
+	saml_attr_desig_set_name(desig, env, "");
+	saml_attr_desig_set_namespace(desig, env, "");
+
+	saml_attr_query_set_resource(attr_q, env, "");
+	saml_attr_query_add_designators(attr_q, desig, env);
+	return attr_q;
+}
+
+saml_authentication_query_t* AXIS2_CALL saml_authentication_query_test(axutil_env_t *env)
+{
+	saml_authentication_query_t *auth_q = NULL;
+	auth_q = saml_authentication_query_create(env);
+	saml_auth_query_set_authentication_method(auth_q, "", env);
+	return auth_q;
+}
+saml_autho_decision_query_t* AXIS2_CALL saml_autho_decision_query_test(axutil_env_t *env)
+{
+	saml_autho_decision_query_t *auth_dec_q = NULL;
+	saml_evidence_t *evidence = NULL;
+	saml_assertion_t *assert = NULL;
+
+	auth_dec_q = saml_autho_decision_query_create(env);
+	evidence = saml_evidence_create(env);
+	assert = saml_test_assertion(env);
+	saml_evidence_add_assertion(evidence, env, assert);
+	saml_evidence_add_assertion_id(evidence, env, assert->assertion_id);
+	saml_autho_decision_query_add_action(auth_dec_q, saml_test_action(env,"opensciencegrid:authorization"), env);
+	saml_autho_decision_query_set_evidence(auth_dec_q,evidence, env);
+	saml_autho_decision_query_set_resource(auth_dec_q, "/DC=org/DC=doegrids/OU=Services/CN=fcdfosg1.fnal.gov", env);
+	return auth_dec_q;
+}
+
+oxs_sign_ctx_t* AXIS2_CALL saml_load_default_sign(axutil_env_t *env, axis2_char_t *pvk_path, axis2_char_t *cert_path, axis2_char_t *pswd)
+{
+	oxs_sign_ctx_t *sig_ctx = NULL;
+	oxs_x509_cert_t *cert = NULL;
+	openssl_pkey_t *pkey = NULL;
+
+	sig_ctx = oxs_sign_ctx_create(env);
+	pkey = oxs_key_mgr_load_private_key_from_pem_file(env, pvk_path, pswd);
+    cert = oxs_key_mgr_load_x509_cert_from_pem_file(env, cert_path);
+
+	oxs_sign_ctx_set_private_key(sig_ctx, env, pkey);
+	oxs_sign_ctx_set_certificate(sig_ctx, env,cert); 
+
+	return sig_ctx;
+
+}
+saml_request_t* AXIS2_CALL saml_request_test_with_sign(axutil_env_t *env)
+{
+	saml_request_t *req = NULL;
+	req = saml_request_test(env);
+	saml_request_set_default_signature(req, env, saml_load_default_sign(env, "key.pem","cert.pem",""));
+	return req;
+}
+saml_response_t* AXIS2_CALL saml_response_test_with_sign(axutil_env_t *env)
+{
+	saml_response_t *res = NULL;
+	res = saml_response_test(env);
+	saml_response_set_default_signature(res, env, saml_load_default_sign(env, "key.pem","cert.pem",""));
+	return res;
+
+}

Added: webservices/rampart/scratch/c/saml/test/saml_test_assertion.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/test/saml_test_assertion.h?rev=592251&view=auto
==============================================================================
--- webservices/rampart/scratch/c/saml/test/saml_test_assertion.h (added)
+++ webservices/rampart/scratch/c/saml/test/saml_test_assertion.h Mon Nov  5 19:44:45 2007
@@ -0,0 +1,12 @@
+#include<SAML.h>
+#include<saml_req.h>
+
+saml_assertion_t * AXIS2_CALL saml_test_assertion(axutil_env_t *env);
+saml_condition_t * AXIS2_CALL saml_test_condition(axutil_env_t *env);
+saml_stmt_t * AXIS2_CALL saml_test_auth_statement(axutil_env_t *env);
+saml_stmt_t * AXIS2_CALL saml_test_auth_des_statement(axutil_env_t *env);
+saml_action_t * AXIS2_CALL saml_test_action(axutil_env_t *env, axis2_char_t *act);
+saml_auth_binding_t * AXIS2_CALL saml_test_autherity_binding(axutil_env_t *env);
+saml_subject_t * AXIS2_CALL saml_test_subject(axutil_env_t *env);
+saml_stmt_t * AXIS2_CALL saml_test_attr_statement(axutil_env_t *env);
+saml_attr_t *AXIS2_CALL saml_test_attribute(axutil_env_t *env);

Added: webservices/rampart/scratch/c/saml/test/saml_test_protocol.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/saml/test/saml_test_protocol.h?rev=592251&view=auto
==============================================================================
--- webservices/rampart/scratch/c/saml/test/saml_test_protocol.h (added)
+++ webservices/rampart/scratch/c/saml/test/saml_test_protocol.h Mon Nov  5 19:44:45 2007
@@ -0,0 +1,23 @@
+#include"saml_test.h"
+#include<saml_req.h>
+#include <oxs_xml_signature.h>
+#include <oxs_sign_ctx.h>
+#include <oxs_xml_key_processor.h>
+#include <oxs_utility.h>
+#include <oxs_transforms_factory.h>
+#include <oxs_xml_key_info_builder.h>
+#include <oxs_key_mgr.h>
+#include <oxs_transform.h>
+#include <oxs_x509_cert.h>
+
+saml_request_t* AXIS2_CALL saml_request_test(axutil_env_t *env);
+saml_response_t* AXIS2_CALL saml_response_test(axutil_env_t *env);
+saml_request_t* AXIS2_CALL saml_request_test_with_sign(axutil_env_t *env);
+saml_response_t* AXIS2_CALL saml_response_test_with_sign(axutil_env_t *env);
+
+saml_status_t* AXIS2_CALL saml_status_test(axutil_env_t *env);
+saml_subject_query_t* AXIS2_CALL saml_subject_query_test(axutil_env_t *env);
+saml_attr_query_t* AXIS2_CALL saml_attr_query_test(axutil_env_t *env);
+saml_authentication_query_t* AXIS2_CALL saml_authentication_query_test(axutil_env_t *env);
+saml_autho_decision_query_t* AXIS2_CALL saml_autho_decision_query_test(axutil_env_t *env);
+oxs_sign_ctx_t* AXIS2_CALL saml_load_default_sign(axutil_env_t *env, axis2_char_t *pvk_path, axis2_char_t *cert_path, axis2_char_t *pswd);
\ No newline at end of file