axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r522424 [2/2] - in /webservices/axis2/trunk/c/rampart: include/ src/omxmlsec/ src/omxmlsec/openssl/ src/util/ test/openssl/sign/
Date Mon, 26 Mar 2007 05:31:27 GMT
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?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/rsa.c Sun Mar 25 22:31:25 2007
@@ -35,126 +35,8 @@
 }
 */
 
-typedef struct openssl_rsa_impl
-{
-    openssl_rsa_t rsa;
-}
-openssl_rsa_impl_t;
-
-#define AXIS2_INTF_TO_IMPL(rsa) ((openssl_rsa_impl_t *)rsa)
-
-/*******************Function Headers ****************************/
-static void
-openssl_rsa_init_ops(
-    openssl_rsa_t *rsa);
-
-/*Public function*/
-axis2_status_t AXIS2_CALL
-openssl_rsa_free(
-    openssl_rsa_t *rsa,
-    const axis2_env_t *env);
-
-int AXIS2_CALL
-openssl_rsa_prv_decrypt(
-    openssl_rsa_t *rsa,
-    const axis2_env_t *env,
-    const openssl_pkey_t *pkey,
-    const axis2_char_t *padding,
-    oxs_buffer_t *in,
-    oxs_buffer_t *out);
-
-int AXIS2_CALL
-openssl_rsa_prv_encrypt(
-    openssl_rsa_t *rsa,
-    const axis2_env_t *env,
-    const openssl_pkey_t *pkey,
-    const axis2_char_t *padding,
-    oxs_buffer_t *in,
-    oxs_buffer_t *out);
-
-int AXIS2_CALL
-openssl_rsa_pub_encrypt(
-    openssl_rsa_t *rsa,
-    const axis2_env_t *env,
-    const openssl_pkey_t *pkey,
-    const axis2_char_t *padding,
-    oxs_buffer_t *in,
-    oxs_buffer_t *out);
-
-int AXIS2_CALL
-openssl_rsa_pub_decrypt(
-    openssl_rsa_t *rsa,
-    const axis2_env_t *env,
-    const openssl_pkey_t *pkey,
-    const axis2_char_t *padding,
-    oxs_buffer_t *in,
-    oxs_buffer_t *out);
-
-/*****************End of function headers ****************************/
-static void
-openssl_rsa_init_ops(
-    openssl_rsa_t *rsa)
-{
-    rsa->ops->free = openssl_rsa_free;
-    rsa->ops->prv_decrypt = openssl_rsa_prv_decrypt;
-    rsa->ops->pub_encrypt = openssl_rsa_pub_encrypt;
-    rsa->ops->prv_encrypt = openssl_rsa_prv_encrypt;
-    rsa->ops->pub_decrypt = openssl_rsa_pub_decrypt;
-}
-
-openssl_rsa_t *AXIS2_CALL
-openssl_rsa_create(
-    const axis2_env_t *env)
-{
-    openssl_rsa_impl_t *rsa_impl = NULL;
-
-    AXIS2_ENV_CHECK(env, NULL);
-
-    rsa_impl = (openssl_rsa_impl_t *) AXIS2_MALLOC(env->allocator,
-            sizeof(openssl_rsa_impl_t));
-
-    if (! rsa_impl)
-    {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
-    }
-
-    rsa_impl->rsa.ops = AXIS2_MALLOC(env->allocator,
-            sizeof(openssl_rsa_ops_t));
-
-    if (! rsa_impl->rsa.ops)
-    {
-        openssl_rsa_free(&(rsa_impl->rsa), env);
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
-    }
-
-    /** initialize ops */
-    openssl_rsa_init_ops(&(rsa_impl->rsa));
-
-    return &(rsa_impl->rsa);
-
-}
-
-axis2_status_t AXIS2_CALL
-openssl_rsa_free(openssl_rsa_t * rsa,
-        const axis2_env_t *env)
-{
-    openssl_rsa_impl_t * rsa_impl = NULL;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
-    rsa_impl = AXIS2_INTF_TO_IMPL(rsa);
-    AXIS2_FREE(env->allocator, rsa_impl);
-    rsa_impl = NULL;
-
-    return AXIS2_SUCCESS;
-
-}
-
-
 int AXIS2_CALL
 openssl_rsa_pub_encrypt(
-    openssl_rsa_t *rsa,
     const axis2_env_t *env,
     const openssl_pkey_t *pkey,
     const axis2_char_t *padding,
@@ -162,15 +44,13 @@
     oxs_buffer_t *out)
 {
     unsigned char *encrypted = NULL;
-    openssl_rsa_impl_t *rsa_impl = NULL;
     int ret;
     EVP_PKEY *key = NULL;
     int pad = RSA_PKCS1_PADDING;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    rsa_impl = AXIS2_INTF_TO_IMPL(rsa);
 
-    key = (EVP_PKEY *)OPENSSL_PKEY_GET_KEY(pkey, env);
+    key = (EVP_PKEY *)openssl_pkey_get_key(pkey, env);
     if(0 == axis2_strcmp(padding, OPENSSL_RSA_PKCS1_OAEP_PADDING  ) ){
         pad = RSA_PKCS1_OAEP_PADDING;
     }else if(0 == axis2_strcmp(padding, OPENSSL_RSA_PKCS1_PADDING  ) ){
@@ -178,8 +58,8 @@
     }
 
     encrypted = AXIS2_MALLOC(env->allocator, RSA_size(key->pkey.rsa));
-    ret = RSA_public_encrypt(OXS_BUFFER_GET_SIZE(in, env),
-            OXS_BUFFER_GET_DATA(in, env),
+    ret = RSA_public_encrypt(oxs_buffer_get_size(in, env),
+            oxs_buffer_get_data(in, env),
             encrypted,
             key->pkey.rsa ,
             pad);
@@ -190,13 +70,12 @@
                             "RSA encryption failed");
         return (-1);
     }
