axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r430731 - in /webservices/axis2/trunk/c/rampart/src: omxmlsec/ omxmlsec/openssl/ util/
Date Fri, 11 Aug 2006 09:12:09 GMT
Author: damitha
Date: Fri Aug 11 02:12:08 2006
New Revision: 430731

URL: http://svn.apache.org/viewvc?rev=430731&view=rev
Log:
Adding files and applying patches

Added:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c
Modified:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am
    webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c
    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/cipher_property.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_data_reference.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_action.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am Fri Aug 11 02:12:08 2006
@@ -4,7 +4,7 @@
 libomxmlsec_la_SOURCES = ctx.c  enc_engine.c buffer.c key.c cipher.c error.c axis2_utils.c
axiom.c \
                         token_encrypted_data.c token_encryption_method.c token_cipher_value.c
\
                         token_cipher_data.c token_key_name.c token_key_info.c token_binary_security_token.c
\
-                        token_reference_list.c token_data_reference.c token_encrypted_key.c
+                        token_reference_list.c token_data_reference.c token_encrypted_key.c
iv.c
 
 libomxmlsec_la_LIBADD  = -lssl\
             -laxis2_util \

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c Fri Aug 11 02:12:08 2006
@@ -365,6 +365,8 @@
     return (0);  
 }
 
+  
+
 
 
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/cipher.c Fri Aug 11 02:12:08 2006
@@ -24,47 +24,30 @@
 oxs_get_cipher(const axis2_env_t *env,
                      axis2_char_t *url)
 {
-    if(AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefDes3Cbc)){
-        return OPENSSL_EVP_des_ede3_cbc;
-    }else if(AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefAes128Cbc)){
-        return OPENSSL_EVP_aes_128_cbc;
-    }else if(AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefAes192Cbc)){
-        return OPENSSL_EVP_aes_192_cbc;
-    }else if(AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefAes256Cbc)){
-        return OPENSSL_EVP_aes_256_cbc;
+
+    axis2_char_t *cipher_name = NULL;
+
+    if(0 == AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefDes3Cbc)){
+         cipher_name = OPENSSL_EVP_des_ede3_cbc;
+
+    }else if(0 == AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefAes128Cbc)){
+        cipher_name = OPENSSL_EVP_aes_128_cbc;
+
+    }else if(0 == AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefAes192Cbc)){
+        cipher_name = OPENSSL_EVP_aes_192_cbc;
+
+    }else if(0 == AXIS2_STRCMP(url, (axis2_char_t*)OXS_HrefAes256Cbc)){
+        cipher_name = OPENSSL_EVP_aes_256_cbc;
+
     }else{
         oxs_error(ERROR_LOCATION,
                     OXS_ERROR_UNSUPPORTED_ALGO, "Algorithm not supported");
         return NULL;
     }
 
-    return NULL; 
-}
+    printf("\n oxs_get_cipher for url = %s,  cipher %s\n", url, cipher_name);
+    return cipher_name;
 
-AXIS2_EXTERN int AXIS2_CALL
-oxs_get_cipher_key_size(const axis2_env_t *env,
-                     axis2_char_t *url)
-{
-    int size = 16;
-    axis2_char_t* cipher_name = NULL;
-
-    cipher_name = oxs_get_cipher(env, url);
-    /*TODO*/
-    return size;    
 }
 
-
-AXIS2_EXTERN int AXIS2_CALL
-oxs_get_cipher_iv_size(const axis2_env_t *env,
-                     axis2_char_t *url)
-{
-    int size = 8;
-    axis2_char_t* cipher_name = NULL;
-
-    cipher_name = oxs_get_cipher(env, url);
-    /*TODO*/
-    
-    return size;
-
-}
 

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?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/enc_engine.c Fri Aug 11 02:12:08 2006
@@ -39,7 +39,7 @@
                             axiom_node_t *enc_key_node,
                             oxs_key_ptr session_key)
 {
-    axis2_char_t *key_enc_algo = NULL, *encrypted_key_value = NULL, *decoded_encrypted_key
= NULL;
+    axis2_char_t *key_enc_algo = NULL, *encrypted_key_value = NULL;
     axiom_node_t *enc_method_node = NULL, *cd_node = NULL, *cv_node = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     oxs_buffer_ptr encrypted_key_buf = NULL, decrypted_key_buf = NULL;
@@ -77,7 +77,7 @@
         return AXIS2_FAILURE;
     }
     /*Encrypted key*/
