diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2011-12-01 18:43:10 +0100 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2011-12-05 12:03:12 +0100 |
commit | 9de6450f4c0f2db9d87c30741a7229b22fb4744e (patch) | |
tree | 4bc9c37c18e23c4fa1e60fa08e162f77390c27fe | |
parent | 5a9a447bad701dbb711c95481175cbd7ab3127f6 (diff) | |
download | lasso-9de6450f4c0f2db9d87c30741a7229b22fb4744e.tar.gz lasso-9de6450f4c0f2db9d87c30741a7229b22fb4744e.tar.xz lasso-9de6450f4c0f2db9d87c30741a7229b22fb4744e.zip |
[tools] add a LassoSignatureContext structure to pass signature parameters around
Signature parameters are mainly a LassoSignatureMethod and a xmlSecKey.
-rw-r--r-- | lasso/xml/private.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lasso/xml/private.h b/lasso/xml/private.h index 249eeaf0..aebee11b 100644 --- a/lasso/xml/private.h +++ b/lasso/xml/private.h @@ -79,6 +79,41 @@ struct XmlSnippet { char *ns_uri; }; +/** + * LassoSignatureContext: + * @signature_method: the method for signing (RSA, DSA, HMAC) + * @signature_key: a key for the signature + * + * Information needed to make a signature + */ +typedef struct _LassoSignatureContext { + LassoSignatureMethod signature_method; + xmlSecKey *signature_key; +} LassoSignatureContext; + +#define LASSO_SIGNATURE_CONTEXT_NONE ((LassoSignatureContext){LASSO_SIGNATURE_TYPE_NONE, NULL}) + +#define lasso_assign_signature_context(to, from) \ + do { \ + LassoSignatureContext *__to = &(to); \ + LassoSignatureContext __from = (from); \ + __to->signature_method = __from.signature_method; \ + lasso_assign_sec_key(__to->signature_key, __from.signature_key); \ + } while(0) + +#define lasso_assign_new_signature_context(to, from) \ + do { \ + LassoSignatureContext *__to = &(to); \ + LassoSignatureContext __from = (from); \ + __to->signature_method = __from.signature_method; \ + lasso_assign_new_sec_key(__to->signature_key, __from.signature_key); \ + } while(0) + +static inline gboolean +lasso_validate_signature_context(LassoSignatureContext context) { + return lasso_validate_signature_method(context.signature_method) + && context.signature_key != NULL; +} /** * This inline method replace normal use of G_STRUCT_MEMBER_P/G_STRUCT_MEMBER, in order to add an |