-    OXS_BUFFER_POPULATE(out, env, encrypted, ret);
+    oxs_buffer_populate(out, env, encrypted, ret);
     return ret;
 }
 
 int AXIS2_CALL
 openssl_rsa_pub_decrypt(
-    openssl_rsa_t *rsa,
     const axis2_env_t *env,
     const openssl_pkey_t *pkey,
     const axis2_char_t *padding,
@@ -204,15 +83,13 @@
     oxs_buffer_t *out)
 {
     unsigned char *decrypted = NULL;
-    openssl_rsa_impl_t *rsa_impl = NULL;
     int ret;
     EVP_PKEY *key = NULL;
     int pad = RSA_PKCS1_PADDING;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    rsa_impl = AXIS2_INTF_TO_IMPL(rsa);
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);    
 
-    key = (EVP_PKEY *)OPENSSL_PKEY_GET_KEY(pkey, env);
+    key = (EVP_PKEY *)openssl_pkey_get_key(pkey, env);
     if(0 == axis2_strcmp(padding, OPENSSL_RSA_PKCS1_OAEP_PADDING  ) ){
         pad = RSA_PKCS1_OAEP_PADDING;
     }else if(0 == axis2_strcmp(padding, OPENSSL_RSA_PKCS1_PADDING  ) ){
@@ -220,8 +97,8 @@
     }
 
     decrypted = AXIS2_MALLOC(env->allocator, RSA_size(key->pkey.rsa));
-    ret = RSA_public_decrypt(OXS_BUFFER_GET_SIZE(in, env),
-            OXS_BUFFER_GET_DATA(in, env),
+    ret = RSA_public_decrypt(oxs_buffer_get_size(in, env),
+            oxs_buffer_get_data(in, env),
             decrypted,
             key->pkey.rsa ,
             pad);
@@ -232,14 +109,13 @@
                             "PUBKEY decrypt (signature verification) failed");
         return (-1);
     }