-    encrypted_key_value = oxs_token_get_cipher_value(env, cv_node);
+    encrypted_key_value = (axis2_char_t*)oxs_token_get_cipher_value(env, cv_node);
 
     /*Create buffers for decryption*/
     encrypted_key_buf = oxs_create_buffer(env, AXIS2_STRLEN(encrypted_key_value));
@@ -98,7 +98,7 @@
     session_key->usage = OXS_KEY_USAGE_DECRYPT;
      
     /*printf("\n>>>>>>>>decrypted session_key %s\n", session_key->data);*/
-    return session_key;
+    return AXIS2_SUCCESS;
 }
 
 /*Decrypt data using the private key*/
@@ -106,7 +106,7 @@
 oxs_prvkey_decrypt_data(const axis2_env_t *env, oxs_buffer_ptr input, oxs_buffer_ptr result,
axis2_char_t *filename)
 {
     evp_pkey_ptr prvk = NULL;
-    axis2_char_t *encoded_encrypted_str = NULL, *decoded_encrypted_str = NULL;    
+    axis2_char_t  *decoded_encrypted_str = NULL;    
     unsigned char *decrypted  =  NULL;
     int ret, declen;
 
@@ -195,7 +195,7 @@
 {
     unsigned char *out_main_buf = NULL;
     openssl_evp_block_cipher_ctx_ptr bc_ctx = NULL;
-    axis2_char_t *iv =  OPENSSL_DEFAULT_IV8;   
+    axis2_char_t *iv = NULL;   
     axis2_char_t *cipher_name =  NULL;   
     axis2_char_t *encoded_str=NULL;
     axis2_char_t *in_data = NULL;
@@ -214,7 +214,10 @@
                      "openssl_evp_block_cipher_ctx_create failed");
          return AXIS2_FAILURE;
     }
