axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kausha...@apache.org
Subject svn commit: r479553 - in /webservices/axis2/trunk/c/rampart: ./ include/ samples/client/enc_echo/data/ src/omxmlsec/ src/omxmlsec/openssl/ src/util/ test/ test/omxmlsec/ test/openssl/ test/openssl/rsa/
Date Mon, 27 Nov 2006 09:03:36 GMT
Author: kaushalye
Date: Mon Nov 27 01:03:35 2006
New Revision: 479553

URL: http://svn.apache.org/viewvc?view=rev&rev=479553
Log:
1. Introducing key manager
2. Introducing pkcs12 support
3. Introducing x509 certificate support
4. Changes made in the asym ctx to use pkcs12

Added:
    webservices/axis2/trunk/c/rampart/include/openssl_pkcs12.h
    webservices/axis2/trunk/c/rampart/include/openssl_x509.h
    webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkcs12.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c
Modified:
    webservices/axis2/trunk/c/rampart/build.sh
    webservices/axis2/trunk/c/rampart/configure.ac
    webservices/axis2/trunk/c/rampart/include/openssl_constants.h
    webservices/axis2/trunk/c/rampart/include/openssl_pkey.h
    webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h
    webservices/axis2/trunk/c/rampart/include/rampart_constants.h
    webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h
    webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml
    webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am
    webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am
    webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
    webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
    webservices/axis2/trunk/c/rampart/src/util/timestamp_token.c
    webservices/axis2/trunk/c/rampart/src/util/username_token.c
    webservices/axis2/trunk/c/rampart/test/Makefile.am
    webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c
    webservices/axis2/trunk/c/rampart/test/openssl/Makefile.am
    webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c

Modified: webservices/axis2/trunk/c/rampart/build.sh
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/build.sh?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/build.sh (original)
+++ webservices/axis2/trunk/c/rampart/build.sh Mon Nov 27 01:03:35 2006
@@ -1,5 +1,5 @@
 #!/bin/bash
 ./autogen.sh
-./configure --prefix=${AXIS2C_HOME}/rampart --enable-static=no 
+./configure --prefix=${AXIS2C_HOME} --enable-static=no 
 make
 make install

Modified: webservices/axis2/trunk/c/rampart/configure.ac
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/configure.ac?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/configure.ac (original)
+++ webservices/axis2/trunk/c/rampart/configure.ac Mon Nov 27 01:03:35 2006
@@ -79,9 +79,11 @@
     src/data/Makefile \
     src/handlers/Makefile \
     src/core/Makefile \
-    src/util/Makefile 
-    test/Makefile 
-    test/omxmlsec/Makefile 
+    src/util/Makefile \
+    test/Makefile \
+    test/omxmlsec/Makefile \
+    test/openssl/Makefile \
+    test/openssl/pkcs/Makefile 
     ])
     
 AC_OUTPUT

Modified: webservices/axis2/trunk/c/rampart/include/openssl_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_constants.h?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_constants.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_constants.h Mon Nov 27 01:03:35 2006
@@ -38,6 +38,8 @@
 #define OPENSSL_EVP_aes_192_cbc      "EVP_aes_192_cbc"
 #define OPENSSL_EVP_aes_256_cbc      "EVP_aes_256_cbc"
 
+#define OPENSSL_RSA_ENCRYPTION      "rsaEncryption"
+
 #define OPENSSL_DEFAULT_IV8          "01234567"
 #define OPENSSL_DEFAULT_IV16         "0123456701234567"
 #define OPENSSL_DEFAULT_IV24         "012345670123456701234567"

