You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ka...@apache.org on 2007/02/06 12:48:57 UTC

svn commit: r504089 - in /webservices/axis2/trunk/c/rampart: include/oxs_sign_part.h src/omxmlsec/Makefile.am src/omxmlsec/sign_part.c

Author: kaushalye
Date: Tue Feb  6 03:48:56 2007
New Revision: 504089

URL: http://svn.apache.org/viewvc?view=rev&rev=504089
Log:
Adding Signature Parts to OMXMLSecurity

Added:
    webservices/axis2/trunk/c/rampart/include/oxs_sign_part.h
    webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c
Modified:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am

Added: webservices/axis2/trunk/c/rampart/include/oxs_sign_part.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_sign_part.h?view=auto&rev=504089
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_sign_part.h (added)
+++ webservices/axis2/trunk/c/rampart/include/oxs_sign_part.h Tue Feb  6 03:48:56 2007
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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_SIGN_PART_H
+#define OXS_SIGN_PART_H
+
+
+/**
+  * @file oxs_sign_part.h
+  * @brief Keeps information relavent for a single node of signing. 
+  */
+
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axiom_node.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+    typedef struct oxs_sign_part_t oxs_sign_part_t;
+
+    /*Create function*/
+    AXIS2_EXTERN oxs_sign_part_t *AXIS2_CALL
+    oxs_sign_part_create(const axis2_env_t *env);
+
+    /*Free*/
+    AXIS2_EXTERN axis2_status_t AXIS2_CALL
+    oxs_sign_part_free(oxs_sign_part_t *ctx,
+        const axis2_env_t *env);
+
+
+/**********************Getter functions******************************************/
+axis2_char_t *AXIS2_CALL
+oxs_sign_part_get_id(
+    const oxs_sign_part_t *sign_part,
+    const axis2_env_t *env);
+
+axiom_node_t *AXIS2_CALL
+oxs_sign_part_get_node(
+    const oxs_sign_part_t *sign_part,
+    const axis2_env_t *env);
+
+axis2_array_list_t *AXIS2_CALL
+oxs_sign_part_get_transforms(
+    const oxs_sign_part_t *sign_part,
+    const axis2_env_t *env);
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_id(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axis2_char_t *id);
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_digest_mtd(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axis2_char_t *digest_mtd);
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_node(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axiom_node_t *node);
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_transforms(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axis2_array_list_t *transforms);
+
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif                          /* OXS_SIGN_PART_H */

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=504089&r1=504088&r2=504089
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am Tue Feb  6 03:48:56 2007
@@ -3,7 +3,7 @@
 
 libomxmlsec_la_SOURCES = ctx.c  buffer.c key.c cipher.c error.c axis2_utils.c axiom.c \
                          iv.c xml_encryption.c encryption.c\
-						utility.c asym_ctx.c x509_cert.c key_mgr.c
+						utility.c asym_ctx.c x509_cert.c key_mgr.c sign_part.c
 						
 
 libomxmlsec_la_LIBADD  = -lssl\

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c?view=auto&rev=504089
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/sign_part.c Tue Feb  6 03:48:56 2007
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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_sign_part.h>
+#include <oxs_error.h>
+
+struct oxs_sign_part_t
+{
+    axis2_char_t *id;
+    axis2_char_t *digest_mtd;
+    axiom_node_t *node ; /*Shallow copies*/
+    axis2_array_list_t *transforms; /*Shallow copies*/
+};
+
+
+/*Public functions*/
+axis2_char_t *AXIS2_CALL
+oxs_sign_part_get_id(
+    const oxs_sign_part_t *sign_part,
+    const axis2_env_t *env)
+{
+    return sign_part->id;
+}
+
+axis2_char_t *AXIS2_CALL
+oxs_sign_part_get_digest_mtd(
+    const oxs_sign_part_t *sign_part,
+    const axis2_env_t *env)
+{
+    return sign_part->digest_mtd;
+}
+
+axiom_node_t *AXIS2_CALL
+oxs_sign_part_get_node(
+    const oxs_sign_part_t *sign_part,
+    const axis2_env_t *env)
+{
+    return sign_part->node;
+}
+
+axis2_array_list_t *AXIS2_CALL
+oxs_sign_part_get_transforms(
+    const oxs_sign_part_t *sign_part,
+    const axis2_env_t *env)
+{
+    return sign_part->transforms;
+}
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_id(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axis2_char_t *id)
+{
+
+    if (sign_part->id)
+    {
+        AXIS2_FREE(env->allocator, sign_part->id);
+        sign_part->id = NULL;
+    }
+    sign_part->id = AXIS2_STRDUP(id, env);
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_digest_mtd(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axis2_char_t *digest_mtd)
+{
+
+    if (sign_part->digest_mtd)
+    {
+        AXIS2_FREE(env->allocator, sign_part->digest_mtd);
+        sign_part->digest_mtd = NULL;
+    }
+    sign_part->digest_mtd = AXIS2_STRDUP(digest_mtd, env);
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_node(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axiom_node_t *node)
+{
+    sign_part->node = node;
+    return AXIS2_SUCCESS;
+}
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_set_transforms(
+    oxs_sign_part_t *sign_part,
+    const axis2_env_t *env,
+    axis2_array_list_t *transforms)
+{
+    sign_part->transforms = transforms;
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN oxs_sign_part_t *AXIS2_CALL
+oxs_sign_part_create(const axis2_env_t *env)
+{
+    oxs_sign_part_t *sign_part = NULL;
+
+    AXIS2_ENV_CHECK(env, NULL);
+
+    sign_part = AXIS2_MALLOC(env->allocator, sizeof(oxs_sign_part_t));
+    if (!sign_part)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    sign_part->id= NULL;
+    sign_part->digest_mtd = NULL;
+    sign_part->node = NULL;
+    sign_part->transforms = NULL;
+
+    return sign_part;
+}
+
+
+axis2_status_t AXIS2_CALL
+oxs_sign_part_free(oxs_sign_part_t *sign_part,
+        const axis2_env_t *env)
+{
+
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    if (sign_part->id)
+    {
+        AXIS2_FREE(env->allocator, sign_part->id);
+        sign_part->id = NULL;
+    }
+
+    if (sign_part->digest_mtd)
+    {
+        AXIS2_FREE(env->allocator, sign_part->digest_mtd);
+        sign_part->digest_mtd = NULL;
+    }
+
+    sign_part->node = NULL;
+    sign_part->transforms = NULL;
+
+    AXIS2_FREE(env->allocator,  sign_part);
+    sign_part = NULL;
+
+    return AXIS2_SUCCESS;
+}
+
+



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