summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-07-16 19:34:26 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-07-16 19:34:26 +0000
commitad93e9f8310592f61fc07e79791eb6d8f17e64fc (patch)
tree0478f78b497da8d62ea745184207e53174c03ab5
parent21ca128532e76be7461d049d8913a17f75f971eb (diff)
downloadlasso-ad93e9f8310592f61fc07e79791eb6d8f17e64fc.tar.gz
lasso-ad93e9f8310592f61fc07e79791eb6d8f17e64fc.tar.xz
lasso-ad93e9f8310592f61fc07e79791eb6d8f17e64fc.zip
[Core] Change lasso_apply_signature to use quark stored annotated signature parameters
The node containing signature do not handle the private keys passwords. As the fields for signature parameters are part of the public ABI we cannot add the password field to the public structure for those nodes. Instead we use the new quark annotation accessed through lasso_node_get/set_signature, and if the sign_type parameter is non-NULL we use it instead of the parameters stored in the public structure. This is a gross hack :( but at least it is documented.
-rw-r--r--lasso/xml/tools.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
index 08a35963..523a7dda 100644
--- a/lasso/xml/tools.c
+++ b/lasso/xml/tools.c
@@ -2247,9 +2247,24 @@ lasso_log_remove_handler(guint handler_id)
void
lasso_apply_signature(LassoNode *node, gboolean lasso_dump,
- xmlNode **xmlnode, char *id_attribute, char *id_value, LassoSignatureType sign_type, char *private_key_file, char *certificate_file)
+ xmlNode **xmlnode, char *id_attribute, char *id_value, LassoSignatureType old_sign_type, char *old_private_key_file, char *old_certificate_file)
{
int rc = 0;
+ LassoSignatureType sign_type = LASSO_SIGNATURE_TYPE_NONE;
+ LassoSignatureMethod sign_method = LASSO_SIGNATURE_METHOD_RSA_SHA1;
+ char *private_key_file = NULL;
+ char *private_key_password = NULL;
+ char *certificate_file = NULL;
+
+ lasso_node_get_signature(node, &sign_type, &sign_method, &private_key_file, &private_key_password,
+ &certificate_file);
+
+ if (!sign_type) {
+ sign_type = old_sign_type;
+ private_key_password = NULL;
+ private_key_file = old_private_key_file;
+ certificate_file = old_certificate_file;
+ }
if (lasso_dump == FALSE && sign_type) {
char *node_name;
@@ -2263,7 +2278,7 @@ lasso_apply_signature(LassoNode *node, gboolean lasso_dump,
"No Private Key set for signing %s:%s", prefix, node_name);
} else {
rc = lasso_sign_node(*xmlnode, id_attribute, id_value, private_key_file,
- certificate_file);
+ private_key_password, certificate_file);
if (rc != 0) {
message(G_LOG_LEVEL_WARNING, "Signing of %s:%s: %s", prefix, node_name, lasso_strerror(rc));
}