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 mi...@apache.org on 2008/02/06 08:46:53 UTC
svn commit: r618917 - in /webservices/rampart/scratch/c/trust/c:
include/trust_constants.h include/trust_rst.h include/trust_rstr.h
include/trust_util.h src/trust/rst.c src/trust/rstr.c src/trust/trust_util.c
Author: milinda
Date: Tue Feb 5 23:46:51 2008
New Revision: 618917
URL: http://svn.apache.org/viewvc?rev=618917&view=rev
Log:
Adding trust extension support. Thanks Kasun for the patch.
Modified:
webservices/rampart/scratch/c/trust/c/include/trust_constants.h
webservices/rampart/scratch/c/trust/c/include/trust_rst.h
webservices/rampart/scratch/c/trust/c/include/trust_rstr.h
webservices/rampart/scratch/c/trust/c/include/trust_util.h
webservices/rampart/scratch/c/trust/c/src/trust/rst.c
webservices/rampart/scratch/c/trust/c/src/trust/rstr.c
webservices/rampart/scratch/c/trust/c/src/trust/trust_util.c
Modified: webservices/rampart/scratch/c/trust/c/include/trust_constants.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_constants.h?rev=618917&r1=618916&r2=618917&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_constants.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_constants.h Tue Feb 5 23:46:51 2008
@@ -39,9 +39,6 @@
#define TRUST_REQUEST_TYPE "RequestType"
#define TRUST_APPLIES_TO "AppliesTo"
-#define TRUST_KEY_TYPE "KeyType"
-#define TRUST_KEY_SIZE "KeySize"
-
#define TRUST_CLAIMS "Claims"
#define TRUST_CLAIMS_DIALECT "Dialect"
@@ -58,7 +55,6 @@
#define TRUST_REQUESTED_PROOF_TOKEN "RequestedProofToken"
#define TRUST_REQUEST_SECURITY_TOKEN_RESPONSE_COLLECTION "RequestSecurityTokenResponseCollection"
#define TRUST_REQUESTED_TOKEN_CANCELED "RequestedTokenCancelled"
-#define TRUST_COMPUTED_KEY_ALGO "ComputedKeyAlgorithm"
#define TRUST_COMPUTED_KEY "ComputedKey"
#define TRUST_REQUESTED_ATTACHED_REFERENCE "RequestedAttachedReference"
#define TRUST_REQUESTED_UNATTACHED_REFERENCE "RequestedUnattachedReference"
@@ -105,6 +101,25 @@
#define TRUST_KEY_TYPE_SYMM_KEY "/SymmetricKey"
#define TRUST_KEY_TYPE_PUBLIC_KEY "/PublicKey"
#define TRUST_KEY_TYPE_BEARER "/Bearer"
+
+
+ /*Key and Token Parameter Extensions*/
+#define TRUST_AUTHENTICATION_TYPE "AuthenticationType"
+#define TRUST_KEY_TYPE "KeyType"
+#define TRUST_KEY_SIZE "KeySize"
+#define TRUST_SIGNATURE_ALGO "SignatureAlgorithm"
+#define TRUST_ENCRYPTION_ALGO "EncryptionAlgorithm"
+#define TRUST_CANONICAL_ALGO "CanonicalizationAlgorithm"
+#define TRUST_COMPUTED_KEY_ALGO "ComputedKeyAlgorithm"
+#define TRUST_DESIRED_ENCRYPTION "Encryption"
+#define TRUST_PROOF_ENCRYPTION "ProofEncryption"
+#define TRUST_USE_KEY "UseKey"
+#define TRUST_SIGN_WITH "SignWith"
+#define TRUST_ENCRYPT_WITH "EncryptWith"
+
+#define TRUST_ATTR_USE_KEY_SIG "Sig"
+
+
/* Trust Namespace URIs and Namespace prefix */
#define TRUST_S11 "S11"
Modified: webservices/rampart/scratch/c/trust/c/include/trust_rst.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_rst.h?rev=618917&r1=618916&r2=618917&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_rst.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_rst.h Tue Feb 5 23:46:51 2008
@@ -46,8 +46,7 @@
trust_rst_populate_rst(
trust_rst_t *rst,
const axutil_env_t *env,
- axiom_node_t *rst_node
- /*axis2_msg_ctx_t *in_msg_ctx*/);
+ axiom_node_t *rst_node);
/*Build RST message from the created RST Context */
AXIS2_EXTERN axiom_node_t * AXIS2_CALL
@@ -141,6 +140,8 @@
trust_life_time_t *life_time);
+ /*Key and Token Parameter Extensions*/
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
trust_rst_set_key_type(
trust_rst_t *rst,
@@ -151,7 +152,7 @@
trust_rst_get_key_type(
trust_rst_t *rst,
const axutil_env_t *env);
-
+
AXIS2_EXTERN axis2_status_t AXIS2_CALL
trust_rst_set_key_size(
@@ -164,8 +165,129 @@
trust_rst_t *rst,
const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_authentication_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *authentication_type);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_authentication_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_signature_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *signature_algorithm);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_signature_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_encryption_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *encryption_algorithm);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_encryption_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_canonicalization_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *canonicalization_algorithm);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_canonicalization_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_computedkey_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *computedkey_algorithm);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_computedkey_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_desired_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *desired_encryption_key);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_rst_get_desired_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_proof_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *proof_encryption_key);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_rst_get_proof_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_usekey(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *usekey_key);
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_rst_get_usekey(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+ /*FIX Usekey attr @Sig*/
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_signwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *signwith);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_signwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_encryptwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *encryptwith);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_encryptwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env);
+
/*Trust Version 1 -2005/02 - http://schemas.xmlsoap.org/ws/2005/02/trust */
/*Trust Version 2 -2005/12 - http://docs.oasis-open.org/ws-sx/ws-trust/200512 */
Modified: webservices/rampart/scratch/c/trust/c/include/trust_rstr.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_rstr.h?rev=618917&r1=618916&r2=618917&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_rstr.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_rstr.h Tue Feb 5 23:46:51 2008
@@ -169,11 +169,11 @@
const axutil_env_t *env,
axis2_bool_t in_header);
- AXIS2_EXTERN axis2_status_t AXIS2_CALL
- trust_rstr_set_wst_ns_uri(
- trust_rstr_t *rstr,
- const axutil_env_t *env,
- axis2_char_t *wst_ns_uri);
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rstr_set_wst_ns_uri(
+ trust_rstr_t *rstr,
+ const axutil_env_t *env,
+ axis2_char_t *wst_ns_uri);
Modified: webservices/rampart/scratch/c/trust/c/include/trust_util.h
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/include/trust_util.h?rev=618917&r1=618916&r2=618917&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/include/trust_util.h (original)
+++ webservices/rampart/scratch/c/trust/c/include/trust_util.h Tue Feb 5 23:46:51 2008
@@ -19,8 +19,6 @@
#ifndef TRUST_UTIL
#define TRUST_UTIL
-//#define AXIS2_EXTERN __declspec(dllexport)
-
/**
* @file trust_util.h
* @brief contains generic operations related to trust module
@@ -292,6 +290,87 @@
axiom_node_t * parent_node,
axis2_char_t * key_type);
+
+ /*AuthenticationType*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_authentication_type_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * authentication_type);
+
+ /*SignatureAlgorithm*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_signature_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * signature_algo);
+
+ /*EncryptionAlgorithm*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_encryption_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * encryption_algo);
+
+ /*CanonicalizationAlgorithm*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_canonicalization_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * canonicalization_algo);
+
+ /*ComputedKeyAlgorithm*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_computedkey_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * computedkey_algo);
+
+ /*(Desired)Encryption*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_desired_encryption_element(
+ const axutil_env_t * env,
+ axis2_char_t * wst_ns_uri,
+ axiom_node_t * parent_node,
+ axiom_node_t * encryption_key); /*@param encryption_key - This can be either a key or a STR*/
+
+ /*ProofEncryption*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_proof_encryption_element(
+ const axutil_env_t * env,
+ axis2_char_t * wst_ns_uri,
+ axiom_node_t * parent_node,
+ axiom_node_t * proof_encryption_key); /*@param encryption_key - This can be either a key or a STR*/
+
+ /*UseKey*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_usekey_element(
+ const axutil_env_t * env,
+ axis2_char_t * wst_ns_uri,
+ axiom_node_t * parent_node,
+ axiom_node_t * usekey_key); /*@param encryption_key - This can be either a key or a STR*/
+
+ /*SignWith*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_signwith_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * signwith);
+
+ /*EncryptWith*/
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ trust_util_create_encryptwith_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * encryptwith);
+
/**
* Create LifeTime element.
*
@@ -422,6 +501,12 @@
axis2_char_t *wst_ns_uri,
axis2_char_t * code,
axis2_char_t * reason);
+
+ /* Generate random se*/
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ trust_util_create_random_session_key_proof_token_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri);
/**
* Returns the namespace uri of WST according to the version.
Modified: webservices/rampart/scratch/c/trust/c/src/trust/rst.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/rst.c?rev=618917&r1=618916&r2=618917&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/rst.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/rst.c Tue Feb 5 23:46:51 2008
@@ -30,11 +30,7 @@
trust_claims_t *claims;
- trust_entropy_t *entropy;
-
- axis2_char_t *key_type;
-
- int key_size;
+ trust_entropy_t *entropy;
axis2_bool_t allow_postdating;
@@ -51,6 +47,26 @@
axis2_char_t *wst_ns_uri;
trust_life_time_t *life_time;
+
+
+
+
+ axis2_char_t *key_type;
+ int key_size;
+ axis2_char_t *authentication_type;
+ axis2_char_t *signature_algo;
+ axis2_char_t *encryption_algo;
+ axis2_char_t *canonicalization_algo;
+ axis2_char_t *computed_key_algo;
+
+ axiom_node_t *desired_encryption;
+ axiom_node_t *proof_encryption;
+ axiom_node_t *usekey;
+ axis2_char_t *usekey_sig_attr;
+ axis2_char_t *sign_with;
+ axis2_char_t *encrypt_with;
+
+
/*ToDo : Federation - Trust Extensions
* - Authorization : AdditionalContext and CommonClaim Dialect
@@ -83,6 +99,17 @@
rst->cancel_target = NULL;
rst->wst_ns_uri = NULL;
rst->life_time = NULL;
+ rst->authentication_type = NULL;
+ rst->signature_algo = NULL;
+ rst->encryption_algo = NULL;
+ rst->canonicalization_algo = NULL;
+ rst->computed_key_algo = NULL;
+ rst->desired_encryption = NULL;
+ rst->proof_encryption = NULL;
+ rst->usekey = NULL;
+ rst->usekey_sig_attr = NULL;
+ rst->sign_with = NULL;
+ rst->encrypt_with = NULL;
return rst;
}
@@ -92,8 +119,7 @@
trust_rst_t *rst,
const axutil_env_t *env,
axiom_node_t *rst_node)
-{
- /*axiom_node_t *rst_node = NULL;*/
+{
axiom_element_t *rst_ele = NULL;
axutil_qname_t *attr_ctx_qname = NULL;
axis2_char_t *attr_ctx = NULL;
@@ -142,13 +168,59 @@
axutil_qname_t *key_size_qname = NULL;
axis2_char_t *key_size = NULL;
+ axiom_node_t *authnetication_type_node = NULL;
+ axiom_element_t *authnetication_type_ele = NULL;
+ axutil_qname_t *authnetication_type_qname = NULL;
+ axis2_char_t *authnetication_type = NULL;
+
+ axiom_node_t *signature_algo_node = NULL;
+ axiom_element_t *signature_algo_ele = NULL;
+ axutil_qname_t *signature_algo_qname = NULL;
+ axis2_char_t *signature_algo = NULL;
+
+ axiom_node_t *encryption_algo_node = NULL;
+ axiom_element_t *encryption_algo_ele = NULL;
+ axutil_qname_t *encryption_algo_qname = NULL;
+ axis2_char_t *encryption_algo = NULL;
+
+ axiom_node_t *canonocalization_algo_node = NULL;
+ axiom_element_t *canonocalization_algo_ele = NULL;
+ axutil_qname_t *canonocalization_algo_qname = NULL;
+ axis2_char_t *canonocalization_algo = NULL;
+
+ axiom_node_t *computedkey_algo_node = NULL;
+ axiom_element_t *computedkey_algo_ele = NULL;
+ axutil_qname_t *computedkey_algo_qname = NULL;
+ axis2_char_t *computedkey_algo = NULL;
+
+ axiom_node_t *desired_encryption_node = NULL;
+ axiom_element_t *desired_encryption_ele = NULL;
+ axutil_qname_t *desired_encryption_qname = NULL;
+ axiom_node_t *desired_encryption_key_node = NULL; /*This can be either Key or STR*/
+ axiom_element_t *desired_encryption_key_ele = NULL;
+
+ axiom_node_t *proof_encryption_node = NULL;
+ axiom_element_t *proof_encryption_ele = NULL;
+ axutil_qname_t *proof_encryption_qname = NULL;
+ axiom_node_t *proof_encryption_key_node = NULL; /*This can be either Key or STR*/
+ axiom_element_t *proof_encryption_key_ele = NULL;
+
+ axiom_node_t *use_key_node = NULL;
+ axiom_element_t *use_key_ele = NULL;
+ axutil_qname_t *use_key_qname = NULL;
+ axiom_node_t *usekey_key_node = NULL; /*This can be either Key or STR*/
+ axiom_element_t *usekey_key_ele = NULL;
+
+ axiom_node_t *sign_with_node = NULL;
+ axiom_element_t *sign_with_ele = NULL;
+ axutil_qname_t *sign_with_qname = NULL;
+ axis2_char_t *sign_with = NULL;
+
+ axiom_node_t *encrypt_with_node = NULL;
+ axiom_element_t *encrypt_with_ele = NULL;
+ axutil_qname_t *encrypt_with_qname = NULL;
+ axis2_char_t *encrypt_with = NULL;
- /*ToBe Fixed with the use of in_message_context ----------*/
- /*soap_env = axis2_msg_ctx_get_soap_envelope(in_msg_ctx, env);
- soap_body = axiom_soap_envelope_get_body(soap_env, env);
- body_base_node = axiom_soap_body_get_base_node(soap_body, env);
-
- rst_node = axiom_node_get_first_child(body_base_node, env);*/
if(NULL == rst_node || NULL == rst)
{
@@ -193,8 +265,7 @@
rst->token_type = token_type;
}
}
-
-
+
/* RequestType */
req_type_qname = axutil_qname_create(env, TRUST_REQUEST_TYPE, rst->wst_ns_uri, TRUST_WST);
if (!req_type_qname)
@@ -296,6 +367,7 @@
}
}
+ /*Key and Encryption Requirements*/
/* KeyType */
key_type_qname = axutil_qname_create(env, TRUST_KEY_TYPE, rst->wst_ns_uri, TRUST_WST);
@@ -328,6 +400,143 @@
}
}
+ /*AuthenticationType*/
+ authnetication_type_qname = axutil_qname_create(env, TRUST_AUTHENTICATION_TYPE, rst->wst_ns_uri, TRUST_WST);
+ authnetication_type_ele = axiom_element_get_first_child_with_qname(rst_ele, env, authnetication_type_qname, rst_node, &authnetication_type_node);
+ if(authnetication_type_ele)
+ {
+ authnetication_type = axiom_element_get_text(authnetication_type_ele, env, authnetication_type_node);
+ if(authnetication_type)
+ {
+ rst->authentication_type = authnetication_type;
+ }
+ }
+
+ /*SignatureAlgorithm*/
+ signature_algo_qname = axutil_qname_create(env, TRUST_SIGNATURE_ALGO, rst->wst_ns_uri, TRUST_WST);
+ signature_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, signature_algo_qname, rst_node, &signature_algo_node);
+ if(signature_algo_ele)
+ {
+ signature_algo = axiom_element_get_text(signature_algo_ele, env, signature_algo_node);
+ if(signature_algo)
+ {
+ rst->signature_algo = signature_algo;
+ }
+ }
+
+ /*EncryptionAlgorithm*/
+ encryption_algo_qname = axutil_qname_create(env, TRUST_ENCRYPTION_ALGO, rst->wst_ns_uri, TRUST_WST);
+ encryption_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, encryption_algo_qname, rst_node, &encryption_algo_node);
+ if(encryption_algo_ele)
+ {
+ encryption_algo = axiom_element_get_text(encryption_algo_ele, env, encryption_algo_node);
+ if(encryption_algo)
+ {
+ rst->encryption_algo = encryption_algo;
+ }
+ }
+
+ /*CanonicalizationAlgorithm*/
+ canonocalization_algo_qname = axutil_qname_create(env, TRUST_CANONICAL_ALGO, rst->wst_ns_uri, TRUST_WST);
+ canonocalization_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, canonocalization_algo_qname, rst_node, &canonocalization_algo_node);
+ if(canonocalization_algo_ele)
+ {
+ canonocalization_algo = axiom_element_get_text(canonocalization_algo_ele, env, canonocalization_algo_node);
+ if(canonocalization_algo)
+ {
+ rst->canonicalization_algo = canonocalization_algo;
+ }
+ }
+
+ /*ComputedKeyAlgorithm*/
+ computedkey_algo_qname = axutil_qname_create(env, TRUST_COMPUTED_KEY_ALGO, rst->wst_ns_uri, TRUST_WST);
+ computedkey_algo_ele = axiom_element_get_first_child_with_qname(rst_ele, env, computedkey_algo_qname, rst_node, &computedkey_algo_node);
+ if(computedkey_algo_ele)
+ {
+ computedkey_algo = axiom_element_get_text(computedkey_algo_ele, env, computedkey_algo_node);
+ if(computedkey_algo)
+ {
+ rst->computed_key_algo = computedkey_algo;
+ }
+ }
+
+
+ /*(Desired)Encryption */
+ desired_encryption_qname = axutil_qname_create(env, TRUST_DESIRED_ENCRYPTION, rst->wst_ns_uri, TRUST_WST);
+ if (!desired_encryption_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] Encryption Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ desired_encryption_ele = axiom_element_get_first_child_with_qname(rst_ele, env, desired_encryption_qname, rst_node, &desired_encryption_node);
+ if(desired_encryption_ele)
+ {
+ desired_encryption_key_ele = axiom_element_get_first_element(desired_encryption_ele, env, desired_encryption_node, &desired_encryption_key_node);
+ rst->desired_encryption = desired_encryption_key_node;
+ }
+
+ /*ProofEncryption*/
+ proof_encryption_qname = axutil_qname_create(env, TRUST_PROOF_ENCRYPTION, rst->wst_ns_uri, TRUST_WST);
+ if (!proof_encryption_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] ProofEncryption Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ proof_encryption_ele = axiom_element_get_first_child_with_qname(rst_ele, env, proof_encryption_qname, rst_node, &proof_encryption_node);
+ if(proof_encryption_ele)
+ {
+ proof_encryption_key_ele = axiom_element_get_first_element(proof_encryption_ele, env, proof_encryption_node, &proof_encryption_key_node);
+ rst->proof_encryption = proof_encryption_key_node;
+
+ }
+
+ /*UseKey*/
+ use_key_qname = axutil_qname_create(env, TRUST_USE_KEY, rst->wst_ns_uri, TRUST_WST);
+ if(!use_key_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] UseKey Qname creation failed.");
+ return AXIS2_FAILURE;
+
+ }
+
+ use_key_ele = axiom_element_get_first_child_with_qname(rst_ele, env, use_key_qname, rst_node, &use_key_node);
+ if(use_key_ele)
+ {
+ usekey_key_ele = axiom_element_get_first_element(use_key_ele, env, use_key_node, &usekey_key_node);
+ rst->usekey = usekey_key_node;
+ }
+
+ /*SignWith*/
+ sign_with_qname = axutil_qname_create(env, TRUST_SIGN_WITH, rst->wst_ns_uri, TRUST_WST);
+ sign_with_ele = axiom_element_get_first_child_with_qname(rst_ele, env, sign_with_qname, rst_node, &sign_with_node);
+ if(sign_with_ele)
+ {
+ sign_with = axiom_element_get_text(sign_with_ele, env, sign_with_node);
+ if(sign_with)
+ {
+ rst->sign_with = sign_with;
+ }
+ }
+
+ /*EncryptWith*/
+ encrypt_with_qname = axutil_qname_create(env, TRUST_ENCRYPT_WITH, rst->wst_ns_uri, TRUST_WST);
+ if(!encrypt_with_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] EncryptWith Qname creation failed.");
+ return AXIS2_FAILURE;
+ }
+ encrypt_with_ele = axiom_element_get_first_child_with_qname(rst_ele, env, encrypt_with_qname, rst_node, &encrypt_with_node);
+ if(encrypt_with_ele)
+ {
+ encrypt_with = axiom_element_get_text(encrypt_with_ele, env, encrypt_with_node);
+ if(encrypt_with)
+ {
+ rst->encrypt_with = encrypt_with;
+ }
+ }
+
AXIS2_FREE(env->allocator, key_size_qname);
AXIS2_FREE(env->allocator, key_type_qname);
AXIS2_FREE(env->allocator, lifetime_qname);
@@ -339,9 +548,16 @@
AXIS2_FREE(env->allocator, req_type_qname);
AXIS2_FREE(env->allocator, token_type_qname);
AXIS2_FREE(env->allocator, attr_ctx_qname);
-
- /*Free Intermediate Objects.. */
-
+ AXIS2_FREE(env->allocator, authnetication_type_qname);
+ AXIS2_FREE(env->allocator, signature_algo_qname);
+ AXIS2_FREE(env->allocator, encryption_algo_qname);
+ AXIS2_FREE(env->allocator, canonocalization_algo_qname);
+ AXIS2_FREE(env->allocator, computedkey_algo_qname);
+ AXIS2_FREE(env->allocator, proof_encryption_qname);
+ AXIS2_FREE(env->allocator, use_key_qname);
+ AXIS2_FREE(env->allocator, sign_with_qname);
+ AXIS2_FREE(env->allocator, encrypt_with_qname);
+
return AXIS2_SUCCESS;
}
@@ -353,7 +569,7 @@
const axutil_env_t *env,
axiom_node_t *parent)
{
- axiom_node_t *rst_node = NULL;
+ axiom_node_t *rst_node = NULL;
axis2_char_t *key_size = NULL;
rst_node = (axiom_node_t*)trust_util_create_rst_element(env, rst->wst_ns_uri, rst->attr_context);
@@ -444,6 +660,97 @@
}
}
+ if(rst->authentication_type)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_authentication_type_element(env, rst->wst_ns_uri, rst_node, rst->authentication_type))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] AuthenticationType element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->signature_algo)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_signature_algo_element(env, rst->wst_ns_uri, rst_node, rst->signature_algo))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] SignatureAlgo element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->encryption_algo)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_encryption_algo_element(env, rst->wst_ns_uri, rst_node, rst->encryption_algo))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] EncryptionAlgo element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->canonicalization_algo)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_canonicalization_algo_element(env, rst->wst_ns_uri, rst_node, rst->canonicalization_algo))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] CanonicalizationAlgo element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->computed_key_algo)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_computedkey_algo_element(env, rst->wst_ns_uri, rst_node, rst->computed_key_algo))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] ComputedKeyAlgo element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->desired_encryption)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_desired_encryption_element(env, rst->wst_ns_uri, rst_node, rst->desired_encryption))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] DesiredEncryption element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->proof_encryption)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_proof_encryption_element(env, rst->wst_ns_uri, rst_node, rst->proof_encryption))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] ProofEncryption element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->usekey)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_usekey_element(env, rst->wst_ns_uri, rst_node, rst->usekey))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] UseKey element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->sign_with)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_signwith_element(env, rst->wst_ns_uri, rst_node, rst->sign_with))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] SignWith element creation failed.");
+ return NULL;
+ }
+ }
+
+ if(rst->encrypt_with)
+ {
+ if(NULL == (axiom_node_t*)trust_util_create_encryptwith_element(env, rst->wst_ns_uri, rst_node, rst->encrypt_with))
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[trust] EncryptWith element creation failed.");
+ return NULL;
+ }
+ }
+
+
return rst_node;
}
@@ -656,7 +963,239 @@
{
return rst->key_size;
}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ trust_rst_set_authentication_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *authentication_type)
+{
+ if(authentication_type)
+ {
+ rst->authentication_type = authentication_type;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ trust_rst_get_authentication_type(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->authentication_type;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_signature_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *signature_algorithm)
+{
+ if(signature_algorithm)
+ {
+ rst->signature_algo = signature_algorithm;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_signature_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->signature_algo;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_encryption_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *encryption_algorithm)
+{
+ if(encryption_algorithm)
+ {
+ rst->encryption_algo = encryption_algorithm;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_encryption_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->encryption_algo;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_canonicalization_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *canonicalization_algorithm)
+{
+ if(canonicalization_algorithm)
+ {
+ rst->canonicalization_algo = canonicalization_algorithm;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_canonicalization_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->canonicalization_algo;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_computedkey_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *computedkey_algorithm)
+{
+ if(computedkey_algorithm)
+ {
+ rst->computed_key_algo = computedkey_algorithm;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_computedkey_algorithm(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->computed_key_algo;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_desired_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *desired_encryption_key)
+{
+ if(desired_encryption_key)
+ {
+ rst->desired_encryption = desired_encryption_key;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rst_get_desired_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->desired_encryption;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_proof_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *proof_encryption_key)
+{
+ if(proof_encryption_key)
+ {
+ rst->proof_encryption = proof_encryption_key;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rst_get_proof_encryption(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->proof_encryption;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_usekey(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axiom_node_t *usekey_key)
+{
+ if(usekey_key)
+ {
+ rst->usekey = usekey_key;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+trust_rst_get_usekey(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->usekey;
+}
+/*FIX Usekey attr @Sig*/
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_signwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *signwith)
+{
+ if(signwith)
+ {
+ rst->sign_with = signwith;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_signwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->sign_with;
+}
+
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+trust_rst_set_encryptwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env,
+ axis2_char_t *encryptwith)
+{
+ if(encryptwith)
+ {
+ rst->encrypt_with = encryptwith;
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+trust_rst_get_encryptwith(
+ trust_rst_t *rst,
+ const axutil_env_t *env)
+{
+ return rst->encrypt_with;
+}
AXIS2_EXTERN axis2_char_t * AXIS2_CALL
trust_rst_get_wst_ns_uri(
@@ -689,4 +1228,5 @@
{
return;
}
+
Modified: webservices/rampart/scratch/c/trust/c/src/trust/rstr.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/rstr.c?rev=618917&r1=618916&r2=618917&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/rstr.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/rstr.c Tue Feb 5 23:46:51 2008
@@ -56,7 +56,7 @@
rstr = (trust_rstr_t*)AXIS2_MALLOC(env->allocator, sizeof(trust_rstr_t));
rstr->token_type = NULL;
- rstr->attr_context = NULL;
+ rstr->attr_context = NULL;
rstr->request_type = NULL;
rstr->requested_sec_token = NULL;
rstr->applies_to = NULL;
@@ -66,7 +66,7 @@
rstr->entropy = NULL;
rstr->life_time = NULL;
rstr->key_size = -1;
- rstr->wst_ns_uri = NULL;
+ rstr->wst_ns_uri = NULL;
return rstr;
}
@@ -96,9 +96,9 @@
axiom_element_t *requested_security_token_ele = NULL;
axutil_qname_t *requested_security_token_qname = NULL;
- axiom_node_t *proof_token_node = NULL;
- axiom_element_t *proof_token_ele = NULL;
- axutil_qname_t *proof_token_qname = NULL;
+ axiom_node_t *proof_token_node = NULL;
+ axiom_element_t *proof_token_ele = NULL;
+ axutil_qname_t *proof_token_qname = NULL;
axiom_node_t *token_type_node = NULL;
axiom_element_t *token_type_ele = NULL;
@@ -268,6 +268,7 @@
AXIS2_FREE(env->allocator, applies_to_qname);
AXIS2_FREE(env->allocator, token_type_qname);
AXIS2_FREE(env->allocator, attr_ctx_qname);
+
return AXIS2_SUCCESS;
Modified: webservices/rampart/scratch/c/trust/c/src/trust/trust_util.c
URL: http://svn.apache.org/viewvc/webservices/rampart/scratch/c/trust/c/src/trust/trust_util.c?rev=618917&r1=618916&r2=618917&view=diff
==============================================================================
--- webservices/rampart/scratch/c/trust/c/src/trust/trust_util.c (original)
+++ webservices/rampart/scratch/c/trust/c/src/trust/trust_util.c Tue Feb 5 23:46:51 2008
@@ -249,7 +249,7 @@
return applies_to_node;
}
-AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_claims_element(
const axutil_env_t * env,
axis2_char_t *wst_ns_uri,
@@ -740,6 +740,390 @@
return unattached_ref_node;
}
+/*AuthenticationType*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_authentication_type_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * authentication_type)
+{
+ axiom_node_t *authentication_type_node = NULL;
+ axiom_element_t *authentication_type_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status;
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ authentication_type_ele =
+ axiom_element_create(env, parent_node, TRUST_AUTHENTICATION_TYPE, wst_ns,
+ &authentication_type_node);
+ if (!authentication_type_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] AuthenticationType element creation failed.");
+ return NULL;
+ }
+
+ if (authentication_type)
+ {
+ status = axiom_element_set_text(authentication_type_ele, env, authentication_type, authentication_type_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] Authenticationtype Element's setting text failed.");
+ return NULL;
+ }
+ }
+
+ return authentication_type_node;
+
+}
+
+/*SignatureAlgorithm*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_signature_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * signature_algo)
+{
+ axiom_node_t *signature_algo_node = NULL;
+ axiom_element_t *signature_algo_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status;
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ signature_algo_ele =
+ axiom_element_create(env, parent_node, TRUST_SIGNATURE_ALGO, wst_ns,
+ &signature_algo_node);
+ if (!signature_algo_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] SignatureAlgo element creation failed.");
+ return NULL;
+ }
+
+ if (signature_algo)
+ {
+ status = axiom_element_set_text(signature_algo_ele, env, signature_algo, signature_algo_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] SignatureAlgo Element's setting text failed.");
+ return NULL;
+ }
+ }
+
+ return signature_algo_node;
+}
+
+/*EncryptionAlgorithm*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_encryption_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * encryption_algo)
+{
+ axiom_node_t *encryption_algo_node = NULL;
+ axiom_element_t *encryption_algo_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status;
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ encryption_algo_ele =
+ axiom_element_create(env, parent_node, TRUST_ENCRYPTION_ALGO, wst_ns,
+ &encryption_algo_node);
+ if (!encryption_algo_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] EncryptionAlgo element creation failed.");
+ return NULL;
+ }
+
+ if (encryption_algo)
+ {
+ status = axiom_element_set_text(encryption_algo_ele, env, encryption_algo, encryption_algo_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] EncryptionAlgo Element's setting text failed.");
+ return NULL;
+ }
+ }
+
+ return encryption_algo_node;
+}
+
+/*CanonicalizationAlgorithm*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_canonicalization_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * canonicalization_algo)
+{
+ axiom_node_t *canonicalization_algo_node = NULL;
+ axiom_element_t *canonicalization_algo_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status;
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ canonicalization_algo_ele =
+ axiom_element_create(env, parent_node, TRUST_CANONICAL_ALGO, wst_ns,
+ &canonicalization_algo_node);
+ if (!canonicalization_algo_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] CanonicalizationAlgo element creation failed.");
+ return NULL;
+ }
+
+ if (canonicalization_algo)
+ {
+ status = axiom_element_set_text(canonicalization_algo_ele, env, canonicalization_algo, canonicalization_algo_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] CanonicalizationAlgo Element's setting text failed.");
+ return NULL;
+ }
+ }
+
+ return canonicalization_algo_node;
+}
+
+/*ComputedKeyAlgorithm*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_computedkey_algo_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * computedkey_algo)
+{
+ axiom_node_t *computedkey_algo_node = NULL;
+ axiom_element_t *computedkey_algo_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status;
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ computedkey_algo_ele =
+ axiom_element_create(env, parent_node, TRUST_COMPUTED_KEY_ALGO, wst_ns,
+ &computedkey_algo_node);
+ if (!computedkey_algo_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] ComputedKeyAlgo element creation failed.");
+ return NULL;
+ }
+
+ if (computedkey_algo)
+ {
+ status = axiom_element_set_text(computedkey_algo_ele, env, computedkey_algo, computedkey_algo_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] ComputedKey Element's setting text failed.");
+ return NULL;
+ }
+ }
+
+
+ return computedkey_algo_node;
+}
+
+/*(Desired)Encryption*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_desired_encryption_element(
+ const axutil_env_t * env,
+ axis2_char_t * wst_ns_uri,
+ axiom_node_t * parent_node,
+ axiom_node_t * encryption_key) /*@param encryption_key - This can be either a key or a STR*/
+{
+ axiom_node_t *desired_encryption_node = NULL;
+ axiom_element_t *desired_encryption_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ desired_encryption_ele =
+ axiom_element_create(env, parent_node, TRUST_DESIRED_ENCRYPTION, wst_ns,
+ &desired_encryption_node);
+
+ if (!desired_encryption_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] Encryption Element creation failed!");
+ return NULL;
+ }
+
+ if(encryption_key)
+ {
+ /*This node can be a key or a STR*/
+ axiom_node_add_child(desired_encryption_node, env, encryption_key);
+ }
+
+ return desired_encryption_node;
+}
+
+/*ProofEncryption*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_proof_encryption_element(
+ const axutil_env_t * env,
+ axis2_char_t * wst_ns_uri,
+ axiom_node_t * parent_node,
+ axiom_node_t * proof_encryption_key) /*@param encryption_key - This can be either a key or a STR*/
+{
+ axiom_node_t *proof_encryption_node = NULL;
+ axiom_element_t *proof_encryption_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ proof_encryption_ele =
+ axiom_element_create(env, parent_node, TRUST_PROOF_ENCRYPTION, wst_ns,
+ &proof_encryption_node);
+
+ if (!proof_encryption_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] ProofEncryption Element creation failed!");
+ return NULL;
+ }
+
+ if(proof_encryption_key)
+ {
+ /*This node can be a key or a STR*/
+ axiom_node_add_child(proof_encryption_node, env, proof_encryption_key);
+ }
+
+ return proof_encryption_node;
+}
+
+/*UseKey*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_usekey_element(
+ const axutil_env_t * env,
+ axis2_char_t * wst_ns_uri,
+ axiom_node_t * parent_node,
+ axiom_node_t * usekey_key) /*@param encryption_key - This can be either a key or a STR*/
+{
+ axiom_node_t *usekey_node = NULL;
+ axiom_element_t *usekey_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ usekey_ele =
+ axiom_element_create(env, parent_node, TRUST_USE_KEY, wst_ns,
+ &usekey_node);
+
+ if (!usekey_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] UseKey Element creation failed!");
+ return NULL;
+ }
+
+ if(usekey_key)
+ {
+ /*This node can be a key or a STR*/
+ axiom_node_add_child(usekey_node, env, usekey_key);
+ }
+
+ return usekey_node;
+
+
+}
+
+/*SignWith*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_signwith_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * signwith)
+{
+ axiom_node_t *signwith_node = NULL;
+ axiom_element_t *signwith_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status;
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ signwith_ele =
+ axiom_element_create(env, parent_node, TRUST_SIGN_WITH, wst_ns,
+ &signwith_node);
+ if (!signwith_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] SignWith element creation failed.");
+ return NULL;
+ }
+
+ if (signwith)
+ {
+ status = axiom_element_set_text(signwith_ele, env, signwith, signwith_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] SignWith Element's setting text failed.");
+ return NULL;
+ }
+ }
+
+ return signwith_node;
+}
+
+/*EncryptWith*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+trust_util_create_encryptwith_element(
+ const axutil_env_t * env,
+ axis2_char_t *wst_ns_uri,
+ axiom_node_t * parent_node,
+ axis2_char_t * encryptwith)
+{
+ axiom_node_t *encryptwith_node = NULL;
+ axiom_element_t *encryptwith_ele = NULL;
+ axiom_namespace_t *wst_ns = NULL;
+ axis2_status_t status;
+
+ wst_ns = axiom_namespace_create(env, wst_ns_uri, TRUST_WST);
+
+ encryptwith_ele =
+ axiom_element_create(env, parent_node, TRUST_ENCRYPT_WITH, wst_ns,
+ &encryptwith_node);
+ if (!encryptwith_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] EncryptWith element creation failed.");
+ return NULL;
+ }
+
+ if (encryptwith)
+ {
+ status = axiom_element_set_text(encryptwith_ele, env, encryptwith, encryptwith_node);
+ if (status == AXIS2_FAILURE)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[trust] EncryptWith Element's setting text failed.");
+ return NULL;
+ }
+ }
+
+ return encryptwith_node;
+
+
+}
+
AXIS2_EXTERN axiom_node_t *AXIS2_CALL
trust_util_create_encrypted_data_element(
const axutil_env_t * env,
@@ -984,6 +1368,7 @@
return status_node;
}
+
/*Generating Random Session Key*/
AXIS2_EXTERN axiom_node_t * AXIS2_CALL