Added: webservices/axis2/trunk/c/rampart/include/openssl_pkcs12.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_pkcs12.h?view=auto&rev=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_pkcs12.h (added)
+++ webservices/axis2/trunk/c/rampart/include/openssl_pkcs12.h Mon Nov 27 01:03:35 2006
@@ -0,0 +1,69 @@
+/*
+ *   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 <openssl/rand.h>
+#include <openssl/evp.h>
+#include <openssl/pem.h>
+#include <openssl/bio.h>
+#include <openssl/rand.h>
+#include <openssl_constants.h>
+#include <openssl_pkey.h>
+#include <axis2_util.h>
+#include <openssl/pkcs12.h>
+
+/**
+  * @file 
+  * @brief 
+  */
+#ifndef OPENSSL_PKCS12_H
+#define OPENSSL_PKCS12_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup
+ * @ingroup
+ * @{
+ */
+
+/*Load*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_pkcs12_load(const axis2_env_t *env,
+    axis2_char_t *filename,
+    PKCS12 **p12);
+
+/*Parse*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_pkcs12_parse(const axis2_env_t *env,
+    axis2_char_t *password ,
+    PKCS12 *p12,
+    EVP_PKEY **pkey,
+    X509 **cert,
+    STACK_OF(X509) **ca);
+
+/*Free*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_pkcs12_free(const axis2_env_t *env,
+    PKCS12 *p12);
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif    /* OPENSSL_PKCS12_H */

Modified: webservices/axis2/trunk/c/rampart/include/openssl_pkey.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_pkey.h?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_pkey.h (original)
+++ webservices/axis2/trunk/c/rampart/include/openssl_pkey.h Mon Nov 27 01:03:35 2006
@@ -38,6 +38,7 @@
  * @{
  */
 
+/*TODO make these enums*/
 #define OPENSSL_PKEY_TYPE_UNKNOWN        0
 #define OPENSSL_PKEY_TYPE_PUBLIC_KEY     1
 #define OPENSSL_PKEY_TYPE_PRIVATE_KEY    2

Added: webservices/axis2/trunk/c/rampart/include/openssl_x509.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/openssl_x509.h?view=auto&rev=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/openssl_x509.h (added)
+++ webservices/axis2/trunk/c/rampart/include/openssl_x509.h Mon Nov 27 01:03:35 2006
@@ -0,0 +1,114 @@
+/*
+ *   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 <openssl/rand.h>
+#include <openssl/evp.h>
+#include <openssl/pem.h>
+#include <openssl/bio.h>
+#include <openssl/rand.h>
+#include <openssl_constants.h>
+#include <openssl_pkey.h>
+#include <axis2_util.h>
+#include <openssl/pkcs12.h>
+#include <oxs_error.h>
+/**
+  * @file 
+  * @brief 
+  */
+#ifndef OPENSSL_X509_H
+#define OPENSSL_X509_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** @defgroup
+ * @ingroup
+ * @{
+ */
+
+typedef enum {
+    OPENSSL_X509_FORMAT_PEM = 0,
+    OPENSSL_X509_FORMAT_DER,
+    OPENSSL_X509_FORMAT_PKCS12 
+} openssl_x509_format_t;
+
+typedef enum {
+    OPENSSL_X509_INFO_SUBJECT = 0,
+    OPENSSL_X509_INFO_ISSUER ,
+    OPENSSL_X509_INFO_VALID_FROM ,
+    OPENSSL_X509_INFO_VALID_TO ,
+    OPENSSL_X509_INFO_FINGER ,
+    OPENSSL_X509_INFO_SIGNATURE ,
+    OPENSSL_X509_INFO_VERSION ,
+    OPENSSL_X509_INFO_PUBKEY ,
+    OPENSSL_X509_INFO_PUBKEY_ALGO ,
+    OPENSSL_X509_INFO_DATA_CERT 
+} openssl_x509_info_type_t;
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_load_from_buffer(const axis2_env_t *env,
+    axis2_char_t *b64_encoded_buf,
+    X509 **cert);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_load_from_pkcs12(const axis2_env_t *env,
+    axis2_char_t *filename,
+    axis2_char_t *password,
+    X509 **cert,
+    EVP_PKEY **pkey,
+    STACK_OF(X509) **ca);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_load_certificate(const axis2_env_t *env,
+    openssl_x509_format_t format,
+    axis2_char_t *filename,
+    axis2_char_t *password,
+    X509 **cert);
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+openssl_x509_get_cert_data(const axis2_env_t *env,
+    X509 *cert);
+
+
+AXIS2_EXTERN int AXIS2_CALL
+openssl_x509_get_serial(const axis2_env_t *env,
+    X509 *cert);
+
+AXIS2_EXTERN unsigned long AXIS2_CALL
+openssl_x509_get_subject_name_hash(const axis2_env_t *env,
+    X509 *cert);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_get_pubkey(const axis2_env_t *env,
+    X509 *cert,
+    EVP_PKEY **pubkey);
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+openssl_x509_get_info(const axis2_env_t *env,
+    openssl_x509_info_type_t type,
+        X509 *cert);
+
+AXIS2_EXTERN void AXIS2_CALL
+openssl_x509_print(const axis2_env_t *env,
+    X509 *cert);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif    /* OPENSSL_X509_H */

Modified: webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h Mon Nov 27 01:03:35 2006
@@ -27,6 +27,7 @@
 #include <axis2_env.h>
 #include <axiom_node.h>
 #include <oxs_x509_cert.h>
+#include <openssl_pkey.h>
 
 #ifdef __cplusplus
 extern "C"
@@ -39,113 +40,30 @@
  */
 
     typedef enum  {
-        OXS_ASYM_CTX_FORMAT_PEM,
+        OXS_ASYM_CTX_FORMAT_PEM=0,
         OXS_ASYM_CTX_FORMAT_PKCS12
     }oxs_asym_ctx_format_t;
 
     typedef enum  {
-        OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT,
+        OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT=0,
         OXS_ASYM_CTX_OPERATION_PRV_DECRYPT,
         OXS_ASYM_CTX_OPERATION_PUB_DECRYPT,
         OXS_ASYM_CTX_OPERATION_PRV_ENCRYPT
     }oxs_asym_ctx_operation_t;
 
-    /** Type name for struct oxs_asym_ctx_ops */
-    typedef struct oxs_asym_ctx_ops oxs_asym_ctx_ops_t;
-    /** Type name for struct oxs_asym_ctx */
-    typedef struct oxs_asym_ctx oxs_asym_ctx_t;
-
-    struct oxs_asym_ctx_ops
-    {
-
-        axis2_status_t (AXIS2_CALL *
-        free)(
-                    oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env
-                    );
-
-        oxs_asym_ctx_operation_t (AXIS2_CALL *
-        get_operation)(
-                    const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env
-                    );
-
-
-        axis2_char_t *(AXIS2_CALL *
-        get_file_name)(
-                    const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env
-                    );
-
-        axis2_char_t *(AXIS2_CALL *
-        get_format)(
-                    const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env
-                    );
-
-        oxs_x509_cert_t *(AXIS2_CALL *
-        get_certificate)(
-                    const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env
-                    );
-
-        axis2_char_t *(AXIS2_CALL *
-        get_algorithm)(
-                    const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env
-                    );
-
-        axis2_status_t (AXIS2_CALL *
-        set_operation)(
-                    oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    oxs_asym_ctx_operation_t operation
-                    );
-
-        axis2_status_t (AXIS2_CALL *
-        set_file_name)(
-                    oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    axis2_char_t *file_name
-                    );
-
-        axis2_status_t (AXIS2_CALL *
-        set_format)(
-                    oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    axis2_char_t *format
-                    );
-
-        axis2_status_t (AXIS2_CALL *
-        set_certificate)(
-                    oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    oxs_x509_cert_t *cert
-                    );
-
-
-        axis2_status_t (AXIS2_CALL *
-        set_algorithm)(
-                    oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    axis2_char_t *enc_algorithm
-                    );
-
-
-    };
-    
-    struct oxs_asym_ctx
-    {
-        /** operations of oxs_asym_ctx */
-        oxs_asym_ctx_ops_t *ops;
-    };
+    typedef struct oxs_asym_ctx_t oxs_asym_ctx_t;
 
     /*Create function*/
     AXIS2_EXTERN oxs_asym_ctx_t *AXIS2_CALL
     oxs_asym_ctx_create(const axis2_env_t *env);
 
+    /*Free*/
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    oxs_asym_ctx_free(oxs_asym_ctx_t *ctx,
+        const axis2_env_t *env);
 
-/**********************Wrappers******************************************/
+
+/**********************Getter functions******************************************/
    
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_asym_ctx_free(oxs_asym_ctx_t *ctx,
@@ -155,7 +73,7 @@
 oxs_asym_ctx_get_file_name(const oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env);
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+AXIS2_EXTERN oxs_asym_ctx_format_t AXIS2_CALL
 oxs_asym_ctx_get_format(const oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env);
 
@@ -167,6 +85,10 @@
 oxs_asym_ctx_get_operation(const oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env);
 
+AXIS2_EXTERN openssl_pkey_t* AXIS2_CALL
+oxs_asym_ctx_private_key(const oxs_asym_ctx_t *ctx,
+                    const axis2_env_t *env);
+
 AXIS2_EXTERN oxs_x509_cert_t* AXIS2_CALL
 oxs_asym_ctx_get_certificate(const oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env);
@@ -179,7 +101,7 @@
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_asym_ctx_set_format(oxs_asym_ctx_t *ctx,
                     const axis2_env_t *env,
-                    axis2_char_t *format);
+                    oxs_asym_ctx_format_t format);
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 oxs_asym_ctx_set_algorithm(oxs_asym_ctx_t *ctx,
@@ -196,7 +118,10 @@
                     const axis2_env_t *env,
                     oxs_x509_cert_t *certificate);
 
-
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_asym_ctx_set_private_key(oxs_asym_ctx_t *asym_ctx,
+                    const axis2_env_t *env,
+                    openssl_pkey_t *private_key);
 /** @} */
 #ifdef __cplusplus
 }

Added: webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h?view=auto&rev=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h (added)
+++ webservices/axis2/trunk/c/rampart/include/oxs_key_mgr.h Mon Nov 27 01:03:35 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2004,2005 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.
+ */
+
+#ifndef OXS_KEY_MGR_H
+#define OXS_KEY_MGR_H
+
+
+/**
+  * @file oxs_encryption.h
+  * @brief 
+  */
+
+#include <axis2_defines.h>
+#include <oxs_ctx.h>
+#include <oxs_asym_ctx.h>
+#include <axis2_env.h>
+#include <axis2_qname.h>
+#include <oxs_x509_cert.h>
+#include <openssl_pkey.h>
+#include <openssl_x509.h>
+#include <openssl_pkcs12.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_mgr_load_key(const axis2_env_t *env,
+    oxs_asym_ctx_t *ctx);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* OXS_KEY_MGR_H */

Modified: webservices/axis2/trunk/c/rampart/include/rampart_constants.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_constants.h?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_constants.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_constants.h Mon Nov 27 01:03:35 2006
@@ -132,6 +132,12 @@
 #define RAMPART_SPR_UT_PASSWORD_TYPE "SPR_UT_passwordType"
 #define RAMPART_SPR_TS_CREATED "SPR_TS_created"
 #define RAMPART_SPR_TS_EXPIRES "SPR_TS_expires"
+#define RAMPART_SPR_UT_CHECKED "SPR_UT_Checked"
+#define RAMPART_SPR_TS_CHECKED "SPR_TS_Checked"
+#define RAMPART_SPR_ENC_CHECKED "SPR_ENC_Checked"
+
+#define RAMPART_YES "YES"
+#define RAMPART_NO "NO"
 
 #ifdef __cplusplus
 }

