diff --git a/src/XML/ds/AbstractDSAKeyValueType.php b/src/XML/ds/AbstractDSAKeyValueType.php index 7462f5e4..d63ba38b 100644 --- a/src/XML/ds/AbstractDSAKeyValueType.php +++ b/src/XML/ds/AbstractDSAKeyValueType.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use function array_pop; @@ -17,8 +19,10 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractDSAKeyValueType extends AbstractDsElement +abstract class AbstractDSAKeyValueType extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * DSAKeyValueType constructor. * diff --git a/src/XML/ds/AbstractDsElement.php b/src/XML/ds/AbstractDsElement.php index efb759ba..587dc681 100644 --- a/src/XML/ds/AbstractDsElement.php +++ b/src/XML/ds/AbstractDsElement.php @@ -19,4 +19,7 @@ abstract class AbstractDsElement extends AbstractElement /** @var string */ public const NS_PREFIX = 'ds'; + + /** @var string */ + public const SCHEMA = 'resources/schemas/xmldsig-core-schema.xsd'; } diff --git a/src/XML/ds/AbstractPGPDataType.php b/src/XML/ds/AbstractPGPDataType.php index 081ed14c..644c0fc9 100644 --- a/src/XML/ds/AbstractPGPDataType.php +++ b/src/XML/ds/AbstractPGPDataType.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement; @@ -20,9 +22,10 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractPGPDataType extends AbstractDsElement +abstract class AbstractPGPDataType extends AbstractDsElement implements SchemaValidatableElementInterface { use ExtendableElementTrait; + use SchemaValidatableElementTrait; /** @var \SimpleSAML\XML\XsNamespace */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; diff --git a/src/XML/ds/AbstractSPKIDataType.php b/src/XML/ds/AbstractSPKIDataType.php index e72ebf28..89621d9f 100644 --- a/src/XML/ds/AbstractSPKIDataType.php +++ b/src/XML/ds/AbstractSPKIDataType.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Registry\ElementRegistry; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSecurity\XML\ds\AbstractDsElement; @@ -18,8 +20,10 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractSPKIDataType extends AbstractDsElement +abstract class AbstractSPKIDataType extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a SPKIData element. * diff --git a/src/XML/ds/CanonicalizationMethod.php b/src/XML/ds/CanonicalizationMethod.php index ddb319f5..bf5c66a8 100644 --- a/src/XML/ds/CanonicalizationMethod.php +++ b/src/XML/ds/CanonicalizationMethod.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; @@ -16,8 +18,10 @@ * * @package simplesamlphp/xml-security */ -final class CanonicalizationMethod extends AbstractDsElement +final class CanonicalizationMethod extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a CanonicalizationMethod element. * diff --git a/src/XML/ds/DigestMethod.php b/src/XML/ds/DigestMethod.php index 335d5d4e..0dc2f333 100644 --- a/src/XML/ds/DigestMethod.php +++ b/src/XML/ds/DigestMethod.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; @@ -18,9 +20,10 @@ * * @package simplesamlphp/xml-security */ -final class DigestMethod extends AbstractDsElement +final class DigestMethod extends AbstractDsElement implements SchemaValidatableElementInterface { use ExtendableElementTrait; + use SchemaValidatableElementTrait; public const XS_ANY_ELT_NAMESPACE = NS::OTHER; diff --git a/src/XML/ds/DigestValue.php b/src/XML/ds/DigestValue.php index 413c563f..9747af30 100644 --- a/src/XML/ds/DigestValue.php +++ b/src/XML/ds/DigestValue.php @@ -5,15 +5,18 @@ namespace SimpleSAML\XMLSecurity\XML\ds; use SimpleSAML\XML\Base64ElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing a ds:DigestValue element. * * @package simplesaml/xml-security */ -final class DigestValue extends AbstractDsElement +final class DigestValue extends AbstractDsElement implements SchemaValidatableElementInterface { use Base64ElementTrait; + use SchemaValidatableElementTrait; /** diff --git a/src/XML/ds/DsObject.php b/src/XML/ds/DsObject.php index 00f0fae0..55f944be 100644 --- a/src/XML/ds/DsObject.php +++ b/src/XML/ds/DsObject.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; /** @@ -15,9 +17,10 @@ * * @package simplesamlphp/xml-security */ -final class DsObject extends AbstractDsElement +final class DsObject extends AbstractDsElement implements SchemaValidatableElementInterface { use ExtendableElementTrait; + use SchemaValidatableElementTrait; /** @var string */ public const LOCALNAME = 'Object'; diff --git a/src/XML/ds/KeyInfo.php b/src/XML/ds/KeyInfo.php index ae5d5a27..01cb7c13 100644 --- a/src/XML/ds/KeyInfo.php +++ b/src/XML/ds/KeyInfo.php @@ -7,6 +7,8 @@ use DOMElement; use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use function array_merge; @@ -15,8 +17,10 @@ * * @package simplesamlphp/xml-security */ -final class KeyInfo extends AbstractKeyInfoType +final class KeyInfo extends AbstractKeyInfoType implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Convert XML into a KeyInfo * diff --git a/src/XML/ds/KeyName.php b/src/XML/ds/KeyName.php index 9b4662ff..b16bd14c 100644 --- a/src/XML/ds/KeyName.php +++ b/src/XML/ds/KeyName.php @@ -4,6 +4,8 @@ namespace SimpleSAML\XMLSecurity\XML\ds; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\StringElementTrait; /** @@ -11,8 +13,9 @@ * * @package simplesamlphp/xml-security */ -final class KeyName extends AbstractDsElement +final class KeyName extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; use StringElementTrait; diff --git a/src/XML/ds/KeyValue.php b/src/XML/ds/KeyValue.php index 7677371b..7fba8cc6 100644 --- a/src/XML/ds/KeyValue.php +++ b/src/XML/ds/KeyValue.php @@ -11,6 +11,8 @@ use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; /** @@ -18,9 +20,10 @@ * * @package simplesamlphp/xml-security */ -final class KeyValue extends AbstractDsElement +final class KeyValue extends AbstractDsElement implements SchemaValidatableElementInterface { use ExtendableElementTrait; + use SchemaValidatableElementTrait; /** The namespace-attribute for the xs:any element */ diff --git a/src/XML/ds/Manifest.php b/src/XML/ds/Manifest.php index 9eac89ab..171cae55 100644 --- a/src/XML/ds/Manifest.php +++ b/src/XML/ds/Manifest.php @@ -9,14 +9,18 @@ use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing a ds:Manifest element. * * @package simplesamlphp/xml-security */ -final class Manifest extends AbstractDsElement +final class Manifest extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a ds:Manifest * diff --git a/src/XML/ds/MgmtData.php b/src/XML/ds/MgmtData.php index 23a1d7de..b51eb4cc 100644 --- a/src/XML/ds/MgmtData.php +++ b/src/XML/ds/MgmtData.php @@ -4,6 +4,8 @@ namespace SimpleSAML\XMLSecurity\XML\ds; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\StringElementTrait; /** @@ -11,8 +13,9 @@ * * @package simplesamlphp/xml-security */ -final class MgmtData extends AbstractDsElement +final class MgmtData extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; use StringElementTrait; diff --git a/src/XML/ds/RSAKeyValue.php b/src/XML/ds/RSAKeyValue.php index ff56e935..4bfef458 100644 --- a/src/XML/ds/RSAKeyValue.php +++ b/src/XML/ds/RSAKeyValue.php @@ -9,14 +9,18 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing a ds:RSAKeyValue element. * * @package simplesamlphp/xml-security */ -final class RSAKeyValue extends AbstractDsElement +final class RSAKeyValue extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize an RSAKeyValue. * diff --git a/src/XML/ds/Reference.php b/src/XML/ds/Reference.php index 86baeab8..e645b485 100644 --- a/src/XML/ds/Reference.php +++ b/src/XML/ds/Reference.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use function array_pop; @@ -17,8 +19,10 @@ * * @package simplesamlphp/xml-security */ -final class Reference extends AbstractDsElement +final class Reference extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a ds:Reference * diff --git a/src/XML/ds/RetrievalMethod.php b/src/XML/ds/RetrievalMethod.php index e14b15c4..01419508 100644 --- a/src/XML/ds/RetrievalMethod.php +++ b/src/XML/ds/RetrievalMethod.php @@ -9,14 +9,18 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing a ds:RetrievalMethod element. * * @package simplesamlphp/xml-security */ -final class RetrievalMethod extends AbstractDsElement +final class RetrievalMethod extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a ds:RetrievalMethod * diff --git a/src/XML/ds/Signature.php b/src/XML/ds/Signature.php index 93658706..9211e5fd 100644 --- a/src/XML/ds/Signature.php +++ b/src/XML/ds/Signature.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Constants as C; use function array_pop; @@ -18,8 +20,10 @@ * * @package simplesamlphp/xml-security */ -final class Signature extends AbstractDsElement +final class Signature extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Signature constructor. * diff --git a/src/XML/ds/SignatureMethod.php b/src/XML/ds/SignatureMethod.php index 72f72be7..eeb04d8a 100644 --- a/src/XML/ds/SignatureMethod.php +++ b/src/XML/ds/SignatureMethod.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; @@ -23,9 +25,10 @@ * * @package simplesamlphp/xml-security */ -final class SignatureMethod extends AbstractDsElement +final class SignatureMethod extends AbstractDsElement implements SchemaValidatableElementInterface { use ExtendableElementTrait; + use SchemaValidatableElementTrait; /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; diff --git a/src/XML/ds/SignatureProperties.php b/src/XML/ds/SignatureProperties.php index cb8cbe10..ac0290ac 100644 --- a/src/XML/ds/SignatureProperties.php +++ b/src/XML/ds/SignatureProperties.php @@ -10,14 +10,18 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing a ds:SignatureProperties element. * * @package simplesamlphp/xml-security */ -final class SignatureProperties extends AbstractDsElement +final class SignatureProperties extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a ds:SignatureProperties * diff --git a/src/XML/ds/SignatureProperty.php b/src/XML/ds/SignatureProperty.php index 858b16f4..1c31fd4c 100644 --- a/src/XML/ds/SignatureProperty.php +++ b/src/XML/ds/SignatureProperty.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; /** @@ -17,10 +19,10 @@ * * @package simplesamlphp/xml-security */ -final class SignatureProperty extends AbstractDsElement +final class SignatureProperty extends AbstractDsElement implements SchemaValidatableElementInterface { use ExtendableElementTrait; - + use SchemaValidatableElementTrait; /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; diff --git a/src/XML/ds/SignatureValue.php b/src/XML/ds/SignatureValue.php index d90f3c7d..11176aac 100644 --- a/src/XML/ds/SignatureValue.php +++ b/src/XML/ds/SignatureValue.php @@ -8,15 +8,18 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Base64ElementTrait; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing a ds:SignatureValue element. * * @package simplesaml/xml-security */ -final class SignatureValue extends AbstractDsElement +final class SignatureValue extends AbstractDsElement implements SchemaValidatableElementInterface { use Base64ElementTrait; + use SchemaValidatableElementTrait; /** diff --git a/src/XML/ds/SignedInfo.php b/src/XML/ds/SignedInfo.php index 4c83d61d..658589ca 100644 --- a/src/XML/ds/SignedInfo.php +++ b/src/XML/ds/SignedInfo.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; use SimpleSAML\XMLSecurity\XML\CanonicalizableElementInterface; use SimpleSAML\XMLSecurity\XML\CanonicalizableElementTrait; @@ -21,9 +23,12 @@ * * @package simplesamlphp/xml-security */ -final class SignedInfo extends AbstractDsElement implements CanonicalizableElementInterface +final class SignedInfo extends AbstractDsElement implements + CanonicalizableElementInterface, + SchemaValidatableElementInterface { use CanonicalizableElementTrait; + use SchemaValidatableElementTrait; /* * @var DOMElement diff --git a/src/XML/ds/Transform.php b/src/XML/ds/Transform.php index b18abb31..915144ee 100644 --- a/src/XML/ds/Transform.php +++ b/src/XML/ds/Transform.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\XML\ec\InclusiveNamespaces; @@ -19,8 +21,10 @@ * * @package simplesamlphp/xml-security */ -class Transform extends AbstractDsElement +class Transform extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize the Transform element. * diff --git a/src/XML/ds/Transforms.php b/src/XML/ds/Transforms.php index aef93203..ad068a8d 100644 --- a/src/XML/ds/Transforms.php +++ b/src/XML/ds/Transforms.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; /** @@ -15,8 +17,10 @@ * * @package simplesamlphp/xml-security */ -final class Transforms extends AbstractDsElement +final class Transforms extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a ds:Transforms * diff --git a/src/XML/ds/X509Data.php b/src/XML/ds/X509Data.php index ee8d61db..ae2a4845 100644 --- a/src/XML/ds/X509Data.php +++ b/src/XML/ds/X509Data.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; use SimpleSAML\XMLSecurity\XML\dsig11\X509Digest; @@ -17,8 +19,10 @@ * * @package simplesamlphp/xml-security */ -final class X509Data extends AbstractDsElement +final class X509Data extends AbstractDsElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a X509Data. * diff --git a/src/XML/dsig11/AbstractDsig11Element.php b/src/XML/dsig11/AbstractDsig11Element.php index 1c3b53bb..8a6907d6 100644 --- a/src/XML/dsig11/AbstractDsig11Element.php +++ b/src/XML/dsig11/AbstractDsig11Element.php @@ -19,4 +19,7 @@ abstract class AbstractDsig11Element extends AbstractElement /** @var string */ public const NS_PREFIX = 'dsig11'; + + /** @var string */ + public const SCHEMA = 'resources/schemas/xmldsig11-schema.xsd'; } diff --git a/src/XML/dsig11/KeyInfoReference.php b/src/XML/dsig11/KeyInfoReference.php index b9a6a78e..fdc9526d 100644 --- a/src/XML/dsig11/KeyInfoReference.php +++ b/src/XML/dsig11/KeyInfoReference.php @@ -8,14 +8,18 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing a dsig11:KeyInfoReference element. * * @package simplesamlphp/xml-security */ -final class KeyInfoReference extends AbstractDsig11Element +final class KeyInfoReference extends AbstractDsig11Element implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize a KeyInfoReference element. * diff --git a/src/XML/dsig11/X509Digest.php b/src/XML/dsig11/X509Digest.php index 0eda198a..607084dc 100644 --- a/src/XML/dsig11/X509Digest.php +++ b/src/XML/dsig11/X509Digest.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Base64ElementTrait; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; @@ -17,9 +19,10 @@ * * @package simplesaml/xml-security */ -final class X509Digest extends AbstractDsig11Element +final class X509Digest extends AbstractDsig11Element implements SchemaValidatableElementInterface { use Base64ElementTrait; + use SchemaValidatableElementTrait; /** diff --git a/src/XML/ec/AbstractEcElement.php b/src/XML/ec/AbstractEcElement.php index 8509dd21..98a23823 100644 --- a/src/XML/ec/AbstractEcElement.php +++ b/src/XML/ec/AbstractEcElement.php @@ -19,4 +19,7 @@ abstract class AbstractEcElement extends AbstractElement /** @var string */ public const NS_PREFIX = 'ec'; + + /** @var string */ + public const SCHEMA = 'resources/schemas/exc-c14n.xsd'; } diff --git a/src/XML/ec/InclusiveNamespaces.php b/src/XML/ec/InclusiveNamespaces.php index eb79c964..49d4c173 100644 --- a/src/XML/ec/InclusiveNamespaces.php +++ b/src/XML/ec/InclusiveNamespaces.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; use function explode; @@ -18,8 +20,10 @@ * * @package simplesamlphp/xml-security */ -class InclusiveNamespaces extends AbstractEcElement +class InclusiveNamespaces extends AbstractEcElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * Initialize the InclusiveNamespaces element. * diff --git a/src/XML/xenc/AbstractAgreementMethodType.php b/src/XML/xenc/AbstractAgreementMethodType.php index 978dbb62..979eeb51 100644 --- a/src/XML/xenc/AbstractAgreementMethodType.php +++ b/src/XML/xenc/AbstractAgreementMethodType.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; use function array_pop; @@ -19,9 +21,10 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractAgreementMethodType extends AbstractXencElement +abstract class AbstractAgreementMethodType extends AbstractXencElement implements SchemaValidatableElementInterface { use ExtendableElementTrait; + use SchemaValidatableElementTrait; /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; diff --git a/src/XML/xenc/AbstractDHKeyValueType.php b/src/XML/xenc/AbstractDHKeyValueType.php index ff1afde2..2ba0144b 100644 --- a/src/XML/xenc/AbstractDHKeyValueType.php +++ b/src/XML/xenc/AbstractDHKeyValueType.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use function array_pop; @@ -18,8 +20,10 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractDHKeyValueType extends AbstractXencElement +abstract class AbstractDHKeyValueType extends AbstractXencElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * DHKeyValueType constructor. * diff --git a/src/XML/xenc/AbstractEncryptionPropertiesType.php b/src/XML/xenc/AbstractEncryptionPropertiesType.php index 5b9810b8..ab272f30 100644 --- a/src/XML/xenc/AbstractEncryptionPropertiesType.php +++ b/src/XML/xenc/AbstractEncryptionPropertiesType.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\Exception\SchemaViolationException; /** @@ -15,8 +17,11 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractEncryptionPropertiesType extends AbstractXencElement +abstract class AbstractEncryptionPropertiesType extends AbstractXencElement implements + SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * EncryptionProperty constructor. * diff --git a/src/XML/xenc/AbstractEncryptionPropertyType.php b/src/XML/xenc/AbstractEncryptionPropertyType.php index a70ff237..b6a2756b 100644 --- a/src/XML/xenc/AbstractEncryptionPropertyType.php +++ b/src/XML/xenc/AbstractEncryptionPropertyType.php @@ -12,6 +12,8 @@ use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; /** @@ -19,10 +21,12 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractEncryptionPropertyType extends AbstractXencElement +abstract class AbstractEncryptionPropertyType extends AbstractXencElement implements + SchemaValidatableElementInterface { use ExtendableAttributesTrait; use ExtendableElementTrait; + use SchemaValidatableElementTrait; /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = [C::NS_XML]; diff --git a/src/XML/xenc/AbstractXencElement.php b/src/XML/xenc/AbstractXencElement.php index 32f74615..33444945 100644 --- a/src/XML/xenc/AbstractXencElement.php +++ b/src/XML/xenc/AbstractXencElement.php @@ -19,4 +19,7 @@ abstract class AbstractXencElement extends AbstractElement /** @var string */ public const NS_PREFIX = 'xenc'; + + /** @var string */ + public const SCHEMA = 'resources/schemas/xenc-schema.xsd'; } diff --git a/src/XML/xenc/CipherData.php b/src/XML/xenc/CipherData.php index 3da5ac6e..01067fdb 100644 --- a/src/XML/xenc/CipherData.php +++ b/src/XML/xenc/CipherData.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use function array_pop; @@ -16,8 +18,10 @@ * * @package simplesamlphp/xml-security */ -class CipherData extends AbstractXencElement +class CipherData extends AbstractXencElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * CipherData constructor. * diff --git a/src/XML/xenc/CipherReference.php b/src/XML/xenc/CipherReference.php index 592ee0cf..2b83c989 100644 --- a/src/XML/xenc/CipherReference.php +++ b/src/XML/xenc/CipherReference.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\XML\xenc\Transforms; /** @@ -16,8 +18,10 @@ * * @package simplesamlphp/xml-security */ -final class CipherReference extends AbstractXencElement +final class CipherReference extends AbstractXencElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * AbstractReference constructor. * diff --git a/src/XML/xenc/EncryptedData.php b/src/XML/xenc/EncryptedData.php index 52801f7d..317e573a 100644 --- a/src/XML/xenc/EncryptedData.php +++ b/src/XML/xenc/EncryptedData.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; use SimpleSAML\XMLSecurity\XML\xenc\CipherData; use SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod; @@ -22,8 +24,10 @@ * * @package simplesamlphp/xml-security */ -final class EncryptedData extends AbstractEncryptedType +final class EncryptedData extends AbstractEncryptedType implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * @inheritDoc * diff --git a/src/XML/xenc/EncryptedKey.php b/src/XML/xenc/EncryptedKey.php index 0dcf0603..7acd86d1 100644 --- a/src/XML/xenc/EncryptedKey.php +++ b/src/XML/xenc/EncryptedKey.php @@ -8,6 +8,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; use SimpleSAML\XMLSecurity\Key\KeyInterface; @@ -18,8 +20,10 @@ * * @package simplesamlphp/xml-security */ -final class EncryptedKey extends AbstractEncryptedType +final class EncryptedKey extends AbstractEncryptedType implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * EncryptedKey constructor. * diff --git a/src/XML/xenc/ReferenceList.php b/src/XML/xenc/ReferenceList.php index 537768e8..152e008e 100644 --- a/src/XML/xenc/ReferenceList.php +++ b/src/XML/xenc/ReferenceList.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Exception\InvalidArgumentException; use function array_merge; @@ -18,8 +20,10 @@ * * @package simplesamlphp/xml-security */ -class ReferenceList extends AbstractXencElement +class ReferenceList extends AbstractXencElement implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * ReferenceList constructor. * diff --git a/src/XML/xenc11/AbstractConcatKDFParamsType.php b/src/XML/xenc11/AbstractConcatKDFParamsType.php index f916d180..fd804962 100644 --- a/src/XML/xenc11/AbstractConcatKDFParamsType.php +++ b/src/XML/xenc11/AbstractConcatKDFParamsType.php @@ -10,6 +10,8 @@ use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\XML\ds\DigestMethod; use function array_pop; @@ -19,8 +21,11 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractConcatKDFParamsType extends AbstractXenc11Element +abstract class AbstractConcatKDFParamsType extends AbstractXenc11Element implements + SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * ConcatKDFParams constructor. * diff --git a/src/XML/xenc11/AbstractDerivedKeyType.php b/src/XML/xenc11/AbstractDerivedKeyType.php index 4531265a..5a1cd9ef 100644 --- a/src/XML/xenc11/AbstractDerivedKeyType.php +++ b/src/XML/xenc11/AbstractDerivedKeyType.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\XML\xenc\ReferenceList; use function array_pop; @@ -18,8 +20,11 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractDerivedKeyType extends AbstractXenc11Element +abstract class AbstractDerivedKeyType extends AbstractXenc11Element implements + SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * DerivedKey constructor. * diff --git a/src/XML/xenc11/AbstractKeyDerivationMethodType.php b/src/XML/xenc11/AbstractKeyDerivationMethodType.php index d6096817..ce9d3aee 100644 --- a/src/XML/xenc11/AbstractKeyDerivationMethodType.php +++ b/src/XML/xenc11/AbstractKeyDerivationMethodType.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\XsNamespace as NS; /** @@ -16,9 +18,11 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractKeyDerivationMethodType extends AbstractXenc11Element +abstract class AbstractKeyDerivationMethodType extends AbstractXenc11Element implements + SchemaValidatableElementInterface { use ExtendableElementTrait; + use SchemaValidatableElementTrait; /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::ANY; diff --git a/src/XML/xenc11/AbstractMGFType.php b/src/XML/xenc11/AbstractMGFType.php index fafd6e27..fea748bf 100644 --- a/src/XML/xenc11/AbstractMGFType.php +++ b/src/XML/xenc11/AbstractMGFType.php @@ -4,13 +4,19 @@ namespace SimpleSAML\XMLSecurity\XML\xenc11; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; + /** * Class representing . * * @package simplesamlphp/xml-security */ -abstract class AbstractMGFType extends AbstractAlgorithmIdentifierType +abstract class AbstractMGFType extends AbstractAlgorithmIdentifierType implements + SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * MGFType constructor. * diff --git a/src/XML/xenc11/AbstractPBKDF2ParameterType.php b/src/XML/xenc11/AbstractPBKDF2ParameterType.php index 69465d8b..51848bf9 100644 --- a/src/XML/xenc11/AbstractPBKDF2ParameterType.php +++ b/src/XML/xenc11/AbstractPBKDF2ParameterType.php @@ -9,6 +9,8 @@ use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use function array_pop; @@ -17,8 +19,10 @@ * * @package simplesamlphp/xml-security */ -abstract class AbstractPBKDF2ParameterType extends AbstractXenc11Element +abstract class AbstractPBKDF2ParameterType extends AbstractXenc11Element implements SchemaValidatableElementInterface { + use SchemaValidatableElementTrait; + /** * PBKDF2ParameterType constructor. * diff --git a/src/XML/xenc11/AbstractXenc11Element.php b/src/XML/xenc11/AbstractXenc11Element.php index dfc979c0..3abe9ef7 100644 --- a/src/XML/xenc11/AbstractXenc11Element.php +++ b/src/XML/xenc11/AbstractXenc11Element.php @@ -19,4 +19,7 @@ abstract class AbstractXenc11Element extends AbstractElement /** @var string */ public const NS_PREFIX = 'xenc11'; + + /** @var string */ + public const SCHEMA = 'resources/schemas/xenc-schema-11.xsd'; } diff --git a/tests/XML/ds/CanonicalizationMethodTest.php b/tests/XML/ds/CanonicalizationMethodTest.php index 32185f75..b5856a75 100644 --- a/tests/XML/ds/CanonicalizationMethodTest.php +++ b/tests/XML/ds/CanonicalizationMethodTest.php @@ -33,8 +33,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = CanonicalizationMethod::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_CanonicalizationMethod.xml', ); diff --git a/tests/XML/ds/DSAKeyValueTest.php b/tests/XML/ds/DSAKeyValueTest.php index 17ffefa3..19c7c902 100644 --- a/tests/XML/ds/DSAKeyValueTest.php +++ b/tests/XML/ds/DSAKeyValueTest.php @@ -42,8 +42,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = DSAKeyValue::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_DSAKeyValue.xml', ); diff --git a/tests/XML/ds/DigestMethodTest.php b/tests/XML/ds/DigestMethodTest.php index d5003507..2fd94b2e 100644 --- a/tests/XML/ds/DigestMethodTest.php +++ b/tests/XML/ds/DigestMethodTest.php @@ -35,8 +35,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = DigestMethod::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_DigestMethod.xml', ); diff --git a/tests/XML/ds/DigestValueTest.php b/tests/XML/ds/DigestValueTest.php index cc6565aa..d9fcacae 100644 --- a/tests/XML/ds/DigestValueTest.php +++ b/tests/XML/ds/DigestValueTest.php @@ -35,8 +35,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = DigestValue::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_DigestValue.xml', ); diff --git a/tests/XML/ds/KeyInfoTest.php b/tests/XML/ds/KeyInfoTest.php index f79bc478..2026673c 100644 --- a/tests/XML/ds/KeyInfoTest.php +++ b/tests/XML/ds/KeyInfoTest.php @@ -60,8 +60,6 @@ public function setUp(): void { self::$testedClass = KeyInfo::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_KeyInfo.xml', ); diff --git a/tests/XML/ds/KeyNameTest.php b/tests/XML/ds/KeyNameTest.php index 96fb9490..7e1b23eb 100644 --- a/tests/XML/ds/KeyNameTest.php +++ b/tests/XML/ds/KeyNameTest.php @@ -33,8 +33,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = KeyName::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_KeyName.xml', ); diff --git a/tests/XML/ds/KeyValueTest.php b/tests/XML/ds/KeyValueTest.php index a64a3711..da3f9695 100644 --- a/tests/XML/ds/KeyValueTest.php +++ b/tests/XML/ds/KeyValueTest.php @@ -48,8 +48,6 @@ protected function setUp(): void { self::$testedClass = KeyValue::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$empty = DOMDocumentFactory::fromString(''); self::$xmlRepresentation = DOMDocumentFactory::fromFile( diff --git a/tests/XML/ds/ManifestTest.php b/tests/XML/ds/ManifestTest.php index 8f9c1b8b..bd908222 100644 --- a/tests/XML/ds/ManifestTest.php +++ b/tests/XML/ds/ManifestTest.php @@ -40,8 +40,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = Manifest::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_Manifest.xml', ); diff --git a/tests/XML/ds/MgmtDataTest.php b/tests/XML/ds/MgmtDataTest.php index 935b87ce..e6d82212 100644 --- a/tests/XML/ds/MgmtDataTest.php +++ b/tests/XML/ds/MgmtDataTest.php @@ -33,8 +33,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = MgmtData::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_MgmtData.xml', ); diff --git a/tests/XML/ds/ObjectTest.php b/tests/XML/ds/ObjectTest.php index ad860bab..a055b5fc 100644 --- a/tests/XML/ds/ObjectTest.php +++ b/tests/XML/ds/ObjectTest.php @@ -32,8 +32,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = DsObject::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_Object.xml', ); diff --git a/tests/XML/ds/PGPDataTest.php b/tests/XML/ds/PGPDataTest.php index cc56a803..fce46e76 100644 --- a/tests/XML/ds/PGPDataTest.php +++ b/tests/XML/ds/PGPDataTest.php @@ -39,8 +39,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = PGPData::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_PGPData.xml', ); diff --git a/tests/XML/ds/RSAKeyValueTest.php b/tests/XML/ds/RSAKeyValueTest.php index 7bb563ae..0384e486 100644 --- a/tests/XML/ds/RSAKeyValueTest.php +++ b/tests/XML/ds/RSAKeyValueTest.php @@ -36,8 +36,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = RSAKeyValue::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_RSAKeyValue.xml', ); diff --git a/tests/XML/ds/ReferenceTest.php b/tests/XML/ds/ReferenceTest.php index fe4b51ff..97a67c2b 100644 --- a/tests/XML/ds/ReferenceTest.php +++ b/tests/XML/ds/ReferenceTest.php @@ -38,8 +38,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = Reference::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_Reference.xml', ); diff --git a/tests/XML/ds/RetrievalMethodTest.php b/tests/XML/ds/RetrievalMethodTest.php index ae44d499..57d1ba81 100644 --- a/tests/XML/ds/RetrievalMethodTest.php +++ b/tests/XML/ds/RetrievalMethodTest.php @@ -38,8 +38,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = RetrievalMethod::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_RetrievalMethod.xml', ); diff --git a/tests/XML/ds/SPKIDataTest.php b/tests/XML/ds/SPKIDataTest.php index b08b25d9..3efce155 100644 --- a/tests/XML/ds/SPKIDataTest.php +++ b/tests/XML/ds/SPKIDataTest.php @@ -38,8 +38,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = SPKIData::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_SPKIData.xml', ); diff --git a/tests/XML/ds/SignatureMethodTest.php b/tests/XML/ds/SignatureMethodTest.php index d1046a81..dcbc691a 100644 --- a/tests/XML/ds/SignatureMethodTest.php +++ b/tests/XML/ds/SignatureMethodTest.php @@ -37,8 +37,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = SignatureMethod::class; - self::$schemaFile = dirname(__FILE__, 3) . '/resources/schemas/simplesamlphp.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_SignatureMethod.xml', ); diff --git a/tests/XML/ds/SignaturePropertiesTest.php b/tests/XML/ds/SignaturePropertiesTest.php index 003592b3..a1d5b901 100644 --- a/tests/XML/ds/SignaturePropertiesTest.php +++ b/tests/XML/ds/SignaturePropertiesTest.php @@ -36,8 +36,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = SignatureProperties::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_SignatureProperties.xml', ); diff --git a/tests/XML/ds/SignaturePropertyTest.php b/tests/XML/ds/SignaturePropertyTest.php index 3f5cfc94..9d14ca8f 100644 --- a/tests/XML/ds/SignaturePropertyTest.php +++ b/tests/XML/ds/SignaturePropertyTest.php @@ -35,8 +35,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = SignatureProperty::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_SignatureProperty.xml', ); diff --git a/tests/XML/ds/SignatureTest.php b/tests/XML/ds/SignatureTest.php index 42ad0763..2c2e8498 100644 --- a/tests/XML/ds/SignatureTest.php +++ b/tests/XML/ds/SignatureTest.php @@ -40,8 +40,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = Signature::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_Signature.xml', ); diff --git a/tests/XML/ds/SignatureValueTest.php b/tests/XML/ds/SignatureValueTest.php index 571269a8..aea9f1d6 100644 --- a/tests/XML/ds/SignatureValueTest.php +++ b/tests/XML/ds/SignatureValueTest.php @@ -35,8 +35,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = SignatureValue::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_SignatureValue.xml', ); diff --git a/tests/XML/ds/SignedInfoTest.php b/tests/XML/ds/SignedInfoTest.php index 715b2c1e..7e83e291 100644 --- a/tests/XML/ds/SignedInfoTest.php +++ b/tests/XML/ds/SignedInfoTest.php @@ -38,8 +38,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = SignedInfo::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_SignedInfo.xml', ); diff --git a/tests/XML/ds/TransformTest.php b/tests/XML/ds/TransformTest.php index b7038eba..ff47bc41 100644 --- a/tests/XML/ds/TransformTest.php +++ b/tests/XML/ds/TransformTest.php @@ -37,8 +37,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = Transform::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_Transform.xml', ); diff --git a/tests/XML/ds/TransformsTest.php b/tests/XML/ds/TransformsTest.php index 8c8109b6..36710ece 100644 --- a/tests/XML/ds/TransformsTest.php +++ b/tests/XML/ds/TransformsTest.php @@ -36,8 +36,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = Transforms::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_Transforms.xml', ); diff --git a/tests/XML/ds/X509DataTest.php b/tests/XML/ds/X509DataTest.php index 85fa3cfd..a2ff2e3e 100644 --- a/tests/XML/ds/X509DataTest.php +++ b/tests/XML/ds/X509DataTest.php @@ -57,8 +57,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = X509Data::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig1-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/ds_X509Data.xml', ); diff --git a/tests/XML/dsig11/KeyInfoReferenceTest.php b/tests/XML/dsig11/KeyInfoReferenceTest.php index 5daa9a32..96005875 100644 --- a/tests/XML/dsig11/KeyInfoReferenceTest.php +++ b/tests/XML/dsig11/KeyInfoReferenceTest.php @@ -33,8 +33,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = KeyInfoReference::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig11-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/dsig11_KeyInfoReference.xml', ); diff --git a/tests/XML/dsig11/X509DigestTest.php b/tests/XML/dsig11/X509DigestTest.php index 29674705..0f50561c 100644 --- a/tests/XML/dsig11/X509DigestTest.php +++ b/tests/XML/dsig11/X509DigestTest.php @@ -44,8 +44,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = X509Digest::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xmldsig11-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/dsig11_X509Digest.xml', ); diff --git a/tests/XML/ec/InclusiveNamespacesTest.php b/tests/XML/ec/InclusiveNamespacesTest.php index b1c65da5..9989d685 100644 --- a/tests/XML/ec/InclusiveNamespacesTest.php +++ b/tests/XML/ec/InclusiveNamespacesTest.php @@ -31,8 +31,6 @@ class InclusiveNamespacesTest extends TestCase */ public static function setUpBeforeClass(): void { - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/exc-c14n.xsd'; - self::$testedClass = InclusiveNamespaces::class; self::$xmlRepresentation = DOMDocumentFactory::fromFile( diff --git a/tests/XML/xenc/AgreementMethodTest.php b/tests/XML/xenc/AgreementMethodTest.php index 46ec79dd..e8dfe992 100644 --- a/tests/XML/xenc/AgreementMethodTest.php +++ b/tests/XML/xenc/AgreementMethodTest.php @@ -47,8 +47,6 @@ public function setUp(): void { self::$testedClass = AgreementMethod::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_AgreementMethod.xml', ); diff --git a/tests/XML/xenc/CipherDataTest.php b/tests/XML/xenc/CipherDataTest.php index 069dc96c..dad95705 100644 --- a/tests/XML/xenc/CipherDataTest.php +++ b/tests/XML/xenc/CipherDataTest.php @@ -37,8 +37,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = CipherData::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_CipherData.xml', ); diff --git a/tests/XML/xenc/CipherReferenceTest.php b/tests/XML/xenc/CipherReferenceTest.php index ef68a877..320ae411 100644 --- a/tests/XML/xenc/CipherReferenceTest.php +++ b/tests/XML/xenc/CipherReferenceTest.php @@ -47,8 +47,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = CipherReference::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_CipherReference.xml', ); diff --git a/tests/XML/xenc/DHKeyValueTest.php b/tests/XML/xenc/DHKeyValueTest.php index 7545a420..32a834bb 100644 --- a/tests/XML/xenc/DHKeyValueTest.php +++ b/tests/XML/xenc/DHKeyValueTest.php @@ -46,8 +46,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = DHKeyValue::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_DHKeyValue.xml', ); diff --git a/tests/XML/xenc/EncryptedDataTest.php b/tests/XML/xenc/EncryptedDataTest.php index 3923ca4d..cba409aa 100644 --- a/tests/XML/xenc/EncryptedDataTest.php +++ b/tests/XML/xenc/EncryptedDataTest.php @@ -45,8 +45,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = EncryptedData::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_EncryptedData.xml', ); diff --git a/tests/XML/xenc/EncryptedKeyTest.php b/tests/XML/xenc/EncryptedKeyTest.php index 42bf8cd4..3ced3a2a 100644 --- a/tests/XML/xenc/EncryptedKeyTest.php +++ b/tests/XML/xenc/EncryptedKeyTest.php @@ -60,8 +60,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = EncryptedKey::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_EncryptedKey.xml', ); diff --git a/tests/XML/xenc/EncryptionPropertiesTest.php b/tests/XML/xenc/EncryptionPropertiesTest.php index 198439b4..867e2059 100644 --- a/tests/XML/xenc/EncryptionPropertiesTest.php +++ b/tests/XML/xenc/EncryptionPropertiesTest.php @@ -43,8 +43,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = EncryptionProperties::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_EncryptionProperties.xml', ); diff --git a/tests/XML/xenc/EncryptionPropertyTest.php b/tests/XML/xenc/EncryptionPropertyTest.php index 26f33c78..7d24b14c 100644 --- a/tests/XML/xenc/EncryptionPropertyTest.php +++ b/tests/XML/xenc/EncryptionPropertyTest.php @@ -42,8 +42,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = EncryptionProperty::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_EncryptionProperty.xml', ); diff --git a/tests/XML/xenc/ReferenceListTest.php b/tests/XML/xenc/ReferenceListTest.php index 19aa5601..127c28fd 100644 --- a/tests/XML/xenc/ReferenceListTest.php +++ b/tests/XML/xenc/ReferenceListTest.php @@ -42,8 +42,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = ReferenceList::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc_ReferenceList.xml', ); diff --git a/tests/XML/xenc11/ConcatKDFParamsTest.php b/tests/XML/xenc11/ConcatKDFParamsTest.php index 37bb9f07..4bffa81f 100644 --- a/tests/XML/xenc11/ConcatKDFParamsTest.php +++ b/tests/XML/xenc11/ConcatKDFParamsTest.php @@ -38,8 +38,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = ConcatKDFParams::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema-11.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc11_ConcatKDFParams.xml', ); diff --git a/tests/XML/xenc11/DerivedKeyTest.php b/tests/XML/xenc11/DerivedKeyTest.php index 3a275b58..ecfab8c1 100644 --- a/tests/XML/xenc11/DerivedKeyTest.php +++ b/tests/XML/xenc11/DerivedKeyTest.php @@ -6,12 +6,15 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\TestCase; +use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Utils\XPath as XPathUtils; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XMLSecurity\XML\ds\Exponent; +use SimpleSAML\XMLSecurity\XML\ds\Modulus; +use SimpleSAML\XMLSecurity\XML\ds\RSAKeyValue; use SimpleSAML\XMLSecurity\XML\ds\Transform; use SimpleSAML\XMLSecurity\XML\ds\Transforms; use SimpleSAML\XMLSecurity\XML\ds\XPath; @@ -51,8 +54,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = DerivedKey::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema-11.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc11_DerivedKey.xml', ); @@ -67,9 +68,12 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $alg = 'http://www.w3.org/2009/xmlenc11#ConcatKDF'; - $keyName = new KeyName('testkey'); + $RSAKeyValue = new RSAKeyValue( + new Modulus('dGhpcyBpcyBzb21lIHJhbmRvbSBtb2R1bHVzCg=='), + new Exponent('dGhpcyBpcyBzb21lIHJhbmRvbSBleHBvbmVudAo='), + ); - $keyDerivationMethod = new KeyDerivationMethod($alg, [$keyName]); + $keyDerivationMethod = new KeyDerivationMethod($alg, [$RSAKeyValue]); $transformData = new Transform( C::XPATH10_URI, @@ -114,9 +118,12 @@ public function testMarshalling(): void public function testMarshallingElementOrder(): void { $alg = 'http://www.w3.org/2009/xmlenc11#ConcatKDF'; - $keyName = new KeyName('testkey'); + $RSAKeyValue = new RSAKeyValue( + new Modulus('dGhpcyBpcyBzb21lIHJhbmRvbSBtb2R1bHVzCg=='), + new Exponent('dGhpcyBpcyBzb21lIHJhbmRvbSBleHBvbmVudAo='), + ); - $keyDerivationMethod = new KeyDerivationMethod($alg, [$keyName]); + $keyDerivationMethod = new KeyDerivationMethod($alg, [$RSAKeyValue]); $transformData = new Transform( C::XPATH10_URI, diff --git a/tests/XML/xenc11/KeyDerivationMethodTest.php b/tests/XML/xenc11/KeyDerivationMethodTest.php index 30fe4f57..52fc69be 100644 --- a/tests/XML/xenc11/KeyDerivationMethodTest.php +++ b/tests/XML/xenc11/KeyDerivationMethodTest.php @@ -39,8 +39,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = KeyDerivationMethod::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema-11.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc11_KeyDerivationMethod.xml', ); diff --git a/tests/XML/xenc11/MGFTest.php b/tests/XML/xenc11/MGFTest.php index 475cfdda..ab4792d2 100644 --- a/tests/XML/xenc11/MGFTest.php +++ b/tests/XML/xenc11/MGFTest.php @@ -37,8 +37,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = MGF::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema-11.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc11_MGF.xml', ); diff --git a/tests/XML/xenc11/PBKDF2paramsTest.php b/tests/XML/xenc11/PBKDF2paramsTest.php index ca51216a..5ee13e81 100644 --- a/tests/XML/xenc11/PBKDF2paramsTest.php +++ b/tests/XML/xenc11/PBKDF2paramsTest.php @@ -43,8 +43,6 @@ public static function setUpBeforeClass(): void { self::$testedClass = PBKDF2params::class; - self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema-11.xsd'; - self::$xmlRepresentation = DOMDocumentFactory::fromFile( dirname(__FILE__, 3) . '/resources/xml/xenc11_PBKDF2-params.xml', ); diff --git a/tests/resources/xml/xenc11_DerivedKey.xml b/tests/resources/xml/xenc11_DerivedKey.xml index 943219e4..7367b2c2 100644 --- a/tests/resources/xml/xenc11_DerivedKey.xml +++ b/tests/resources/xml/xenc11_DerivedKey.xml @@ -1,6 +1,9 @@ - testkey + + dGhpcyBpcyBzb21lIHJhbmRvbSBtb2R1bHVzCg== + dGhpcyBpcyBzb21lIHJhbmRvbSBleHBvbmVudAo= +