-    OXS_BUFFER_POPULATE(out, env, decrypted, ret);
+    oxs_buffer_populate(out, env, decrypted, ret);
     return ret;
  }
 
 
 int AXIS2_CALL
 openssl_rsa_prv_decrypt(
-    openssl_rsa_t *rsa,
     const axis2_env_t *env,
     const openssl_pkey_t *pkey,
     const axis2_char_t *padding,
@@ -247,15 +123,13 @@
     oxs_buffer_t *out)
 {
     unsigned char *decrypted = NULL;
-    openssl_rsa_impl_t *rsa_impl = NULL;
     int ret;
     EVP_PKEY *key = NULL;
     int pad = RSA_PKCS1_PADDING;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    rsa_impl = AXIS2_INTF_TO_IMPL(rsa);
 
-    key = (EVP_PKEY *)OPENSSL_PKEY_GET_KEY(pkey, env);
+    key = (EVP_PKEY *)openssl_pkey_get_key(pkey, env);
 
     /*Set padding. This is the only diff btwn RSA-v1.5 and RSA-OAEP*/
     if(0 == axis2_strcmp(padding, OPENSSL_RSA_PKCS1_OAEP_PADDING  ) ){
@@ -266,7 +140,7 @@
 
     decrypted =  AXIS2_MALLOC(env->allocator, RSA_size(key->pkey.rsa));
     ret = RSA_private_decrypt(RSA_size(key->pkey.rsa),
-            OXS_BUFFER_GET_DATA(in, env),
+            oxs_buffer_get_data(in, env),
             decrypted,
             key->pkey.rsa,
             pad);
@@ -277,13 +151,12 @@
                             "RSA decryption failed");
         return (-1);
     }
-    OXS_BUFFER_POPULATE(out, env, decrypted, ret);
+    oxs_buffer_populate(out, env, decrypted, ret);
     return ret;
 }
 
 int AXIS2_CALL
 openssl_rsa_prv_encrypt(
-    openssl_rsa_t *rsa,
     const axis2_env_t *env,
     const openssl_pkey_t *pkey,
     const axis2_char_t *padding,
@@ -291,16 +164,14 @@
     oxs_buffer_t *out)
 {
     unsigned char *encrypted = NULL;
-    openssl_rsa_impl_t *rsa_impl = NULL;
     int ret;
     EVP_PKEY *key = NULL;
     int pad = RSA_PKCS1_PADDING;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    rsa_impl = AXIS2_INTF_TO_IMPL(rsa);
 
     /*Get the private key*/
-    key = (EVP_PKEY *)OPENSSL_PKEY_GET_KEY(pkey, env);
+    key = (EVP_PKEY *)openssl_pkey_get_key(pkey, env);
 
     /*Set padding. This is the only diff btwn RSA-v1.5 and RSA-OAEP*/
     if(0 == axis2_strcmp(padding, OPENSSL_RSA_PKCS1_OAEP_PADDING  ) ){
@@ -311,7 +182,7 @@
 
     encrypted =  AXIS2_MALLOC(env->allocator, RSA_size(key->pkey.rsa));
     ret = RSA_private_encrypt(RSA_size(key->pkey.rsa),
-            OXS_BUFFER_GET_DATA(in, env),
+            oxs_buffer_get_data(in, env),
             encrypted,
             key->pkey.rsa,
             pad);
@@ -322,7 +193,7 @@
                             "RSA private encryption(Signing) failed. Error code %d: %s",ERR_get_error(),
ERR_reason_error_string(ERR_get_error()));
         return (-1);
     }
-    OXS_BUFFER_POPULATE(out, env, encrypted, ret);
+    oxs_buffer_populate(out, env, encrypted, ret);
     return ret;
 }
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/sign.c Sun Mar 25 22:31:25 2007
@@ -46,7 +46,7 @@
     int err, ret;
     /*Get the key*/
     /*open_pkey = oxs_sign_ctx_get_private_key(sign_ctx, env);*/
-    pkey = OPENSSL_PKEY_GET_KEY(prvkey, env);
+    pkey = openssl_pkey_get_key(prvkey, env);
     if(!pkey){
          oxs_error(env, ERROR_LOCATION, OXS_ERROR_SIGN_FAILED,"Cannot load the private key"
);
     }
@@ -59,8 +59,8 @@
 
     /*Sign init*/
     ret = EVP_SignInit(&md_ctx, digest);
