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 2006/11/22 07:20:52 UTC
svn commit: r478050 - in /webservices/axis2/trunk/c/rampart: include/
samples/client/enc_echo/data/ src/omxmlsec/ src/util/ test/omxmlsec/
Author: kaushalye
Date: Tue Nov 21 22:20:51 2006
New Revision: 478050
URL: http://svn.apache.org/viewvc?view=rev&rev=478050
Log:
1. Introducing x509 certificate
2. Modifications in XML encryption.
Added:
webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h
webservices/axis2/trunk/c/rampart/src/omxmlsec/x509_cert.c
Removed:
webservices/axis2/trunk/c/rampart/include/oxs_certificate.h
webservices/axis2/trunk/c/rampart/src/omxmlsec/certificate.c
Modified:
webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h
webservices/axis2/trunk/c/rampart/include/oxs_axiom.h
webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml
webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am
webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c
webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c
webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c
webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c
webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c
Modified: webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_asym_ctx.h Tue Nov 21 22:20:51 2006
@@ -26,7 +26,7 @@
#include <axis2_defines.h>
#include <axis2_env.h>
#include <axiom_node.h>
-#include <oxs_certificate.h>
+#include <oxs_x509_cert.h>
#ifdef __cplusplus
extern "C"
@@ -83,7 +83,7 @@
const axis2_env_t *env
);
- oxs_certificate_t *(AXIS2_CALL *
+ oxs_x509_cert_t *(AXIS2_CALL *
get_certificate)(
const oxs_asym_ctx_t *ctx,
const axis2_env_t *env
@@ -120,7 +120,7 @@
set_certificate)(
oxs_asym_ctx_t *ctx,
const axis2_env_t *env,
- oxs_certificate_t *cert
+ oxs_x509_cert_t *cert
);
@@ -167,7 +167,7 @@
oxs_asym_ctx_get_operation(const oxs_asym_ctx_t *ctx,
const axis2_env_t *env);
-AXIS2_EXTERN oxs_certificate_t* AXIS2_CALL
+AXIS2_EXTERN oxs_x509_cert_t* AXIS2_CALL
oxs_asym_ctx_get_certificate(const oxs_asym_ctx_t *ctx,
const axis2_env_t *env);
@@ -194,7 +194,7 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
oxs_asym_ctx_set_certificate(oxs_asym_ctx_t *ctx,
const axis2_env_t *env,
- oxs_certificate_t *certificate);
+ oxs_x509_cert_t *certificate);
/** @} */
Modified: webservices/axis2/trunk/c/rampart/include/oxs_axiom.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_axiom.h?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_axiom.h (original)
+++ webservices/axis2/trunk/c/rampart/include/oxs_axiom.h Tue Nov 21 22:20:51 2006
@@ -35,10 +35,7 @@
{
#endif
-/*** Forward Declarations ****/
-typedef struct axiom_document_t oxs_axiom_document, *oxs_axiom_document_ptr;
-typedef struct axiom_node_t oxs_axiom_node, *oxs_axiom_node_ptr;
AXIS2_EXTERN int AXIS2_CALL
oxs_axiom_get_number_of_children_with_qname(const axis2_env_t *env,
@@ -46,6 +43,12 @@
axis2_char_t* local_name,
axis2_char_t* ns_uri,
axis2_char_t* prefix);
+
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_axiom_get_node_by_id(const axis2_env_t *env,
+ axiom_node_t *node,
+ axis2_char_t *id_val);
+
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
oxs_axiom_get_attribute_value_of_node_by_name(const axis2_env_t *env,
axiom_node_t *node,
Added: webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h?view=auto&rev=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h (added)
+++ webservices/axis2/trunk/c/rampart/include/oxs_x509_cert.h Tue Nov 21 22:20:51 2006
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef OXS_X509_CERT
+#define OXS_X509_CERT
+
+
+/**
+ * @file oxs_certificate.h
+ * @brief
+ */
+
+#include <axis2_defines.h>
+#include <axis2_env.h>
+#include <axiom_node.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/** @defgroup oxs_x509_cert
+ * @ingroup
+ * @{
+ */
+
+/**
+ * issuer
+ * subject
+ * dates
+ * hash
+ * fingerprint
+ */
+
+typedef struct oxs_x509_cert_t oxs_x509_cert_t;
+/*Create*/
+AXIS2_EXTERN oxs_x509_cert_t *AXIS2_CALL
+oxs_x509_cert_create( const axis2_env_t *env);
+
+/*Free*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_free(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+
+/*Getters*/
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_serial_number(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_subject(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_issuer(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_fingerprint(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_date(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_hash(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_data(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env);
+
+/*Setters*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_serial_number(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_issuer(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_subject(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_fingerprint(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_date(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_hash(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value);
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_data(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value);
+
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OXS_X509_CERT */
Modified: webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml (original)
+++ webservices/axis2/trunk/c/rampart/samples/client/enc_echo/data/server.enc.axis2.xml Tue Nov 21 22:20:51 2006
@@ -31,9 +31,6 @@
<parameter name="InflowSecurity">
<action>
- <items>Encrypt</items>
- <encryptionKeyTransportAlgorithm>http://www.w3.org/2000/09/xmldsig#rsa-sha1</encryptionKeyTransportAlgorithm>
- <encryptionSymAlgorithm>http://www.w3.org/200i1/04/xmlenc#tripledes-cbc</encryptionSymAlgorithm>
<decryptionPropFile>/home/kau/keys/rsakey.pem</decryptionPropFile>
</action>
</parameter>
Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/Makefile.am Tue Nov 21 22:20:51 2006
@@ -5,7 +5,7 @@
token_encrypted_data.c token_encryption_method.c token_cipher_value.c \
token_cipher_data.c token_key_name.c token_key_info.c token_binary_security_token.c \
token_reference_list.c token_data_reference.c token_encrypted_key.c iv.c xml_encryption.c encryption.c\
- utility.c certificate.c asym_ctx.c
+ utility.c asym_ctx.c x509_cert.c
libomxmlsec_la_LIBADD = -lssl\
../../../util/src/libaxis2_util.la \
Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/asym_ctx.c Tue Nov 21 22:20:51 2006
@@ -17,7 +17,7 @@
#include <stdio.h>
#include <axis2_util.h>
#include <oxs_asym_ctx.h>
-#include <oxs_certificate.h>
+#include <oxs_x509_cert.h>
#include <oxs_error.h>
typedef struct oxs_asym_ctx_impl
@@ -28,7 +28,7 @@
axis2_char_t *format;
axis2_char_t *algorithm;
oxs_asym_ctx_operation_t operation;
- oxs_certificate_t *certificate;
+ oxs_x509_cert_t *certificate;
}
oxs_asym_ctx_impl_t;
@@ -69,7 +69,7 @@
const oxs_asym_ctx_t *asym_ctx,
const axis2_env_t *env);
-oxs_certificate_t *AXIS2_CALL
+oxs_x509_cert_t *AXIS2_CALL
oxs_asym_ctx_get_certificate_impl(
const oxs_asym_ctx_t *asym_ctx,
const axis2_env_t *env);
@@ -102,7 +102,7 @@
oxs_asym_ctx_set_certificate_impl(
oxs_asym_ctx_t *asym_ctx,
const axis2_env_t *env,
- oxs_certificate_t *certificate);
+ oxs_x509_cert_t *certificate);
/******************** end of function headers *****************/
@@ -155,7 +155,7 @@
return asym_ctx_impl->operation;
}
-oxs_certificate_t *AXIS2_CALL
+oxs_x509_cert_t *AXIS2_CALL
oxs_asym_ctx_get_certificate_impl(
const oxs_asym_ctx_t *asym_ctx,
const axis2_env_t *env)
@@ -250,7 +250,7 @@
oxs_asym_ctx_set_certificate_impl(
oxs_asym_ctx_t *asym_ctx,
const axis2_env_t *env,
- oxs_certificate_t *certificate)
+ oxs_x509_cert_t *certificate)
{
oxs_asym_ctx_impl_t *oxs_asym_ctx_impl = NULL;
@@ -260,7 +260,7 @@
if (oxs_asym_ctx_impl->certificate)
{
- oxs_certificate_free(oxs_asym_ctx_impl->certificate, env);
+ oxs_x509_cert_free(oxs_asym_ctx_impl->certificate, env);
oxs_asym_ctx_impl->certificate = NULL;
}
oxs_asym_ctx_impl->certificate = certificate;
@@ -351,7 +351,7 @@
if (asym_ctx_impl->certificate)
{
- oxs_certificate_free(asym_ctx_impl->certificate, env);
+ oxs_x509_cert_free(asym_ctx_impl->certificate, env);
asym_ctx_impl->certificate = NULL;
}
@@ -398,7 +398,7 @@
return ctx->ops->get_operation(ctx, env);
}
-AXIS2_EXTERN oxs_certificate_t* AXIS2_CALL
+AXIS2_EXTERN oxs_x509_cert_t* AXIS2_CALL
oxs_asym_ctx_get_certificate(const oxs_asym_ctx_t *ctx,
const axis2_env_t *env)
{
@@ -440,7 +440,7 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
oxs_asym_ctx_set_certificate(oxs_asym_ctx_t *ctx,
const axis2_env_t *env,
- oxs_certificate_t *certificate)
+ oxs_x509_cert_t *certificate)
{
return ctx->ops->set_certificate(ctx, env, certificate);
}
Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/axiom.c Tue Nov 21 22:20:51 2006
@@ -18,6 +18,7 @@
#include <axis2_util.h>
#include <oxs_constants.h>
#include <oxs_error.h>
+#include <oxs_axiom.h>
#include <axiom_node.h>
#include <axiom_namespace.h>
#include <axiom_attribute.h>
@@ -58,11 +59,50 @@
return counter;
}
+/**
+ * Traverse thru the node and its children. Check if the id attribute is equal to the given value
+ * */
+AXIS2_EXTERN axiom_node_t* AXIS2_CALL
+oxs_axiom_get_node_by_id(const axis2_env_t *env,
+ axiom_node_t *node,
+ axis2_char_t *id_val)
+{
+ axis2_char_t *attribute_value = NULL;
+
+ attribute_value = oxs_axiom_get_attribute_value_of_node_by_name(env, node, OXS_ATTR_ID);
+ if(0 == AXIS2_STRCMP(id_val, attribute_value) ){
+ /*Gottcha.. return this node*/
+ return node;
+ }else{
+ /*Doesnt match. Search sibling/children*/
+ axiom_node_t *sib_node = NULL;
+
+ sib_node = node;
+ while(sib_node){
+ axiom_element_t *ele = NULL;
+ axiom_children_iterator_t *iter = NULL;
+
+ ele = AXIOM_NODE_GET_DATA_ELEMENT(sib_node, env);
+ iter = AXIOM_ELEMENT_GET_CHILDREN(ele, env, sib_node);
+ while (AXIS2_TRUE == AXIOM_CHILDREN_ITERATOR_HAS_NEXT(iter, env)){
+ axiom_node_t *child_node = NULL;
+ child_node = AXIOM_CHILDREN_ITERATOR_NEXT(iter, env);
+ /*If the child is an element*/
+ if(AXIOM_ELEMENT == AXIOM_NODE_GET_NODE_TYPE(child_node, env)){
+ /*Recursive call*/
+ return oxs_axiom_get_node_by_id(env, child_node, id_val);
+ }
+ }
+ sib_node = AXIOM_NODE_GET_NEXT_SIBLING(sib_node, env);
+ }/*sib_node while*/
+ }
+ return NULL;
+}
AXIS2_EXTERN axis2_char_t* AXIS2_CALL
oxs_axiom_get_attribute_value_of_node_by_name(const axis2_env_t *env,
- axiom_node_t *node,
- axis2_char_t *attribute_name)
+ axiom_node_t *node,
+ axis2_char_t *attribute_name)
{
axis2_char_t *attribute_value = NULL;
axiom_element_t *ele = NULL;
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?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/axis2_utils.c Tue Nov 21 22:20:51 2006
@@ -43,11 +43,9 @@
encoded_str = AXIS2_MALLOC(env->allocator, (unsigned int)axis2_base64_encode_len(AXIS2_STRLEN((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);
if (ret < 0) return NULL;
- printf("\nEncoded_str= %s", encoded_str);
/*Set to the output buffer */
out_buf = oxs_string_to_buffer(env, encoded_str);
Added: webservices/axis2/trunk/c/rampart/src/omxmlsec/x509_cert.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/x509_cert.c?view=auto&rev=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/x509_cert.c (added)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/x509_cert.c Tue Nov 21 22:20:51 2006
@@ -0,0 +1,231 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <axis2_util.h>
+#include <oxs_constants.h>
+#include <oxs_x509_cert.h>
+
+
+struct oxs_x509_cert_t
+{
+ axis2_char_t *serial_number;
+ axis2_char_t *subject;
+ axis2_char_t *issuer;
+ axis2_char_t *fingerprint;
+ axis2_char_t *date;
+ axis2_char_t *hash;
+ axis2_char_t *data;
+};
+
+AXIS2_EXTERN oxs_x509_cert_t *AXIS2_CALL
+oxs_x509_cert_create(const axis2_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 =NULL;
+ x509_cert->subject =NULL;
+ x509_cert->issuer =NULL;
+ x509_cert->fingerprint =NULL;
+ x509_cert->date =NULL;
+ x509_cert->hash =NULL;
+ x509_cert->data =NULL;
+
+ return x509_cert;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_free(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env)
+{
+ if(x509_cert->serial_number ){
+ AXIS2_FREE(env->allocator, x509_cert->serial_number );
+ x509_cert->serial_number =NULL;
+ }
+ 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->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_char_t *AXIS2_CALL
+oxs_x509_cert_get_serial_number(oxs_x509_cert_t *x509_cert,
+ const axis2_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 axis2_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 axis2_env_t *env)
+{
+ return x509_cert->issuer;
+}
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+oxs_x509_cert_get_fingerprint(oxs_x509_cert_t *x509_cert,
+ const axis2_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 axis2_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 axis2_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 axis2_env_t *env)
+{
+ return x509_cert->data;
+}
+
+/*Setters*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_serial_number(oxs_x509_cert_t *x509_cert,
+ const axis2_env_t *env,
+ axis2_char_t *value)
+{ if(x509_cert->serial_number)
+ {
+ AXIS2_FREE(env->allocator, x509_cert->serial_number);
+ x509_cert->serial_number = NULL;
+ }
+ x509_cert->serial_number= (axis2_char_t *)AXIS2_STRDUP(value, env);
+ return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_subject(oxs_x509_cert_t *x509_cert,
+ const axis2_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 *)AXIS2_STRDUP(value, env);
+ return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_issuer(oxs_x509_cert_t *x509_cert,
+ const axis2_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 *)AXIS2_STRDUP(value, env);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_fingerprint(oxs_x509_cert_t *x509_cert,
+ const axis2_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 *)AXIS2_STRDUP(value, env);
+ return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_date(oxs_x509_cert_t *x509_cert,
+ const axis2_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 *)AXIS2_STRDUP(value, env);
+ return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_hash(oxs_x509_cert_t *x509_cert,
+ const axis2_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 *)AXIS2_STRDUP(value, env);
+ return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+oxs_x509_cert_set_data(oxs_x509_cert_t *x509_cert,
+ const axis2_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 *)AXIS2_STRDUP(value, env);
+ return AXIS2_SUCCESS;
+}
Modified: webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c (original)
+++ webservices/axis2/trunk/c/rampart/src/omxmlsec/xml_encryption.c Tue Nov 21 22:20:51 2006
@@ -25,6 +25,7 @@
#include <oxs_token_cipher_value.h>
#include <oxs_token_cipher_data.h>
#include <oxs_token_reference_list.h>
+#include <oxs_token_key_info.h>
#include <oxs_constants.h>
#include <oxs_axiom.h>
#include <oxs_ctx.h>
@@ -197,7 +198,7 @@
oxs_buffer_t *result = NULL;
axiom_node_t *encrypted_key_node = NULL;
axiom_node_t *enc_mtd_node = NULL;
- /*axiom_node_t *key_info_node = NULL;*/
+ axiom_node_t *key_info_node = NULL;
axiom_node_t *cd_node = NULL;
axiom_node_t *cv_node = NULL;
axis2_status_t status = AXIS2_FAILURE;
@@ -219,7 +220,7 @@
encrypted_key_node = oxs_token_build_encrypted_key_element(env, parent);
algorithm = oxs_asym_ctx_get_algorithm(asym_ctx, env);
enc_mtd_node = oxs_token_build_encryption_method_element(env, encrypted_key_node, algorithm);
- /*key_info_node = oxs_token_build_key_info_element(env, encrypted_key_node);*/
+ key_info_node = oxs_token_build_key_info_element(env, encrypted_key_node);
cd_node = oxs_token_build_cipher_data_element(env, encrypted_key_node);
cv_node = oxs_token_build_cipher_value_element(env, cd_node, encrypted_key_data);
Modified: webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c (original)
+++ webservices/axis2/trunk/c/rampart/src/util/rampart_sec_header_processor.c Tue Nov 21 22:20:51 2006
@@ -39,9 +39,6 @@
#include <oxs_axiom.h>
#include <oxs_asym_ctx.h>
-
-
-
/*Private functions*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_shp_process_timestamptoken(const axis2_env_t *env,
@@ -65,20 +62,15 @@
else
{
/*TODO return a fault*/
-
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][scp] Timestamp is not valid");
if (sub_codes)
{
AXIS2_ARRAY_LIST_ADD(sub_codes, env, RAMPART_FAULT_FAILED_AUTHENTICATION);
}
-
return AXIS2_FAILURE;
-
}
-
}
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
rampart_shp_process_usernametoken(const axis2_env_t *env,
axis2_msg_ctx_t *msg_ctx,
@@ -107,11 +99,9 @@
{
AXIS2_ARRAY_LIST_ADD(sub_codes, env, RAMPART_FAULT_FAILED_AUTHENTICATION);
}
-
AXIS2_LOG_INFO(env->log, "[rampart][shp] Validating UsernameToken FAILED");
return AXIS2_FAILURE;
}
-
}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
@@ -139,7 +129,7 @@
AXIS2_LOG_INFO(env->log, "[rampart][shp] Reference List is empty");
return AXIS2_SUCCESS;
}
- AXIS2_LOG_INFO(env->log, "[rampart][shp] Reference List has %d node references", AXIS2_ARRAY_LIST_SIZE(reference_list, env));
+ AXIS2_LOG_INFO(env->log, "[rampart][shp] Reference List has %d node reference(s)", AXIS2_ARRAY_LIST_SIZE(reference_list, env));
/*If the reference list > 0 then We have nodes to decrypt. Next step is to get the encrypted key*/
/*Obtain the session key which is encrypted*/
@@ -162,7 +152,9 @@
/*Go thru each and every node in the list and decrypt them*/
for(i=0 ; i < AXIS2_ARRAY_LIST_SIZE(reference_list, env); i++ ){
axis2_char_t *id = NULL;
+ axis2_char_t *id2 = NULL;
axiom_node_t *enc_data_node = NULL;
+ axiom_node_t *envelope_node = NULL;
oxs_ctx_t *ctx = NULL;
axiom_node_t *decrypted_node = NULL;
axiom_soap_body_t *body = NULL;
@@ -171,13 +163,18 @@
/*Get the i-th element and decrypt it */
id = (axis2_char_t*)AXIS2_ARRAY_LIST_GET(reference_list, env, i);
AXIS2_LOG_INFO(env->log, "[rampart][shp] Decrypting node, ID=%s", id);
- /*TODO Write a proper function to get the node bu its ID*/
+ id2 = axis2_string_substring_starting_at(id, 1);
+ envelope_node = AXIOM_SOAP_ENVELOPE_GET_BASE_NODE(soap_envelope, env);
- /*This is only for test*/
+ /*Search for the node by its ID*/
body = AXIOM_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
body_node = AXIOM_SOAP_BODY_GET_BASE_NODE(body, env);
- enc_data_node = AXIOM_NODE_GET_FIRST_CHILD(body_node, env);
-
+ /*TODO Check why this fails for soap envelope node*/
+ enc_data_node = oxs_axiom_get_node_by_id(env, body_node, id2);
+ if(!enc_data_node){
+ AXIS2_LOG_INFO(env->log, "[rampart][shp] Node with ID=%s cannot be found", id);
+ continue;
+ }
/*Create an enc_ctx*/
ctx = oxs_ctx_create(env);
OXS_CTX_SET_KEY(ctx, env, decrypted_sym_key);
Modified: webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c?view=diff&rev=478050&r1=478049&r2=478050
==============================================================================
--- webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c (original)
+++ webservices/axis2/trunk/c/rampart/test/omxmlsec/test.c Tue Nov 21 22:20:51 2006
@@ -27,7 +27,7 @@
#include <oxs_encryption.h>
#include <oxs_xml_encryption.h>
#include <oxs_token_encrypted_data.h>
-#include <oxs_certificate.h>
+#include <oxs_x509_cert.h>
AXIS2_EXTERN axiom_node_t* AXIS2_CALL
@@ -123,10 +123,10 @@
printf("--Testing started--------------------------------------------\n");
/*additional code start*/
- oxs_certificate_t *cert = NULL;
- cert = oxs_certificate_create(env);
- oxs_certificate_set_serial_number(cert, env, "MYSER-NUMBER");
- printf("\nSER NO :%s\n", oxs_certificate_get_serial_number(cert, env));
+ oxs_x509_cert_t *cert = NULL;
+ cert = oxs_x509_cert_create(env);
+ oxs_x509_cert_set_issuer(cert, env, "IssuerXYZ");
+ printf("\nSER NO :%s\n", oxs_x509_cert_get_issuer(cert, env));
/*additional code end*/
if (argc > 1)
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org