-    
+    /*Set the IV*/   
+    /*iv = OPENSSL_DEFAULT_IV16;*/ /*oxs_iv_generate_for_algo(env,  enc_ctx->encmtd_algorithm);
*/
+    iv =(axis2_char_t*)oxs_iv_generate_for_algo(env,  enc_ctx->encmtd_algorithm); 
+
     /*Set the key*/
     bc_ctx->key = AXIS2_STRDUP(enc_ctx->key->data, env);
     bc_ctx->key_initialized = 1;

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c?rev=430731&view=auto
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/iv.c Fri Aug 11 02:12:08 2006
@@ -0,0 +1,65 @@
+/*
+ *   Copyright 2003-2004 The Apache Software Foundation.
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ */
+
+#include <stdio.h>
+#include <axis2_util.h>
+#include <oxs_iv.h>
+#include <oxs_buffer.h>
+#include <oxs_cipher.h>
+#include <oxs_error.h>
+#include <openssl_cipher_property.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_iv_generate_for_algo(const axis2_env_t *env,
+                            axis2_char_t *key_algo)
+{
+    axis2_char_t* iv = NULL;
+    cipher_prop_ptr cprop = NULL;
+    int size;
+    axis2_char_t *algo_name = NULL; /*This is not the url name*/
+
+    /*Check algo and then set the key data size))*/
+    algo_name = oxs_get_cipher(env, key_algo);
+    if(!algo_name){
+        oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
+            "oxs_get_cipher failed");
+        return NULL;
+    }
+    cprop = (cipher_prop_ptr)openssl_get_cipher_property(env, algo_name);
+    if(!cprop){
+        oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
+            "openssl_get_cipher_property failed");
+        return NULL;
+    }
+    size = cprop->iv_size;
+    
+    /*Here we have predefined IVs in the openssl_constants.
+      Get the correct one using the size*/ 
+    
+    if(size == 8){
+        iv = OPENSSL_DEFAULT_IV8;
+    }else if(size == 16){
+        iv = OPENSSL_DEFAULT_IV16;
+    }else if(size == 24){
+        iv = OPENSSL_DEFAULT_IV24;
+    }else{
+        iv = OXS_IV_DEFAULT;/* i.e. OPENSSL_DEFAULT_IV16. Many ciphers have 16... mmm.. need
a better way.. a TODO*/
+    }
+    printf("IVIVIVIV size=%d value = %s", size, iv);
+    
+    return iv;
+}

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?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_ctx.c Fri Aug 11 02:12:08
2006
@@ -29,12 +29,25 @@
 AXIS2_EXTERN openssl_evp_block_cipher_ctx_ptr AXIS2_CALL
 openssl_evp_block_cipher_ctx_create(const axis2_env_t *env)
 {
-    openssl_evp_block_cipher_ctx_ptr bc_ctx = NULL;
+    openssl_evp_block_cipher_ctx_ptr   bc_ctx = NULL;
     bc_ctx = (openssl_evp_block_cipher_ctx_ptr)AXIS2_MALLOC(env->allocator,sizeof(openssl_evp_block_cipher_ctx));
-    
+    openssl_evp_block_cipher_ctx_reset(env, bc_ctx); 
     return bc_ctx;
 }
 
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_evp_block_cipher_ctx_reset(const axis2_env_t *env, openssl_evp_block_cipher_ctx_ptr
bc_ctx)
+{
+    bc_ctx->cipher = NULL;
+    bc_ctx->key_initialized = -1;
+    bc_ctx->ctx_initialized = -1;
+    bc_ctx->key = NULL;
+    bc_ctx->iv = NULL;
+    bc_ctx->pad = NULL;
+
+    return AXIS2_SUCCESS;
+}
+
 AXIS2_EXTERN int  AXIS2_CALL  
 openssl_evp_block_cipher_ctx_init(const axis2_env_t *env,
                              openssl_evp_block_cipher_ctx_ptr bc_ctx,
@@ -70,7 +83,7 @@
     }
     */
 
-    bc_ctx->cipher = (EVP_CIPHER*)openssl_get_evp_cipher_by_name(env, (axis2_char_t*)cipher_name);
+    bc_ctx->cipher =  (EVP_CIPHER*)openssl_get_evp_cipher_by_name(env, (axis2_char_t*)cipher_name);
 
     /*Sets the IV if not set. Well..How we convey this IV to decrypt*/
     if(!(bc_ctx->iv)){
@@ -80,7 +93,7 @@
                 return(-1);
         }
     }else{
-        iv_len =  AXIS2_STRLEN(bc_ctx->iv);
+        iv_len =  AXIS2_STRLEN((axis2_char_t*)bc_ctx->iv);
     }
 
     /*Key supposed to be set before this */
