Skip to content
Snippets Groups Projects
Commit c4ef2ba2 authored by Olav Morken's avatar Olav Morken
Browse files

xmlseclibs: Added updates from newest version.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@705 44740490-163a-0410-bde0-09ae8108e29a
parent 355861e6
No related branches found
No related tags found
No related merge requests found
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* @author Robert Richards <rrichards@cdatazone.org> * @author Robert Richards <rrichards@cdatazone.org>
* @copyright 2007 Robert Richards <rrichards@cdatazone.org> * @copyright 2007 Robert Richards <rrichards@cdatazone.org>
* @license http://www.opensource.org/licenses/bsd-license.php BSD License * @license http://www.opensource.org/licenses/bsd-license.php BSD License
* @version 1.2.0 * @version 1.2.1-dev
*/ */
/* /*
...@@ -80,6 +80,12 @@ function canonical($tree, $element, $withcomments) { ...@@ -80,6 +80,12 @@ function canonical($tree, $element, $withcomments) {
$dom = $tree; $dom = $tree;
} }
if ($element->nodeType != XML_ELEMENT_NODE) { if ($element->nodeType != XML_ELEMENT_NODE) {
if ($element->nodeType == XML_DOCUMENT_NODE) {
foreach ($element->childNodes AS $node) {
canonical($dom, $node, $withcomments);
}
return;
}
if ($element->nodeType == XML_COMMENT_NODE && ! $withcomments) { if ($element->nodeType == XML_COMMENT_NODE && ! $withcomments) {
return; return;
} }
...@@ -165,8 +171,8 @@ function C14NGeneral($element, $exclusive=FALSE, $withcomments=FALSE) { ...@@ -165,8 +171,8 @@ function C14NGeneral($element, $exclusive=FALSE, $withcomments=FALSE) {
return $element->C14N($exclusive, $withcomments); return $element->C14N($exclusive, $withcomments);
} }
/* Must be element */ /* Must be element or document */
if (! $element instanceof DOMElement) { if (! $element instanceof DOMElement && ! $element instanceof DOMDocument) {
return NULL; return NULL;
} }
/* Currently only exclusive XML is supported */ /* Currently only exclusive XML is supported */
...@@ -372,7 +378,7 @@ class XMLSecurityKey { ...@@ -372,7 +378,7 @@ class XMLSecurityKey {
private function encryptOpenSSL($data) { private function encryptOpenSSL($data) {
if ($this->cryptParams['type'] == 'public') { if ($this->cryptParams['type'] == 'public') {
if (! openssl_public_encrypt($data, $encrypted_data, $this->key, $this->cryptParams['padding'])) { if (! openssl_public_encrypt($data, $encrypted_data, $this->key, $this->cryptParams['padding'])) {
throw new Exception('Failure encrypting Data ' . openssl_error_string() . "###" . $this->key); throw new Exception('Failure encrypting Data');
return; return;
} }
} else { } else {
...@@ -392,7 +398,7 @@ class XMLSecurityKey { ...@@ -392,7 +398,7 @@ class XMLSecurityKey {
} }
} else { } else {
if (! openssl_private_decrypt($data, $decrypted, $this->key, $this->cryptParams['padding'])) { if (! openssl_private_decrypt($data, $decrypted, $this->key, $this->cryptParams['padding'])) {
throw new Exception('Failure decrypting Data' . openssl_error_string() . "###" . $this->key); throw new Exception('Failure decrypting Data');
return; return;
} }
} }
...@@ -694,7 +700,12 @@ class XMLSecurityDSig { ...@@ -694,7 +700,12 @@ class XMLSecurityDSig {
default: default:
throw new Exception("Cannot validate digest: Unsupported Algorith <$digestAlgorithm>"); throw new Exception("Cannot validate digest: Unsupported Algorith <$digestAlgorithm>");
} }
return base64_encode(hash($alg, $data, TRUE)); if (function_exists('hash')) {
return base64_encode(hash($alg, $data, TRUE));
} else {
$alg = "MHASH_" . strtoupper($alg);
return base64_encode(mhash(constant($alg), $data));
}
} }
public function validateDigest($refNode, $data) { public function validateDigest($refNode, $data) {
...@@ -882,7 +893,7 @@ class XMLSecurityDSig { ...@@ -882,7 +893,7 @@ class XMLSecurityDSig {
$prefix = empty($options['prefix'])?NULL:$options['prefix']; $prefix = empty($options['prefix'])?NULL:$options['prefix'];
$prefix_ns = empty($options['prefix_ns'])?NULL:$options['prefix_ns']; $prefix_ns = empty($options['prefix_ns'])?NULL:$options['prefix_ns'];
$id_name = empty($options['id_name'])?'Id':$options['id_name']; $id_name = empty($options['id_name'])?'Id':$options['id_name'];
$overwrite_id = empty($options['overwrite'])?TRUE:(bool)$options['overwrite']; $overwrite_id = !isset($options['overwrite'])?TRUE:(bool)$options['overwrite'];
} }
$attname = $id_name; $attname = $id_name;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment