Author: shankar
Date: Mon Feb 25 01:30:35 2008
New Revision: 630777

URL: http://svn.apache.org/viewvc?rev=630777&view=rev
Log:
finding derived key length based on algorithm suite

Modified:
    webservices/rampart/trunk/c/include/rampart_context.h
    webservices/rampart/trunk/c/src/util/rampart_context.c
    webservices/rampart/trunk/c/src/util/rampart_encryption.c
    webservices/rampart/trunk/c/src/util/rampart_signature.c

Modified: webservices/rampart/trunk/c/include/rampart_context.h
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/rampart_context.h?rev=630777&r1=630776&r2=630777&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/rampart_context.h (original)
+++ webservices/rampart/trunk/c/include/rampart_context.h Mon Feb 25 01:30:35 
2008
@@ -681,6 +681,16 @@
                                                                const 
axutil_env_t *env,
                                                                
issued_token_callback_func issued_token_aquire);
 
+    AXIS2_EXTERN int AXIS2_CALL
+    rampart_context_get_encryption_derived_key_len(
+        rampart_context_t *rampart_context,
+        const axutil_env_t *env);
+
+    AXIS2_EXTERN int AXIS2_CALL
+    rampart_context_get_signature_derived_key_len(
+        rampart_context_t *rampart_context,
+        const axutil_env_t *env);
+
 #ifdef __cplusplus
 }
 #endif

Modified: webservices/rampart/trunk/c/src/util/rampart_context.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_context.c?rev=630777&r1=630776&r2=630777&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Mon Feb 25 01:30:35 
2008
@@ -2424,6 +2424,38 @@
         return AXIS2_FALSE;
 }
 
+AXIS2_EXTERN int AXIS2_CALL
+rampart_context_get_encryption_derived_key_len(
+    rampart_context_t *rampart_context,
+    const axutil_env_t *env)
+{
+    rp_algorithmsuite_t *algosuite = NULL;
+
+    algosuite = rampart_context_get_algorithmsuite(rampart_context,env);
+    if(algosuite)
+    {
+        return 
rp_algorithmsuite_get_encryption_derivation_keylength(algosuite,env)/8;
+    }
+    else
+        return 0;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rampart_context_get_signature_derived_key_len(
+    rampart_context_t *rampart_context,
+    const axutil_env_t *env)
+{
+    rp_algorithmsuite_t *algosuite = NULL;
+
+    algosuite = rampart_context_get_algorithmsuite(rampart_context,env);
+    if(algosuite)
+    {
+        return 
rp_algorithmsuite_get_signature_derivation_keylength(algosuite,env)/8;
+    }
+    else
+        return 0;
+}
+
 AXIS2_EXTERN axis2_char_t *AXIS2_CALL
 rampart_context_get_enc_sym_algo(
     rampart_context_t *rampart_context,

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=630777&r1=630776&r2=630777&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Mon Feb 25 
01:30:35 2008
@@ -373,6 +373,7 @@
         {
             /*Derive a new key*/
             derived_key = oxs_key_create(env);
+            oxs_key_set_length(derived_key, env, 
rampart_context_get_encryption_derived_key_len(rampart_context, env));
             status = oxs_derivation_derive_key(env, session_key, derived_key, 
AXIS2_TRUE); 
             
             /*Set the derived key for the encryption*/
@@ -1080,6 +1081,7 @@
     {
         /*Derive a new key*/
         derived_key = oxs_key_create(env);
+        oxs_key_set_length(derived_key, env, 
rampart_context_get_encryption_derived_key_len(rampart_context, env));
         status = oxs_derivation_derive_key(env, session_key, derived_key, 
AXIS2_TRUE);
 
         /*Set the derived key for the encryption*/

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=630777&r1=630776&r2=630777&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_signature.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_signature.c Mon Feb 25 
01:30:35 2008
@@ -326,6 +326,7 @@
         oxs_key_t *derived_key = NULL;
         /*Derive a new key*/
         derived_key = oxs_key_create(env);
+        oxs_key_set_length(derived_key, env, 
rampart_context_get_signature_derived_key_len(rampart_context, env));
         oxs_derivation_derive_key(env, session_key, derived_key, AXIS2_TRUE);
         oxs_sign_ctx_set_secret(sign_ctx, env, derived_key);
     }


Reply via email to