@@ -103,7 +116,7 @@
     EVP_CIPHER_CTX_init(&(bc_ctx->cipher_ctx));
     
     EVP_CipherInit_ex(&(bc_ctx->cipher_ctx), bc_ctx->cipher, NULL, NULL, NULL,
encrypt);
-    EVP_CIPHER_CTX_set_key_length(&(bc_ctx->cipher_ctx), strlen(bc_ctx->key));
+    EVP_CIPHER_CTX_set_key_length(&(bc_ctx->cipher_ctx), strlen((axis2_char_t*)bc_ctx->key));
     /* We finished modifying parameters so now we can set key and IV */
     ret  = EVP_CipherInit_ex(&(bc_ctx->cipher_ctx), NULL, NULL, bc_ctx->key, bc_ctx->iv,
encrypt);
     

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/cipher_property.c Fri Aug 11 02:12:08
2006
@@ -30,8 +30,21 @@
 openssl_cipher_property_create(const axis2_env_t *env)
 {
     cipher_prop_ptr cprop = NULL;
-    cprop = (cipher_prop_ptr) AXIS2_MALLOC(env->allocator,sizeof(cipher_prop_ptr));
+    cprop = (cipher_prop_ptr) AXIS2_MALLOC(env->allocator,sizeof(cipher_prop));
+    openssl_cipher_property_reset(env, cprop);
     return cprop;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_cipher_property_reset(const axis2_env_t *env, cipher_prop_ptr cprop)
+{
+    cprop->cipher = NULL;
+    cprop->name = NULL;
+    cprop->key_size = -1;
+    cprop->block_size = -1;
+    cprop->iv_size = -1;
+
+    return AXIS2_SUCCESS;
 }
 
 /*TODO write the free function*/

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?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/crypt.c Fri Aug 11 02:12:08 2006
@@ -17,6 +17,7 @@
 #include <stdio.h>
 #include <axis2_util.h>
 #include <oxs_buffer.h>
+#include <oxs_error.h>
 #include <openssl_cipher_ctx.h>
 #include <openssl_crypt.h>
 #include <openssl/rand.h>
@@ -63,7 +64,6 @@
                 }else{
                     inlen = BUFSIZE;
                 }
-
                 
                 if(do_encrypt == 1){
                     printf("\nEncrypting block[%d] %s", inlen, inbuf);
@@ -73,8 +73,10 @@
                 if(!EVP_CipherUpdate(&ctx, outbuf, &outlen, inbuf, inlen))
                 {
                         /* Error */
+                        oxs_error(ERROR_LOCATION,OXS_ERROR_OPENSSL_FUNC_FAILED,
+                        "Cannot get the ReferenceList node");
+
                         EVP_CIPHER_CTX_cleanup(&ctx);
-                        printf("\nERROR: EVP_CIPHER_CTX_cleanup");
                         return (-1);
                 }
                 /*TODO: Write the encrypted block to the tempbuf*/

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c Fri Aug 11 02:12:08 2006
@@ -51,8 +51,8 @@
         return AXIS2_FAILURE;
     }
 /**************REMOVE TODO***/
-#if 0
-    buf->data = "012345670123456701234567";
+#if 1
+    buf->data = (unsigned char *)"012345670123456701234567";
     buf->size = 24;
 #endif
 /***************************/

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c Fri Aug 11 02:12:08 2006
@@ -28,13 +28,12 @@
 AXIS2_EXTERN cipher_prop_ptr  AXIS2_CALL
 openssl_get_cipher_property(const axis2_env_t *env, axis2_char_t *cipher_name)
 {
-    int ret, key_length;
     EVP_CIPHER* cipher;
     EVP_CIPHER_CTX ctx;
     cipher_prop_ptr cprop = NULL;
     
    
-    cipher = openssl_get_evp_cipher_by_name(env, cipher_name); 
+    cipher = (EVP_CIPHER*)openssl_get_evp_cipher_by_name(env, cipher_name); 
     if(!cipher){
          oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
             "openssl_get_evp_cipher_by_name failed");
@@ -47,32 +46,42 @@
     
     /*Create a cipher property and populate it*/
     cprop = openssl_cipher_property_create(env);
+    
+
     cprop->cipher = cipher;
-    cprop->name = AXIS2_STRDUP(cipher_name, env);
+    cprop->name = cipher_name;
     cprop->key_size = EVP_CIPHER_CTX_key_length(&ctx);
     cprop->block_size = EVP_CIPHER_CTX_block_size(&ctx);
     cprop->iv_size = EVP_CIPHER_CTX_iv_length(&ctx);
+
+    printf("\n openssl get Cipher prop\n------\n name=%s, bs=%d, ks=%d, ivs=%d\n", cipher_name
, cprop->key_size, cprop->block_size, cprop->iv_size);
+
+    /*EVP_CIPHER_CTX_cleanup(&ctx);*/
     return cprop;
 }
 
 AXIS2_EXTERN EVP_CIPHER*  AXIS2_CALL
 openssl_get_evp_cipher_by_name(const axis2_env_t *env, axis2_char_t *cipher_name)
 {
-    if(AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_des_ede3_cbc ))
-    {
-        return EVP_des_ede3_cbc();
-    }else if(AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_aes_128_cbc ))
-    {
-        return EVP_aes_128_cbc();
-    }else if(AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_aes_128_cbc ))
-    {
-        return EVP_aes_192_cbc();
-    }else if(AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_aes_128_cbc ))
-    {
-        return EVP_aes_256_cbc();
+    EVP_CIPHER* cipher = NULL;
+
+    if(0 == AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_des_ede3_cbc )){
+        cipher = (EVP_CIPHER*) EVP_des_ede3_cbc();
+
+    }else if(0 == AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_aes_128_cbc )){
+        cipher =  (EVP_CIPHER*)EVP_aes_128_cbc();
+
+    }else if(0 == AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_aes_192_cbc )){
+        cipher =  (EVP_CIPHER*)EVP_aes_192_cbc();
+
+    }else if(0 == AXIS2_STRCMP((char*)cipher_name, (char*)OPENSSL_EVP_aes_256_cbc )){
+        cipher =  (EVP_CIPHER*)EVP_aes_256_cbc();
+
     }else{
         return NULL;
     }
