Author: kaushalye
Date: Mon Oct 8 23:33:26 2007
New Revision: 583056
URL: http://svn.apache.org/viewvc?rev=583056&view=rev
Log:
DerivedKey encryption implementation in the Rampart Encryption module
Modified:
webservices/rampart/trunk/c/include/oxs_constants.h
webservices/rampart/trunk/c/src/util/rampart_encryption.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=583056&r1=583055&r2=583056&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_constants.h (original)
+++ webservices/rampart/trunk/c/include/oxs_constants.h Mon Oct 8 23:33:26 2007
@@ -305,6 +305,8 @@
#define OXS_NAME_SHA512 "sha512"
#define OXS_HREF_SHA512 "http://www.w3.org/2001/04/xmlenc#sha512"
+#define OXS_SC_DK_NAME_P_SHA1 "P_SHA-1"
+#define OXS_SC_DK_HREF_P_SHA1
"http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1"
/****************************************************************
X509
****************************************************************/
Modified: webservices/rampart/trunk/c/src/util/rampart_encryption.c
URL:
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_encryption.c?rev=583056&r1=583055&r2=583056&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Mon Oct 8
23:33:26 2007
@@ -63,6 +63,66 @@
/*Public functions*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rampart_enc_dk_encrypt_message(const axutil_env_t *env,
+ axis2_msg_ctx_t *msg_ctx,
+ rampart_context_t *rampart_context,
+ axiom_soap_envelope_t *soap_envelope,
+ axiom_node_t *sec_node)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ oxs_key_t *session_key = NULL;
+ axutil_array_list_t *nodes_to_encrypt = NULL;
+ axis2_char_t *enc_sym_algo = NULL;
+
+ /*TODO Derived Key Encryption*/
+
+ /*Get nodes to be encrypted*/
+ nodes_to_encrypt = axutil_array_list_create(env, 0);
+ status = rampart_enc_get_nodes_to_encrypt(
+ rampart_context, env, soap_envelope, nodes_to_encrypt);
+
+ if(status != AXIS2_SUCCESS)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_signature] Error occured in Adding
Encrypted parts..");
+ axutil_array_list_free(nodes_to_encrypt, env);
+ nodes_to_encrypt = NULL;
+ return AXIS2_FAILURE;
+ }
+
+
+ /*Get the symmetric encryption algorithm*/
+ enc_sym_algo = rampart_context_get_enc_sym_algo(rampart_context, env);
+
+ /*If not specified set the default*/
+ if(!enc_sym_algo || (0 == axutil_strcmp(enc_sym_algo, "")))
+ {
+ AXIS2_LOG_INFO(env->log,
+ "[rampart][rampart_encryption] No symmetric algorithm
is specified for encryption. Using the default");
+ enc_sym_algo = OXS_DEFAULT_SYM_ALGO;
+ }
+
+
+ /*Generate the session key*/
+ session_key = oxs_key_create(env);
+ status = oxs_key_for_algo(session_key, env, enc_sym_algo);
+ if(AXIS2_FAILURE == status)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[rampart][rampart_encryption] Cannot generate the key
for the algorithm %s, ", enc_sym_algo);
+ return AXIS2_FAILURE;
+ }
+
+
+ /* For each and every encryption part.
+ 1. Derive a new key
+ 2. Encrypt using that key
+ */
+
+ return status;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_enc_encrypt_message(
const axutil_env_t *env,
axis2_msg_ctx_t *msg_ctx,