Author: kaushalye
Date: Mon Nov 12 03:23:53 2007
New Revision: 594085
URL: http://svn.apache.org/viewvc?rev=594085&view=rev
Log:
Signature Confirmation support.
Modified:
webservices/rampart/trunk/c/include/oxs_constants.h
webservices/rampart/trunk/c/include/rampart_signature.h
webservices/rampart/trunk/c/src/omxmlsec/derivation.c
webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c
webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
webservices/rampart/trunk/c/src/util/rampart_sec_header_processor.c
webservices/rampart/trunk/c/src/util/rampart_signature.c
Modified: webservices/rampart/trunk/c/include/oxs_constants.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_constants.h?rev=594085&r1=594084&r2=594085&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_constants.h (original)
+++ webservices/rampart/trunk/c/include/oxs_constants.h Mon Nov 12 03:23:53 2007
@@ -65,6 +65,7 @@
#define OXS_CERT_ID "CertID"
#define OXS_EMBEDDED_ID "EmbeddedID"
#define OXS_DERIVED_ID "DKID"
+#define OXS_SIG_CONF_ID "SigConfID"
/****************************************************************
Global namespaces
Modified: webservices/rampart/trunk/c/include/rampart_signature.h
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_signature.h?rev=594085&r1=594084&r2=594085&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_signature.h (original)
+++ webservices/rampart/trunk/c/include/rampart_signature.h Mon Nov 12 03:23:53
2007
@@ -37,7 +37,12 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rampart_sig_confirm_signature(const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx,
+ rampart_context_t *rampart_context,
+ axiom_node_t *sec_node);
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_sig_sign_message(const axutil_env_t *env,
axis2_msg_ctx_t *msg_ctx,
Modified: webservices/rampart/trunk/c/src/omxmlsec/derivation.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/derivation.c?rev=594085&r1=594084&r2=594085&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/derivation.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/derivation.c Mon Nov 12 03:23:53
2007
@@ -86,6 +86,8 @@
/*We need to set the name of the derived key*/
id = oxs_axiom_get_attribute_value_of_node_by_name(env, dk_token_node,
OXS_ATTR_ID, OXS_WSU_XMLNS);
oxs_key_set_name(derived_key, env, id);
+
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[oxs][derivation] DK=%s derived
from Sk=%s ", id , oxs_key_get_name(base_key, env) );
return derived_key;
}
Modified: webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c?rev=594085&r1=594084&r2=594085&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c Mon Nov 12
03:23:53 2007
@@ -339,8 +339,7 @@
/*Decrypt*/
status = oxs_xml_enc_decrypt_data(env, enc_ctx, enc_type_node, result_buf);
if(AXIS2_FAILURE == status){
- oxs_error(env, ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
- "Data encryption failed");
+ oxs_error(env, ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED, "Data
encryption failed");
return AXIS2_FAILURE;
}
decrypted_data = axutil_strmemdup(oxs_buffer_get_data(result_buf, env),
oxs_buffer_get_size(result_buf, env), env);
@@ -534,17 +533,20 @@
axis2_status_t status = AXIS2_FAILURE;
oxs_buffer_t *input_buf = NULL;
oxs_buffer_t *result_buf = NULL;
+ axis2_char_t *key_name = NULL;
/*Get encryption method algorithm*/
enc_mtd_node = oxs_axiom_get_first_child_node_by_name(env,
encrypted_key_node, OXS_NODE_ENCRYPTION_METHOD,OXS_ENC_NS,OXS_XENC);
enc_mtd_algo = oxs_token_get_encryption_method(env, enc_mtd_node);
if(!enc_mtd_algo){
+ oxs_error(env, ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED, "Cannot find
the Encryption method");
return AXIS2_FAILURE;
}
/*Get cipher data*/
cd_node = oxs_axiom_get_first_child_node_by_name(env, encrypted_key_node,
OXS_NODE_CIPHER_DATA,OXS_ENC_NS,OXS_XENC);
cipher_val = oxs_token_get_cipher_value_from_cipher_data(env, cd_node);
if(!cipher_val){
+ oxs_error(env, ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED, "Cannot find
the cipher value for key decryption");
return AXIS2_FAILURE;
}
@@ -579,10 +581,11 @@
return AXIS2_FAILURE;
}
+ key_name = oxs_axiom_get_attribute_value_of_node_by_name(env,
encrypted_key_node, OXS_ATTR_ID, NULL);
/*Populate the key with the data in the result buffer*/
oxs_key_populate(key, env,
oxs_buffer_get_data(result_buf, env),
- "decrypted_session_key",
+ key_name,
oxs_buffer_get_size(result_buf, env),
OXS_KEY_USAGE_SESSION );
/*Free*/
Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c?rev=594085&r1=594084&r2=594085&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c Mon Nov
12 03:23:53 2007
@@ -88,6 +88,15 @@
}
}
+ /*Signature Confirmation support. Only in the server side*/
+ if(axis2_msg_ctx_get_server_side(msg_ctx,env)){
+ axis2_bool_t sign_conf_reqd = AXIS2_TRUE;
+ /*TODO sign_conf_reqd <- Get from context <- policy*/
+ if(sign_conf_reqd){
+ status = rampart_sig_confirm_signature(env, msg_ctx,
rampart_context, sec_node);
+ }
+ }
+
/*Check the encryption and signature order*/
if(rampart_context_is_encrypt_before_sign(rampart_context, env))
{
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=594085&r1=594084&r2=594085&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 Mon Nov
12 03:23:53 2007
@@ -1234,10 +1234,10 @@
}else if ((rampart_context_get_binding_type(rampart_context,env)) ==
RP_PROPERTY_SYMMETRIC_BINDING){
status = rampart_shp_process_sym_binding_signature(env, msg_ctx,
rampart_context, soap_envelope, sec_node, sig_node);
}else if((rampart_context_get_binding_type(rampart_context,env)) ==
RP_PROPERTY_TRANSPORT_BINDING){
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shp] Transport
Binding Not supported", );
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shp] Transport
Binding Not supported" );
/*Not supported*/
}else{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shp] Binding type
not supported", );
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shp] Binding type
not supported");
/*Not supported*/
}
return status;
Modified: webservices/rampart/trunk/c/src/util/rampart_signature.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_signature.c?rev=594085&r1=594084&r2=594085&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_signature.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_signature.c Mon Nov 12
03:23:53 2007
@@ -713,6 +713,31 @@
return status;
}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_sig_confirm_signature(const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx,
+ rampart_context_t *rampart_context,
+ axiom_node_t *sec_node)
+{
+ axis2_char_t *id = NULL;
+ axis2_char_t *sig_val = NULL;
+
+ /*Check whether the request was signed*/
+ /*If there is no signature. @Value is not present*/
+ /*If the request has signed, then the @Value = contents of
<ds:SignatureValue>*/
+
+ /*Generate an Id*/
+ id = oxs_util_generate_id(env,(axis2_char_t*)OXS_SIG_CONF_ID);
+
+ /*TODO: Get the SignatureValue from the request*/
+ sig_val = "FAKE-SIG-VAL==";
+
+ /*Build wsse11:SignatureConfirmation element */
+ oxs_token_build_signature_confirmation_element(env, sec_node, id, sig_val);
+
+ return AXIS2_SUCCESS;
+
+}