+
+    return cipher;
 }
 
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_data_reference.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_data_reference.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_data_reference.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_data_reference.c Fri Aug 11 02:12:08
2006
@@ -25,7 +25,7 @@
 AXIS2_EXTERN axiom_node_t* AXIS2_CALL
 oxs_token_build_data_reference_element(const axis2_env_t *env,
                         axiom_node_t *parent,
-                        axis2_char_t* data_ref )
+                        axis2_char_t *data_ref )
 {
     axiom_node_t *data_reference_node = NULL;
     axiom_element_t *data_reference_ele = NULL;

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_action.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_action.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_action.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_action.c Fri Aug 11 02:12:08 2006
@@ -23,38 +23,27 @@
 #include <rampart_action.h>
 #include <rampart_constants.h>
 
-/*
-typedef struct _actions actions, *actions_ptr;
-struct _actions{
-        axis2_char_t *items  ;
-        axis2_char_t *user  ;
-        axis2_char_t *passwordC_callback_lass  ;
-        axis2_char_t *encryption_prop_file;
-        axis2_char_t *signature_prop_file ;
-        axis2_char_t *signature_key_identifier  ;
-        axis2_char_t *encryption_key_identifier  ;
-        axis2_char_t *encryption_user  ;
-        axis2_char_t *signature_parts  ;
-        axis2_char_t *encryption_parts  ;
-        axis2_char_t *optimize_parts  ;
-        axis2_char_t *encryption_sym_algorithm  ;
-        axis2_char_t *embedded_key_callback_class  ;
-        axis2_char_t *encryption_key_transport_algorithm  ;
-        axis2_char_t *embedded_key_name  ;
-        axis2_char_t *time_to_live  ;
-
-};
-*/
 
 AXIS2_EXTERN actions_ptr AXIS2_CALL
 oxs_ctx_create_actions_ptr(const axis2_env_t *env)
 {
     actions_ptr actions= NULL;
-    actions = (actions_ptr) AXIS2_MALLOC(env->allocator,sizeof(actions_ptr));
-
+    actions = (actions_ptr) AXIS2_MALLOC(env->allocator,sizeof(actionss));
+    oxs_ctx_reset_actions_ptr(env, actions);
     return actions;
 }
 
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_ctx_reset_actions_ptr(const axis2_env_t *env, actions_ptr actions)
+{
+    actions->encryption_user = NULL;
+    actions->encryption_sym_algorithm = NULL; 
+    actions->encryption_key_transport_algorithm = NULL;
+    
+    return AXIS2_SUCCESS;
+
+}
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_ctx_free_actions_ptr(const axis2_env_t *env, actions_ptr actions)

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c?rev=430731&r1=430730&r2=430731&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_crypto_engine.c Fri Aug 11 02:12:08
2006
@@ -55,7 +55,7 @@
     axiom_node_t *enc_key_node = NULL; 
     oxs_key_ptr session_key = NULL;
     axis2_array_list_t *uuid_list = NULL;
-    axis2_array_list_t *enc_data_node_list = NULL;
+    /*axis2_array_list_t *enc_data_node_list = NULL;*/
 
     ret = AXIS2_SUCCESS;/*TODO Remove*/
     /*TODO get the key using callbacks*/
@@ -103,7 +103,7 @@
 
     ret = oxs_enc_decrypt_template(env, enc_data_node, &decrypted_data, enc_ctx);
     if(ret == AXIS2_FAILURE){
-        oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
+        oxs_error(ERROR_LOCATION, OXS_ERROR_DECRYPT_FAILED,
                      "oxs_enc_decrypt_template failed");
         return ret;
     }else{
@@ -150,7 +150,7 @@
     }
 
     /*Generate the session key*/
-    sessionkey = oxs_key_generate_for_algo(env, actions->encryption_sym_algorithm);
+    sessionkey = oxs_key_generate_for_algo(env,actions->encryption_sym_algorithm);
     if(!sessionkey){
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
             "Session key generate failed");
@@ -176,6 +176,7 @@
         node_to_enc = AXIOM_NODE_GET_FIRST_CHILD(body_node, env);
     }
 
