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 da...@apache.org on 2006/07/18 07:57:26 UTC

svn commit: r422979 - in /webservices/axis2/trunk/c/rampart/src/omxmlsec: Makefile.am axis2_utils.c buffer.c error.c token_cipher_data.c token_cipher_value.c token_encrypted_type.c token_encryption_method.c token_key_info.c token_key_name.c

Author: damitha
Date: Mon Jul 17 22:57:25 2006
New Revision: 422979

URL: http://svn.apache.org/viewvc?rev=422979&view=rev
Log:
Adding token files for omxmlsec

Added:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_type.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encryption_method.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_name.c
Modified:
    webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am
    webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c
    webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am?rev=422979&r1=422978&r2=422979&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am Mon Jul 17 22:57:25 2006
@@ -1,7 +1,9 @@
 SUBDIRS = openssl
 noinst_LTLIBRARIES = libomxmlsec.la
 #libomxmlsec_la_SOURCES = ctx.c enc.c transforms.c  buffer.c errors.c
-libomxmlsec_la_SOURCES = buffer.c error.c axis2_utils.c axiom.c
+libomxmlsec_la_SOURCES = buffer.c error.c axis2_utils.c axiom.c \
+                        token_encrypted_type.c token_encryption_method.c token_cipher_value.c \
+                        token_cipher_data.c token_key_name.c token_key_info.c
 
 libomxmlsec_la_LIBADD  = -lssl\
             -laxis2_util \

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c?rev=422979&r1=422978&r2=422979&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c Mon Jul 17 22:57:25 2006
@@ -41,7 +41,7 @@
 
     int ret;
 
-    encoded_str = AXIS2_MALLOC(env->allocator, axis2_base64_encode_len((char*)(plain_buf->data)));
+    encoded_str = AXIS2_MALLOC(env->allocator, (unsigned int)axis2_base64_encode_len((char*)(plain_buf->data)));
 
     printf("\noxs_base64_encode\nIn Data Size= %d", plain_buf->size);
     ret =  axis2_base64_encode(encoded_str, (char*)(plain_buf->data), plain_buf->size);

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c?rev=422979&r1=422978&r2=422979&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/buffer.c Mon Jul 17 22:57:25 2006
@@ -264,6 +264,7 @@
         fclose(f);
         return (0); 
     }/*End of while*/
+    return(0);
 }
 
 AXIS2_EXTERN int AXIS2_CALL
