axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r472377 - in /webservices/axis2/trunk/c/rampart: ./ include/ src/omxmlsec/ src/omxmlsec/openssl/ src/util/ test/
Date Wed, 08 Nov 2006 03:59:17 GMT
Author: kaushalye
Date: Tue Nov  7 19:59:16 2006
New Revision: 472377

URL: http://svn.apache.org/viewvc?view=rev&rev=472377
Log:
Changes made for openssl cipher context

Modified:
    webservices/axis2/trunk/c/rampart/Makefile.am
    webservices/axis2/trunk/c/rampart/configure.ac
    webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h
    webservices/axis2/trunk/c/rampart/include/oxs_enc_engine.h
    webservices/axis2/trunk/c/rampart/include/oxs_token_encrypted_data.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_util.c
    webservices/axis2/trunk/c/rampart/test/Makefile.am

Modified: webservices/axis2/trunk/c/rampart/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/Makefile.am?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/Makefile.am Tue Nov  7 19:59:16 2006
@@ -1,4 +1,4 @@
-SUBDIRS = src
+SUBDIRS = src 
 include_HEADERS=$(top_builddir)/include/*.h
 EXTRA_DIST = LICENSE build.sh autogen.sh samples
 

Modified: webservices/axis2/trunk/c/rampart/configure.ac
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/configure.ac?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/configure.ac (original)
+++ webservices/axis2/trunk/c/rampart/configure.ac Tue Nov  7 19:59:16 2006
@@ -54,7 +54,7 @@
     src/data/Makefile \
     src/handlers/Makefile \
     src/core/Makefile \
-    src/util/Makefile
+    src/util/Makefile 
     ])
     
 AC_OUTPUT

Modified: webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_cipher_ctx.h Tue Nov  7 19:59:16 2006
@@ -15,8 +15,8 @@
  */
 #include <axis2_defines.h>
 #include <axis2_env.h>
-#include<openssl/evp.h>
-
+#include <openssl/evp.h>
+#include <oxs_key.h>
 /**
   * @file 
   * @brief 
@@ -48,7 +48,7 @@
             const axis2_env_t *env
             );
         
-        axis2_char_t *(AXIS2_CALL *
+        oxs_key_t *(AXIS2_CALL *
         get_key)(openssl_cipher_ctx_t *ctx,
             const axis2_env_t *env
             );
@@ -72,7 +72,7 @@
         axis2_status_t (AXIS2_CALL *
         set_key_value)(openssl_cipher_ctx_t *ctx,
             const axis2_env_t *env,
-            axis2_char_t *key
+            oxs_key_t *key
             );
 
         axis2_status_t (AXIS2_CALL *

Modified: webservices/axis2/trunk/c/rampart/include/oxs_enc_engine.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_enc_engine.h?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_enc_engine.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_enc_engine.h Tue Nov  7 19:59:16 2006
@@ -173,7 +173,18 @@
                 axiom_node_t* template_node,
                 axis2_char_t* data,
                 oxs_ctx_t * enc_ctx);
-
+        /**
+         *
+         *
+         */
+        axis2_status_t (AXIS2_CALL *
+        encrypt_node)(
+                oxs_enc_engine_t *enc_engine,
+                const axis2_env_t *env,
+                oxs_ctx_t * enc_ctx,
+                axiom_node_t* node,
+                axiom_node_t* enc_type_node);
+                
     };
 
     /**
@@ -218,6 +229,9 @@
 
 #define OXS_ENC_ENGINE_ENCRYPT_TEMPLATE(enc_engine, env, template_node, data, enc_ctx) \
         ((enc_engine)->ops->encrypt_template(enc_engine, env, template_node, data,
enc_ctx))
+
+#define OXS_ENC_ENGINE_ENCRYPT_NODE(enc_engine, env, enc_ctx, node, enc_type_node) \
+        ((enc_engine)->ops->encrypt_template(enc_engine, env, enc_ctx, node, enc_type_node))
 
 
 /** @} */

Modified: webservices/axis2/trunk/c/rampart/include/oxs_token_encrypted_data.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_token_encrypted_data.h?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_token_encrypted_data.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_token_encrypted_data.h Tue Nov  7 19:59:16
2006
@@ -43,7 +43,7 @@
                         axis2_char_t* id
                     );
 