Modified: webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h (original)
+++ webservices/axis2/trunk/c/rampart/include/rampart_timestamp_token.h Mon Nov 27 01:03:35 2006
@@ -69,6 +69,7 @@
         axis2_status_t (AXIS2_CALL *
         validate)(rampart_timestamp_token_t *timestamp_token,
             const axis2_env_t *env,
+            axis2_msg_ctx_t *msg_ctx,
             axiom_node_t *ts_node,
             axis2_array_list_t *sub_codes);
     };
@@ -98,8 +99,8 @@
 #define RAMPART_TIMESTAMP_TOKEN_BUILD(timestamp_token, env, ctx, sec_node, sec_ns_obj, ttl) \
         ((timestamp_token)->ops->build(timestamp_token, env, ctx,  sec_node, sec_ns_obj, ttl))
 
-#define RAMPART_TIMESTAMP_TOKEN_VALIDATE(timestamp_token, env, ts_node, sub_codes) \
-        ((timestamp_token)->ops->validate(timestamp_token, env, ts_node, sub_codes))
+#define RAMPART_TIMESTAMP_TOKEN_VALIDATE(timestamp_token, env, msg_ctx, ts_node, sub_codes) \
+        ((timestamp_token)->ops->validate(timestamp_token, env, msg_ctx, ts_node, sub_codes))
 
 /** @} */
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml (original)
+++ webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml Mon Nov 27 01:03:35 2006
@@ -31,6 +31,7 @@
 
     <parameter name="InflowSecurity">
       <action>
+        <items>Encrypt</items>
         <decryptionPropFile>/home/kau/keys/rsakey.pem</decryptionPropFile>
       </action>
     </parameter>

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?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am Mon Nov 27 01:03:35 2006
@@ -5,7 +5,7 @@
                         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 iv.c xml_encryption.c encryption.c\
-						utility.c asym_ctx.c x509_cert.c
+						utility.c asym_ctx.c x509_cert.c key_mgr.c
 
 libomxmlsec_la_LIBADD  = -lssl\
 			../../../util/src/libaxis2_util.la \

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c Mon Nov 27 01:03:35 2006
@@ -20,428 +20,210 @@
 #include <oxs_x509_cert.h>
 #include <oxs_error.h>
 
-typedef struct oxs_asym_ctx_impl
+struct oxs_asym_ctx_t
 {
-    oxs_asym_ctx_t asym_ctx;
-    
     axis2_char_t *file_name;
-    axis2_char_t *format;
     axis2_char_t *algorithm;
     oxs_asym_ctx_operation_t operation;   
+    oxs_asym_ctx_format_t format;   
     oxs_x509_cert_t *certificate;
-}
-oxs_asym_ctx_impl_t;
+    openssl_pkey_t *private_key;
+};
 
-/** Interface to implementation conversion macro */
-#define AXIS2_INTF_TO_IMPL(oxs_asym_ctx) ((oxs_asym_ctx_impl_t *)oxs_asym_ctx)
-
-/******** function headers ***************/
 
 /*private functions*/
-static void
-oxs_asym_ctx_init_ops(
-    oxs_asym_ctx_t *asym_ctx);
-
-/*Public functions*/
-axis2_status_t AXIS2_CALL
-oxs_asym_ctx_free_impl(
-    oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env
-);
 
 axis2_char_t *AXIS2_CALL
-oxs_asym_ctx_get_file_name_impl(
-    const oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env);
-
-axis2_char_t *AXIS2_CALL
-oxs_asym_ctx_get_format_impl(
-    const oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env);
-
-axis2_char_t *AXIS2_CALL
-oxs_asym_ctx_get_algorithm_impl(
-    const oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env);
-
-oxs_asym_ctx_operation_t AXIS2_CALL
-oxs_asym_ctx_get_operation_impl(
+oxs_asym_ctx_get_file_name(
     const oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env);
-
-oxs_x509_cert_t *AXIS2_CALL
-oxs_asym_ctx_get_certificate_impl(
-    const oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env);
-
-axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_file_name_impl(
-    oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env,
-    axis2_char_t *file_name);
-
-axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_format_impl(
-    oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env,
-    axis2_char_t *file_name);
-
-axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_algorithm_impl(
-    oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env,
-    axis2_char_t *algorithm);
-
-axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_operation_impl(
-    oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env,
-    oxs_asym_ctx_operation_t operation);
-
-axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_certificate_impl(
-    oxs_asym_ctx_t *asym_ctx,
-    const axis2_env_t *env,
-    oxs_x509_cert_t *certificate);
-
-/******************** end of function headers *****************/
-
+    const axis2_env_t *env)
+{
+    return asym_ctx->file_name;
+}
 