-    AXIS2_LOG_INFO(env->log, "[openssl][sig] Signing content %s", OXS_BUFFER_GET_DATA(input_buf,
env) );    
-    EVP_SignUpdate (&md_ctx, OXS_BUFFER_GET_DATA(input_buf, env), OXS_BUFFER_GET_SIZE(input_buf,
env));
+    AXIS2_LOG_INFO(env->log, "[openssl][sig] Signing content %s", oxs_buffer_get_data(input_buf,
env) );    
+    EVP_SignUpdate (&md_ctx, oxs_buffer_get_data(input_buf, env), oxs_buffer_get_size(input_buf,
env));
     sig_len = sizeof(sig_buf);
     err = EVP_SignFinal (&md_ctx,
                sig_buf,
@@ -70,7 +70,7 @@
         ERR_print_errors_fp (stderr);     
     }
     /*Fill the output buffer*/
-    OXS_BUFFER_POPULATE(output_buf, env, sig_buf, sig_len);
+    oxs_buffer_populate(output_buf, env, sig_buf, sig_len);
 
     return sig_len;
 }
@@ -90,7 +90,7 @@
     /*Get the publickey*/
     /*cert = oxs_sign_ctx_get_certificate(sign_ctx, env);
     open_pubkey = oxs_x509_cert_get_public_key(cert, env);*/
