-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
pick 7612dde Refactor ds:KeyInfo | ||
pick 396cecd Add element xenc:OriginatorKeyInfo | ||
pick 26d0811 Add element xenc:RecipientKeyInfo | ||
pick 3fbdc66 Add element xenc:AgreementMethod | ||
s 25beba4 Add element xenc:AgreementMethod | ||
|
||
# Rebase 271d943..25beba4 onto 271d943 (5 commands) | ||
# | ||
# Commands: | ||
# p, pick <commit> = use commit | ||
# r, reword <commit> = use commit, but edit the commit message | ||
# e, edit <commit> = use commit, but stop for amending | ||
# s, squash <commit> = use commit, but meld into previous commit | ||
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous | ||
# commit's log message, unless -C is used, in which case | ||
# keep only this commit's message; -c is same as -C but | ||
# opens the editor | ||
# x, exec <command> = run command (the rest of the line) using shell | ||
# b, break = stop here (continue rebase later with 'git rebase --continue') | ||
# d, drop <commit> = remove commit | ||
# l, label <label> = label current HEAD with a name | ||
# t, reset <label> = reset HEAD to a label | ||
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>] | ||
# create a merge commit using the original merge commit's | ||
# message (or the oneline, if no original merge commit was | ||
# specified); use -c <commit> to reword the commit message | ||
# u, update-ref <ref> = track a placeholder for the <ref> to be updated | ||
# to this position in the new commits. The <ref> is | ||
# updated at the end of the rebase | ||
# | ||
# These lines can be re-ordered; they are executed from top to bottom. | ||
# | ||
# If you remove a line here THAT COMMIT WILL BE LOST. | ||
# | ||
# However, if you remove everything, the rebase will be aborted. | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\XMLSecurity\XML\xenc; | ||
|
||
use SimpleSAML\XML\Base64ElementTrait; | ||
|
||
/** | ||
* Class representing a xenc:P element. | ||
* | ||
* @package simplesaml/xml-security | ||
*/ | ||
final class P extends AbstractXencElement | ||
{ | ||
use Base64ElementTrait; | ||
|
||
|
||
/** | ||
* @param string $content | ||
*/ | ||
public function __construct(string $content) | ||
{ | ||
$this->setContent($content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\XMLSecurity\Test\XML\xenc; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
use SimpleSAML\Assert\AssertionFailedException; | ||
use SimpleSAML\XML\DOMDocumentFactory; | ||
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; | ||
use SimpleSAML\XMLSecurity\Test\XML\XMLDumper; | ||
use SimpleSAML\XMLSecurity\XML\xenc\AbstractXencElement; | ||
use SimpleSAML\XMLSecurity\XML\xenc\P; | ||
|
||
use function dirname; | ||
use function strval; | ||
|
||
/** | ||
* Class \SimpleSAML\XMLSecurity\Test\XML\xenc\PTest | ||
* | ||
* @covers \SimpleSAML\XMLSecurity\XML\xenc\AbstractXencElement | ||
* @covers \SimpleSAML\XMLSecurity\XML\xenc\P | ||
* | ||
* @package simplesamlphp/xml-security | ||
*/ | ||
#[CoversClass(AbstractXencElement::class)] | ||
#[CoversClass(P::class)] | ||
final class PTest extends TestCase | ||
{ | ||
use SerializableElementTestTrait; | ||
|
||
/** | ||
*/ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
self::$testedClass = P::class; | ||
|
||
self::$xmlRepresentation = DOMDocumentFactory::fromFile( | ||
dirname(__FILE__, 3) . '/resources/xml/xenc_P.xml', | ||
); | ||
} | ||
|
||
|
||
/** | ||
*/ | ||
public function testMarshalling(): void | ||
{ | ||
$p = new P('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); | ||
|
||
$this->assertEquals( | ||
XMLDumper::dumpDOMDocumentXMLWithBase64Content(self::$xmlRepresentation), | ||
strval($p), | ||
); | ||
} | ||
|
||
|
||
/** | ||
*/ | ||
public function testMarshallingNotBase64(): void | ||
{ | ||
$this->expectException(AssertionFailedException::class); | ||
new P('/CTj3d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<xenc:P xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI=</xenc:P> |