-axis2_char_t *AXIS2_CALL
-oxs_asym_ctx_get_file_name_impl(
+oxs_asym_ctx_format_t AXIS2_CALL
+oxs_asym_ctx_get_format(
     const oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env)
 {
-    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
-    asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
-
-    return asym_ctx_impl->file_name;
+    return asym_ctx->format;
 }
 
 axis2_char_t *AXIS2_CALL
-oxs_asym_ctx_get_format_impl(
+oxs_asym_ctx_get_algorithm(
     const oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env)
 {
-    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
-    asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
-
-    return asym_ctx_impl->format;
+    return asym_ctx->algorithm;
 }
 
-axis2_char_t *AXIS2_CALL
-oxs_asym_ctx_get_algorithm_impl(
+oxs_asym_ctx_operation_t AXIS2_CALL
+oxs_asym_ctx_get_operation(
     const oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env)
 {
-    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
-    asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
-
-    return asym_ctx_impl->algorithm;
+    return asym_ctx->operation;
 }
 
-oxs_asym_ctx_operation_t AXIS2_CALL
-oxs_asym_ctx_get_operation_impl(
+openssl_pkey_t *AXIS2_CALL
+oxs_asym_ctx_get_private_key(
     const oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env)
 {
-    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
-    /*AXIS2_ENV_CHECK(env, NULL);*/
-    asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
 
-    return asym_ctx_impl->operation;
+    return asym_ctx->private_key;
 }
 
 oxs_x509_cert_t *AXIS2_CALL
-oxs_asym_ctx_get_certificate_impl(
+oxs_asym_ctx_get_certificate(
     const oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env)
 {
-    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
-    asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
 
-    return asym_ctx_impl->certificate;
+    return asym_ctx->certificate;
 }
 
 axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_file_name_impl(
+oxs_asym_ctx_set_file_name(
     oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env,
     axis2_char_t *file_name)
 {
-    oxs_asym_ctx_impl_t *oxs_asym_ctx_impl = NULL;
-
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env->error, file_name, AXIS2_FAILURE);
-    oxs_asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
 
-    if (oxs_asym_ctx_impl->file_name)
+    if (asym_ctx->file_name)
     {
-        AXIS2_FREE(env->allocator, oxs_asym_ctx_impl->file_name);
-        oxs_asym_ctx_impl->file_name = NULL;
+        AXIS2_FREE(env->allocator, asym_ctx->file_name);
+        asym_ctx->file_name = NULL;
     }
-    oxs_asym_ctx_impl->file_name = AXIS2_STRDUP(file_name, env);
+    asym_ctx->file_name = AXIS2_STRDUP(file_name, env);
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_format_impl(
+oxs_asym_ctx_set_format(
     oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env,
-    axis2_char_t *format)
+    oxs_asym_ctx_format_t format)
 {
-    oxs_asym_ctx_impl_t *oxs_asym_ctx_impl = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env->error, format, AXIS2_FAILURE);
-    oxs_asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
-
-    if (oxs_asym_ctx_impl->format)
-    {
-        AXIS2_FREE(env->allocator, oxs_asym_ctx_impl->format);
-        oxs_asym_ctx_impl->format = NULL;
-    }
-    oxs_asym_ctx_impl->format = AXIS2_STRDUP(format, env);
+    asym_ctx->format = format;
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_algorithm_impl(
+oxs_asym_ctx_set_algorithm(
     oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env,
     axis2_char_t *algorithm)
 {
-    oxs_asym_ctx_impl_t *oxs_asym_ctx_impl = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env->error, algorithm, AXIS2_FAILURE);
-    oxs_asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
-
-    if (oxs_asym_ctx_impl->algorithm)
+    if (asym_ctx->algorithm)
     {
-        AXIS2_FREE(env->allocator, oxs_asym_ctx_impl->algorithm);
-        oxs_asym_ctx_impl->algorithm = NULL;
+        AXIS2_FREE(env->allocator, asym_ctx->algorithm);
+        asym_ctx->algorithm = NULL;
     }
-    oxs_asym_ctx_impl->algorithm = AXIS2_STRDUP(algorithm, env);
+    asym_ctx->algorithm = AXIS2_STRDUP(algorithm, env);
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_operation_impl(
+oxs_asym_ctx_set_operation(
     oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env,
     oxs_asym_ctx_operation_t operation)
 {
-    oxs_asym_ctx_impl_t *oxs_asym_ctx_impl = NULL;
-
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    oxs_asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
 
-    oxs_asym_ctx_impl->operation = operation;
+    asym_ctx->operation = operation;
     return AXIS2_SUCCESS;
 }
 
 
 axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_certificate_impl(
+oxs_asym_ctx_set_certificate(
     oxs_asym_ctx_t *asym_ctx,
     const axis2_env_t *env,
     oxs_x509_cert_t *certificate)
 {
-    oxs_asym_ctx_impl_t *oxs_asym_ctx_impl = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env->error, certificate, AXIS2_FAILURE);
-    oxs_asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
-
-    if (oxs_asym_ctx_impl->certificate)
+    if (asym_ctx->certificate)
     {
-        oxs_x509_cert_free(oxs_asym_ctx_impl->certificate, env);
-        oxs_asym_ctx_impl->certificate = NULL;
+        oxs_x509_cert_free(asym_ctx->certificate, env);
+        asym_ctx->certificate = NULL;
     }
-    oxs_asym_ctx_impl->certificate = certificate;
+    asym_ctx->certificate = certificate;
     return AXIS2_SUCCESS;
 }
 
+axis2_status_t AXIS2_CALL
+oxs_asym_ctx_set_private_key(
+    oxs_asym_ctx_t *asym_ctx,
+    const axis2_env_t *env,
+    openssl_pkey_t *private_key)
+{
 
-static void
-oxs_asym_ctx_init_ops(
-    oxs_asym_ctx_t *asym_ctx)
-{
-    asym_ctx->ops->get_file_name  = oxs_asym_ctx_get_file_name_impl;
-    asym_ctx->ops->get_format  = oxs_asym_ctx_get_format;
-    asym_ctx->ops->get_algorithm  = oxs_asym_ctx_get_algorithm_impl;
-    asym_ctx->ops->get_operation  = oxs_asym_ctx_get_operation_impl;
-    asym_ctx->ops->get_certificate  = oxs_asym_ctx_get_certificate_impl;
-    asym_ctx->ops->set_file_name   = oxs_asym_ctx_set_file_name_impl;
-    asym_ctx->ops->set_format   = oxs_asym_ctx_set_format;
-    asym_ctx->ops->set_algorithm  = oxs_asym_ctx_set_algorithm_impl;
-    asym_ctx->ops->set_operation  = oxs_asym_ctx_set_operation_impl;
-    asym_ctx->ops->set_certificate  = oxs_asym_ctx_set_certificate_impl;
-    asym_ctx->ops->free      = oxs_asym_ctx_free_impl;
+    if (asym_ctx->private_key)
+    {
+        OPENSSL_PKEY_FREE(asym_ctx->private_key, env);
+        asym_ctx->private_key = NULL;
+    }
+    asym_ctx->private_key = private_key;
+    return AXIS2_SUCCESS;
 }
 
 
 AXIS2_EXTERN oxs_asym_ctx_t *AXIS2_CALL
 oxs_asym_ctx_create(const axis2_env_t *env)
 {
-    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
+    oxs_asym_ctx_t *asym_ctx = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    asym_ctx_impl = AXIS2_MALLOC(env->allocator, sizeof(oxs_asym_ctx_impl_t));
-    if (!asym_ctx_impl)
-    {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        return NULL;
-    }
-
-    asym_ctx_impl->file_name= NULL;
-    asym_ctx_impl->format= NULL;
-    asym_ctx_impl->algorithm = NULL;
-    asym_ctx_impl->operation = -1;
-    asym_ctx_impl->certificate = NULL;
-
-    asym_ctx_impl->asym_ctx.ops =  AXIS2_MALLOC(env->allocator, sizeof(oxs_asym_ctx_ops_t));
-    if (!asym_ctx_impl->asym_ctx.ops)
+    asym_ctx = AXIS2_MALLOC(env->allocator, sizeof(oxs_asym_ctx_t));
+    if (!asym_ctx)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        oxs_asym_ctx_free(&(asym_ctx_impl->asym_ctx), env);
         return NULL;
     }
 
-    oxs_asym_ctx_init_ops(&(asym_ctx_impl->asym_ctx));
-
-    return &(asym_ctx_impl->asym_ctx);
-
+    asym_ctx->file_name= NULL;
+    asym_ctx->format= -1;
+    asym_ctx->algorithm = NULL;
+    asym_ctx->operation = -1;
+    asym_ctx->certificate = NULL;
+    
+    return asym_ctx;
 }
 
 
 axis2_status_t AXIS2_CALL
-oxs_asym_ctx_free_impl(oxs_asym_ctx_t *asym_ctx,
+oxs_asym_ctx_free(oxs_asym_ctx_t *asym_ctx,
         const axis2_env_t *env)
 {
-    oxs_asym_ctx_impl_t *asym_ctx_impl = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    asym_ctx_impl = AXIS2_INTF_TO_IMPL(asym_ctx);
-
-    if (asym_ctx_impl->file_name)
+    if (asym_ctx->file_name)
     {
-        AXIS2_FREE(env->allocator, asym_ctx_impl->file_name);
-        asym_ctx_impl->file_name = NULL;
+        AXIS2_FREE(env->allocator, asym_ctx->file_name);
+        asym_ctx->file_name = NULL;
     }
 
-    if (asym_ctx_impl->format)
+    if (asym_ctx->algorithm)
     {
-        AXIS2_FREE(env->allocator, asym_ctx_impl->format);
-        asym_ctx_impl->format = NULL;
+        AXIS2_FREE(env->allocator, asym_ctx->algorithm);
+        asym_ctx->algorithm = NULL;
     }
 
-    if (asym_ctx_impl->algorithm)
+    if (asym_ctx->certificate)
     {
-        AXIS2_FREE(env->allocator, asym_ctx_impl->algorithm);
-        asym_ctx_impl->algorithm = NULL;
+        oxs_x509_cert_free(asym_ctx->certificate, env);
+        asym_ctx->certificate = NULL;
     }
 
-    if (asym_ctx_impl->certificate)
-    {
-        oxs_x509_cert_free(asym_ctx_impl->certificate, env);
-        asym_ctx_impl->certificate = NULL;
-    }
-
-    AXIS2_FREE(env->allocator,  asym_ctx_impl);
-    asym_ctx_impl = NULL;
+    AXIS2_FREE(env->allocator,  asym_ctx);
+    asym_ctx = NULL;
 
     return AXIS2_SUCCESS;
 }
 
-/**********************Wrappers******************************************/
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_asym_ctx_free(oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env)
-{
-     return  ctx->ops->free(ctx, env);
-}
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-oxs_asym_ctx_get_file_name(const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env)
-{
-     return  ctx->ops->get_file_name(ctx, env);
-}
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-oxs_asym_ctx_get_format(const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env)
-{
-     return  ctx->ops->get_format(ctx, env);
-}
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-oxs_asym_ctx_get_algorithm(const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env)
-{
-     return  ctx->ops->get_algorithm(ctx, env);
-}
-
-AXIS2_EXTERN oxs_asym_ctx_operation_t AXIS2_CALL
-oxs_asym_ctx_get_operation(const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env)
-{
-     return  ctx->ops->get_operation(ctx, env);
-}
-
-AXIS2_EXTERN oxs_x509_cert_t* AXIS2_CALL
-oxs_asym_ctx_get_certificate(const oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env)
-{
-     return  ctx->ops->get_certificate(ctx, env);
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_file_name(oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    axis2_char_t *file_name)
-{
-     return  ctx->ops->set_file_name(ctx, env,file_name );
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_format(oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    axis2_char_t *format)
-{
-     return  ctx->ops->set_format(ctx, env,format );
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_algorithm(oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    axis2_char_t *algorithm)
-{
-     return  ctx->ops->set_algorithm(ctx, env, algorithm);
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_operation(oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    oxs_asym_ctx_operation_t operation)
-{
-     return  ctx->ops->set_operation(ctx, env,operation );
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-oxs_asym_ctx_set_certificate(oxs_asym_ctx_t *ctx,
-                    const axis2_env_t *env,
-                    oxs_x509_cert_t *certificate)
-{
-     return  ctx->ops->set_certificate(ctx, env, certificate);
-}
 

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/encryption.c Mon Nov 27 01:03:35 2006
@@ -166,6 +166,7 @@
 
     /*1. Try to get the pkey from the asy_ctx*/
     
+
     /*2. If not try to load the key from the dec_prop_file*/
     file_name = oxs_asym_ctx_get_file_name(ctx, env);
     pkey =  openssl_pkey_create(env);

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/key.c Mon Nov 27 01:03:35 2006
@@ -31,8 +31,6 @@
     oxs_buffer_t *buf;
     axis2_char_t *name;
     int            usage;
-    /*int            size;
-    unsigned char *data;*/
 }
 oxs_key_impl_t;
 

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c?view=auto&rev=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/key_mgr.c Mon Nov 27 01:03:35 2006
@@ -0,0 +1,82 @@
+/*
+ *   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_error.h>
+#include <oxs_key_mgr.h>
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_key_mgr_load_key(const axis2_env_t *env,
+    oxs_asym_ctx_t *ctx)
+{
+    axis2_char_t *filename = NULL;
+    axis2_char_t *password = "1234";
+    axis2_status_t status = AXIS2_FAILURE;
+    openssl_x509_format_t format;
+    openssl_pkey_t *open_pkey = NULL;
+    oxs_x509_cert_t *oxs_cert = NULL;
+
+    X509 *cert = NULL;
+    STACK_OF(X509) *ca = NULL;
+    EVP_PKEY *pkey = NULL;
+
+    /*Get file to be loaded. Can be either in PEM or PKCS12 format*/
+    filename = oxs_asym_ctx_get_file_name(ctx, env);
+    if(!filename){
+        return AXIS2_FAILURE;
+    }
+
+    if(OXS_ASYM_CTX_FORMAT_PEM == oxs_asym_ctx_get_format(ctx, env)){
+        format = OPENSSL_X509_FORMAT_PEM;
+    }else if(OXS_ASYM_CTX_FORMAT_PKCS12 == oxs_asym_ctx_get_format(ctx, env)){
+        format = OPENSSL_X509_FORMAT_PKCS12;
+        status = openssl_x509_load_from_pkcs12(env, filename, password, &cert, &pkey, &ca);
+ 
+    }
+   
+    /**
+     *   Now we have X509 and/or Pkey. If the format is PKCS12, then we have a chance to get both certificate and pkey.
+     *   If the format is PEM only, we might have only the pkey. 
+     */ 
+    
+    /*Alright if the pkey is available, populate the openssl_pkey*/
+    if(pkey){
+        open_pkey = openssl_pkey_create(env);
+        OPENSSL_PKEY_POPULATE(open_pkey, env, pkey, filename, OPENSSL_PKEY_TYPE_PRIVATE_KEY);
+        
+    }
+    /*If the X509 certificate is available, populate oxs_x509_cert*/
+    if(cert){
+        axis2_char_t *serial = NULL;
+        int serial_num = 0;
+
+        oxs_cert = oxs_x509_cert_create(env);
+        oxs_x509_cert_set_data(oxs_cert, env, openssl_x509_get_cert_data(env, cert));
+        oxs_x509_cert_set_date(oxs_cert, env, openssl_x509_get_info(env, OPENSSL_X509_INFO_VALID_TO ,cert));
+        oxs_x509_cert_set_issuer(oxs_cert, env, openssl_x509_get_info(env, OPENSSL_X509_INFO_ISSUER ,cert));
+        oxs_x509_cert_set_subject(oxs_cert, env, openssl_x509_get_info(env, OPENSSL_X509_INFO_SUBJECT ,cert));
+        oxs_x509_cert_set_fingerprint(oxs_cert, env, openssl_x509_get_info(env, OPENSSL_X509_INFO_FINGER,cert));
+        serial_num = openssl_x509_get_serial(env, cert);
+        sprintf(serial, "%d" ,serial_num);
+        oxs_x509_cert_set_serial_number(oxs_cert, env, serial);
+        /*TODO Subject hash*/ 
+
+
+    }
+
+    return AXIS2_SUCCESS;
+}

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/Makefile.am Mon Nov 27 01:03:35 2006
@@ -1,5 +1,5 @@
 noinst_LTLIBRARIES = libomopenssl.la
-libomopenssl_la_SOURCES = cipher_ctx.c crypt.c rsa.c pkey.c util.c cipher_property.c digest.c
+libomopenssl_la_SOURCES = cipher_ctx.c crypt.c rsa.c pkey.c util.c cipher_property.c digest.c x509.c pkcs12.c
 
 libomopenssl_la_LIBADD  = -lssl\
 			../../../../util/src/libaxis2_util.la \

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkcs12.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkcs12.c?view=auto&rev=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkcs12.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/pkcs12.c Mon Nov 27 01:03:35 2006
@@ -0,0 +1,79 @@
+/*
+ *   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 <openssl_rsa.h>
+#include <openssl/rand.h>
+#include <openssl/evp.h>
+#include <openssl/pem.h>
+#include <openssl/bio.h>
+#include <openssl/rand.h>
+#include <oxs_error.h>
+#include <openssl_pkcs12.h>
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_pkcs12_load(const axis2_env_t *env,
+    axis2_char_t *filename,
+    PKCS12 **p12)
+{
+    FILE *fp = NULL;
+
+    SSLeay_add_all_algorithms();
+    ERR_load_crypto_strings();
+    if (!(fp = fopen(filename, "rb"))) {
+        fprintf(stderr, "Error opening file %s\n", filename);
+        return AXIS2_FAILURE;
+    }
+    /*Load pkcs store*/
+    *p12 = d2i_PKCS12_fp(fp, NULL);
+    fclose (fp);
+
+    if (!p12) {
+        fprintf(stderr, "Error reading PKCS#12 file\n");
+        ERR_print_errors_fp(stderr);
+        return AXIS2_FAILURE;
+    }
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_pkcs12_parse(const axis2_env_t *env,
+    axis2_char_t *password ,
+    PKCS12 *p12,
+    EVP_PKEY **pkey,
+    X509 **cert,
+    STACK_OF(X509) **ca)
+{
+    /*Parse the pkcs store*/
+    if (!PKCS12_parse(p12, password, pkey, cert, ca)) {
+        fprintf(stderr, "Error parsing PKCS#12 file\n");
+        ERR_print_errors_fp(stderr);
+        return AXIS2_FAILURE;
+    }
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_pkcs12_free(const axis2_env_t *env,
+    PKCS12 *p12)
+{
+
+    PKCS12_free(p12);
+    return AXIS2_SUCCESS;
+}
+
+

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c?view=auto&rev=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/openssl/x509.c Mon Nov 27 01:03:35 2006
@@ -0,0 +1,307 @@
+/*
+ *   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 <openssl_rsa.h>
+#include <openssl/rand.h>
+#include <openssl/evp.h>
+#include <openssl/pem.h>
+#include <openssl/bio.h>
+#include <openssl/rand.h>
+#include <oxs_buffer.h>
+#include <oxs_error.h>
+#include <openssl_pkcs12.h>
+#include <openssl_x509.h>
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_load_from_buffer(const axis2_env_t *env,
+    axis2_char_t *b64_encoded_buf,
+    X509 **cert)
+{
+    unsigned char *buff = NULL;
+    BIO *mem = NULL;
+    int ilen = 0;
+
+    /*First we need to base64 decode*/
+#if 0
+    int decoded_len = -1;
+
+    buff = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len(b64_encoded_buf));
+    ilen = axis2_strlen(b64_encoded_buf);
+    decoded_len = axis2_base64_decode_binary(buff, b64_encoded_buf );
+    if (decoded_len < 0)
+    {
+        /*oxs_error(ERROR_LOCATION, OXS_ERROR_DEFAULT,
+                "axis2_base64_decode_binary failed");*/
+        return AXIS2_FAILURE;
+    }
+#else
+    EVP_ENCODE_CTX ctx;
+    int len = 0;
+    int ret = 0;
+
+    buff = AXIS2_MALLOC(env->allocator, axis2_base64_decode_len(b64_encoded_buf));
+    ilen = axis2_strlen(b64_encoded_buf);
+    EVP_DecodeInit(&ctx);
+    EVP_DecodeUpdate(&ctx, (unsigned char*)buff, &len,
+                   (unsigned char*)b64_encoded_buf, ilen);
+    EVP_DecodeFinal(&ctx, (unsigned char*)buff, &ret);
+    ret += len;
+#endif
+    if ((mem = BIO_new_mem_buf(buff, ilen)) == NULL)
+    {
+        /*oxs_error(ERROR_LOCATION, OXS_ERROR_DEFAULT,
+                "BIO memeory allocation failure");*/
+        return AXIS2_FAILURE;
+    }
+
+    *cert = d2i_X509_bio(mem, NULL);
+    BIO_free(mem);
+
+    if (*cert == NULL){
+        /*oxs_error(ERROR_LOCATION, OXS_ERROR_DEFAULT,
+                "Certificate is NULL");*/
+        return AXIS2_FAILURE;
+    }
+    
+    return AXIS2_SUCCESS;   
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_load_from_pkcs12(const axis2_env_t *env,
+    axis2_char_t *filename,
+    axis2_char_t *password,
+    X509 **cert,
+    EVP_PKEY **pkey,
+    STACK_OF(X509) **ca)
+{
+    PKCS12 *p12 = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+
+    /*Load*/
+    status = openssl_pkcs12_load(env, filename, &p12);
+    if(AXIS2_FAILURE == status){
+        return AXIS2_FAILURE;
+    }
+    /*Parse*/
+    status = openssl_pkcs12_parse(env, password, p12, pkey,
+                cert,
+                 ca);
+    if(AXIS2_FAILURE == status){
+        return AXIS2_FAILURE;
+    }
+    /*Free*/
+    status = openssl_pkcs12_free(env, p12);
+    if(AXIS2_FAILURE == status){
+        return AXIS2_FAILURE;
+    }
+    
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_load_certificate(const axis2_env_t *env,
+    openssl_x509_format_t format,
+    axis2_char_t *filename,
+    axis2_char_t *password,
+    X509 **cert)
+{
+    axis2_status_t status = AXIS2_FAILURE;
+
+    if(OPENSSL_X509_FORMAT_PEM == format){
+        /*Load from PEM*/
+
+    }else if(OPENSSL_X509_FORMAT_PKCS12 == format){
+        /*Load from PKCS12*/
+        EVP_PKEY *pkey = NULL;
+        STACK_OF(X509) *ca = NULL;
+        status = openssl_x509_load_from_pkcs12(env, filename, password, cert, &pkey, &ca);        
+         if(AXIS2_FAILURE == status){
+             return AXIS2_FAILURE;
+         }
+    }else if(OPENSSL_X509_FORMAT_DER == format){
+        /*Load from DER*/
+    
+    }else{
+        /*Unspported*/
+    }
+    return AXIS2_SUCCESS;
+}
+
+
+/*
+ * Here we take data in btwn
+ -----BEGIN CERTIFICATE-----
+ -----END CERTIFICATE-----
+ */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+openssl_x509_get_cert_data(const axis2_env_t *env,
+    X509 *cert)
+{
+    axis2_char_t *unformatted = NULL;
+    axis2_char_t *core_tail = NULL;
+    axis2_char_t *core = NULL;
+    axis2_char_t *res = NULL;
+    
+    unformatted = openssl_x509_get_info(env, OPENSSL_X509_INFO_DATA_CERT, cert);
+    core_tail = axis2_strstr(unformatted, "\n");
+    res = axis2_strstr(core_tail,"-----END");
+    res[0] = '\0';
+    core = (axis2_char_t*)axis2_strdup(core_tail,env); 
+    return core;
+}
+
+
+AXIS2_EXTERN int AXIS2_CALL
+openssl_x509_get_serial(const axis2_env_t *env,
+    X509 *cert)
+{
+    axis2_char_t *serial = NULL;
+    int no = 0;
+    serial = (axis2_char_t*)i2s_ASN1_INTEGER(NULL,X509_get_serialNumber(cert));
+    no = atoi(serial);
+
+    return no;
+}
+
+AXIS2_EXTERN unsigned long AXIS2_CALL
+openssl_x509_get_subject_name_hash(const axis2_env_t *env,
+    X509 *cert)
+{
+    unsigned long l = 0;
+    l=X509_subject_name_hash(cert);
+    return l;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+openssl_x509_get_pubkey(const axis2_env_t *env,
+    X509 *cert,
+    EVP_PKEY **pubkey)
+{
+    *pubkey = X509_get_pubkey(cert);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+openssl_x509_get_info(const axis2_env_t *env,
+    openssl_x509_info_type_t type,
+    X509 *cert)
+{
+    BIO *out = NULL;
+    unsigned char *data= NULL;
+    axis2_char_t *result = NULL;
+    int n = 0;
+
+    out = BIO_new(BIO_s_mem());
+    if(OPENSSL_X509_INFO_SUBJECT==type){
+        X509_NAME_print_ex(out, X509_get_subject_name(cert), 0, 0);
+    }else if(OPENSSL_X509_INFO_ISSUER == type){
+        X509_NAME_print_ex(out, X509_get_subject_name(cert), 0, 0);    
+    }else if(OPENSSL_X509_INFO_VALID_FROM == type){
+        ASN1_TIME_print(out, X509_get_notBefore(cert));    
+    }else if(OPENSSL_X509_INFO_VALID_TO == type){
+        ASN1_TIME_print(out, X509_get_notAfter(cert));
+    }else if(OPENSSL_X509_INFO_DATA_CERT == type){
+        if(!PEM_write_bio_X509(out, cert)){
+            return NULL;
+        }
+    }else if(OPENSSL_X509_INFO_FINGER == type){
+        int j = 0;
+        const EVP_MD *digest = NULL;
+        unsigned char md[EVP_MAX_MD_SIZE];
+        unsigned int _n = 0;
+        
+        digest = EVP_sha1();/*If we use EVP_md5(); here we can get the digest from md5. */
+        if(X509_digest(cert,digest,md,&_n))
+        {
+            BIO_printf(out, "%s:", OBJ_nid2sn(EVP_MD_type(digest)));
+            for (j=0; j<(int)_n; j++)
+            {
+                BIO_printf (out, "%02X",md[j]);
+                if (j+1 != (int)_n) BIO_printf(out,":");
+            }
+        }
+    }else if(OPENSSL_X509_INFO_SIGNATURE == type){
+        int i = 0;
+        unsigned char *s = NULL;
+
+        n=cert->signature->length;
+        s=cert->signature->data;
+        for (i=0; i<n; i++)
+        {
+           if ( ((i%18) == 0) && (i!=0) ) BIO_printf(out,"\n");
+           BIO_printf(out,"%02x%s",s[i], (((i+1)%18) == 0)?"":":");
+        }
+            
+    }else if(OPENSSL_X509_INFO_VERSION == type){
+        long l = 0.0;
+
+        l = X509_get_version(cert);
+        BIO_printf (out,"%lu (0x%lx)",l+1,l);
+    }else if(OPENSSL_X509_INFO_PUBKEY == type){
+        EVP_PKEY *pkey = NULL;
+
+        pkey=X509_get_pubkey(cert);
+        if (pkey != NULL)
+        {
+            if (pkey->type == EVP_PKEY_RSA){
+                RSA_print(out,pkey->pkey.rsa,0);
+            }else if (pkey->type == EVP_PKEY_DSA){
+                DSA_print(out,pkey->pkey.dsa,0);
+            }
+            EVP_PKEY_free(pkey);
+        }
+    }else if(OPENSSL_X509_INFO_PUBKEY_ALGO == type){
+       X509_CINF *ci = NULL;
+
+       ci = cert->cert_info;
+       i2a_ASN1_OBJECT(out, ci->key->algor->algorithm);
+    }
+    n = BIO_get_mem_data(out, &data);
+    result = axis2_strndup( data, n, env );
+    BIO_free(out);
+    out = NULL;
+    
+    return result;
+}
+
+
+AXIS2_EXTERN void  AXIS2_CALL
+openssl_x509_print(const axis2_env_t *env,
+    X509 *cert)
+{
+        printf("\n*************START PRINTING*****************\n"); 
+        printf("OPENSSL_X509_INFO_SUBJECT : %s\n", openssl_x509_get_info(env, OPENSSL_X509_INFO_SUBJECT,cert));
+        printf("OPENSSL_X509_INFO_ISSUER : %s\n", openssl_x509_get_info(env,OPENSSL_X509_INFO_ISSUER ,cert));
+        printf("OPENSSL_X509_INFO_VALID_FROM : %s\n", openssl_x509_get_info(env, OPENSSL_X509_INFO_VALID_FROM,cert));
+        printf("OPENSSL_X509_INFO_VALID_TO : %s\n", openssl_x509_get_info(env,OPENSSL_X509_INFO_VALID_TO ,cert));
+        printf("OPENSSL_X509_INFO_FINGER : %s\n", openssl_x509_get_info(env,OPENSSL_X509_INFO_FINGER ,cert));
+        printf("OPENSSL_X509_INFO_SIGNATURE : %s\n", openssl_x509_get_info(env, OPENSSL_X509_INFO_SIGNATURE,cert));
+        printf("OPENSSL_X509_INFO_VERSION : %s\n", openssl_x509_get_info(env,OPENSSL_X509_INFO_VERSION ,cert));
+        printf("OPENSSL_X509_INFO_PUBKEY : %s\n", openssl_x509_get_info(env,OPENSSL_X509_INFO_PUBKEY ,cert));
+        printf("OPENSSL_X509_INFO_PUBKEY_ALGO : %s\n", openssl_x509_get_info(env,OPENSSL_X509_INFO_PUBKEY_ALGO ,cert));
+        /*printf("SUBJ_NAME_HASH : %u\n", openssl_x509_get_subject_name_hash(env,cert));*/
+        printf("SERIAL : %u\n", openssl_x509_get_serial(env,cert));
+        printf("PUBKEY : %s\n", openssl_x509_get_cert_data(env,cert));
+
+        printf("\n*************END PRINTING********************\n"); 
+
+
+
+}

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=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_encryption.c Mon Nov 27 01:03:35 2006
@@ -119,6 +119,8 @@
     oxs_asym_ctx_set_algorithm(asym_ctx, env, enc_asym_algo);
     oxs_asym_ctx_set_file_name(asym_ctx, env, certificate_file);
     oxs_asym_ctx_set_operation(asym_ctx, env, OXS_ASYM_CTX_OPERATION_PUB_ENCRYPT);
+    /*TODO This should be taken from the configurations*/
+    oxs_asym_ctx_set_format(asym_ctx, env, OXS_ASYM_CTX_FORMAT_PKCS12);
     /*Encrypt the session key*/
     oxs_xml_enc_encrypt_key(env, asym_ctx, sec_node,session_key, id_list);    
 

Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_handler_util.c Mon Nov 27 01:03:35 2006
@@ -218,12 +218,9 @@
 
         }/*End of for*/
     }
-
     return header_block_node;
 
 }
-
-
 
 AXIS2_EXTERN void AXIS2_CALL
 rampart_create_fault_envelope(const axis2_env_t *env,

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=479553&r1=479552&r2=479553
==============================================================================
--- 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 Mon Nov 27 01:03:35 2006
@@ -52,7 +52,7 @@
     axis2_status_t valid_ts = AXIS2_FAILURE;
     
     timestamp_token = rampart_timestamp_token_create(env);
-    valid_ts = RAMPART_TIMESTAMP_TOKEN_VALIDATE(timestamp_token, env, ts_node, sub_codes);
+    valid_ts = RAMPART_TIMESTAMP_TOKEN_VALIDATE(timestamp_token, env, msg_ctx, ts_node, sub_codes);
 
     if (valid_ts)
     {
@@ -267,7 +267,11 @@
     axis2_status_t status = AXIS2_FAILURE;
 
     /*If certian security elements are expected by the reciever, rampart should check for those */
-    return rampart_shp_enforce_security(env, msg_ctx, actions,  soap_envelope, sec_node, sub_codes);
+    /*This should be done along with the the message header processing. Need to be modified later for encryption*/
+    status =  rampart_shp_enforce_security(env, msg_ctx, actions,  soap_envelope, sec_node, sub_codes);
+    if(AXIS2_FAILURE == status){
+        return AXIS2_FAILURE;
+    }
 
     AXIS2_LOG_INFO(env->log, "[rampart][shp] Process security header");
     /*Get the first token of the security header element*/

Modified: webservices/axis2/trunk/c/rampart/src/util/timestamp_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/timestamp_token.c?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/timestamp_token.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/timestamp_token.c Mon Nov 27 01:03:35 2006
@@ -58,6 +58,7 @@
 axis2_status_t AXIS2_CALL
 rampart_timestamp_token_validate(rampart_timestamp_token_t *timestamp_token,
         const axis2_env_t *env,
+        axis2_msg_ctx_t *msg_ctx,
         axiom_node_t *ts_node,
         axis2_array_list_t *sub_codes);
 
@@ -184,6 +185,7 @@
 axis2_status_t AXIS2_CALL
 rampart_timestamp_token_validate(rampart_timestamp_token_t *timestamp_token,
         const axis2_env_t *env,
+        axis2_msg_ctx_t *msg_ctx,
         axiom_node_t *ts_node,
         axis2_array_list_t *sub_codes)
 {
@@ -233,6 +235,7 @@
     }
 
     created_val = AXIOM_ELEMENT_GET_TEXT(created_ele, env, created_node);
+    rampart_set_security_processed_result(env, msg_ctx,RAMPART_SPR_TS_CREATED, created_val);
     /*Check whether created is less than current time or not*/
     current_val = rampart_generate_time(env, 0);
     validity = rampart_compare_date_time(env, created_val, current_val);
@@ -262,6 +265,7 @@
     /*Now the expires element is present. So check whether this has a valid timestamp.
       If not it's a failure*/
     expires_val = AXIOM_ELEMENT_GET_TEXT(expires_ele, env, expires_node);
+    rampart_set_security_processed_result(env, msg_ctx,RAMPART_SPR_TS_EXPIRES, expires_val);
 
     /*Check whether time has expired or not*/
     validity = rampart_compare_date_time(env, current_val, expires_val);
@@ -271,7 +275,7 @@
         return AXIS2_FAILURE;
     }
     AXIS2_LOG_INFO(env->log, "[rampart][ts] Timstamp is valid");
-
+    rampart_set_security_processed_result(env, msg_ctx,RAMPART_SPR_TS_CHECKED, RAMPART_YES);
     /*free memory for qnames*/
     return validity;
 }

Modified: webservices/axis2/trunk/c/rampart/src/util/username_token.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/username_token.c?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/username_token.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/username_token.c Mon Nov 27 01:03:35 2006
@@ -577,6 +577,7 @@
     if (0 == AXIS2_STRCMP(password_to_compare , password))
     {
         AXIS2_LOG_INFO(env->log,  "[rampart][rampart_usernametoken] Password comparison SUCCESS");
+        rampart_set_security_processed_result(env, msg_ctx,RAMPART_SPR_UT_CHECKED, RAMPART_YES);
         return AXIS2_SUCCESS;
     }
     else

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=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/test/Makefile.am Mon Nov 27 01:03:35 2006
@@ -1,2 +1,2 @@
-SUBDIRS = omxmlsec
+SUBDIRS = omxmlsec openssl
 

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=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c (original)
+++ webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c Mon Nov 27 01:03:35 2006
@@ -122,13 +122,6 @@
     env = test_init();
     printf("--Testing started--------------------------------------------\n");
 
-    /*additional code start*/
-    oxs_x509_cert_t *cert = NULL;
-    cert = oxs_x509_cert_create(env);
-    oxs_x509_cert_set_issuer(cert, env, "IssuerXYZ");
-    printf("\nSER NO :%s\n", oxs_x509_cert_get_issuer(cert, env));
-    /*additional code end*/
-
     if (argc > 1)
         filename = argv[1];
 

Modified: webservices/axis2/trunk/c/rampart/test/openssl/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/openssl/Makefile.am?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/openssl/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/test/openssl/Makefile.am Mon Nov 27 01:03:35 2006
@@ -1,20 +1,4 @@
-TESTS = test 
-bin_PROGRAMS = test
-#SUBDIRS = rsa
+SUBDIRS = pkcs
 
-AM_CFLAGS = -g -O2 -pthread
+ 
 
-#test_SOURCES = des_test.c
-test_SOURCES = block_cipher_test.c
-
-INCLUDES = -I$(top_builddir)/include \
-			@UTILINC@ \
-            @AXIOMINC@
-
-test_LDADD   = $(top_builddir)/src/util/librampart_util.la \
-                    $(top_builddir)/src/omxmlsec/libomxmlsec.la \
-                    $(top_builddir)/src/omxmlsec/openssl/libomopenssl.la \
-		   -laxis2_util \
-		   -laxis2_axiom \
-            -laxis2_libxml2 \
-            -lxml2

Modified: webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c?view=diff&rev=479553&r1=479552&r2=479553
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c (original)
+++ webservices/axis2/trunk/c/rampart/test/openssl/rsa/test_rsa.c Mon Nov 27 01:03:35 2006
@@ -78,6 +78,9 @@
     return 0;
 }
 
+
+
+
 int main()
 {
     return encdec();



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