diff --git a/resources/schemas/ws-securitypolicy-1.2.xsd b/resources/schemas/ws-securitypolicy-1.2.xsd
index 710acf4b..b52f120d 100644
--- a/resources/schemas/ws-securitypolicy-1.2.xsd
+++ b/resources/schemas/ws-securitypolicy-1.2.xsd
@@ -29,7 +29,7 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
blockDefault="#all" >
+ schemaLocation="ws-addr.xsd" />
@@ -109,11 +131,11 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
-
-
-
-
+
+
+
+
+
@@ -1194,7 +1216,7 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
+
10.1 Trust13 Assertion
@@ -1202,4 +1224,4 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
-
\ No newline at end of file
+
diff --git a/src/Constants.php b/src/Constants.php
index 1a84f602..e8e6596a 100644
--- a/src/Constants.php
+++ b/src/Constants.php
@@ -42,6 +42,11 @@ class Constants extends \SimpleSAML\SAML2\Constants
*/
public const NS_SEC_EXT = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
+ /**
+ * The namespace for WS Security Policy.
+ */
+ public const NS_SEC_POLICY = 'http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702';
+
/**
* The namespace for WS-Security utilities protocol.
*/
diff --git a/src/Utils/XPath.php b/src/Utils/XPath.php
new file mode 100644
index 00000000..cba95d16
--- /dev/null
+++ b/src/Utils/XPath.php
@@ -0,0 +1,41 @@
+registerNamespace('addr', C::NS_ADDR);
+ $xp->registerNamespace('auth', C::NS_AUTH);
+ $xp->registerNamespace('fed', C::NS_FED);
+ $xp->registerNamespace('trust', C::NS_TRUST);
+ $xp->registerNamespace('policy', C::NS_POLICY);
+ $xp->registerNamespace('sp', C::NS_SEC_POLICY);
+ $xp->registerNamespace('wsse', C::NS_SEC_EXT);
+ $xp->registerNamespace('wsu', C::NS_SEC_UTIL);
+
+ return $xp;
+ }
+}
diff --git a/src/XML/sp/AbsXPath.php b/src/XML/sp/AbsXPath.php
new file mode 100644
index 00000000..b59ff705
--- /dev/null
+++ b/src/XML/sp/AbsXPath.php
@@ -0,0 +1,14 @@
+localName,
+ $qualifiedName,
+ sprintf('Unexpected name for EmptyType: %s. Expected: %s.', $xml->localName, $qualifiedName),
+ InvalidDOMElementException::class
+ );
+
+
+ return new static();
+ }
+
+
+ /**
+ * Convert this element to XML.
+ *
+ * @param \DOMElement|null $parent The element we should append this element to.
+ * @return \DOMElement
+ */
+ public function toXML(DOMElement $parent = null): DOMElement
+ {
+ return $this->instantiateParentElement($parent);
+ }
+}
diff --git a/src/XML/sp/AbstractHeaderType.php b/src/XML/sp/AbstractHeaderType.php
new file mode 100644
index 00000000..08d65115
--- /dev/null
+++ b/src/XML/sp/AbstractHeaderType.php
@@ -0,0 +1,129 @@
+ $namespacedAttributes
+ */
+ final public function __construct(
+ protected string $namespace,
+ protected ?string $name = null,
+ array $namespacedAttributes = []
+ ) {
+ Assert::nullOrValidURI($namespace);
+ Assert::validQName($name);
+
+ $this->setAttributesNS($namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the Name property.
+ *
+ * @return string|null
+ */
+ public function getName(): ?string
+ {
+ return $this->name;
+ }
+
+
+ /**
+ * Collect the value of the Namespace property.
+ *
+ * @return string
+ */
+ public function getNamespace(): string
+ {
+ return $this->namespace;
+ }
+
+
+ /**
+ * Initialize an HeaderType.
+ *
+ * Note: this method cannot be used when extending this class, if the constructor has a different signature.
+ *
+ * @param \DOMElement $xml The XML element we should load.
+ * @return static
+ *
+ * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ $qualifiedName = static::getClassName(static::class);
+ Assert::eq(
+ $xml->localName,
+ $qualifiedName,
+ sprintf('Unexpected name for HeaderType: %s. Expected: %s.', $xml->localName, $qualifiedName),
+ InvalidDOMElementException::class
+ );
+
+ $namespacedAttributes = self::getAttributesNSFromXML($xml);
+ foreach ($namespacedAttributes as $i => $attr) {
+ if ($attr->getNamespaceURI() === null) {
+ if ($attr->getAttrName() === 'Name' || $attr->getAttrName() === 'Namespace') {
+ unset($namespacedAttributes[$i]);
+ }
+ }
+ }
+
+ return new static(
+ self::getAttribute($xml, 'Namespace'),
+ self::getOptionalAttribute($xml, 'Name', null),
+ $namespacedAttributes,
+ );
+ }
+
+
+ /**
+ * Convert this element to XML.
+ *
+ * @param \DOMElement|null $parent The element we should append this element to.
+ * @return \DOMElement
+ */
+ public function toXML(DOMElement $parent = null): DOMElement
+ {
+ $e = $this->instantiateParentElement($parent);
+
+ if ($this->getName() !== null) {
+ $e->setAttribute('Name', $this->getName());
+ }
+
+ $e->setAttribute('Namespace', $this->getNamespace());
+
+ foreach ($this->getAttributesNS() as $attr) {
+ $attr->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XML/sp/AbstractQNameAssertionType.php b/src/XML/sp/AbstractQNameAssertionType.php
new file mode 100644
index 00000000..c22c4d6e
--- /dev/null
+++ b/src/XML/sp/AbstractQNameAssertionType.php
@@ -0,0 +1,83 @@
+ $namespacedAttributes
+ */
+ final public function __construct(
+ array $namespacedAttributes = []
+ ) {
+ $this->setAttributesNS($namespacedAttributes);
+ }
+
+
+ /**
+ * Initialize an QNameAssertionType.
+ *
+ * Note: this method cannot be used when extending this class, if the constructor has a different signature.
+ *
+ * @param \DOMElement $xml The XML element we should load.
+ * @return static
+ *
+ * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ $qualifiedName = static::getClassName(static::class);
+ Assert::eq(
+ $xml->localName,
+ $qualifiedName,
+ sprintf('Unexpected name for QNameAssertion: %s. Expected: %s.', $xml->localName, $qualifiedName),
+ InvalidDOMElementException::class
+ );
+
+
+ return new static(self::getAttributesNSFromXML($xml));
+ }
+
+
+ /**
+ * Convert this element to XML.
+ *
+ * @param \DOMElement|null $parent The element we should append this element to.
+ * @return \DOMElement
+ */
+ public function toXML(DOMElement $parent = null): DOMElement
+ {
+ $e = $this->instantiateParentElement($parent);
+
+ foreach ($this->getAttributesNS() as $attr) {
+ $attr->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XML/sp/AbstractReqPartsType.php b/src/XML/sp/AbstractReqPartsType.php
new file mode 100644
index 00000000..65f1ee32
--- /dev/null
+++ b/src/XML/sp/AbstractReqPartsType.php
@@ -0,0 +1,145 @@
+setElements($details);
+ $this->setAttributesNS($namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the Header
+ *
+ * @return \SimpleSAML\WSSecurity\XML\sp\Header[]
+ */
+ public function getHeader(): array
+ {
+ return $this->header;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return empty($this->getElements())
+ && empty($this->getHeader())
+ && empty($this->getAttributesNS());
+ }
+
+
+ /**
+ * Initialize an ReqPartsType.
+ *
+ * Note: this method cannot be used when extending this class, if the constructor has a different signature.
+ *
+ * @param \DOMElement $xml The XML element we should load.
+ * @return static
+ *
+ * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ $qualifiedName = static::getClassName(static::class);
+ Assert::eq(
+ $xml->localName,
+ $qualifiedName,
+ sprintf('Unexpected name for Empty: %s. Expected: %s.', $xml->localName, $qualifiedName),
+ InvalidDOMElementException::class
+ );
+
+ $header = Header::getChildrenOfClass($xml);
+ Assert::maxcount($header, 1, TooManyElementsException::class);
+
+ $details = [];
+ foreach ($xml->childNodes as $detail) {
+ if (!($detail instanceof DOMElement)) {
+ continue;
+ } elseif ($detail->namespaceURI === static::NS) {
+ continue;
+ }
+
+ $details[] = new Chunk($detail);
+ }
+
+ return new static(
+ $header,
+ $details,
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+
+
+ /**
+ * Convert this element to XML.
+ *
+ * @param \DOMElement|null $parent The element we should append this element to.
+ * @return \DOMElement
+ */
+ public function toXML(DOMElement $parent = null): DOMElement
+ {
+ $e = $this->instantiateParentElement($parent);
+
+ foreach ($this->getHeader() as $header) {
+ $header->toXML($e);
+ }
+
+ foreach ($this->getElements() as $elt) {
+ /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */
+ $elt->toXML($e);
+ }
+
+ foreach ($this->getAttributesNS() as $attr) {
+ $attr->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XML/sp/AbstractSePartsType.php b/src/XML/sp/AbstractSePartsType.php
new file mode 100644
index 00000000..179cb8c7
--- /dev/null
+++ b/src/XML/sp/AbstractSePartsType.php
@@ -0,0 +1,187 @@
+setElements($details);
+ $this->setAttributesNS($namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the Body
+ *
+ * @return \SimpleSAML\WSSecurity\XML\sp\Body|null
+ */
+ public function getBody(): ?Body
+ {
+ return $this->body;
+ }
+
+
+ /**
+ * Collect the Header
+ *
+ * @return \SimpleSAML\WSSecurity\XML\sp\Header[]
+ */
+ public function getHeader(): array
+ {
+ return $this->header;
+ }
+
+
+ /**
+ * Collect the Attachments
+ *
+ * @return \SimpleSAML\WSSecurity\XML\sp\Attachments|null
+ */
+ public function getAttachments(): ?Attachments
+ {
+ return $this->attachments;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return empty($this->getElements())
+ && empty($this->getBody())
+ && empty($this->getHeader())
+ && empty($this->getAttachments())
+ && empty($this->getAttributesNS());
+ }
+
+
+ /**
+ * Initialize an SePartsType.
+ *
+ * Note: this method cannot be used when extending this class, if the constructor has a different signature.
+ *
+ * @param \DOMElement $xml The XML element we should load.
+ * @return static
+ *
+ * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ $qualifiedName = static::getClassName(static::class);
+ Assert::eq(
+ $xml->localName,
+ $qualifiedName,
+ sprintf('Unexpected name for Empty: %s. Expected: %s.', $xml->localName, $qualifiedName),
+ InvalidDOMElementException::class
+ );
+
+ $body = Body::getChildrenOfClass($xml);
+
+ $header = Header::getChildrenOfClass($xml);
+ Assert::maxcount($header, 1, TooManyElementsException::class);
+
+ $attachments = Attachments::getChildrenOfClass($xml);
+
+ $details = [];
+ foreach ($xml->childNodes as $detail) {
+ if (!($detail instanceof DOMElement)) {
+ continue;
+ } elseif ($detail->namespaceURI === static::NS) {
+ continue;
+ }
+
+ $details[] = new Chunk($detail);
+ }
+
+ return new static(
+ array_pop($body),
+ $header,
+ array_pop($attachments),
+ $details,
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+
+
+ /**
+ * Convert this element to XML.
+ *
+ * @param \DOMElement|null $parent The element we should append this element to.
+ * @return \DOMElement
+ */
+ public function toXML(DOMElement $parent = null): DOMElement
+ {
+ $e = $this->instantiateParentElement($parent);
+
+ if ($this->getBody() !== null) {
+ $this->getBody()->toXML($e);
+ }
+
+ foreach ($this->getHeader() as $header) {
+ $header->toXML($e);
+ }
+
+ if ($this->getAttachments() !== null) {
+ $this->getAttachments()->toXML($e);
+ }
+
+ foreach ($this->getElements() as $elt) {
+ /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */
+ $elt->toXML($e);
+ }
+
+ foreach ($this->getAttributesNS() as $attr) {
+ $attr->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XML/sp/AbstractSpElement.php b/src/XML/sp/AbstractSpElement.php
new file mode 100644
index 00000000..019b8991
--- /dev/null
+++ b/src/XML/sp/AbstractSpElement.php
@@ -0,0 +1,22 @@
+includeToken;
+ }
+
+
+ /**
+ * Set the value of the includeToken-property
+ *
+ * @param \SimpleSAML\WSSecurity\XML\sp\IncludeToken|string $includeToken
+ */
+ protected function setIncludeToken(IncludeToken|string $includeToken): void
+ {
+ if (is_string($includeToken)) {
+ Assert::validURI($includeToken);
+ }
+
+ $this->includeToken = $includeToken;
+ }
+}
diff --git a/src/XML/sp/InclusiveC14N.php b/src/XML/sp/InclusiveC14N.php
new file mode 100644
index 00000000..1da447f2
--- /dev/null
+++ b/src/XML/sp/InclusiveC14N.php
@@ -0,0 +1,14 @@
+assertEquals(
+ static::$xmlRepresentation->saveXML(static::$xmlRepresentation->documentElement),
+ strval($qns),
+ );
+ }
+
+
+ /**
+ * Test that creating a QNameAssertionType from scratch without attributes works.
+ */
+ public function testMarshallingWithoutNSAttr(): void
+ {
+ $xmlRepresentation = clone static::$xmlRepresentation;
+ $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'attr1');
+ $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'ssp');
+
+ $qns = new static::$testedClass();
+
+ $this->assertEquals(
+ $xmlRepresentation->saveXML($xmlRepresentation->documentElement),
+ strval($qns),
+ );
+ }
+
+
+ // test unmarshalling
+
+
+ /**
+ * Test that creating a QNameAssertionType from XML succeeds.
+ */
+ public function testUnmarshalling(): void
+ {
+ $qna = static::$testedClass::fromXML(static::$xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ static::$xmlRepresentation->saveXML(static::$xmlRepresentation->documentElement),
+ strval($qna),
+ );
+ }
+
+
+ /**
+ * Test that creating a QNameAssertionType from XML without attributes succeeds.
+ */
+ public function testUnmarshallingWithoutNSAttr(): void
+ {
+ $xmlRepresentation = clone static::$xmlRepresentation;
+ $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'attr1');
+ $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'ssp');
+
+ $qna = static::$testedClass::fromXML($xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ $xmlRepresentation->saveXML($xmlRepresentation->documentElement),
+ strval($qna),
+ );
+ }
+}
diff --git a/tests/WSSecurity/XML/sp/AttachmentsTest.php b/tests/WSSecurity/XML/sp/AttachmentsTest.php
new file mode 100644
index 00000000..cc04f7cc
--- /dev/null
+++ b/tests/WSSecurity/XML/sp/AttachmentsTest.php
@@ -0,0 +1,74 @@
+assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($attachments),
+ );
+ }
+
+
+ // test unmarshalling
+
+
+ /**
+ * Test that creating an Attachments from XML succeeds.
+ */
+ public function testUnmarshalling(): void
+ {
+ $attachments = Attachments::fromXML(self::$xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($attachments),
+ );
+ }
+}
diff --git a/tests/WSSecurity/XML/sp/Basic128Rsa15Test.php b/tests/WSSecurity/XML/sp/Basic128Rsa15Test.php
new file mode 100644
index 00000000..de4eecfa
--- /dev/null
+++ b/tests/WSSecurity/XML/sp/Basic128Rsa15Test.php
@@ -0,0 +1,41 @@
+assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($body),
+ );
+ }
+
+
+ // test unmarshalling
+
+
+ /**
+ * Test that creating a Body from XML succeeds.
+ */
+ public function testUnmarshalling(): void
+ {
+ $body = Body::fromXML(self::$xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($body),
+ );
+ }
+}
diff --git a/tests/WSSecurity/XML/sp/EncryptBeforeSigningTest.php b/tests/WSSecurity/XML/sp/EncryptBeforeSigningTest.php
new file mode 100644
index 00000000..4081f392
--- /dev/null
+++ b/tests/WSSecurity/XML/sp/EncryptBeforeSigningTest.php
@@ -0,0 +1,41 @@
+some'
+ )->documentElement);
+
+ $EncryptedParts = new EncryptedParts($body, [$header], $attachments, [$chunk], [$attr]);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($EncryptedParts),
+ );
+ }
+
+
+ /**
+ * Adding an empty EncryptedParts element should yield an empty element.
+ */
+ public function testMarshallingEmptyElement(): void
+ {
+ $spns = C::NS_SEC_POLICY;
+ $encryptedParts = new EncryptedParts();
+ $this->assertEquals(
+ "",
+ strval($encryptedParts),
+ );
+ $this->assertTrue($encryptedParts->isEmptyElement());
+ }
+
+
+ /**
+ */
+ public function testMarshallingElementOrdering(): void
+ {
+ $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1');
+ $body = new Body();
+ $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]);
+ $attachments = new Attachments();
+ $chunk = new Chunk(DOMDocumentFactory::fromString(
+ 'some'
+ )->documentElement);
+
+ $EncryptedParts = new EncryptedParts($body, [$header], $attachments, [$chunk], [$attr]);
+ $EncryptedPartsElement = $EncryptedParts->toXML();
+
+ // Test for a Body
+ $xpCache = XPath::getXPath($EncryptedPartsElement);
+ $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body', $xpCache);
+ $this->assertCount(1, $EncryptedPartsElements);
+
+ // Test ordering of EncryptedParts contents
+ /** @psalm-var \DOMElement[] $EncryptedPartsElements */
+ $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body/following-sibling::*', $xpCache);
+ $this->assertCount(3, $EncryptedPartsElements);
+ $this->assertEquals('sp:Header', $EncryptedPartsElements[0]->tagName);
+ $this->assertEquals('sp:Attachments', $EncryptedPartsElements[1]->tagName);
+ $this->assertEquals('ssp:Chunk', $EncryptedPartsElements[2]->tagName);
+ }
+
+
+ // test unmarshalling
+
+
+ /**
+ * Test that creating a EncryptedParts from XML succeeds.
+ */
+ public function testUnmarshalling(): void
+ {
+ $EncryptedParts = EncryptedParts::fromXML(self::$xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($EncryptedParts),
+ );
+ }
+}
diff --git a/tests/WSSecurity/XML/sp/HashPasswordTest.php b/tests/WSSecurity/XML/sp/HashPasswordTest.php
new file mode 100644
index 00000000..7e9df6f0
--- /dev/null
+++ b/tests/WSSecurity/XML/sp/HashPasswordTest.php
@@ -0,0 +1,41 @@
+assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($header),
+ );
+ }
+
+
+ // test unmarshalling
+
+
+ /**
+ * Test that creating a Header from XML succeeds.
+ */
+ public function testUnmarshalling(): void
+ {
+ $header = Header::fromXML(self::$xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($header),
+ );
+ }
+}
diff --git a/tests/WSSecurity/XML/sp/HttpBasicAuthenticationTest.php b/tests/WSSecurity/XML/sp/HttpBasicAuthenticationTest.php
new file mode 100644
index 00000000..1d3f3d36
--- /dev/null
+++ b/tests/WSSecurity/XML/sp/HttpBasicAuthenticationTest.php
@@ -0,0 +1,41 @@
+assertEquals(
+ "",
+ strval($requiredParts),
+ );
+ $this->assertTrue($requiredParts->isEmptyElement());
+ }
+
+
+ /**
+ */
+ public function testMarshallingElementOrdering(): void
+ {
+ $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1');
+ $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]);
+ $chunk = new Chunk(DOMDocumentFactory::fromString(
+ 'some'
+ )->documentElement);
+
+ $RequiredParts = new RequiredParts([$header], [$chunk], [$attr]);
+ $RequiredPartsElement = $RequiredParts->toXML();
+
+ // Test for a Header
+ $xpCache = XPath::getXPath($RequiredPartsElement);
+ $RequiredPartsElements = XPath::xpQuery($RequiredPartsElement, './sp:Header', $xpCache);
+ $this->assertCount(1, $RequiredPartsElements);
+
+ // Test ordering of RequiredParts contents
+ /** @psalm-var \DOMElement[] $RequiredPartsElements */
+ $RequiredPartsElements = XPath::xpQuery($RequiredPartsElement, './sp:Header/following-sibling::*', $xpCache);
+ $this->assertCount(1, $RequiredPartsElements);
+ $this->assertEquals('ssp:Chunk', $RequiredPartsElements[0]->tagName);
+ }
+
+
+ // test marshalling
+
+
+ /**
+ * Test that creating a RequiredParts from scratch works.
+ */
+ public function testMarshalling(): void
+ {
+ $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1');
+ $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]);
+ $chunk = new Chunk(DOMDocumentFactory::fromString(
+ 'some'
+ )->documentElement);
+
+ $RequiredParts = new RequiredParts([$header], [$chunk], [$attr]);
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($RequiredParts),
+ );
+ }
+
+
+ // test unmarshalling
+
+
+ /**
+ * Test that creating a RequiredParts from XML succeeds.
+ */
+ public function testUnmarshalling(): void
+ {
+ $RequiredParts = RequiredParts::fromXML(self::$xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($RequiredParts),
+ );
+ }
+}
diff --git a/tests/WSSecurity/XML/sp/RsaKeyValueTest.php b/tests/WSSecurity/XML/sp/RsaKeyValueTest.php
new file mode 100644
index 00000000..13487625
--- /dev/null
+++ b/tests/WSSecurity/XML/sp/RsaKeyValueTest.php
@@ -0,0 +1,41 @@
+assertEquals(
+ "",
+ strval($signedParts),
+ );
+ $this->assertTrue($signedParts->isEmptyElement());
+ }
+
+
+ // test marshalling
+
+
+ /**
+ * Test that creating a SignedParts from scratch works.
+ */
+ public function testMarshalling(): void
+ {
+ $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1');
+ $body = new Body();
+ $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]);
+ $attachments = new Attachments();
+ $chunk = new Chunk(DOMDocumentFactory::fromString(
+ 'some'
+ )->documentElement);
+
+ $signedParts = new SignedParts($body, [$header], $attachments, [$chunk], [$attr]);
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($signedParts),
+ );
+ }
+
+
+ /**
+ */
+ public function testMarshallingElementOrdering(): void
+ {
+ $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1');
+ $body = new Body();
+ $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]);
+ $attachments = new Attachments();
+ $chunk = new Chunk(DOMDocumentFactory::fromString(
+ 'some'
+ )->documentElement);
+
+ $SignedParts = new SignedParts($body, [$header], $attachments, [$chunk], [$attr]);
+ $SignedPartsElement = $SignedParts->toXML();
+
+ // Test for a Body
+ $xpCache = XPath::getXPath($SignedPartsElement);
+ $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body', $xpCache);
+ $this->assertCount(1, $SignedPartsElements);
+
+ // Test ordering of SignedParts contents
+ /** @psalm-var \DOMElement[] $SignedartsElements */
+ $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body/following-sibling::*', $xpCache);
+ $this->assertCount(3, $SignedPartsElements);
+ $this->assertEquals('sp:Header', $SignedPartsElements[0]->tagName);
+ $this->assertEquals('sp:Attachments', $SignedPartsElements[1]->tagName);
+ $this->assertEquals('ssp:Chunk', $SignedPartsElements[2]->tagName);
+ }
+
+
+
+ // test unmarshalling
+
+
+ /**
+ * Test that creating a SignedParts from XML succeeds.
+ */
+ public function testUnmarshalling(): void
+ {
+ $signedParts = SignedParts::fromXML(self::$xmlRepresentation->documentElement);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($signedParts),
+ );
+ }
+}
diff --git a/tests/WSSecurity/XML/sp/StrictTest.php b/tests/WSSecurity/XML/sp/StrictTest.php
new file mode 100644
index 00000000..2c494350
--- /dev/null
+++ b/tests/WSSecurity/XML/sp/StrictTest.php
@@ -0,0 +1,41 @@
+
diff --git a/tests/resources/xml/sp_Attachments.xml b/tests/resources/xml/sp_Attachments.xml
new file mode 100644
index 00000000..e0295d5a
--- /dev/null
+++ b/tests/resources/xml/sp_Attachments.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic128.xml b/tests/resources/xml/sp_Basic128.xml
new file mode 100644
index 00000000..a516099e
--- /dev/null
+++ b/tests/resources/xml/sp_Basic128.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic128Rsa15.xml b/tests/resources/xml/sp_Basic128Rsa15.xml
new file mode 100644
index 00000000..b6e72abf
--- /dev/null
+++ b/tests/resources/xml/sp_Basic128Rsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic128Sha256.xml b/tests/resources/xml/sp_Basic128Sha256.xml
new file mode 100644
index 00000000..f64641c1
--- /dev/null
+++ b/tests/resources/xml/sp_Basic128Sha256.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic128Sha256Rsa15.xml b/tests/resources/xml/sp_Basic128Sha256Rsa15.xml
new file mode 100644
index 00000000..2e695ccd
--- /dev/null
+++ b/tests/resources/xml/sp_Basic128Sha256Rsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic192.xml b/tests/resources/xml/sp_Basic192.xml
new file mode 100644
index 00000000..0ec3907d
--- /dev/null
+++ b/tests/resources/xml/sp_Basic192.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic192Rsa15.xml b/tests/resources/xml/sp_Basic192Rsa15.xml
new file mode 100644
index 00000000..cbd00ca8
--- /dev/null
+++ b/tests/resources/xml/sp_Basic192Rsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic192Sha256.xml b/tests/resources/xml/sp_Basic192Sha256.xml
new file mode 100644
index 00000000..b4fd83fc
--- /dev/null
+++ b/tests/resources/xml/sp_Basic192Sha256.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic192Sha256Rsa15.xml b/tests/resources/xml/sp_Basic192Sha256Rsa15.xml
new file mode 100644
index 00000000..2bb8128d
--- /dev/null
+++ b/tests/resources/xml/sp_Basic192Sha256Rsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic256.xml b/tests/resources/xml/sp_Basic256.xml
new file mode 100644
index 00000000..6935966b
--- /dev/null
+++ b/tests/resources/xml/sp_Basic256.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic256Rsa15.xml b/tests/resources/xml/sp_Basic256Rsa15.xml
new file mode 100644
index 00000000..224dc72b
--- /dev/null
+++ b/tests/resources/xml/sp_Basic256Rsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic256Sha256.xml b/tests/resources/xml/sp_Basic256Sha256.xml
new file mode 100644
index 00000000..98b17685
--- /dev/null
+++ b/tests/resources/xml/sp_Basic256Sha256.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Basic256Sha256Rsa15.xml b/tests/resources/xml/sp_Basic256Sha256Rsa15.xml
new file mode 100644
index 00000000..bc0eb105
--- /dev/null
+++ b/tests/resources/xml/sp_Basic256Sha256Rsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Body.xml b/tests/resources/xml/sp_Body.xml
new file mode 100644
index 00000000..f4468dab
--- /dev/null
+++ b/tests/resources/xml/sp_Body.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_EncryptBeforeSigning.xml b/tests/resources/xml/sp_EncryptBeforeSigning.xml
new file mode 100644
index 00000000..d60d91b2
--- /dev/null
+++ b/tests/resources/xml/sp_EncryptBeforeSigning.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_EncryptSignature.xml b/tests/resources/xml/sp_EncryptSignature.xml
new file mode 100644
index 00000000..47adcfba
--- /dev/null
+++ b/tests/resources/xml/sp_EncryptSignature.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_EncryptedParts.xml b/tests/resources/xml/sp_EncryptedParts.xml
new file mode 100644
index 00000000..c9ce63b1
--- /dev/null
+++ b/tests/resources/xml/sp_EncryptedParts.xml
@@ -0,0 +1,6 @@
+
+
+
+
+ some
+
diff --git a/tests/resources/xml/sp_HashPassword.xml b/tests/resources/xml/sp_HashPassword.xml
new file mode 100644
index 00000000..21955d33
--- /dev/null
+++ b/tests/resources/xml/sp_HashPassword.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Header.xml b/tests/resources/xml/sp_Header.xml
new file mode 100644
index 00000000..56ef7fc3
--- /dev/null
+++ b/tests/resources/xml/sp_Header.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_HttpBasicAuthentication.xml b/tests/resources/xml/sp_HttpBasicAuthentication.xml
new file mode 100644
index 00000000..a2f23e02
--- /dev/null
+++ b/tests/resources/xml/sp_HttpBasicAuthentication.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_HttpDigestAuthentication.xml b/tests/resources/xml/sp_HttpDigestAuthentication.xml
new file mode 100644
index 00000000..fe1c23d8
--- /dev/null
+++ b/tests/resources/xml/sp_HttpDigestAuthentication.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_IncludeTimestamp.xml b/tests/resources/xml/sp_IncludeTimestamp.xml
new file mode 100644
index 00000000..c41a226e
--- /dev/null
+++ b/tests/resources/xml/sp_IncludeTimestamp.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_InclusiveC14N.xml b/tests/resources/xml/sp_InclusiveC14N.xml
new file mode 100644
index 00000000..6f68710d
--- /dev/null
+++ b/tests/resources/xml/sp_InclusiveC14N.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_Lax.xml b/tests/resources/xml/sp_Lax.xml
new file mode 100644
index 00000000..1451d6e3
--- /dev/null
+++ b/tests/resources/xml/sp_Lax.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_LaxTsFirst.xml b/tests/resources/xml/sp_LaxTsFirst.xml
new file mode 100644
index 00000000..5ac1257f
--- /dev/null
+++ b/tests/resources/xml/sp_LaxTsFirst.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_LaxTsLast.xml b/tests/resources/xml/sp_LaxTsLast.xml
new file mode 100644
index 00000000..ba086a7a
--- /dev/null
+++ b/tests/resources/xml/sp_LaxTsLast.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustNotSendAmend.xml b/tests/resources/xml/sp_MustNotSendAmend.xml
new file mode 100644
index 00000000..8f6ed888
--- /dev/null
+++ b/tests/resources/xml/sp_MustNotSendAmend.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustNotSendCancel.xml b/tests/resources/xml/sp_MustNotSendCancel.xml
new file mode 100644
index 00000000..56ef447b
--- /dev/null
+++ b/tests/resources/xml/sp_MustNotSendCancel.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustNotSendRenew.xml b/tests/resources/xml/sp_MustNotSendRenew.xml
new file mode 100644
index 00000000..0372e02d
--- /dev/null
+++ b/tests/resources/xml/sp_MustNotSendRenew.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportClientChallenge.xml b/tests/resources/xml/sp_MustSupportClientChallenge.xml
new file mode 100644
index 00000000..d001e37b
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportClientChallenge.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportIssuedTokens.xml b/tests/resources/xml/sp_MustSupportIssuedTokens.xml
new file mode 100644
index 00000000..620a74dd
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportIssuedTokens.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportRefEmbeddedToken.xml b/tests/resources/xml/sp_MustSupportRefEmbeddedToken.xml
new file mode 100644
index 00000000..3bf5cd24
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportRefEmbeddedToken.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportRefEncryptedKey.xml b/tests/resources/xml/sp_MustSupportRefEncryptedKey.xml
new file mode 100644
index 00000000..f3c3b3c3
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportRefEncryptedKey.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportRefExternalURI.xml b/tests/resources/xml/sp_MustSupportRefExternalURI.xml
new file mode 100644
index 00000000..ef967f97
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportRefExternalURI.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportRefIssuerSerial.xml b/tests/resources/xml/sp_MustSupportRefIssuerSerial.xml
new file mode 100644
index 00000000..c0ca665c
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportRefIssuerSerial.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportRefKeyIdentifier.xml b/tests/resources/xml/sp_MustSupportRefKeyIdentifier.xml
new file mode 100644
index 00000000..a9ef430a
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportRefKeyIdentifier.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportRefThumbprint.xml b/tests/resources/xml/sp_MustSupportRefThumbprint.xml
new file mode 100644
index 00000000..1a3cbe42
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportRefThumbprint.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_MustSupportServerChallenge.xml b/tests/resources/xml/sp_MustSupportServerChallenge.xml
new file mode 100644
index 00000000..be2824fc
--- /dev/null
+++ b/tests/resources/xml/sp_MustSupportServerChallenge.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_NoPassword.xml b/tests/resources/xml/sp_NoPassword.xml
new file mode 100644
index 00000000..5b82ad29
--- /dev/null
+++ b/tests/resources/xml/sp_NoPassword.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_OnlySignEntireHeadersAndBody.xml b/tests/resources/xml/sp_OnlySignEntireHeadersAndBody.xml
new file mode 100644
index 00000000..492b78ba
--- /dev/null
+++ b/tests/resources/xml/sp_OnlySignEntireHeadersAndBody.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_ProtectTokens.xml b/tests/resources/xml/sp_ProtectTokens.xml
new file mode 100644
index 00000000..a9aa5f05
--- /dev/null
+++ b/tests/resources/xml/sp_ProtectTokens.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireAppliesTo.xml b/tests/resources/xml/sp_RequireAppliesTo.xml
new file mode 100644
index 00000000..dd3383b2
--- /dev/null
+++ b/tests/resources/xml/sp_RequireAppliesTo.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireClientCertificate.xml b/tests/resources/xml/sp_RequireClientCertificate.xml
new file mode 100644
index 00000000..dc613fb9
--- /dev/null
+++ b/tests/resources/xml/sp_RequireClientCertificate.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireClientEntropy.xml b/tests/resources/xml/sp_RequireClientEntropy.xml
new file mode 100644
index 00000000..30a36c1a
--- /dev/null
+++ b/tests/resources/xml/sp_RequireClientEntropy.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireDerivedKeys.xml b/tests/resources/xml/sp_RequireDerivedKeys.xml
new file mode 100644
index 00000000..32be2ec1
--- /dev/null
+++ b/tests/resources/xml/sp_RequireDerivedKeys.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireEmbeddedTokenReference.xml b/tests/resources/xml/sp_RequireEmbeddedTokenReference.xml
new file mode 100644
index 00000000..feb5a8e4
--- /dev/null
+++ b/tests/resources/xml/sp_RequireEmbeddedTokenReference.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireExplicitDerivedKeys.xml b/tests/resources/xml/sp_RequireExplicitDerivedKeys.xml
new file mode 100644
index 00000000..27dc75f9
--- /dev/null
+++ b/tests/resources/xml/sp_RequireExplicitDerivedKeys.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireExternalReference.xml b/tests/resources/xml/sp_RequireExternalReference.xml
new file mode 100644
index 00000000..8c4c0428
--- /dev/null
+++ b/tests/resources/xml/sp_RequireExternalReference.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireExternalUriReference.xml b/tests/resources/xml/sp_RequireExternalUriReference.xml
new file mode 100644
index 00000000..60bc469c
--- /dev/null
+++ b/tests/resources/xml/sp_RequireExternalUriReference.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireImpliedDerivedKeys.xml b/tests/resources/xml/sp_RequireImpliedDerivedKeys.xml
new file mode 100644
index 00000000..bab75242
--- /dev/null
+++ b/tests/resources/xml/sp_RequireImpliedDerivedKeys.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireInternalReference.xml b/tests/resources/xml/sp_RequireInternalReference.xml
new file mode 100644
index 00000000..6bf3fbdc
--- /dev/null
+++ b/tests/resources/xml/sp_RequireInternalReference.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireIssuerSerialReference.xml b/tests/resources/xml/sp_RequireIssuerSerialReference.xml
new file mode 100644
index 00000000..59290954
--- /dev/null
+++ b/tests/resources/xml/sp_RequireIssuerSerialReference.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireKeyIdentifierReference.xml b/tests/resources/xml/sp_RequireKeyIdentifierReference.xml
new file mode 100644
index 00000000..a8da36ca
--- /dev/null
+++ b/tests/resources/xml/sp_RequireKeyIdentifierReference.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireRequestSecurityTokenCollection.xml b/tests/resources/xml/sp_RequireRequestSecurityTokenCollection.xml
new file mode 100644
index 00000000..a6f20f5f
--- /dev/null
+++ b/tests/resources/xml/sp_RequireRequestSecurityTokenCollection.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireServerEntropy.xml b/tests/resources/xml/sp_RequireServerEntropy.xml
new file mode 100644
index 00000000..4c7126e0
--- /dev/null
+++ b/tests/resources/xml/sp_RequireServerEntropy.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireSignatureConfirmation.xml b/tests/resources/xml/sp_RequireSignatureConfirmation.xml
new file mode 100644
index 00000000..0f5d7599
--- /dev/null
+++ b/tests/resources/xml/sp_RequireSignatureConfirmation.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequireThumbprintReference.xml b/tests/resources/xml/sp_RequireThumbprintReference.xml
new file mode 100644
index 00000000..29213350
--- /dev/null
+++ b/tests/resources/xml/sp_RequireThumbprintReference.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_RequiredParts.xml b/tests/resources/xml/sp_RequiredParts.xml
new file mode 100644
index 00000000..45ddb1e9
--- /dev/null
+++ b/tests/resources/xml/sp_RequiredParts.xml
@@ -0,0 +1,4 @@
+
+
+ some
+
diff --git a/tests/resources/xml/sp_RsaKeyValue.xml b/tests/resources/xml/sp_RsaKeyValue.xml
new file mode 100644
index 00000000..006d390b
--- /dev/null
+++ b/tests/resources/xml/sp_RsaKeyValue.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_SC13SecurityContextToken.xml b/tests/resources/xml/sp_SC13SecurityContextToken.xml
new file mode 100644
index 00000000..66f4cb86
--- /dev/null
+++ b/tests/resources/xml/sp_SC13SecurityContextToken.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_SOAPNormalization10.xml b/tests/resources/xml/sp_SOAPNormalization10.xml
new file mode 100644
index 00000000..71afddb3
--- /dev/null
+++ b/tests/resources/xml/sp_SOAPNormalization10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_STRTransform10.xml b/tests/resources/xml/sp_STRTransform10.xml
new file mode 100644
index 00000000..bbd6464d
--- /dev/null
+++ b/tests/resources/xml/sp_STRTransform10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_SignedParts.xml b/tests/resources/xml/sp_SignedParts.xml
new file mode 100644
index 00000000..87c91e57
--- /dev/null
+++ b/tests/resources/xml/sp_SignedParts.xml
@@ -0,0 +1,6 @@
+
+
+
+
+ some
+
diff --git a/tests/resources/xml/sp_Strict.xml b/tests/resources/xml/sp_Strict.xml
new file mode 100644
index 00000000..1bf8b550
--- /dev/null
+++ b/tests/resources/xml/sp_Strict.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_TripleDes.xml b/tests/resources/xml/sp_TripleDes.xml
new file mode 100644
index 00000000..c778ddf0
--- /dev/null
+++ b/tests/resources/xml/sp_TripleDes.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_TripleDesRsa15.xml b/tests/resources/xml/sp_TripleDesRsa15.xml
new file mode 100644
index 00000000..e65bb6f9
--- /dev/null
+++ b/tests/resources/xml/sp_TripleDesRsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_TripleDesSha256.xml b/tests/resources/xml/sp_TripleDesSha256.xml
new file mode 100644
index 00000000..5a533112
--- /dev/null
+++ b/tests/resources/xml/sp_TripleDesSha256.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_TripleDesSha256Rsa15.xml b/tests/resources/xml/sp_TripleDesSha256Rsa15.xml
new file mode 100644
index 00000000..a8352942
--- /dev/null
+++ b/tests/resources/xml/sp_TripleDesSha256Rsa15.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssGssKerberosV5ApReqToken11.xml b/tests/resources/xml/sp_WssGssKerberosV5ApReqToken11.xml
new file mode 100644
index 00000000..d8b38a2f
--- /dev/null
+++ b/tests/resources/xml/sp_WssGssKerberosV5ApReqToken11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssKerberosV5ApReqToken11.xml b/tests/resources/xml/sp_WssKerberosV5ApReqToken11.xml
new file mode 100644
index 00000000..00f87c2e
--- /dev/null
+++ b/tests/resources/xml/sp_WssKerberosV5ApReqToken11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssRelV10Token10.xml b/tests/resources/xml/sp_WssRelV10Token10.xml
new file mode 100644
index 00000000..0b041bda
--- /dev/null
+++ b/tests/resources/xml/sp_WssRelV10Token10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssRelV10Token11.xml b/tests/resources/xml/sp_WssRelV10Token11.xml
new file mode 100644
index 00000000..b2818f51
--- /dev/null
+++ b/tests/resources/xml/sp_WssRelV10Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssRelV20Token10.xml b/tests/resources/xml/sp_WssRelV20Token10.xml
new file mode 100644
index 00000000..50d53093
--- /dev/null
+++ b/tests/resources/xml/sp_WssRelV20Token10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssRelV20Token11.xml b/tests/resources/xml/sp_WssRelV20Token11.xml
new file mode 100644
index 00000000..cc10a513
--- /dev/null
+++ b/tests/resources/xml/sp_WssRelV20Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssSamlV11Token10.xml b/tests/resources/xml/sp_WssSamlV11Token10.xml
new file mode 100644
index 00000000..a43dc8b0
--- /dev/null
+++ b/tests/resources/xml/sp_WssSamlV11Token10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssSamlV11Token11.xml b/tests/resources/xml/sp_WssSamlV11Token11.xml
new file mode 100644
index 00000000..6c11f647
--- /dev/null
+++ b/tests/resources/xml/sp_WssSamlV11Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssSamlV20Token11.xml b/tests/resources/xml/sp_WssSamlV20Token11.xml
new file mode 100644
index 00000000..a5be0604
--- /dev/null
+++ b/tests/resources/xml/sp_WssSamlV20Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssUsernameToken10.xml b/tests/resources/xml/sp_WssUsernameToken10.xml
new file mode 100644
index 00000000..cb1ecf84
--- /dev/null
+++ b/tests/resources/xml/sp_WssUsernameToken10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssUsernameToken11.xml b/tests/resources/xml/sp_WssUsernameToken11.xml
new file mode 100644
index 00000000..16aeeff0
--- /dev/null
+++ b/tests/resources/xml/sp_WssUsernameToken11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssX509Pkcs7Token10.xml b/tests/resources/xml/sp_WssX509Pkcs7Token10.xml
new file mode 100644
index 00000000..e5cb90ca
--- /dev/null
+++ b/tests/resources/xml/sp_WssX509Pkcs7Token10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssX509Pkcs7Token11.xml b/tests/resources/xml/sp_WssX509Pkcs7Token11.xml
new file mode 100644
index 00000000..8e9aa504
--- /dev/null
+++ b/tests/resources/xml/sp_WssX509Pkcs7Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssX509PkiPathV1Token10.xml b/tests/resources/xml/sp_WssX509PkiPathV1Token10.xml
new file mode 100644
index 00000000..af250e42
--- /dev/null
+++ b/tests/resources/xml/sp_WssX509PkiPathV1Token10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssX509PkiPathV1Token11.xml b/tests/resources/xml/sp_WssX509PkiPathV1Token11.xml
new file mode 100644
index 00000000..896712c1
--- /dev/null
+++ b/tests/resources/xml/sp_WssX509PkiPathV1Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssX509V1Token11.xml b/tests/resources/xml/sp_WssX509V1Token11.xml
new file mode 100644
index 00000000..62becc8f
--- /dev/null
+++ b/tests/resources/xml/sp_WssX509V1Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssX509V3Token10.xml b/tests/resources/xml/sp_WssX509V3Token10.xml
new file mode 100644
index 00000000..6931e0a0
--- /dev/null
+++ b/tests/resources/xml/sp_WssX509V3Token10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_WssX509V3Token11.xml b/tests/resources/xml/sp_WssX509V3Token11.xml
new file mode 100644
index 00000000..f6d56e98
--- /dev/null
+++ b/tests/resources/xml/sp_WssX509V3Token11.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_XPath10.xml b/tests/resources/xml/sp_XPath10.xml
new file mode 100644
index 00000000..233ab1fd
--- /dev/null
+++ b/tests/resources/xml/sp_XPath10.xml
@@ -0,0 +1 @@
+
diff --git a/tests/resources/xml/sp_XPathFilter20.xml b/tests/resources/xml/sp_XPathFilter20.xml
new file mode 100644
index 00000000..c871aa27
--- /dev/null
+++ b/tests/resources/xml/sp_XPathFilter20.xml
@@ -0,0 +1 @@
+