From b84f12bfec9a1ff0978a8f2ca42653430db28b82 Mon Sep 17 00:00:00 2001 From: Valery Febvre Date: Thu, 13 May 2004 16:38:08 +0000 Subject: lasso_ds_signature_new() rewritten --- lasso/xml/ds_signature.c | 20 +++++++++++--------- lasso/xml/ds_signature.h | 8 ++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lasso/xml/ds_signature.c b/lasso/xml/ds_signature.c index 442c5ad6..28a20022 100644 --- a/lasso/xml/ds_signature.c +++ b/lasso/xml/ds_signature.c @@ -109,19 +109,21 @@ GType lasso_ds_signature_get_type() { * * Return value: the new @LassoDsDignature **/ -LassoNode* lasso_ds_signature_new(xmlDocPtr doc, - xmlSecTransformId signMethodId) +LassoNode* lasso_ds_signature_new(LassoNode *node, + xmlSecTransformId sign_method) { - LassoNode *node; + LassoNode *sign_node; + xmlDocPtr doc = xmlNewDoc("1.0"); xmlNodePtr signature; xmlNodePtr reference; xmlNodePtr key_info; - node = LASSO_NODE(g_object_new(LASSO_TYPE_DS_SIGNATURE, NULL)); + xmlAddChild((xmlNodePtr)doc, LASSO_NODE_GET_CLASS(node)->get_xmlNode(node)); + + sign_node = LASSO_NODE(g_object_new(LASSO_TYPE_DS_SIGNATURE, NULL)); - //signature = xmlSecTmplSignatureCreate(NULL, xmlSecTransformExclC14NId, signature = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId, - signMethodId, NULL); + sign_method, NULL); if (signature == NULL) { printf("Error: failed to create signature template\n"); } @@ -132,7 +134,7 @@ LassoNode* lasso_ds_signature_new(xmlDocPtr doc, printf("Error: failed to add reference to signature template\n"); } - // add enveloped transform + /* add enveloped transform */ if (xmlSecTmplReferenceAddTransform(reference, xmlSecTransformEnvelopedId) == NULL) { printf("Error: failed to add enveloped transform to reference\n"); } @@ -147,7 +149,7 @@ LassoNode* lasso_ds_signature_new(xmlDocPtr doc, printf("Error: failed to add X509Data node\n"); } - LASSO_NODE_GET_CLASS(node)->set_xmlNode(node, signature); + LASSO_NODE_GET_CLASS(sign_node)->set_xmlNode(sign_node, signature); - return (node); + return (sign_node); } diff --git a/lasso/xml/ds_signature.h b/lasso/xml/ds_signature.h index 8f047819..921f2a1d 100644 --- a/lasso/xml/ds_signature.h +++ b/lasso/xml/ds_signature.h @@ -51,12 +51,12 @@ struct _LassoDsSignatureClass { }; LASSO_EXPORT GType lasso_ds_signature_get_type(void); -LASSO_EXPORT LassoNode* lasso_ds_signature_new(xmlDocPtr doc, - xmlSecTransformId signMethodId); +LASSO_EXPORT LassoNode* lasso_ds_signature_new(LassoNode *node, + xmlSecTransformId sign_method); LASSO_EXPORT void lasso_ds_signature_sign (LassoDsSignature *node, - const xmlChar* key_file, - const xmlChar* cert_file); + const xmlChar *private_key_file, + const xmlChar *certificate_file); #ifdef __cplusplus } -- cgit