summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2006-12-05 14:31:18 +0000
committerFrederic Peters <fpeters@entrouvert.com>2006-12-05 14:31:18 +0000
commitf491bbfc69e0d50e72e41654818e78ccaa715ed8 (patch)
tree1f62928331e9aa3e34964cce614225ea7e837ddc
parent7a1a57ba735298f8677e72b0f86f839a7ad16f15 (diff)
look up harder for encypted stuff
-rw-r--r--lasso/xml/xml.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index e36d59fd..c9a309c9 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -613,8 +613,20 @@ lasso_node_decrypt(LassoSaml2EncryptedElement* encrypted_element,
}
}
if (encrypted_key_node == NULL) {
- message(G_LOG_LEVEL_WARNING, "No EncryptedKey data\n");
- return NULL;
+ /* Look an EncryptedKey inside the EncryptedData */
+ xmlNode *t = encrypted_data_node;
+ while (t && strcmp((char*)t->name, "EncryptedKey") != 0 ) {
+ if (strcmp((char*)t->name, "EncryptedData") == 0 ||
+ strcmp((char*)t->name, "KeyInfo") == 0)
+ t = t->children;
+ t = t->next;
+ }
+
+ if (t == NULL) {
+ message(G_LOG_LEVEL_WARNING, "No EncryptedKey data");
+ return NULL;
+ }
+ encrypted_key_node = t;
}
/* Create a document to contain the node to decrypt */
@@ -624,21 +636,6 @@ lasso_node_decrypt(LassoSaml2EncryptedElement* encrypted_element,
doc2 = xmlNewDoc((xmlChar*)"1.0");
xmlDocSetRootElement(doc2, encrypted_key_node);
-#if 0
- /* This block can be used in case we must be compatible with an EncryptedKey
- * inside the EncryptedData
- */
- xmlNode *t = xml_node;
- while (t && strcmp((char*)t->name, "EncryptedKey") != 0 ) {
- if (strcmp((char*)t->name, "EncryptedData") == 0 ||
- strcmp((char*)t->name, "KeyInfo") == 0)
- t = t->children;
- t = t->next;
- }
- if (t == NULL)
- return NULL;
-#endif
-
/* create encryption context to decrypt EncryptedKey */
encCtx = xmlSecEncCtxCreate(NULL);
if (encCtx == NULL) {