@@ -271,8 +272,8 @@
 {
     axis2_char_t *content = NULL;
     axis2_char_t *decoded_str = NULL;
-    unsigned int size;
-    int ret, length;
+    int ret;
+    unsigned int length;
         
     content = oxs_axiom_get_node_content(env, node);    
     if(content == NULL) return (-1);
@@ -286,7 +287,7 @@
     if(length < 0 ) return (-1);
     
     /*Store data in the buffer*/    
-    buf->data = decoded_str;
+    buf->data = (unsigned char*)decoded_str;
     buf->size = length;
 
     return (0);  

Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c?rev=422979&r1=422978&r2=422979&view=diff
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/error.c Mon Jul 17 22:57:25 2006
@@ -29,6 +29,7 @@
     {OXS_ERROR_INVALID_DATA , "invalid data"},
     {OXS_ERROR_INVALID_SIZE , "invalid size"},
     {OXS_ERROR_INVALID_FORMAT , "invalid format"},
+    {OXS_ERROR_ELEMENT_FAILED , "element failed"},
 };
 
 AXIS2_EXTERN const char* AXIS2_CALL

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c?rev=422979&view=auto
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_data.c Mon Jul 17 22:57:25 2006
@@ -0,0 +1,47 @@
+/*
+ *   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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_cipher_data.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_cipher_data_element(const axis2_env_t *env,
+                        axiom_node_t *parent
+                    )
+{
+    axiom_node_t *cipher_data_node = NULL;
+    axiom_element_t *cipher_data_ele = NULL;
+    axis2_status_t ret; 
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create (env, OXS_EncNs,
+                                              OXS_xenc);
+
+    cipher_data_ele = axiom_element_create(env, parent, OXS_NodeCipherData, ns_obj, &cipher_data_node );
+    if(!cipher_data_ele)
+    {   
+        oxs_error(ERROR_LOCATION,
+                    OXS_ERROR_ELEMENT_FAILED,"Error creating cipher value element");
+        return NULL;
+    }  
+ 
+    return cipher_data_node; 
+}
+

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c?rev=422979&view=auto
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_cipher_value.c Mon Jul 17 22:57:25 2006
@@ -0,0 +1,52 @@
+/*
+ *   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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_cipher_value.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_cipher_value_element(const axis2_env_t *env,
+                        axiom_node_t *parent,
+                        axis2_char_t* cipher_val
+                    )
+{
+    axiom_node_t *cipher_value_node = NULL;
+    axiom_element_t *cipher_value_ele = NULL;
+    axis2_status_t ret; 
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create (env, OXS_EncNs,
+                                              OXS_xenc);
+
+
+    cipher_value_ele = axiom_element_create(env, parent, OXS_NodeCipherValue, ns_obj, &cipher_value_node );
+    if(!cipher_value_ele)
+    {   
+        oxs_error(ERROR_LOCATION,
+                    OXS_ERROR_ELEMENT_FAILED,"Error creating cipher value element");
+        return NULL;
+    }  
+
+    ret  = AXIOM_ELEMENT_SET_TEXT(cipher_value_ele, env, cipher_val, cipher_value_node);
+   
+    return cipher_value_node; 
+     
+}
+

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_type.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_type.c?rev=422979&view=auto
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_type.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encrypted_type.c Mon Jul 17 22:57:25 2006
@@ -0,0 +1,59 @@
+/*
+ *   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 <oxs_constants.h>
+#include <oxs_error.h>
+#include <oxs_token_encrypted_type.h>
+#include <axiom_attribute.h>
+#include <axiom_element.h>
+
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_token_build_encrypted_type_element(const axis2_env_t *env,
+                        axiom_node_t *parent,
+                        axis2_char_t* encrypted_type,
+                        axis2_char_t* type_attribute,
+                        axis2_char_t* id
+                    )
+{
+    axiom_node_t *encrypted_type_node = NULL;
+    axiom_element_t *encrypted_type_ele = NULL;
+    axiom_attribute_t *type_attr = NULL, *id_attr = NULL;
+    int ret; 
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create (env, OXS_EncNs,
+                                              OXS_xenc);
+
+    encrypted_type_ele = axiom_element_create(env, parent, encrypted_type, ns_obj, &encrypted_type_node );
+    if(!encrypted_type_ele)
+    {   
+        oxs_error(ERROR_LOCATION,
+                    OXS_ERROR_ELEMENT_FAILED,"Error creating encrypted type element");
+        return NULL;
+    }  
+
+    type_attr =  axiom_attribute_create (env, OXS_AttrType, type_attribute, NULL);
+    id_attr = axiom_attribute_create(env, OXS_AttrId, id, NULL);
+
+    ret = AXIOM_ELEMENT_ADD_ATTRIBUTE(encrypted_type_ele, env, type_attr, encrypted_type_node);  
+    ret = AXIOM_ELEMENT_ADD_ATTRIBUTE(encrypted_type_ele, env, id_attr, encrypted_type_node);  
+   
+    return encrypted_type_node; 
+     
+}
+

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encryption_method.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encryption_method.c?rev=422979&view=auto
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encryption_method.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_encryption_method.c Mon Jul 17 22:57:25 2006
@@ -0,0 +1,55 @@
+/*
+ *   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 <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 axis2_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_EncNs,
+                                              OXS_xenc);
+
+    encryption_method_ele = axiom_element_create(env, parent, OXS_NodeEncryptionMethod, ns_obj, &encryption_method_node );
+    if(!encryption_method_ele)
+    {   
+        oxs_error(ERROR_LOCATION,
+                    OXS_ERROR_ELEMENT_FAILED,"Error creating encryption method element");
+        return NULL;
+    }  
+
+    algo_attr =  axiom_attribute_create (env, OXS_AttrAlgorithm, algorithm, NULL);
+
+    ret = AXIOM_ELEMENT_ADD_ATTRIBUTE(encryption_method_ele, env, algo_attr, encryption_method_node);  
+   
+    return encryption_method_node; 
+     
+}
+

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c?rev=422979&view=auto
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_info.c Mon Jul 17 22:57:25 2006
@@ -0,0 +1,48 @@
+/*
+ *   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 <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 axis2_env_t *env,
+                        axiom_node_t *parent
+                    )
+{
+    axiom_node_t *key_info_node = NULL;
+    axiom_element_t *key_info_ele = NULL;
+    axis2_status_t ret; 
+    axiom_namespace_t *ns_obj = NULL;
+
+    ns_obj = axiom_namespace_create (env, OXS_DSigNs,
+                                              OXS_ds);
+    
+
+    key_info_ele = axiom_element_create(env, parent, OXS_NodeKeyInfo, ns_obj, &key_info_node );
+    if(!key_info_ele)
+    {   
+        oxs_error(ERROR_LOCATION,
+                    OXS_ERROR_ELEMENT_FAILED,"Error creating KeyInfo element");
+        return NULL;
+    }  
+ 
+    return key_info_node; 
+}
+

Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_name.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_name.c?rev=422979&view=auto
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_name.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/token_key_name.c Mon Jul 17 22:57:25 2006
@@ -0,0 +1,52 @@
+/*
+ *   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 <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 axis2_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_DSigNs,
+                                              OXS_ds);
+
+
+    key_name_ele = axiom_element_create(env, parent, OXS_NodeKeyName, ns_obj, &key_name_node );
+    if(!key_name_ele)
+    {   
+        oxs_error(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; 
+     
+}
+



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