You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2006/11/10 09:39:47 UTC

svn commit: r473259 - in /webservices/axis2/trunk/c/rampart: src/omxmlsec/openssl/crypt.c src/omxmlsec/xml_encryption.c test/omxmlsec/test.c

Author: kaushalye
Date: Fri Nov 10 00:39:47 2006
New Revision: 473259

URL: http://svn.apache.org/viewvc?view=rev&rev=473259
Log:
Fixed a bug in openssl/crypt.c

Modified:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c
    webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c?view=diff&rev=473259&r1=473258&r2=473259
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c Fri Nov 10 00:39:47 2006
@@ -112,7 +112,7 @@
     {
         /* Error */
         EVP_CIPHER_CTX_cleanup(&ctx);
-        printf("\nERROR:EVP_CipherFinal_ex--- EVP_CIPHER_CTX_cleanup");
+        printf("\nERROR:EVP_CipherFinal_ex--- EVP_CIPHER_CTX_cleanup\n");
         return (-1);
     }
     /*Alright now we need to write the last drop*/
@@ -125,7 +125,8 @@
     out_buf_index = out_buf_index + outlen;/*Update the writing position of the tempbuf*/
     EVP_CIPHER_CTX_cleanup(&ctx);
     /*Assign the temp buf to the out_main_buf*/
-    *out_main_buf = tempbuf;
+    *out_main_buf = malloc(out_buf_index+outlen);
+    memcpy(*out_main_buf, tempbuf, out_buf_index+outlen);
     free(tempbuf2);
     return out_buf_index;
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c?view=diff&rev=473259&r1=473258&r2=473259
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c Fri Nov 10 00:39:47 2006
@@ -124,17 +124,20 @@
     /*Decrypt*/
     oxs_xml_enc_decrypt_data(env, enc_ctx, enc_type_node, result_buf);
     decrypted_data = (axis2_char_t *)OXS_BUFFER_GET_DATA(result_buf, env);
-     
+    printf("\nDecrypted_Data = %s\n", decrypted_data); 
     /*De-serialize the decrypted content to build the node*/
     deserialized_node = (axiom_node_t*)oxs_axiom_deserialize_node(env, decrypted_data);
-
+    if(!deserialized_node){
+        oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,"Cannot deserialize a node from the content.");
+        return AXIS2_FAILURE;
+    }
     /*Assign deserialized_node to the reference passed*/
     *decrypted_node = deserialized_node;
 
     /*Replace the encrypted node with the de-serialized node*/
-    AXIOM_NODE_DETACH(enc_type_node, env);    
     parent_of_enc_node = AXIOM_NODE_GET_PARENT(enc_type_node, env);
     AXIOM_NODE_ADD_CHILD(parent_of_enc_node, env, deserialized_node);
+    AXIOM_NODE_DETACH(enc_type_node, env);    
 
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c?view=diff&rev=473259&r1=473258&r2=473259
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c (original)
+++ webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c Fri Nov 10 00:39:47 2006
@@ -66,7 +66,7 @@
 {
     oxs_key_t *key = NULL;
     key = oxs_key_create_key(env);
-    OXS_KEY_POPULATE(key, env, (unsigned char*)"12345678", "session_key",  8, OXS_KEY_USAGE_DECRYPT);
+    OXS_KEY_POPULATE(key, env, (unsigned char*)"12345678123456781234567812345678", "session_key",  32, OXS_KEY_USAGE_DECRYPT);
     return key;
 }
 
@@ -143,7 +143,7 @@
     OXS_CTX_SET_KEY(ctx, env, key);
 
     /*Set algorithm*/
-    OXS_CTX_SET_ENC_MTD_ALGORITHM(ctx, env, OXS_HrefAes128Cbc);
+    OXS_CTX_SET_ENC_MTD_ALGORITHM(ctx, env, OXS_HrefAes256Cbc);
 
     /*Get the node to be encrypted*/
     enc_node = AXIOM_NODE_GET_FIRST_CHILD(tmpl, env);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org