-    pkey = OPENSSL_PKEY_GET_KEY(pubkey, env);
+    pkey = openssl_pkey_get_key(pubkey, env);
     if(!pkey){
          oxs_error(env, ERROR_LOCATION, OXS_ERROR_SIG_VERIFICATION_FAILED,"Cannot load the
public key" );
     }
@@ -107,15 +107,15 @@
          oxs_error(env, ERROR_LOCATION, OXS_ERROR_SIG_VERIFICATION_FAILED,"EVP_VerifyInit
failed" );
         return AXIS2_FAILURE;
     }
-    ret = EVP_VerifyUpdate(&md_ctx,  OXS_BUFFER_GET_DATA(input_buf, env),  OXS_BUFFER_GET_SIZE(input_buf,
env));
+    ret = EVP_VerifyUpdate(&md_ctx,  oxs_buffer_get_data(input_buf, env),  oxs_buffer_get_size(input_buf,
env));
     if(ret != 1) {
         /*Error*/
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_SIG_VERIFICATION_FAILED,"EVP_VerifyUpdate
failed" );
         return AXIS2_FAILURE;
     }
     
-    ret = EVP_VerifyFinal(&md_ctx, OXS_BUFFER_GET_DATA(sig_buf, env), 
-                                   OXS_BUFFER_GET_SIZE(sig_buf, env),
+    ret = EVP_VerifyFinal(&md_ctx, oxs_buffer_get_data(sig_buf, env), 
+                                   oxs_buffer_get_size(sig_buf, env),
                                    pkey);
     if(ret == 0){
         /*Error. Signature verification FAILED */

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?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/util.c Sun Mar 25 22:31:25 2007
@@ -48,11 +48,11 @@
     encodedlen = axis2_base64_encode_len(size);
     encoded_str = AXIS2_MALLOC(env->allocator, encodedlen);
     ret = axis2_base64_encode(encoded_str, (const char *)temp_buffer, size);
-    status = OXS_BUFFER_POPULATE(buffer, env, (unsigned char*)encoded_str, size);
+    status = oxs_buffer_populate(buffer, env, (unsigned char*)encoded_str, size);
     AXIS2_FREE(env->allocator, encoded_str);
     encoded_str = NULL;
 #else
-    status = OXS_BUFFER_POPULATE(buffer, env, (unsigned char*)temp_buffer, size);
+    status = oxs_buffer_populate(buffer, env, (unsigned char*)temp_buffer, size);
 
 #endif
     return AXIS2_SUCCESS;
@@ -76,7 +76,7 @@
 
     }
 
-    cipher_name = OPENSSL_CIPHER_PROPERTY_GET_NAME(cprop, env);
+    cipher_name = openssl_cipher_property_get_name(cprop, env);
     if (!cipher_name)
     {
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
@@ -98,10 +98,10 @@
     EVP_CIPHER_CTX_init(&ctx);
     EVP_CipherInit_ex(&ctx, cipher, NULL, NULL, NULL, -1);
 
-    OPENSSL_CIPHER_PROPERTY_SET_CIPHER(cprop, env, cipher);
-    OPENSSL_CIPHER_PROPERTY_SET_KEY_SIZE(cprop, env, EVP_CIPHER_CTX_key_length(&ctx));
-    OPENSSL_CIPHER_PROPERTY_SET_BLOCK_SIZE(cprop, env, EVP_CIPHER_CTX_block_size(&ctx));
-    OPENSSL_CIPHER_PROPERTY_SET_IV_SIZE(cprop, env, EVP_CIPHER_CTX_iv_length(&ctx));
+    openssl_cipher_property_set_cipher(cprop, env, cipher);
+    openssl_cipher_property_set_key_size(cprop, env, EVP_CIPHER_CTX_key_length(&ctx));
+    openssl_cipher_property_set_block_size(cprop, env, EVP_CIPHER_CTX_block_size(&ctx));
+    openssl_cipher_property_set_iv_size(cprop, env, EVP_CIPHER_CTX_iv_length(&ctx));
 
     /*free ctx*/
     EVP_CIPHER_CTX_cleanup(&ctx);

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/signature.c Sun Mar 25 22:31:25 2007
@@ -56,8 +56,8 @@
     /*Base64 encode*/
     encodedlen = axis2_base64_encode_len(signedlen);
     encoded_str = AXIS2_MALLOC(env->allocator, encodedlen);
-    ret = axis2_base64_encode(encoded_str, (const char *)OXS_BUFFER_GET_DATA(signed_result_buf,
env), signedlen);
-    status = OXS_BUFFER_POPULATE(output, env, (unsigned char*)axis2_strdup(encoded_str, env),
encodedlen);
+    ret = axis2_base64_encode(encoded_str, (const char *)oxs_buffer_get_data(signed_result_buf,
env), signedlen);
+    status = oxs_buffer_populate(output, env, (unsigned char*)axis2_strdup(encoded_str, env),
encodedlen);
 
     /*Free signed_result_buf*/
     
@@ -124,11 +124,11 @@
     
     /*Create the signature buffer*/
     sig_buf = oxs_buffer_create(env);
-    ret = OXS_BUFFER_POPULATE(sig_buf, env, decoded_data, decoded_len);     
+    ret = oxs_buffer_populate(sig_buf, env, decoded_data, decoded_len);     
 
     /*Create the input buffer*/
     in_buf = oxs_buffer_create(env);
-    status = OXS_BUFFER_POPULATE(in_buf, env, (unsigned char*)content, axis2_strlen(content));
+    status = oxs_buffer_populate(in_buf, env, (unsigned char*)content, axis2_strlen(content));
 
     /*Get the public key. See.. this method is trickey. It might take the public key from
the certificate, only if
      * the public key is not available directly*/

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=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c Sun Mar 25 22:31:25 2007
@@ -236,7 +236,7 @@
     /*Serialize node*/
     serialized_data = AXIOM_NODE_TO_STRING(node, env);
     serialized_buf = oxs_buffer_create(env);
-    ret =  OXS_BUFFER_POPULATE(serialized_buf, env, (unsigned char *)serialized_data, axis2_strlen(serialized_data));
+    ret =  oxs_buffer_populate(serialized_buf, env, (unsigned char *)serialized_data, axis2_strlen(serialized_data));
    
     /*We call encrypt_data*/
     ret = oxs_xml_enc_encrypt_data(env, enc_ctx, serialized_buf, enc_type_node); 
@@ -246,7 +246,7 @@
         AXIOM_NODE_DETACH(node, env);
     }
     /*Free*/
-    OXS_BUFFER_FREE(serialized_buf, env); 
+    oxs_buffer_free(serialized_buf, env); 
     serialized_buf = NULL;
 
     /*Return success*/
@@ -269,13 +269,13 @@
     axis2_status_t ret = AXIS2_FAILURE;
 
     /*Determine the algorithm to be used*/
-    sym_algo = OXS_CTX_GET_ENC_MTD_ALGORITHM(enc_ctx, env);
+    sym_algo = oxs_ctx_get_enc_mtd_algorithm(enc_ctx, env);
     
     /*Determine the key to be used*/
-    sym_key = OXS_CTX_GET_KEY(enc_ctx, env);
+    sym_key = oxs_ctx_get_key(enc_ctx, env);
 
     /*Set the operation to encrypt*/
-    OXS_CTX_SET_OPERATION(enc_ctx, env, OXS_CTX_OPERATION_ENCRYPT);
+    oxs_ctx_set_operation(enc_ctx, env, OXS_CTX_OPERATION_ENCRYPT);
 
     /*Create an empty buffer for encrypted data*/
     result_buf = oxs_buffer_create(env);
@@ -285,10 +285,10 @@
     /*Create EncryptionMethod, CipherData element and populate*/
     enc_mtd_node = oxs_token_build_encryption_method_element(env, *enc_type_node, sym_algo);
    
     cd_node = oxs_token_build_cipher_data_element(env, *enc_type_node);
-    cv_node = oxs_token_build_cipher_value_element(env, cd_node, (axis2_char_t*)OXS_BUFFER_GET_DATA(result_buf,
env));
+    cv_node = oxs_token_build_cipher_value_element(env, cd_node, (axis2_char_t*)oxs_buffer_get_data(result_buf,
env));
 
     /*Free buffers*/
-    OXS_BUFFER_FREE(result_buf, env); 
+    oxs_buffer_free(result_buf, env); 
     result_buf = NULL;
 
     return AXIS2_SUCCESS;
@@ -316,7 +316,7 @@
                   "Data encryption failed");
         return AXIS2_FAILURE;
     }