+
     str_to_enc = AXIOM_NODE_TO_STRING(node_to_enc, env);
     
     /*Build the template*/
@@ -184,7 +185,7 @@
                         AXIOM_NODE_GET_PARENT(node_to_enc, env),
                         OXS_TypeEncElement,
                         uuid );
-    enc_mtd_node = oxs_token_build_encryption_method_element(env, enc_data_node, OXS_HrefDes3Cbc);
+    enc_mtd_node = oxs_token_build_encryption_method_element(env, enc_data_node, actions->encryption_sym_algorithm);
     key_info_node = oxs_token_build_key_info_element(env, enc_data_node);
     key_name_node = oxs_token_build_key_name_element(env, key_info_node, sessionkey->name
);
     cd_node = oxs_token_build_cipher_data_element(env, enc_data_node);
@@ -206,9 +207,6 @@
         /*printf("Encryption template is \n %s", AXIOM_NODE_TO_STRING(enc_data_node, env));*/
     }
 
-    
-
-    /*Encrypt the session key using the public key TODO*/
     /*Here u have the key file name or the key store name. Right now we support only the
key file name*/
     session_key_buf_plain = oxs_string_to_buffer(env, (axis2_char_t*)sessionkey->data);
     session_key_buf_encrypted = oxs_create_buffer(env, (int)OXS_BUFFER_INITIAL_SIZE);
@@ -218,7 +216,6 @@
         oxs_error(ERROR_LOCATION, OXS_ERROR_ENCRYPT_FAILED,
                      "oxs_pubkey_encrypt_data failed");
         return ret;
-    
     }
 
     /*Create the key info*/
@@ -230,7 +227,7 @@
     enc_key_cv_node = oxs_token_build_cipher_value_element(env, enc_key_cd_node, (axis2_char_t*)session_key_buf_encrypted->data);
     enc_key_ref_list_node = oxs_token_build_reference_list_element(env, enc_key_node);
     /*TODO If there are multiple elements encrypted by the same session key, enqueue those
here*/
-    enc_key_data_ref_node = oxs_token_build_data_reference_element(env, enc_key_ref_list_node,
uuid);
+    enc_key_data_ref_node = (axiom_node_t*)oxs_token_build_data_reference_element(env, enc_key_ref_list_node,
uuid);
     
     /*Remove the encrypted node*/
     /*temp = AXIOM_NODE_DETACH(node_to_enc, env);
@@ -243,7 +240,7 @@
     /*Now arrange this encrypted nodes in a suitable manner to the envelope*/ 
    
     /*FREE*/
-    oxs_ctx_free_ctx(enc_ctx); 
+    /*oxs_ctx_free_ctx(enc_ctx); */
     return ret;
 }
 



---------------------------------------------------------------------
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