diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-12-14 01:58:38 +0100 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-12-14 01:58:38 +0100 |
commit | 447c610c9cdfd81f46841a290964b20842cdb02d (patch) | |
tree | d0e317919c93654b38719c4546a0d896b00695d8 /lasso/xml | |
parent | 185ce3c139ba7c2a0ed779f158ea6b3dc3512720 (diff) | |
download | lasso-447c610c9cdfd81f46841a290964b20842cdb02d.tar.gz lasso-447c610c9cdfd81f46841a290964b20842cdb02d.tar.xz lasso-447c610c9cdfd81f46841a290964b20842cdb02d.zip |
[tools] fix xml decryption
This commit rewrite the extraction of the EncryptedKey when it is
embedded inside the EncryptedData element, which seem to be the frequent
case.
Diffstat (limited to 'lasso/xml')
-rw-r--r-- | lasso/xml/tools.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c index 9a91ccc3..c4b3c8aa 100644 --- a/lasso/xml/tools.c +++ b/lasso/xml/tools.c @@ -1591,16 +1591,13 @@ lasso_node_decrypt_xmlnode(xmlNode* encrypted_element, } } else { /* Look an EncryptedKey inside the EncryptedData */ - encrypted_key_node = encrypted_data_node; - while (encrypted_key_node && - strcmp((char*)encrypted_key_node->name, "EncryptedKey") != 0 ) { - if (strcmp((char*)encrypted_key_node->name, "EncryptedData") == 0 || - strcmp((char*)encrypted_key_node->name, "KeyInfo") == 0) { - encrypted_key_node = xmlCopyNode(encrypted_key_node->children, 1); + xmlNodePtr key_info; + do { + key_info = xmlSecFindChild(encrypted_data_node, xmlSecNodeKeyInfo, xmlSecDSigNs); + if (! key_info) break; - } - encrypted_key_node = encrypted_key_node->next; - } + encrypted_key_node = xmlSecFindChild(key_info, xmlSecNodeEncryptedKey, xmlSecEncNs); + } while (0); } if (encrypted_key_node == NULL) { |