import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -17,14 +17,9 @@
|
||||
* @subpackage Zend_InfoCard_Xml
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Assertion.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: Assertion.php 13213 2008-12-14 11:05:07Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Assertion_Interface
|
||||
*/
|
||||
@ -71,6 +66,7 @@ final class Zend_InfoCard_Xml_Assertion
|
||||
} else if (is_string($xmlData)) {
|
||||
$strXmlData = $xmlData;
|
||||
} else {
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Exception("Invalid Data provided to create instance");
|
||||
}
|
||||
|
||||
@ -86,6 +82,7 @@ final class Zend_InfoCard_Xml_Assertion
|
||||
}
|
||||
}
|
||||
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Exception("Unable to determine Assertion type by Namespace");
|
||||
}
|
||||
}
|
||||
|
@ -17,24 +17,14 @@
|
||||
* @subpackage Zend_InfoCard_Xml
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Element.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: Element.php 15577 2009-05-14 12:43:34Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Element_Interface
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Element/Interface.php';
|
||||
|
||||
/**
|
||||
* Zend_Loader
|
||||
*/
|
||||
require_once 'Zend/Loader.php';
|
||||
|
||||
/**
|
||||
* An abstract class representing a an XML data block
|
||||
*
|
||||
@ -72,6 +62,7 @@ abstract class Zend_InfoCard_Xml_Element
|
||||
if(!($dom instanceof DOMElement)) {
|
||||
// Zend_InfoCard_Xml_Element exntes SimpleXMLElement, so this should *never* fail
|
||||
// @codeCoverageIgnoreStart
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Exception("Failed to convert between SimpleXML and DOM");
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
@ -89,12 +80,15 @@ abstract class Zend_InfoCard_Xml_Element
|
||||
*/
|
||||
static public function convertToObject(DOMElement $e, $classname)
|
||||
{
|
||||
|
||||
Zend_Loader::loadClass($classname);
|
||||
if (!class_exists($classname)) {
|
||||
require_once 'Zend/Loader.php';
|
||||
Zend_Loader::loadClass($classname);
|
||||
}
|
||||
|
||||
$reflection = new ReflectionClass($classname);
|
||||
|
||||
if(!$reflection->isSubclassOf('Zend_InfoCard_Xml_Element')) {
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Exception("DOM element must be converted to an instance of Zend_InfoCard_Xml_Element");
|
||||
}
|
||||
|
||||
@ -103,6 +97,7 @@ abstract class Zend_InfoCard_Xml_Element
|
||||
if(!($sxe instanceof Zend_InfoCard_Xml_Element)) {
|
||||
// Since we just checked to see if this was a subclass of Zend_infoCard_Xml_Element this shoudl never fail
|
||||
// @codeCoverageIgnoreStart
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Exception("Failed to convert between DOM and SimpleXML");
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
@ -17,14 +17,9 @@
|
||||
* @subpackage Zend_InfoCard_Xml
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: EncryptedData.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: EncryptedData.php 13213 2008-12-14 11:05:07Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_EncryptedData
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
|
||||
/**
|
||||
* A factory class for producing Zend_InfoCard_Xml_EncryptedData objects based on
|
||||
* the type of XML document provided
|
||||
@ -61,6 +56,7 @@ final class Zend_InfoCard_Xml_EncryptedData
|
||||
} else if (is_string($xmlData)) {
|
||||
$strXmlData = $xmlData;
|
||||
} else {
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Exception("Invalid Data provided to create instance");
|
||||
}
|
||||
|
||||
@ -71,7 +67,9 @@ final class Zend_InfoCard_Xml_EncryptedData
|
||||
include_once 'Zend/InfoCard/Xml/EncryptedData/XmlEnc.php';
|
||||
return simplexml_load_string($strXmlData, 'Zend_InfoCard_Xml_EncryptedData_XmlEnc');
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Xml/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Exception("Unknown EncryptedData type found");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,9 @@
|
||||
* @subpackage Zend_InfoCard_Xml_Security
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Security.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: Security.php 13213 2008-12-14 11:05:07Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Security_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Security_Transform
|
||||
*/
|
||||
@ -94,28 +89,34 @@ class Zend_InfoCard_Xml_Security
|
||||
static public function validateXMLSignature($strXMLInput)
|
||||
{
|
||||
if(!extension_loaded('openssl')) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("You must have the openssl extension installed to use this class");
|
||||
}
|
||||
|
||||
$sxe = simplexml_load_string($strXMLInput);
|
||||
|
||||
if(!isset($sxe->Signature)) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Could not identify XML Signature element");
|
||||
}
|
||||
|
||||
if(!isset($sxe->Signature->SignedInfo)) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Signature is missing a SignedInfo block");
|
||||
}
|
||||
|
||||
if(!isset($sxe->Signature->SignatureValue)) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Signature is missing a SignatureValue block");
|
||||
}
|
||||
|
||||
if(!isset($sxe->Signature->KeyInfo)) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Signature is missing a KeyInfo block");
|
||||
}
|
||||
|
||||
if(!isset($sxe->Signature->KeyInfo->KeyValue)) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Signature is missing a KeyValue block");
|
||||
}
|
||||
|
||||
@ -124,7 +125,9 @@ class Zend_InfoCard_Xml_Security
|
||||
$cMethod = (string)$sxe->Signature->SignedInfo->CanonicalizationMethod['Algorithm'];
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Unknown or unsupported CanonicalizationMethod Requested");
|
||||
break;
|
||||
}
|
||||
|
||||
switch((string)$sxe->Signature->SignedInfo->SignatureMethod['Algorithm']) {
|
||||
@ -132,7 +135,9 @@ class Zend_InfoCard_Xml_Security
|
||||
$sMethod = (string)$sxe->Signature->SignedInfo->SignatureMethod['Algorithm'];
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Unknown or unsupported SignatureMethod Requested");
|
||||
break;
|
||||
}
|
||||
|
||||
switch((string)$sxe->Signature->SignedInfo->Reference->DigestMethod['Algorithm']) {
|
||||
@ -140,7 +145,9 @@ class Zend_InfoCard_Xml_Security
|
||||
$dMethod = (string)$sxe->Signature->SignedInfo->Reference->DigestMethod['Algorithm'];
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Unknown or unsupported DigestMethod Requested");
|
||||
break;
|
||||
}
|
||||
|
||||
$base64DecodeSupportsStrictParam = version_compare(PHP_VERSION, '5.2.0', '>=');
|
||||
@ -168,6 +175,7 @@ class Zend_InfoCard_Xml_Security
|
||||
$transformed_xml_binhash = pack("H*", sha1($transformed_xml));
|
||||
|
||||
if($transformed_xml_binhash != $dValue) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Locally Transformed XML does not match XML Document. Cannot Verify Signature");
|
||||
}
|
||||
|
||||
@ -186,6 +194,7 @@ class Zend_InfoCard_Xml_Security
|
||||
$public_key = openssl_pkey_get_public($pem);
|
||||
|
||||
if(!$public_key) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Unable to extract and prcoess X509 Certificate from KeyValue");
|
||||
}
|
||||
|
||||
@ -194,7 +203,8 @@ class Zend_InfoCard_Xml_Security
|
||||
|
||||
if(!isset($sxe->Signature->KeyInfo->KeyValue->RSAKeyValue->Modulus) ||
|
||||
!isset($sxe->Signature->KeyInfo->KeyValue->RSAKeyValue->Exponent)) {
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("RSA Key Value not in Modulus/Exponent form");
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("RSA Key Value not in Modulus/Exponent form");
|
||||
}
|
||||
|
||||
$modulus = base64_decode((string)$sxe->Signature->KeyInfo->KeyValue->RSAKeyValue->Modulus);
|
||||
@ -206,6 +216,7 @@ class Zend_InfoCard_Xml_Security
|
||||
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Unable to determine or unsupported representation of the KeyValue block");
|
||||
}
|
||||
|
||||
@ -284,9 +295,11 @@ class Zend_InfoCard_Xml_Security
|
||||
case ($len < 0x010000):
|
||||
return sprintf("%c%c%c%c%s", $type, 0x82, $len / 0x0100, $len % 0x0100, $data);
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Could not encode value");
|
||||
}
|
||||
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Invalid code path");
|
||||
}
|
||||
}
|
@ -17,14 +17,9 @@
|
||||
* @subpackage Zend_InfoCard_Xml_Security
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Transform.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: Transform.php 15577 2009-05-14 12:43:34Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Loader
|
||||
*/
|
||||
require_once 'Zend/Loader.php';
|
||||
|
||||
/**
|
||||
* A class to create a transform rule set based on XML URIs and then apply those rules
|
||||
* in the correct order to a given XML input
|
||||
@ -59,6 +54,7 @@ class Zend_InfoCard_Xml_Security_Transform
|
||||
case 'http://www.w3.org/2001/10/xml-exc-c14n#':
|
||||
return 'Zend_InfoCard_Xml_Security_Transform_XmlExcC14N';
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Unknown or Unsupported Transformation Requested");
|
||||
}
|
||||
}
|
||||
@ -97,13 +93,17 @@ class Zend_InfoCard_Xml_Security_Transform
|
||||
public function applyTransforms($strXmlDocument)
|
||||
{
|
||||
foreach($this->_transformList as $transform) {
|
||||
Zend_Loader::loadClass($transform['class']);
|
||||
if (!class_exists($transform['class'])) {
|
||||
require_once 'Zend/Loader.php';
|
||||
Zend_Loader::loadClass($transform['class']);
|
||||
}
|
||||
|
||||
$transformer = new $transform['class'];
|
||||
|
||||
// We can't really test this check because it would require logic changes in the component itself
|
||||
// @codeCoverageIgnoreStart
|
||||
if(!($transformer instanceof Zend_InfoCard_Xml_Security_Transform_Interface)) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Exception("Transforms must implement the Transform Interface");
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_InfoCard_Xml_Security
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: EnvelopedSignature.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: EnvelopedSignature.php 13213 2008-12-14 11:05:07Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -25,11 +25,6 @@
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Security/Transform/Interface.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Security_Transform_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Security/Transform/Exception.php';
|
||||
|
||||
/**
|
||||
* A object implementing the EnvelopedSignature XML Transform
|
||||
*
|
||||
@ -54,6 +49,7 @@ class Zend_InfoCard_Xml_Security_Transform_EnvelopedSignature
|
||||
$sxe = simplexml_load_string($strXMLData);
|
||||
|
||||
if(!$sxe->Signature) {
|
||||
require_once 'Zend/InfoCard/Xml/Security/Transform/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Transform_Exception("Unable to locate Signature Block for EnvelopedSignature Transform");
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_InfoCard_Xml_Security
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: XmlExcC14N.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: XmlExcC14N.php 13213 2008-12-14 11:05:07Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -25,11 +25,6 @@
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Security/Transform/Interface.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Xml_Security_Transform_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Xml/Security/Transform/Exception.php';
|
||||
|
||||
/**
|
||||
* A Transform to perform C14n XML Exclusive Canonicalization
|
||||
*
|
||||
@ -58,6 +53,7 @@ class Zend_InfoCard_Xml_Security_Transform_XmlExcC14N
|
||||
return $dom->C14N(true, false);
|
||||
}
|
||||
|
||||
require_once 'Zend/InfoCard/Xml/Security/Transform/Exception.php';
|
||||
throw new Zend_InfoCard_Xml_Security_Transform_Exception("This transform requires the C14N() method to exist in the DOM extension");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user