-
+/*TODO write get attribute methods*/
 /*TODO write free method*/
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c Tue Nov  7 19:59:16 2006
@@ -411,7 +411,8 @@
     unsigned char *out_main_buf = NULL;
     openssl_cipher_ctx_t *oc_ctx = NULL;
     axis2_char_t *iv = NULL;
-    axis2_char_t *key = NULL;
+    /*axis2_char_t *key = NULL;*/
+    
     axis2_char_t *cipher_name =  NULL;
     axis2_char_t *encoded_str = NULL;
     axis2_char_t *in_data = NULL;
@@ -448,13 +449,14 @@
     ret = OPENSSL_CIPHER_CTX_SET_IV(oc_ctx, env, iv);
 
     /*Set the key*/
-    key =  AXIS2_STRNDUP((axis2_char_t*)OXS_KEY_GET_DATA(OXS_CTX_GET_KEY(enc_ctx,
+    /*key =  AXIS2_STRNDUP((axis2_char_t*)OXS_KEY_GET_DATA(OXS_CTX_GET_KEY(enc_ctx,
             env),
             env),
             OPENSSL_CIPHER_PROPERTY_GET_KEY_SIZE(cprop, env),
-            env);
+            env);*/
+
 
-    ret = OPENSSL_CIPHER_CTX_SET_KEY(oc_ctx, env, key);
+    ret = OPENSSL_CIPHER_CTX_SET_KEY(oc_ctx, env, OXS_CTX_GET_KEY(enc_ctx, env));
 
     /*Set the cipher*/
     cipher_name = (axis2_char_t*)OPENSSL_CIPHER_PROPERTY_GET_NAME(cprop, env);
@@ -486,7 +488,6 @@
     else if (OXS_CTX_GET_OPERATION(enc_ctx, env) == OXS_CTX_OPERATION_DECRYPT)
     {
         in_data = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len((char*)(OXS_CTX_GET_INPUT_DATA(enc_ctx,
env))));
-        /*axis2_base64_decode(in_data, (char*)(enc_ctx->inputdata)); */
         decoded_len = axis2_base64_decode_binary((unsigned char*)in_data, (char*)(OXS_CTX_GET_INPUT_DATA(enc_ctx,
env)));
         if (decoded_len < 0)
         {

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c Tue Nov  7 19:59:16
2006
@@ -30,7 +30,8 @@
     openssl_cipher_ctx_t ctx;
 
     const EVP_CIPHER*   cipher;
-    axis2_char_t  *key;
+    /*axis2_char_t  *key;*/
+    oxs_key_t *key;
     axis2_char_t  *iv;
     axis2_char_t  *pad;
 }
@@ -57,7 +58,7 @@
         const axis2_env_t *env
                              );
 
-axis2_char_t *AXIS2_CALL
+oxs_key_t *AXIS2_CALL
 openssl_cipher_ctx_get_key(openssl_cipher_ctx_t *ctx,
         const axis2_env_t *env
                           );
@@ -81,7 +82,7 @@
 axis2_status_t AXIS2_CALL
 openssl_cipher_ctx_set_key(openssl_cipher_ctx_t *ctx,
         const axis2_env_t *env,
-        axis2_char_t *key
+        oxs_key_t *key
                           );
 
 axis2_status_t AXIS2_CALL
@@ -161,7 +162,8 @@
     /*TODO Check how to free the EVP_CIPHER. Might be a problem if we try to free it here.*/
     if (ctx_impl->key)
     {
-        AXIS2_FREE(env->allocator, ctx_impl->key);
+        OXS_KEY_FREE(ctx_impl->key, env);
+        /*AXIS2_FREE(env->allocator, ctx_impl->key);*/
         ctx_impl->key = NULL;
     }
 
@@ -194,7 +196,7 @@
     return ctx_impl->cipher ;
 }
 
-axis2_char_t *AXIS2_CALL
+oxs_key_t *AXIS2_CALL
 openssl_cipher_ctx_get_key(openssl_cipher_ctx_t *ctx,
         const axis2_env_t *env
                           )
@@ -254,7 +256,7 @@
 axis2_status_t AXIS2_CALL
 openssl_cipher_ctx_set_key(openssl_cipher_ctx_t *ctx,
         const axis2_env_t *env,
-        axis2_char_t *key
+        oxs_key_t *key
                           )
 {
     openssl_cipher_ctx_impl_t * ctx_impl = NULL;
@@ -264,10 +266,11 @@
     ctx_impl = AXIS2_INTF_TO_IMPL(ctx);
     if (ctx_impl->key)
     {
-        AXIS2_FREE(env->allocator, ctx_impl->key);
+        OXS_KEY_FREE(ctx_impl->key, env);
+        /*AXIS2_FREE(env->allocator, ctx_impl->key);*/
         ctx_impl->key = NULL;
     }
-    ctx_impl->key = AXIS2_STRDUP(key, env);
+    ctx_impl->key = key ;/* AXIS2_STRDUP(key, env);*/
 
     return AXIS2_SUCCESS;
 }

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=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c Tue Nov  7 19:59:16 2006
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <axis2_util.h>
 #include <oxs_buffer.h>
+#include <oxs_key.h>
 #include <oxs_error.h>
 #include <openssl_cipher_ctx.h>
 #include <openssl_crypt.h>
@@ -40,17 +41,23 @@
     unsigned char inbuf[BUFSIZE + 1 ], outbuf[BUFSIZE + EVP_MAX_BLOCK_LENGTH]; /*EVP_MAX_BLOCK_LENGTH
= 32 in evp.h*/
     unsigned char *tempbuf = NULL;
     unsigned char *tempbuf2 = NULL;
+    unsigned char *key_data = NULL;
+    oxs_key_t *key = NULL;
 
     int inlen, outlen, i,  out_buf_index;
     int ret;
 
     i = 0;
     out_buf_index = 0;
-
+    
+    /*Get the key*/
+    key = OPENSSL_CIPHER_CTX_GET_KEY(oc_ctx, env);
+    key_data = AXIS2_MALLOC(env->allocator, OXS_KEY_GET_SIZE(key, env));
+    key_data = memcpy(key_data,  OXS_KEY_GET_DATA(key, env), OXS_KEY_GET_SIZE(key, env));
     /*Init ctx*/
     EVP_CIPHER_CTX_init(&ctx);
     ret = EVP_CipherInit_ex(&ctx, (EVP_CIPHER *)OPENSSL_CIPHER_CTX_GET_CIPHER(oc_ctx,
env), NULL, NULL, NULL, do_encrypt);
-    ret  = EVP_CipherInit_ex(&ctx, NULL, NULL, (unsigned char*)OPENSSL_CIPHER_CTX_GET_KEY(oc_ctx,
env),
+    ret  = EVP_CipherInit_ex(&ctx, NULL, NULL, key_data,
             (unsigned char*)OPENSSL_CIPHER_CTX_GET_IV(oc_ctx, env),
             do_encrypt);
     for (;;)

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_util.c?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_util.c Tue Nov  7 19:59:16 2006
@@ -41,9 +41,14 @@
     char *rand_str = NULL;
     axis2_char_t* encoded_str = NULL;
 
+
     buffer = oxs_buffer_create(env);
     status = generate_random_data(env, buffer, 16);
-    rand_str = (char*)OXS_BUFFER_GET_DATA(buffer, env);
+    
+
+    rand_str = (char *)malloc(OXS_BUFFER_GET_SIZE(buffer, env)+1);
+    memcpy(rand_str, (char*)OXS_BUFFER_GET_DATA(buffer, env), OXS_BUFFER_GET_SIZE(buffer,
env));
+    /*rand_str = (char*)OXS_BUFFER_GET_DATA(buffer, env);*/
     encoded_str = AXIS2_MALLOC(env->allocator, sizeof(char) * (SIZE_NONCE+1));
     axis2_base64_encode(encoded_str, rand_str, OXS_BUFFER_GET_SIZE(buffer, env));
     OXS_BUFFER_FREE(buffer, env);

Modified: webservices/axis2/trunk/c/rampart/test/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/Makefile.am?view=diff&rev=472377&r1=472376&r2=472377
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/test/Makefile.am Tue Nov  7 19:59:16 2006
@@ -1,2 +1,2 @@
-SUBDIRS = openssl util
+SUBDIRS = openssl 
 



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


Mime
View raw message