diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-07-16 19:34:23 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-07-16 19:34:23 +0000 |
| commit | f8ce6b25e5aab36a82017a6dfd4229cbeabbc5dc (patch) | |
| tree | e6345ff2d168a3576a5199b90fa6c01dc9055e0d | |
| parent | c939427f217655e4f13204b0a24aa99039d86d79 (diff) | |
| download | lasso-f8ce6b25e5aab36a82017a6dfd4229cbeabbc5dc.tar.gz lasso-f8ce6b25e5aab36a82017a6dfd4229cbeabbc5dc.tar.xz lasso-f8ce6b25e5aab36a82017a6dfd4229cbeabbc5dc.zip | |
[Code] add a lasso_node_export_to_query_with_password method
| -rw-r--r-- | lasso/xml/xml.c | 37 | ||||
| -rw-r--r-- | lasso/xml/xml.h | 4 |
2 files changed, 41 insertions, 0 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 6c3358ae..f5339721 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -393,6 +393,43 @@ lasso_node_export_to_query(LassoNode *node, } /** + * lasso_node_export_to_query_with_password: + * @node: a #LassoNode + * @sign_method:(default 1): the Signature transform method + * @private_key_file:(allow-none): the path to the private key (may be NULL) + * @private_key_file_password:(allow-none): the password needed to decrypt the private key + * + * Exports @node to a HTTP query string. If @private_key_file is NULL, + * query won't be signed. + * + * Return value: a HTTP query export of @node. The string must be freed by the + * caller. + **/ +char* +lasso_node_export_to_query_with_password(LassoNode *node, + LassoSignatureMethod sign_method, const char *private_key_file, + const char *private_key_file_password) +{ + char *unsigned_query, *query = NULL; + + g_return_val_if_fail(LASSO_IS_NODE(node), NULL); + + unsigned_query = lasso_node_build_query(node); + if (unsigned_query == NULL) { + return NULL; + } + if (private_key_file) { + query = lasso_query_sign(unsigned_query, sign_method, private_key_file, + private_key_file_password); + } else { + lasso_transfer_string(query, unsigned_query); + } + lasso_release(unsigned_query); + + return query; +} + +/** * lasso_node_export_to_xml: * @node: a #LassoNode * diff --git a/lasso/xml/xml.h b/lasso/xml/xml.h index b6c92fbc..06709c02 100644 --- a/lasso/xml/xml.h +++ b/lasso/xml/xml.h @@ -140,6 +140,10 @@ LASSO_EXPORT char* lasso_node_export_to_base64(LassoNode *node); LASSO_EXPORT char* lasso_node_export_to_query(LassoNode *node, LassoSignatureMethod sign_method, const char *private_key_file); +LASSO_EXPORT char* lasso_node_export_to_query_with_password(LassoNode *node, + LassoSignatureMethod sign_method, const char *private_key_file, + const char *private_key_file_password); + LASSO_EXPORT char* lasso_node_export_to_soap(LassoNode *node); LASSO_EXPORT gchar* lasso_node_export_to_xml(LassoNode *node); |