-    decrypted_data = axis2_strmemdup(OXS_BUFFER_GET_DATA(result_buf, env), OXS_BUFFER_GET_SIZE(result_buf,
env), env);
+    decrypted_data = axis2_strmemdup(oxs_buffer_get_data(result_buf, env), oxs_buffer_get_size(result_buf,
env), env);
     /*De-serialize the decrypted content to build the node*/
     deserialized_node = (axiom_node_t*)oxs_axiom_deserialize_node(env, decrypted_data);
     if(!deserialized_node){
@@ -331,7 +331,7 @@
     AXIOM_NODE_ADD_CHILD(parent_of_enc_node, env, deserialized_node);
     AXIOM_NODE_DETACH(enc_type_node, env);    
 
-    OXS_BUFFER_FREE(result_buf, env);
+    oxs_buffer_free(result_buf, env);
     result_buf = NULL;
 
     return AXIS2_SUCCESS;
@@ -364,9 +364,9 @@
     type = oxs_axiom_get_attribute_value_of_node_by_name(env, enc_type_node, OXS_ATTR_TYPE);
 
     /*Populate the context for future use*/
-    OXS_CTX_SET_ENC_MTD_ALGORITHM(enc_ctx, env, sym_algo);
-    OXS_CTX_SET_ID(enc_ctx, env, id);
-    OXS_CTX_SET_TYPE(enc_ctx, env, type);
+    oxs_ctx_set_enc_mtd_algorithm(enc_ctx, env, sym_algo);
+    oxs_ctx_set_id(enc_ctx, env, id);
+    oxs_ctx_set_id(enc_ctx, env, type);
     
     /*Get the cipher value*/
     cd_node = oxs_axiom_get_first_child_node_by_name(env, enc_type_node, OXS_NODE_CIPHER_DATA,OXS_ENC_NS,OXS_XENC);
@@ -375,14 +375,14 @@
     
     /*Create input buffer with cipher data obtained*/
     input_buf = oxs_buffer_create(env);
-    OXS_BUFFER_POPULATE(input_buf, env, (unsigned char*)cipher_val, axis2_strlen(cipher_val)
);
+    oxs_buffer_populate(input_buf, env, (unsigned char*)cipher_val, axis2_strlen(cipher_val)
);
 
     /*Decrypt*/
-    OXS_CTX_SET_OPERATION(enc_ctx, env, OXS_CTX_OPERATION_DECRYPT);
+    oxs_ctx_set_operation(enc_ctx, env, OXS_CTX_OPERATION_DECRYPT);
     status =  oxs_encryption_symmetric_crypt(env, enc_ctx, input_buf, result_buf);
     
     /*Free*/
-    OXS_BUFFER_FREE(input_buf, env);
+    oxs_buffer_free(input_buf, env);
     input_buf = NULL;
 
     return status;
@@ -411,7 +411,7 @@
 
     /*Create input buffer*/
     input = oxs_buffer_create(env);
-    OXS_BUFFER_POPULATE(input, env, OXS_KEY_GET_DATA(sym_key, env), OXS_KEY_GET_SIZE(sym_key,
env));
+    oxs_buffer_populate(input, env, oxs_key_get_data(sym_key, env), oxs_key_get_size(sym_key,
env));
 
     /*Create an empty buffer to collect results*/
     result = oxs_buffer_create(env);
@@ -419,7 +419,7 @@
     /*Call encryption*/
     status = oxs_encryption_asymmetric_crypt(env, asym_ctx, input, result);
     /*Free input*/
-    OXS_BUFFER_FREE(input, env);
+    oxs_buffer_free(input, env);
     input = NULL;
 
     if(AXIS2_FAILURE == status){
@@ -428,7 +428,7 @@
         return AXIS2_FAILURE;
     }
     /*Get the encrypted key*/
-    encrypted_key_data = (axis2_char_t *)OXS_BUFFER_GET_DATA(result, env);
+    encrypted_key_data = (axis2_char_t *)oxs_buffer_get_data(result, env);
 
     /*Build nodes*/
     encrypted_key_node = oxs_token_build_encrypted_key_element(env, parent);
@@ -459,7 +459,7 @@
     oxs_token_build_data_reference_list(env, encrypted_key_node, id_list); 
 
     /*Free*/
-    OXS_BUFFER_FREE(result, env);
+    oxs_buffer_free(result, env);
     result = NULL;
 
     return AXIS2_SUCCESS; 
@@ -507,7 +507,7 @@
     /*Get the pkey used to decrypt the session key. If found set it to the asym_ctx*/
     /*Create the input buffer*/
     input_buf = oxs_buffer_create(env);
-    OXS_BUFFER_POPULATE(input_buf, env, (unsigned char*)cipher_val, axis2_strlen(cipher_val));
+    oxs_buffer_populate(input_buf, env, (unsigned char*)cipher_val, axis2_strlen(cipher_val));
 
     /*Create a results buffer*/
     result_buf = oxs_buffer_create(env);
@@ -515,7 +515,7 @@
     /*Call decryption*/
     status = oxs_encryption_asymmetric_crypt(env, asym_ctx, input_buf, result_buf);
     /*Free input*/
-    OXS_BUFFER_FREE(input_buf, env);
+    oxs_buffer_free(input_buf, env);
     input_buf = NULL;
     
     if(AXIS2_FAILURE == status){
@@ -523,13 +523,13 @@
     }
     
     /*Populate the key with the data in the result buffer*/
-    OXS_KEY_POPULATE(key, env, 
-                            OXS_BUFFER_GET_DATA(result_buf, env), 
+    oxs_key_populate(key, env, 
+                            oxs_buffer_get_data(result_buf, env), 
                             "decrypted_session_key", 
-                            OXS_BUFFER_GET_SIZE(result_buf, env), 
+                            oxs_buffer_get_size(result_buf, env), 
                             OXS_KEY_USAGE_DECRYPT  );
     /*Free*/
-    OXS_BUFFER_FREE(result_buf, env);
+    oxs_buffer_free(result_buf, env);
     result_buf = NULL;
 
     return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_signature.c Sun Mar 25 22:31:25 2007
@@ -206,11 +206,11 @@
     input_buf = oxs_buffer_create(env);
     output_buf = oxs_buffer_create(env);
 
-    OXS_BUFFER_POPULATE(input_buf, env, (unsigned char *)serialized_signed_info, axis2_strlen(serialized_signed_info));
+    oxs_buffer_populate(input_buf, env, (unsigned char *)serialized_signed_info, axis2_strlen(serialized_signed_info));
     /*Then sign... NOTE: The signature process includes making the digest. e.g. rsa-sha1
=> RSA(SHA-1(contents))*/ 
     status = oxs_sig_sign(env, sign_ctx, input_buf, output_buf);
 
-    signature_val = (axis2_char_t*)OXS_BUFFER_GET_DATA(output_buf, env);
+    signature_val = (axis2_char_t*)oxs_buffer_get_data(output_buf, env);
     
     /*Construct <SignatureValue>*/
     signature_val_node = oxs_token_build_signature_value_element(env, signature_node, signature_val);

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c Sun Mar 25 22:31:25 2007
@@ -100,7 +100,7 @@
     }
     /*Generate the  session key*/
     session_key = oxs_key_create(env);
-    status = OXS_KEY_FOR_ALGO(session_key, env, enc_sym_algo); 
+    status = oxs_key_for_algo(session_key, env, enc_sym_algo); 
     if(AXIS2_FAILURE == status){
         return AXIS2_FAILURE;
     }
@@ -125,9 +125,9 @@
         /*Create the encryption context for OMXMLSEC*/
         enc_ctx = oxs_ctx_create(env);
         /*Set the key*/
-        OXS_CTX_SET_KEY(enc_ctx, env, session_key);
+        oxs_ctx_set_key(enc_ctx, env, session_key);
         /*Set the algorithm*/
-        OXS_CTX_SET_ENC_MTD_ALGORITHM(enc_ctx, env, enc_sym_algo);
+        oxs_ctx_set_enc_mtd_algorithm(enc_ctx, env, enc_sym_algo);
         /*Create an empty EncryptedDataNode*/
         parent_of_node_to_enc = AXIOM_NODE_GET_PARENT(node_to_enc, env);
         id = oxs_util_generate_id(env,(axis2_char_t*)OXS_ENCDATA_ID);

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c Sun Mar 25 22:31:25
2007
@@ -394,7 +394,7 @@
         }        
 
         ctx = oxs_ctx_create(env);
