diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2011-11-29 12:36:47 +0100 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2011-11-29 12:36:47 +0100 |
commit | 29800377a38349c04e3744aa736fc9e70c2bf16a (patch) | |
tree | ab00fde9b27760febeeeda86ff6b348a58803d90 /lasso/xml | |
parent | 92ebef91f584d3afd72ded1747c09981b4476c14 (diff) | |
parent | b785881e531116da7250190e632bd205212a9bdf (diff) | |
download | lasso-29800377a38349c04e3744aa736fc9e70c2bf16a.tar.gz lasso-29800377a38349c04e3744aa736fc9e70c2bf16a.tar.xz lasso-29800377a38349c04e3744aa736fc9e70c2bf16a.zip |
Merge branch 'multi-certificates'
Diffstat (limited to 'lasso/xml')
-rw-r--r-- | lasso/xml/tools.c | 7 | ||||
-rw-r--r-- | lasso/xml/xml.c | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c index 0eeb8d2f..b4afba91 100644 --- a/lasso/xml/tools.c +++ b/lasso/xml/tools.c @@ -1574,7 +1574,7 @@ lasso_node_decrypt_xmlnode(xmlNode* encrypted_element, xmlChar *algorithm = NULL; xmlSecKeyDataId key_type; GList *i = NULL; - int rc = LASSO_DS_ERROR_DECRYPTION_FAILED; + int rc = LASSO_XMLENC_ERROR_INVALID_ENCRYPTED_DATA; if (encryption_private_key == NULL || !xmlSecKeyIsValid(encryption_private_key)) { message(G_LOG_LEVEL_WARNING, "Invalid decryption key"); @@ -1582,6 +1582,8 @@ lasso_node_decrypt_xmlnode(xmlNode* encrypted_element, goto cleanup; } + xmlSetGenericErrorFunc(NULL, lasso_xml_generic_error_func); + /* Need to duplicate it because xmlSecEncCtxDestroy(encCtx); will destroy it */ encryption_private_key = xmlSecKeyDuplicate(encryption_private_key); @@ -1655,8 +1657,8 @@ lasso_node_decrypt_xmlnode(xmlNode* encrypted_element, if (key_buffer != NULL) { sym_key = xmlSecKeyReadBuffer(key_type, key_buffer); } + rc = LASSO_DS_ERROR_ENCRYPTION_FAILED; if (sym_key == NULL) { - message(G_LOG_LEVEL_WARNING, "EncryptedKey decryption failed"); goto cleanup; } @@ -1673,6 +1675,7 @@ lasso_node_decrypt_xmlnode(xmlNode* encrypted_element, /* decrypt the EncryptedData */ if ((xmlSecEncCtxDecrypt(encCtx, encrypted_data_node) < 0) || (encCtx->result == NULL)) { + rc = LASSO_XMLENC_ERROR_INVALID_ENCRYPTED_DATA; message(G_LOG_LEVEL_WARNING, "EncryptedData decryption failed"); goto cleanup; } diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c index 465a6992..9ce3f245 100644 --- a/lasso/xml/xml.c +++ b/lasso/xml/xml.c @@ -916,6 +916,7 @@ _lasso_node_free_custom_element(struct _CustomElement *custom_element) lasso_release_string(custom_element->private_key); lasso_release_string(custom_element->private_key_password); lasso_release_string(custom_element->certificate); + lasso_release_sec_key(custom_element->encryption_public_key); } lasso_release(custom_element); } |