Author: kaushalye
Date: Fri Oct 12 04:15:18 2007
New Revision: 584135

URL: http://svn.apache.org/viewvc?rev=584135&view=rev
Log:
Introduced new fields for OXS Key to support derrived keys 

Modified:
    webservices/rampart/trunk/c/include/oxs_key.h
    webservices/rampart/trunk/c/src/omxmlsec/key.c
    webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c

Modified: webservices/rampart/trunk/c/include/oxs_key.h
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/include/oxs_key.h?rev=584135&r1=584134&r2=584135&view=diff
==============================================================================
--- webservices/rampart/trunk/c/include/oxs_key.h (original)
+++ webservices/rampart/trunk/c/include/oxs_key.h Fri Oct 12 04:15:18 2007
@@ -39,16 +39,12 @@
 {
 #endif
 
-    /*Key is for signing*/
-#define OXS_KEY_USAGE_SIGN          0
-    /*Key is for verifying signature*/
-#define OXS_KEY_USAGE_VERIFY        1
-    /*Key is for encrypting */
-#define OXS_KEY_USAGE_ENCRYPT       2
-    /*Key is for decrypting*/
-#define OXS_KEY_USAGE_DECRYPT       3
     /*Key usage is not specified yet*/
-#define OXS_KEY_USAGE_NONE          4
+#define OXS_KEY_USAGE_NONE          0
+    /*Key is a session key */
+#define OXS_KEY_USAGE_SESSION       1
+    /*Key is a derived key */
+#define OXS_KEY_USAGE_DERIVED       2 
 
 #define OXS_KEY_DEFAULT_SIZE        64
 
@@ -77,6 +73,16 @@
         const oxs_key_t *key,
         const axutil_env_t *env);
     /**
+    * Gets the nonce of the key.
+    * @param key oxs_key ptr to key
+    * @param env pointer to environment struct
+    * @return nonce of the key
+    */
+    AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+    oxs_key_get_nonce(
+        const oxs_key_t *key,
+        const axutil_env_t *env);
+    /**
     * Gets the size of the key.
     * @param key oxs_key ptr to key
     * @param env pointer to environment struct
@@ -97,6 +103,16 @@
         const oxs_key_t *key,
         const axutil_env_t *env);
 
+    /**
+    * Gets the offset of the key.
+    * @param key oxs_key ptr to key
+    * @param env pointer to environment struct
+    * @return offset of the key
+    */
+    AXIS2_EXTERN int AXIS2_CALL
+    oxs_key_get_offset(
+        const oxs_key_t *key,
+        const axutil_env_t *env);
 
     /**
     * Sets the name of the key.

Modified: webservices/rampart/trunk/c/src/omxmlsec/key.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/key.c?rev=584135&r1=584134&r2=584135&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/key.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/key.c Fri Oct 12 04:15:18 2007
@@ -28,9 +28,10 @@
 {
     oxs_buffer_t *buf;
     axis2_char_t *name;
-    axis2_char_t *nonce;
     int           usage;
-    int           offset;
+    
+    axis2_char_t *nonce;  /*Specially added for WS-Secure Conversation*/
+    int           offset; /*Specially added for WS-Secure Conversation*/
 };
 
 /******************** end of function headers *****************/
@@ -53,7 +54,16 @@
     AXIS2_ENV_CHECK(env, NULL);
 
     return key->name;
+}
 
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_key_get_nonce(
+    const oxs_key_t *key,
+    const axutil_env_t *env)
+{
+    AXIS2_ENV_CHECK(env, NULL);
+
+    return key->nonce;
 }
 
 AXIS2_EXTERN oxs_buffer_t *AXIS2_CALL
@@ -85,7 +95,6 @@
 }
 
 
-
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_key_set_name(
     oxs_key_t *key,
@@ -107,6 +116,26 @@
 
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_set_nonce(
+    oxs_key_t *key,
+    const axutil_env_t *env,
+    axis2_char_t *nonce)
+{
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, nonce, AXIS2_FAILURE);
+
+    if (key->nonce)
+    {
+        AXIS2_FREE(env->allocator, key->nonce);
+        key->nonce = NULL;
+    }
+    key->nonce = axutil_strdup(env, nonce);
+    return AXIS2_SUCCESS;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_key_set_usage(
     oxs_key_t *key,
     const axutil_env_t *env,
@@ -162,7 +191,9 @@
 
     key->buf = NULL;
     key->name = NULL;
+    key->nonce = NULL;
     key->usage = -1;
+    key->offset = 0;
 
     /*additionally we need to create a buffer to keep data*/
     key->buf = oxs_buffer_create(env);
@@ -181,6 +212,8 @@
     key->buf = NULL;
     AXIS2_FREE(env->allocator,  key->name);
     key->name = NULL;
+    AXIS2_FREE(env->allocator,  key->nonce);
+    key->nonce = NULL;
 
     AXIS2_FREE(env->allocator,  key);
     key = NULL;

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=584135&r1=584134&r2=584135&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/xml_encryption.c Fri Oct 12 
04:15:18 2007
@@ -577,7 +577,7 @@
                      oxs_buffer_get_data(result_buf, env),
                      "decrypted_session_key",
                      oxs_buffer_get_size(result_buf, env),
-                     OXS_KEY_USAGE_DECRYPT  );
+                     OXS_KEY_USAGE_SESSION  );
     /*Free*/
     oxs_buffer_free(result_buf, env);
     result_buf = NULL;


Reply via email to