You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by pi...@apache.org on 2007/09/06 12:49:17 UTC

svn commit: r573215 [13/22] - in /webservices/rampart/tags/c/0.90: ./ build/ build/linux/ build/win32/ include/ samples/ samples/authn_provider/ samples/callback/ samples/callback/htpasswd_callback/ samples/client/ samples/client/sec_echo/ samples/clie...

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_encryption_method.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_encryption_method.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_encryption_method.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_encryption_method.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,89 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_encryption_method.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_encryption_method_element(const axutil_env_t *env,
+        axiom_node_t *parent,
+        axis2_char_t* algorithm
+                                         )
+{
+    axiom_node_t *encryption_method_node = NULL;
+    axiom_element_t *encryption_method_ele = NULL;
+    axiom_attribute_t *algo_attr = NULL;
+    int ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
+                                    OXS_XENC);
+
+    encryption_method_ele = axiom_element_create(env, parent, OXS_NODE_ENCRYPTION_METHOD, ns_obj, &encryption_method_node);
+    if (!encryption_method_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating encryption method element");
+        return NULL;
+    }
+    /*Fixed bug. If kt algorithm is NULL then use the default*/
+    if (!algorithm)
+    {
+        algorithm = (axis2_char_t*)OXS_DEFAULT_KT_ALGO_HREF;
+    }
+
+    algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);
+
+    ret = axiom_element_add_attribute(encryption_method_ele, env, algo_attr, encryption_method_node);
+
+    return encryption_method_node;
+
+}
+
+
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_token_get_encryption_method(const axutil_env_t *env, axiom_node_t *enc_mtd_node)
+{
+    axis2_char_t *enc_mtd = NULL;
+    axiom_element_t *enc_mtd_ele = NULL;
+
+    if(!enc_mtd_node){
+        return NULL;
+    }
+
+    enc_mtd_ele = axiom_node_get_data_element(enc_mtd_node, env);
+    if (!enc_mtd_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving encryption method element");
+        return NULL;
+    }
+
+    enc_mtd = axiom_element_get_attribute_value_by_name(enc_mtd_ele, env, OXS_ATTR_ALGORITHM);
+    if((!enc_mtd) ||(0 == axutil_strcmp("", enc_mtd))){
+        return NULL;
+    }
+    return enc_mtd;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_identifier.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_identifier.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_identifier.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_identifier.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_key_identifier.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_key_identifier_element(const axutil_env_t *env,
+                                       axiom_node_t *parent,
+                                       axis2_char_t* encoding_type,
+                                       axis2_char_t* value_type,
+                                       axis2_char_t* value  )
+{
+    axiom_node_t *ki_node = NULL;
+    axiom_element_t *ki_ele = NULL;
+    axiom_attribute_t *encoding_type_att = NULL;
+    axiom_attribute_t *value_type_att = NULL;
+    int ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS,
+                                    OXS_WSSE);
+
+    ki_ele = axiom_element_create(env, parent, OXS_NODE_KEY_IDENTIFIER, ns_obj, &ki_node);
+    if (!ki_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating KeyIdentifier element");
+        return NULL;
+    }
+
+    encoding_type_att =  axiom_attribute_create(env, OXS_ATTR_ENCODING_TYPE, encoding_type, NULL);
+    value_type_att =  axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE, value_type, NULL);
+
+    ret = axiom_element_add_attribute(ki_ele, env, encoding_type_att, ki_node);
+    ret = axiom_element_add_attribute(ki_ele, env, value_type_att, ki_node);
+
+    if (value)
+    {
+        ret  = axiom_element_set_text(ki_ele, env, value, ki_node);
+    }
+
+
+    return ki_node;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_info.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_info.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_info.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_info.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,48 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_key_info.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_key_info_element(const axutil_env_t *env,
+                                 axiom_node_t *parent
+                                )
+{
+    axiom_node_t *key_info_node = NULL;
+    axiom_element_t *key_info_ele = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+
+    key_info_ele = axiom_element_create(env, parent, OXS_NODE_KEY_INFO, ns_obj, &key_info_node);
+    if (!key_info_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating KeyInfo element");
+        return NULL;
+    }
+
+    return key_info_node;
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_name.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_name.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_name.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_key_name.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,53 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_key_name.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_key_name_element(const axutil_env_t *env,
+                                 axiom_node_t *parent,
+                                 axis2_char_t* key_name_val
+                                )
+{
+    axiom_node_t *key_name_node = NULL;
+    axiom_element_t *key_name_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+
+    key_name_ele = axiom_element_create(env, parent, OXS_NODE_KEY_NAME, ns_obj, &key_name_node);
+    if (!key_name_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating KeyName element");
+        return NULL;
+    }
+
+    ret  = axiom_element_set_text(key_name_ele, env, key_name_val, key_name_node);
+
+    return key_name_node;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,99 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_reference.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_reference_element(const axutil_env_t *env,
+                                  axiom_node_t *parent,
+                                  axis2_char_t *ref,
+                                  axis2_char_t *value_type)
+{
+    axiom_node_t *reference_node = NULL;
+    axiom_element_t *reference_ele = NULL;
+    axiom_attribute_t *ref_attr = NULL;
+    axiom_attribute_t *value_type_attr = NULL;
+    int ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS,
+                                    OXS_WSSE);
+
+    reference_ele = axiom_element_create(env, parent, OXS_NODE_REFERENCE, ns_obj, &reference_node);
+    if (!reference_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating Reference element");
+        return NULL;
+    }
+    /*attach empty string*/
+    if (!ref)
+    {
+        ref = "";
+    }
+
+    ref_attr =  axiom_attribute_create(env, OXS_ATTR_URI , ref, NULL);
+    value_type_attr =  axiom_attribute_create(env, OXS_ATTR_VALUE_TYPE , value_type, NULL);
+
+    ret = axiom_element_add_attribute(reference_ele, env, ref_attr, reference_node);
+    ret = axiom_element_add_attribute(reference_ele, env, value_type_attr, reference_node);
+
+    return reference_node;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_token_get_reference(const axutil_env_t *env, axiom_node_t *ref_node)
+{
+    axis2_char_t *ref = NULL;
+    axiom_element_t *reference_ele = NULL;
+
+    reference_ele = axiom_node_get_data_element(ref_node, env);
+    if (!reference_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving data reference element");
+        return NULL;
+    }
+
+    ref = axiom_element_get_attribute_value_by_name(reference_ele, env, OXS_ATTR_URI);
+    return ref;
+
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_token_get_reference_value_type(const axutil_env_t *env, axiom_node_t *ref_node)
+{
+    axis2_char_t *val_type = NULL;
+    axiom_element_t *reference_ele = NULL;
+
+    reference_ele = axiom_node_get_data_element(ref_node, env);
+    if (!reference_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving data reference element");
+        return NULL;
+    }
+
+    val_type = axiom_element_get_attribute_value_by_name(reference_ele, env, OXS_ATTR_VALUE_TYPE);
+    return val_type;
+}

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference_list.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference_list.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference_list.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_reference_list.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,121 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_reference_list.h>
+#include <axiom_element.h>
+#include <oxs_token_data_reference.h>
+#include <axutil_array_list.h>
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_reference_list_element(const axutil_env_t *env,
+                                       axiom_node_t *parent )
+{
+    axiom_node_t *reference_list_node = NULL;
+    axiom_element_t *reference_list_ele = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_ENC_NS,
+                                    OXS_XENC);
+
+
+    reference_list_ele = axiom_element_create(env, parent, OXS_NODE_REFERENCE_LIST, ns_obj, &reference_list_node);
+    if (!reference_list_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating ReferenceList element");
+        return NULL;
+    }
+
+    return reference_list_node;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_token_build_data_reference_list(const axutil_env_t *env, axiom_node_t *parent, axutil_array_list_t *id_list)
+{
+    axiom_node_t *ref_list_node = NULL;
+    int i=0;
+
+    if(!id_list){
+        return AXIS2_SUCCESS;
+    }
+    /*Build the ReferenceList element*/
+    ref_list_node = oxs_token_build_reference_list_element(env, parent);
+    if(!ref_list_node) {return AXIS2_FAILURE;}
+
+    /*Build the list*/
+    for(i=0 ; i < axutil_array_list_size(id_list, env); i++){
+        axiom_node_t *data_ref_node = NULL;
+        axis2_char_t *id = NULL;
+
+        /*We need to prepend # to the id in the list to create the reference*/
+        id = axutil_stracat(env, "#",(axis2_char_t*)axutil_array_list_get(id_list, env, i));
+        data_ref_node = oxs_token_build_data_reference_element(env, ref_list_node, id);
+
+        if(!data_ref_node) {return AXIS2_FAILURE;}
+
+    }
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+oxs_token_get_reference_list_data(const axutil_env_t *env, axiom_node_t *ref_list_node)
+{
+    axutil_array_list_t *list = NULL;
+    axiom_children_qname_iterator_t *iter = NULL;
+    axiom_element_t *ref_list_ele = NULL;
+    axutil_qname_t *qname = NULL;
+
+    if (!ref_list_node)
+    {
+        oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
+                  "reference list node is NULL");
+        return NULL;
+    }
+    ref_list_ele = axiom_node_get_data_element(ref_list_node, env);
+
+    /*Get children*/
+    qname = axutil_qname_create(env, OXS_NODE_DATA_REFERENCE,OXS_ENC_NS,OXS_ENC_NS);
+    iter = axiom_element_get_children_with_qname(ref_list_ele, env, qname, ref_list_node);
+    axutil_qname_free(qname, env);
+    qname = NULL;
+
+    if(!iter){
+        oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
+                  "There are no children for %s", OXS_NODE_DATA_REFERENCE);
+        return NULL;
+    }
+
+    list = axutil_array_list_create(env, 0);
+
+    /*Insert UIDs of nodes to the list*/
+    while (AXIS2_TRUE == axiom_children_qname_iterator_has_next(iter, env))
+    {
+        axiom_node_t *dref_node = NULL;
+        axis2_char_t *dref_val = NULL;
+
+        dref_node = axiom_children_qname_iterator_next(iter, env);
+        dref_val = oxs_token_get_data_reference(env, dref_node);
+
+        axutil_array_list_add(list, env, dref_val);
+    }
+
+    return list;
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_security_token_reference.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_security_token_reference.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_security_token_reference.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_security_token_reference.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,49 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_security_token_reference.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+/*TODO These names should be changed to oxs_token_build_XXX_node*/
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_security_token_reference_element(const axutil_env_t *env,
+        axiom_node_t *parent)
+{
+    axiom_node_t *security_token_reference_node = NULL;
+    axiom_element_t *security_token_reference_ele = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_WSSE_NS,
+                                    OXS_WSSE);
+
+    security_token_reference_ele = axiom_element_create(env, parent, OXS_NODE_SECURITY_TOKEN_REFRENCE, ns_obj, &security_token_reference_node);
+    if (!security_token_reference_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating SecurityTokenReference element");
+        return NULL;
+    }
+
+    return security_token_reference_node;
+}
+
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,59 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_signature.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_signature_element(const axutil_env_t *env,
+                                  axiom_node_t *parent,
+                                  axis2_char_t* id)
+{
+    axiom_node_t *signature_node = NULL;
+    axiom_element_t *signature_ele = NULL;
+    axiom_attribute_t *id_attr = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+    int ret;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+    signature_ele = axiom_element_create(env, parent, OXS_NODE_SIGNATURE, ns_obj, &signature_node);
+    if (!signature_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating ds:Signature element");
+        return NULL;
+    }
+
+    /*If id is not NULL then add it as an attribute*/
+    if (id)
+    {
+        id_attr = axiom_attribute_create(env, OXS_ATTR_ID, id, NULL);
+        ret = axiom_element_add_attribute(signature_ele, env, id_attr, signature_node);
+    }
+
+    return signature_node;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_method.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_method.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_method.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_method.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,89 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_signature_method.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_signature_method_element(const axutil_env_t *env,
+        axiom_node_t *parent,
+        axis2_char_t* algorithm
+                                        )
+{
+    axiom_node_t *signature_method_node = NULL;
+    axiom_element_t *signature_method_ele = NULL;
+    axiom_attribute_t *algo_attr = NULL;
+    int ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+    signature_method_ele = axiom_element_create(env, parent, OXS_NODE_SIGNATURE_METHOD, ns_obj, &signature_method_node);
+    if (!signature_method_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating signature method element");
+        return NULL;
+    }
+    /*Fixed bug. If signature algorithm is NULL then use the default*/
+    if (!algorithm)
+    {
+        algorithm = (axis2_char_t*)OXS_HREF_RSA_SHA1;
+    }
+
+    algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);
+
+    ret = axiom_element_add_attribute(signature_method_ele, env, algo_attr, signature_method_node);
+
+    return signature_method_node;
+
+}
+
+
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_token_get_signature_method(const axutil_env_t *env, axiom_node_t *enc_mtd_node)
+{
+    axis2_char_t *enc_mtd = NULL;
+    axiom_element_t *enc_mtd_ele = NULL;
+
+    if(!enc_mtd_node){
+        return NULL;
+    }
+
+    enc_mtd_ele = axiom_node_get_data_element(enc_mtd_node, env);
+    if (!enc_mtd_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving signature method element");
+        return NULL;
+    }
+
+    enc_mtd = axiom_element_get_attribute_value_by_name(enc_mtd_ele, env, OXS_ATTR_ALGORITHM);
+    if((!enc_mtd) ||(0 == axutil_strcmp("", enc_mtd))){
+        return NULL;
+    }
+    return enc_mtd;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_value.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_value.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_value.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signature_value.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,67 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_signature_value.h>
+#include <axiom_element.h>
+#include <oxs_axiom.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_token_get_signature_value(const axutil_env_t *env,
+                              axiom_node_t *sv_node)
+{
+    axis2_char_t *sv = NULL;
+    /*TODO Verification*/
+    sv = (axis2_char_t*)oxs_axiom_get_node_content(env, sv_node);
+    return sv;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_signature_value_element(const axutil_env_t *env,
+                                        axiom_node_t *parent,
+                                        axis2_char_t* signature_val
+                                       )
+{
+    axiom_node_t *signature_value_node = NULL;
+    axiom_element_t *signature_value_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+    signature_value_ele = axiom_element_create(env, parent, OXS_NODE_SIGNATURE_VALUE, ns_obj, &signature_value_node);
+    if (!signature_value_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating signature value element");
+        return NULL;
+    }
+
+    if (signature_val)
+    {
+        ret  = axiom_element_set_text(signature_value_ele, env, signature_val, signature_value_node);
+    }
+
+    return signature_value_node;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signed_info.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signed_info.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signed_info.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_signed_info.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,48 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_signed_info.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_signed_info_element(const axutil_env_t *env,
+                                    axiom_node_t *parent
+                                   )
+{
+    axiom_node_t *signed_info_node = NULL;
+    axiom_element_t *signed_info_ele = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+
+    signed_info_ele = axiom_element_create(env, parent, OXS_NODE_SIGNEDINFO, ns_obj, &signed_info_node);
+    if (!signed_info_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating SignedInfo element");
+        return NULL;
+    }
+
+    return signed_info_node;
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transform.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transform.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transform.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transform.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,90 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_transform.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_transform_element(const axutil_env_t *env,
+                                  axiom_node_t *parent,
+                                  axis2_char_t* algorithm
+                                 )
+{
+    axiom_node_t *transform_node = NULL;
+    axiom_element_t *transform_ele = NULL;
+    axiom_attribute_t *algo_attr = NULL;
+    int ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+    transform_ele = axiom_element_create(env, parent, OXS_NODE_TRANSFORM, ns_obj, &transform_node);
+    if (!transform_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating transform element");
+        return NULL;
+    }
+    /*If transform algorithm is NULL then use the default*/
+    if (!algorithm)
+    {
+        algorithm = (axis2_char_t*)OXS_HREF_XML_EXC_C14N;
+    }
+
+    algo_attr =  axiom_attribute_create(env, OXS_ATTR_ALGORITHM, algorithm, NULL);
+
+    ret = axiom_element_add_attribute(transform_ele, env, algo_attr, transform_node);
+
+    return transform_node;
+
+}
+
+
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_token_get_transform(const axutil_env_t *env, axiom_node_t *transform_node)
+{
+    axis2_char_t *transform = NULL;
+    axiom_element_t *transform_ele = NULL;
+
+    if(!transform_node){
+        return NULL;
+    }
+
+    transform_ele = axiom_node_get_data_element(transform_node, env);
+    if (!transform_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error retrieving digest method element");
+        return NULL;
+    }
+
+    transform = axiom_element_get_attribute_value_by_name(transform_ele, env, OXS_ATTR_ALGORITHM);
+    if((!transform) ||(0 == axutil_strcmp("", transform))){
+        return NULL;
+    }
+
+    return transform;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transforms.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transforms.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transforms.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_transforms.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,48 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_transforms.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_transforms_element(const axutil_env_t *env,
+                                   axiom_node_t *parent)
+{
+    axiom_node_t *transforms_node = NULL;
+    axiom_element_t *transforms_ele = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+
+    transforms_ele = axiom_element_create(env, parent, OXS_NODE_TRANSFORMS, ns_obj, &transforms_node);
+    if (!transforms_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating Transforms element");
+        return NULL;
+    }
+
+    return transforms_node;
+}
+
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_certificate.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_certificate.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_certificate.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_certificate.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,66 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_x509_certificate.h>
+#include <axiom_element.h>
+#include <oxs_axiom.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_token_get_x509_certificate(const axutil_env_t *env,
+                               axiom_node_t *sv_node)
+{
+    axis2_char_t *sv = NULL;
+    /*TODO Verification*/
+    sv = (axis2_char_t*)oxs_axiom_get_node_content(env, sv_node);
+    return sv;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_x509_certificate_element(const axutil_env_t *env,
+        axiom_node_t *parent,
+        axis2_char_t* cert_data)
+{
+    axiom_node_t *x509_certificate_node = NULL;
+    axiom_element_t *x509_certificate_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+    x509_certificate_ele = axiom_element_create(env, parent, OXS_NODE_X509_CERTIFICATE, ns_obj, &x509_certificate_node);
+    if (!x509_certificate_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating %s element", OXS_NODE_X509_CERTIFICATE);
+        return NULL;
+    }
+
+    if (cert_data)
+    {
+        ret  = axiom_element_set_text(x509_certificate_ele, env, cert_data, x509_certificate_node);
+    }
+
+    return x509_certificate_node;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_data.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_data.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_data.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_data.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,47 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_x509_data.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_x509_data_element(const axutil_env_t *env,
+                                  axiom_node_t *parent)
+{
+    axiom_node_t *x509_data_node = NULL;
+    axiom_element_t *x509_data_ele = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+
+    x509_data_ele = axiom_element_create(env, parent, OXS_NODE_X509_DATA, ns_obj, &x509_data_node);
+    if (!x509_data_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating X509Data element");
+        return NULL;
+    }
+
+    return x509_data_node;
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_name.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_name.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_name.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_name.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,67 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_x509_issuer_name.h>
+#include <axiom_element.h>
+#include <oxs_axiom.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_token_get_issuer_name(const axutil_env_t *env,
+                          axiom_node_t *issuer_name_node)
+{
+    axis2_char_t *val = NULL;
+    /*TODO Verification*/
+    val = (axis2_char_t*)oxs_axiom_get_node_content(env, issuer_name_node);
+    return val;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_issuer_name_element(const axutil_env_t *env,
+                                    axiom_node_t *parent,
+                                    axis2_char_t* value
+                                   )
+{
+    axiom_node_t *issuer_name_node = NULL;
+    axiom_element_t *issuer_name_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+    issuer_name_ele = axiom_element_create(env, parent, OXS_NODE_X509_ISSUER_NAME, ns_obj, &issuer_name_node);
+    if (!issuer_name_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating  element");
+        return NULL;
+    }
+
+    if (value)
+    {
+        ret  = axiom_element_set_text(issuer_name_ele, env, value, issuer_name_node);
+    }
+
+    return issuer_name_node;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_serial.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_serial.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_serial.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_issuer_serial.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,70 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_x509_issuer_serial.h>
+#include <oxs_token_x509_issuer_name.h>
+#include <oxs_token_x509_serial_number.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_x509_issuer_serial_with_data(const axutil_env_t *env,
+        axiom_node_t *parent,
+        axis2_char_t *issuer_name,
+        axis2_char_t *serial_number)
+{
+    axiom_node_t *x509_issuer_serial_node = NULL;
+    axiom_node_t *x509_issuer_name_node = NULL;
+    axiom_node_t *x509_serial_number_node = NULL;
+
+    x509_issuer_serial_node = oxs_token_build_x509_issuer_serial_element(env, parent);
+    if(issuer_name){
+        x509_issuer_name_node = oxs_token_build_issuer_name_element(env, x509_issuer_serial_node, issuer_name);
+    }
+    if(serial_number){
+        x509_serial_number_node = oxs_token_build_serial_number_element(env, x509_issuer_serial_node, serial_number);
+    }
+    return x509_issuer_serial_node;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_x509_issuer_serial_element(const axutil_env_t *env,
+        axiom_node_t *parent)
+{
+    axiom_node_t *x509_issuer_serial_node = NULL;
+    axiom_element_t *x509_issuer_serial_ele = NULL;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+
+    x509_issuer_serial_ele = axiom_element_create(env, parent, OXS_NODE_X509_ISSUER_SERIAL, ns_obj, &x509_issuer_serial_node);
+    if (!x509_issuer_serial_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating X509IssuerSerial element");
+        return NULL;
+    }
+
+    return x509_issuer_serial_node;
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_serial_number.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_serial_number.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_serial_number.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/tokens/token_x509_serial_number.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,67 @@
+/*
+ * 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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_x509_serial_number.h>
+#include <axiom_element.h>
+#include <oxs_axiom.h>
+
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_token_get_serial_number(const axutil_env_t *env,
+                            axiom_node_t *serial_number_node)
+{
+    axis2_char_t *val = NULL;
+    /*TODO Verification*/
+    val = (axis2_char_t*)oxs_axiom_get_node_content(env, serial_number_node);
+    return val;
+
+}
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_serial_number_element(const axutil_env_t *env,
+                                      axiom_node_t *parent,
+                                      axis2_char_t* value
+                                     )
+{
+    axiom_node_t *serial_number_node = NULL;
+    axiom_element_t *serial_number_ele = NULL;
+    axis2_status_t ret;
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create(env, OXS_DSIG_NS,
+                                    OXS_DS);
+
+    serial_number_ele = axiom_element_create(env, parent, OXS_NODE_X509_SERIAL_NUMBER, ns_obj, &serial_number_node);
+    if (!serial_number_ele)
+    {
+        oxs_error(env, ERROR_LOCATION,
+                  OXS_ERROR_ELEMENT_FAILED, "Error creating  element");
+        return NULL;
+    }
+
+    if (value)
+    {
+        ret  = axiom_element_set_text(serial_number_ele, env, value, serial_number_node);
+    }
+
+    return serial_number_node;
+
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/transform.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/transform.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/transform.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/transform.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,148 @@
+/*
+ * 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_transform.h>
+#include <oxs_error.h>
+
+
+struct oxs_transform_t
+{
+    axis2_char_t *id ;
+    oxs_tr_dtype_t input_data_type;
+    oxs_tr_dtype_t output_data_type;
+    oxs_transform_tr_func transform_func; /*The function to implement the transform*/
+};
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_transform_get_id(
+    const oxs_transform_t *transform,
+    const axutil_env_t *env)
+{
+    return transform->id;
+}
+
+AXIS2_EXTERN oxs_tr_dtype_t AXIS2_CALL
+oxs_transform_get_input_data_type(
+    const oxs_transform_t *transform,
+    const axutil_env_t *env)
+{
+    return transform->input_data_type;
+}
+
+AXIS2_EXTERN oxs_tr_dtype_t AXIS2_CALL
+oxs_transform_get_output_data_type(
+    const oxs_transform_t *transform,
+    const axutil_env_t *env)
+{
+    return transform->output_data_type;
+}
+
+AXIS2_EXTERN oxs_transform_tr_func AXIS2_CALL
+oxs_transform_get_transform_function(
+    const oxs_transform_t *transform,
+    const axutil_env_t *env)
+{
+    return transform->transform_func;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_transform_set_id(
+    oxs_transform_t *transform,
+    const axutil_env_t *env,
+    axis2_char_t *id)
+{
+
+    if (transform->id)
+    {
+        AXIS2_FREE(env->allocator, transform->id);
+        transform->id = NULL;
+    }
+    transform->id = axutil_strdup(env, id);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_transform_set_input_data_type(
+    oxs_transform_t *transform,
+    const axutil_env_t *env,
+    oxs_tr_dtype_t input_data_type)
+{
+    transform->input_data_type = input_data_type;
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_transform_set_output_data_type(
+    oxs_transform_t *transform,
+    const axutil_env_t *env,
+    oxs_tr_dtype_t output_data_type)
+{
+    transform->output_data_type = output_data_type;
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_transform_set_transform_func(
+    oxs_transform_t *transform,
+    const axutil_env_t *env,
+    oxs_transform_tr_func transform_func)
+{
+    transform->transform_func = transform_func;
+    return AXIS2_SUCCESS;
+}
+
+/*Create function*/
+AXIS2_EXTERN oxs_transform_t *AXIS2_CALL
+oxs_transform_create(const axutil_env_t *env)
+{
+    oxs_transform_t *transform = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+    transform = AXIS2_MALLOC(env->allocator, sizeof(oxs_transform_t));
+    if (!transform)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    /*TODO Set defaults*/
+    transform->id = NULL;
+
+    return transform;
+}
+
+/*Free*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_transform_free(oxs_transform_t *transform,
+                   const axutil_env_t *env)
+{
+    /*TODO free*/
+    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    if (transform->id)
+    {
+        AXIS2_FREE(env->allocator, transform->id);
+        transform->id = NULL;
+    }
+
+    AXIS2_FREE(env->allocator,  transform);
+    transform = NULL;
+
+    return AXIS2_SUCCESS;
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/transforms_factory.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/transforms_factory.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/transforms_factory.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/transforms_factory.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,75 @@
+/*
+ * 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_constants.h>
+#include <oxs_error.h>
+#include <oxs_buffer.h>
+#include <oxs_transform.h>
+#include <oxs_transforms_factory.h>
+#include <oxs_buffer.h>
+#include <oxs_c14n.h>
+
+/*Functions that implements transforms*/
+oxs_tr_dtype_t AXIS2_CALL
+oxs_transforms_exc_c14n(const axutil_env_t *env,
+                        axiom_node_t *input,
+                        oxs_tr_dtype_t input_dtype,
+                        axis2_char_t **output)
+{
+    axiom_document_t *doc = NULL;
+    axis2_char_t *algo = NULL;
+    axis2_char_t *c14nized = NULL;
+    oxs_tr_dtype_t output_dtype = OXS_TRANSFORM_TYPE_UNKNOWN;
+
+    if(input_dtype != OXS_TRANSFORM_TYPE_NODE){
+        oxs_error(env, ERROR_LOCATION, OXS_ERROR_TRANSFORM_FAILED,"Transform expects a NODE.");
+        return OXS_TRANSFORM_TYPE_UNKNOWN;
+    }
+
+    doc = axiom_node_get_document(input, env);
+    algo = OXS_HREF_TRANSFORM_XML_EXC_C14N;
+    oxs_c14n_apply_algo(env, doc, &c14nized, NULL, input, algo);
+    /*oxs_c14n_apply(env, doc, AXIS2_FALSE, &c14nized, AXIS2_TRUE, NULL, (axiom_node_t*)input);*/
+    AXIS2_LOG_INFO(env->log, "[rampart][c14n-OutPut] is\n\n%s\n\n",c14nized);
+    *output= c14nized;
+    output_dtype = OXS_TRANSFORM_TYPE_CHAR;
+    return output_dtype;
+}
+
+/*Public functions*/
+AXIS2_EXTERN oxs_transform_t *AXIS2_CALL
+oxs_transforms_factory_produce_transform(const axutil_env_t *env,
+        axis2_char_t *id)
+{
+    oxs_transform_t *tr =  NULL;
+
+    /*Inspect the id and produce a transform*/
+    if(0== axutil_strcmp(id, OXS_HREF_TRANSFORM_XML_EXC_C14N)){
+        tr = oxs_transform_create(env);
+        oxs_transform_set_id(tr, env, id);
+        oxs_transform_set_input_data_type(tr, env, OXS_TRANSFORM_TYPE_NODE);
+        oxs_transform_set_output_data_type(tr, env, OXS_TRANSFORM_TYPE_CHAR);
+        oxs_transform_set_transform_func(tr, env, (oxs_transform_tr_func)oxs_transforms_exc_c14n);
+        return tr;
+    }else{
+        /*Error we do not support*/
+        return NULL;
+    }
+}
+

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/utility.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/utility.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/utility.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/utility.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,86 @@
+/*
+ * 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_utility.h>
+#include <oxs_error.h>
+#include <oxs_asym_ctx.h>
+
+/* Generates an id for an element.
+ * Specially used in xml encryption and signature references.
+ * */
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+oxs_util_generate_id(const axutil_env_t *env,
+                     axis2_char_t *prefix)
+{
+    axis2_char_t *id = NULL;
+    char _id[50];
+    axis2_char_t *random ;
+
+    random =  axutil_strndup(env, axutil_uuid_gen(env),18);
+    sprintf(_id, "%s-%s",prefix,random);
+    id = (axis2_char_t*)axutil_strdup(env, _id);
+    return id;
+
+}
+
+AXIS2_EXTERN oxs_asym_ctx_format_t AXIS2_CALL
+oxs_util_get_format_by_file_extension(const axutil_env_t *env,
+                                      axis2_char_t *file_name)
+{
+    axis2_char_t *extension = NULL;
+    if(!file_name){
+        return OXS_ASYM_CTX_FORMAT_UNKNOWN;
+    }
+    extension = axutil_rindex(file_name, '.');
+    if(!extension){
+        /*No extension*/
+        /*Its safe to assume that PEM can be without extension*/
+        return OXS_ASYM_CTX_FORMAT_PEM;
+    }
+
+    if((strcmp(extension, ".pfx") == 0) ){
+        return OXS_ASYM_CTX_FORMAT_PKCS12;
+    }else{
+        /*Its safe to assume that PEM can be in any extensions. e.g. .cert, .cer, .pem*/
+        return OXS_ASYM_CTX_FORMAT_PEM;
+    }
+
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_util_get_newline_removed_string(const axutil_env_t *env,
+                                    axis2_char_t *input)
+{
+    axis2_char_t *output = NULL;
+    int i = 0;
+
+    output = AXIS2_MALLOC(env->allocator,  axutil_strlen(input)+1);
+
+    while(*input!='\0')
+    {
+        if(*input!='\n')
+        {
+            output[i] = *input;
+            i++;
+        }
+        input++;
+    }
+    output[i]='\0';
+    return output;
+}

Added: webservices/rampart/tags/c/0.90/src/omxmlsec/x509_cert.c
URL: http://svn.apache.org/viewvc/webservices/rampart/tags/c/0.90/src/omxmlsec/x509_cert.c?rev=573215&view=auto
==============================================================================
--- webservices/rampart/tags/c/0.90/src/omxmlsec/x509_cert.c (added)
+++ webservices/rampart/tags/c/0.90/src/omxmlsec/x509_cert.c Thu Sep  6 03:48:44 2007
@@ -0,0 +1,293 @@
+/*
+ * 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_constants.h>
+#include <oxs_x509_cert.h>
+
+
+struct oxs_x509_cert_t
+{
+    int serial_number;
+    axis2_char_t *subject;
+    axis2_char_t *issuer;
+    axis2_char_t *key_identifier;
+    axis2_char_t *fingerprint;
+    axis2_char_t *date;
+    axis2_char_t *hash;
+    axis2_char_t *data;
+    openssl_pkey_t *public_key;
+};
+
+
+
+AXIS2_EXTERN oxs_x509_cert_t *AXIS2_CALL
+oxs_x509_cert_create(const axutil_env_t *env)
+{
+    oxs_x509_cert_t *x509_cert = NULL;
+    AXIS2_ENV_CHECK(env, NULL);
+
+    x509_cert = (oxs_x509_cert_t *)AXIS2_MALLOC(env->allocator,
+                sizeof(oxs_x509_cert_t));
+
+    if(!x509_cert)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+
+    /* initialize properties */
+    x509_cert->serial_number = 0;
+    x509_cert->subject =NULL;
+    x509_cert->issuer =NULL;
+    x509_cert->key_identifier =NULL;
+    x509_cert->fingerprint =NULL;
+    x509_cert->date =NULL;
+    x509_cert->hash =NULL;
+    x509_cert->data =NULL;
+    x509_cert->public_key =NULL;
+
+    return x509_cert;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_free(oxs_x509_cert_t *x509_cert,
+                   const axutil_env_t *env)
+{
+    if(x509_cert->subject ){
+        AXIS2_FREE(env->allocator, x509_cert->subject );
+        x509_cert->subject =NULL;
+    }
+    if(x509_cert->issuer ){
+        AXIS2_FREE(env->allocator, x509_cert->issuer );
+        x509_cert->issuer =NULL;
+    }
+    if(x509_cert->key_identifier ){
+        AXIS2_FREE(env->allocator, x509_cert->key_identifier );
+        x509_cert->key_identifier =NULL;
+    }
+    if(x509_cert->fingerprint ){
+        AXIS2_FREE(env->allocator, x509_cert->fingerprint );
+        x509_cert->fingerprint =NULL;
+    }
+    if(x509_cert->date ){
+        AXIS2_FREE(env->allocator, x509_cert->date );
+        x509_cert->date =NULL;
+    }
+    if(x509_cert->hash ){
+        AXIS2_FREE(env->allocator, x509_cert->hash );
+        x509_cert->hash =NULL;
+    }
+    if(x509_cert->data ){
+        AXIS2_FREE(env->allocator, x509_cert->data );
+        x509_cert->data =NULL;
+    }
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_copy_to(oxs_x509_cert_t *x509_cert,
+                      const axutil_env_t *env,
+                      oxs_x509_cert_t *to)
+{
+    oxs_x509_cert_set_serial_number(to, env, x509_cert->serial_number);
+    oxs_x509_cert_set_issuer(to, env, x509_cert->issuer);
+    oxs_x509_cert_set_key_identifier(to, env, x509_cert->key_identifier);
+    oxs_x509_cert_set_subject(to, env, x509_cert->subject);
+    oxs_x509_cert_set_fingerprint(to, env, x509_cert->fingerprint);
+    oxs_x509_cert_set_date(to, env, x509_cert->date);
+    oxs_x509_cert_set_hash(to, env, x509_cert->hash);
+    oxs_x509_cert_set_data(to, env, x509_cert->data);
+    oxs_x509_cert_set_public_key(to, env, x509_cert->public_key);
+
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+oxs_x509_cert_get_serial_number(oxs_x509_cert_t *x509_cert,
+                                const axutil_env_t *env)
+{
+    return x509_cert->serial_number;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_subject(oxs_x509_cert_t *x509_cert,
+                          const axutil_env_t *env)
+{
+    return x509_cert->subject;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_issuer(oxs_x509_cert_t *x509_cert,
+                         const axutil_env_t *env)
+{
+    return x509_cert->issuer;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_key_identifier(oxs_x509_cert_t *x509_cert,
+                                 const axutil_env_t *env)
+{
+    return x509_cert->key_identifier;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_fingerprint(oxs_x509_cert_t *x509_cert,
+                              const axutil_env_t *env)
+{
+    return x509_cert->fingerprint;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_date(oxs_x509_cert_t *x509_cert,
+                       const axutil_env_t *env)
+{
+    return x509_cert->date;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_hash(oxs_x509_cert_t *x509_cert,
+                       const axutil_env_t *env)
+{
+    return x509_cert->hash;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_data(oxs_x509_cert_t *x509_cert,
+                       const axutil_env_t *env)
+{
+    return x509_cert->data;
+}
+
+AXIS2_EXTERN openssl_pkey_t *AXIS2_CALL
+oxs_x509_cert_get_public_key(oxs_x509_cert_t *x509_cert,
+                             const axutil_env_t *env)
+{
+    return x509_cert->public_key;
+}
+
+/*Setters*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_serial_number(oxs_x509_cert_t *x509_cert,
+                                const axutil_env_t *env,
+                                int value)
+{
+    x509_cert->serial_number= value;
+
+    return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_subject(oxs_x509_cert_t *x509_cert,
+                          const axutil_env_t *env,
+                          axis2_char_t *value)
+{
+    if(x509_cert->subject)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->subject);
+        x509_cert->subject = NULL;
+    }
+    x509_cert->subject = (axis2_char_t *)axutil_strdup(env, value);
+    return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_issuer(oxs_x509_cert_t *x509_cert,
+                         const axutil_env_t *env,
+                         axis2_char_t *value)
+{
+    if(x509_cert->issuer)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->issuer);
+        x509_cert->issuer = NULL;
+    }
+    x509_cert->issuer = (axis2_char_t *)axutil_strdup(env, value);
+    return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_key_identifier(oxs_x509_cert_t *x509_cert,
+                                 const axutil_env_t *env,
+                                 axis2_char_t *value)
+{
+    if(x509_cert->key_identifier)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->key_identifier);
+        x509_cert->key_identifier = NULL;
+    }
+    x509_cert->key_identifier = (axis2_char_t *)axutil_strdup(env, value);
+    return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_fingerprint(oxs_x509_cert_t *x509_cert,
+                              const axutil_env_t *env,
+                              axis2_char_t *value)
+{
+    if(x509_cert->fingerprint)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->fingerprint);
+        x509_cert->fingerprint = NULL;
+    }
+    x509_cert->fingerprint = (axis2_char_t *)axutil_strdup(env, value);
+    return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_date(oxs_x509_cert_t *x509_cert,
+                       const axutil_env_t *env,
+                       axis2_char_t *value)
+{
+    if(x509_cert->date)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->date);
+        x509_cert->date = NULL;
+    }
+    x509_cert->date = (axis2_char_t *)axutil_strdup(env, value);
+    return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_hash(oxs_x509_cert_t *x509_cert,
+                       const axutil_env_t *env,
+                       axis2_char_t *value)
+{
+    if(x509_cert->hash)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->hash);
+        x509_cert->hash = NULL;
+    }
+    x509_cert->hash = (axis2_char_t *)axutil_strdup(env, value);
+    return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_data(oxs_x509_cert_t *x509_cert,
+                       const axutil_env_t *env,
+                       axis2_char_t *value)
+{
+    if(x509_cert->data)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->data);
+        x509_cert->data = NULL;
+    }
+    x509_cert->data = (axis2_char_t *)axutil_strdup(env, value);
+    return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_public_key(oxs_x509_cert_t *x509_cert,
+                             const axutil_env_t *env,
+                             openssl_pkey_t *public_key)
+{
+    if(x509_cert->public_key)
+    {
+        AXIS2_FREE(env->allocator, x509_cert->public_key);
+        x509_cert->public_key = NULL;
+    }
+    x509_cert->public_key = public_key;
+    return AXIS2_SUCCESS;
+}
+