-        OXS_CTX_SET_KEY(ctx, env, decrypted_sym_key);
+        oxs_ctx_set_key(ctx, env, decrypted_sym_key);
         
         status = oxs_xml_enc_decrypt_node(env, ctx, enc_data_node, &decrypted_node);
         if(AXIS2_FAILURE == status){
@@ -403,7 +403,7 @@
             return AXIS2_FAILURE;
         }
         /*Free*/
-        OXS_CTX_FREE(ctx, env);
+        oxs_ctx_free(ctx, env);
         ctx = NULL;
 
         AXIS2_LOG_INFO(env->log, "[rampart][shp] Node ID=%s decrypted successfuly", id);
@@ -416,7 +416,7 @@
     /*Free*/
     oxs_asym_ctx_free(asym_ctx, env);
     asym_ctx = NULL;
-    OXS_KEY_FREE(decrypted_sym_key, env);
+    oxs_key_free(decrypted_sym_key, env);
     decrypted_sym_key = NULL;
 
     return AXIS2_SUCCESS;    

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=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_util.c Sun Mar 25 22:31:25 2007
@@ -180,10 +180,10 @@
 
     buffer = oxs_buffer_create(env);
     status = generate_random_data(env, buffer, 16);
-    rand_str = (char*)OXS_BUFFER_GET_DATA(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);
+    axis2_base64_encode(encoded_str, rand_str, oxs_buffer_get_size(buffer, env));
+    oxs_buffer_free(buffer, env);
 
     return encoded_str;
 }

Modified: webservices/axis2/trunk/c/rampart/test/openssl/sign/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/openssl/sign/test.c?view=diff&rev=522424&r1=522423&r2=522424
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/openssl/sign/test.c (original)
+++ webservices/axis2/trunk/c/rampart/test/openssl/sign/test.c Sun Mar 25 22:31:25 2007
@@ -145,7 +145,7 @@
     }
 
     inbuf = oxs_buffer_create(env);
-    OXS_BUFFER_POPULATE(inbuf, env, (unsigned char *)data, strlen(data));
+    oxs_buffer_populate(inbuf, env, (unsigned char *)data, strlen(data));
 
     outbuf = oxs_buffer_create(env);
     



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