Skip to content

Merge release 3.1.1 into 4.0.x #400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
daf3440
Remove X5C EOL (#353)
Spomky Aug 22, 2022
4379a59
Bugs/ed keys loading (#365)
Spomky Aug 22, 2022
2941d17
Stale reduced to 30 days
Spomky Aug 22, 2022
272f38e
Blake2b added as an experimental algorithm (#367)
Spomky Aug 23, 2022
e8c6730
ECDH-SS support (#366)
Spomky Aug 23, 2022
b61e32a
Update phpstan/phpstan-phpunit requirement from ^1.0 to ^1.1
dependabot[bot] Aug 23, 2022
b97b211
Update phpunit/phpunit requirement from ^9.5.5 to ^9.5.23
dependabot[bot] Aug 23, 2022
9a6ba91
Update blackfire/php-sdk requirement from ^1.14 to ^1.31
dependabot[bot] Aug 23, 2022
c042ca9
Update matthiasnoback/symfony-config-test requirement
dependabot[bot] Aug 23, 2022
91f1b69
Update phpstan/phpstan-phpunit requirement from ^1.0 to ^1.1
github-actions[bot] Aug 23, 2022
bf84df3
Update symfony/dependency-injection requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
b21b19e
Update phpunit/phpunit requirement from ^9.5.5 to ^9.5.23
github-actions[bot] Aug 23, 2022
0d60302
Update symfony/yaml requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
edea993
Update blackfire/php-sdk requirement from ^1.14 to ^1.31
github-actions[bot] Aug 23, 2022
5d21bb9
Update matthiasnoback/symfony-config-test requirement
github-actions[bot] Aug 23, 2022
c9a9a81
Update phpstan/phpstan requirement from ^1.0 to ^1.8
dependabot[bot] Aug 23, 2022
0c45f1c
Update symfony/dependency-injection requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
6ea0483
Update symfony/browser-kit requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
9c7b2fd
Update symfony/yaml requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
5115de1
Update symfony/http-kernel requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
31a1194
Update symfony/http-kernel requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
19d2a78
Update symfony/phpunit-bridge requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
319861f
Update symfony/event-dispatcher requirement from ^5.4|^6.0 to ^6.1.0
dependabot[bot] Aug 23, 2022
ef20dbb
Update fgrosse/phpasn1 requirement from ^2.0 to ^2.4
dependabot[bot] Aug 23, 2022
df8aba1
Update nyholm/psr7 requirement from ^1.3 to ^1.5
dependabot[bot] Aug 23, 2022
f86e011
Update phpstan/phpstan requirement from ^1.0 to ^1.8
github-actions[bot] Aug 23, 2022
186f44d
Update nyholm/psr7 requirement from ^1.3 to ^1.5
github-actions[bot] Aug 23, 2022
be9f133
Update symfony/browser-kit requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
d195157
Update phpstan/phpstan-strict-rules requirement from ^1.0 to ^1.4
dependabot[bot] Aug 23, 2022
72934c9
Update php-http/mock-client requirement from ^1.0 to ^1.5
dependabot[bot] Aug 23, 2022
9cc1bd8
Update bjeavons/zxcvbn-php requirement from ^1.0 to ^1.3
dependabot[bot] Aug 23, 2022
42c2e53
Update symfony/phpunit-bridge requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
cf5e415
Update symfony/serializer requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
809c307
Update symfony/serializer requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
103ce32
Update symfony/event-dispatcher requirement from ^5.4|^6.0 to ^6.1.0
github-actions[bot] Aug 23, 2022
7f7bf36
Update symfony/var-dumper requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
731467d
Update symfony/framework-bundle requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
0ee4618
Update symfony/polyfill-mbstring requirement from ^1.12 to ^1.26
dependabot[bot] Aug 23, 2022
9021318
Dependabot rules fixed
Spomky Aug 23, 2022
892451a
Update symfony/config requirement from ^5.4|^6.0 to ^6.1.3
dependabot[bot] Aug 23, 2022
286a856
Update symfony/framework-bundle requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
4c6de91
Update symfony/polyfill-mbstring requirement from ^1.12 to ^1.26
github-actions[bot] Aug 23, 2022
67684a6
Update phpstan/phpstan-strict-rules requirement from ^1.0 to ^1.4
github-actions[bot] Aug 23, 2022
014baeb
Update symfony/config requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
ce2a0a5
Update php-http/mock-client requirement from ^1.0 to ^1.5
github-actions[bot] Aug 23, 2022
a797b44
Update fgrosse/phpasn1 requirement from ^2.0 to ^2.4
github-actions[bot] Aug 23, 2022
cc166c7
Update bjeavons/zxcvbn-php requirement from ^1.0 to ^1.3
github-actions[bot] Aug 23, 2022
1888a79
Update symfony/var-dumper requirement from ^5.4|^6.0 to ^6.1.3
github-actions[bot] Aug 23, 2022
47e281b
Reverted auto-merge dependabot
Spomky Aug 23, 2022
119babf
Repository link fixed
Spomky Aug 23, 2022
e11b004
Gitsplit rule changed
Spomky Aug 23, 2022
b7ac7af
Gitsplit origins
Spomky Aug 23, 2022
0ef6de1
Fixes OKP keys
Spomky Aug 24, 2022
c89b0dc
Resolve conflicts
Spomky Aug 30, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Component/Console/AddKeyIntoKeysetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:add:key', description: 'Add a key into a key set.',)]
#[AsCommand(name: 'keyset:add:key', description: 'Add a key into a key set.')]
final class AddKeyIntoKeysetCommand extends ObjectOutputCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/EcKeyGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:generate:ec', description: 'Generate an EC key (JWK format)',)]
#[AsCommand(name: 'key:generate:ec', description: 'Generate an EC key (JWK format)')]
final class EcKeyGeneratorCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/EcKeysetGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:generate:ec', description: 'Generate an EC key set (JWKSet format)',)]
#[AsCommand(name: 'keyset:generate:ec', description: 'Generate an EC key set (JWKSet format)')]
final class EcKeysetGeneratorCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/GetThumbprintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:thumbprint', description: 'Get the thumbprint of a JWK key.',)]
#[AsCommand(name: 'key:thumbprint', description: 'Get the thumbprint of a JWK key.')]
final class GetThumbprintCommand extends ObjectOutputCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/JKULoaderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:load:jku', description: 'Loads a key set from an url.',)]
#[AsCommand(name: 'keyset:load:jku', description: 'Loads a key set from an url.')]
final class JKULoaderCommand extends ObjectOutputCommand
{
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/KeyAnalyzerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:analyze', description: 'JWK quality analyzer.',)]
#[AsCommand(name: 'key:analyze', description: 'JWK quality analyzer.')]
final class KeyAnalyzerCommand extends Command
{
public function __construct(
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/KeyFileLoaderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:load:key', description: 'Loads a key from a key file (JWK format)',)]
#[AsCommand(name: 'key:load:key', description: 'Loads a key from a key file (JWK format)')]
final class KeyFileLoaderCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
5 changes: 2 additions & 3 deletions src/Component/Console/KeysetAnalyzerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:analyze', description: 'JWKSet quality analyzer.',)]
#[AsCommand(name: 'keyset:analyze', description: 'JWKSet quality analyzer.')]
final class KeysetAnalyzerCommand extends Command
{
public function __construct(
private readonly KeysetAnalyzerManager $keysetAnalyzerManager,
private readonly KeyAnalyzerManager $keyAnalyzerManager,
string $name = null
private readonly KeyAnalyzerManager $keyAnalyzerManager
) {
parent::__construct();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/MergeKeysetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:merge', description: 'Merge several key sets into one.',)]
#[AsCommand(name: 'keyset:merge', description: 'Merge several key sets into one.')]
final class MergeKeysetCommand extends ObjectOutputCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/OctKeyGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:generate:oct', description: 'Generate an octet key (JWK format)',)]
#[AsCommand(name: 'key:generate:oct', description: 'Generate an octet key (JWK format)')]
final class OctKeyGeneratorCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/OctKeysetGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:generate:oct', description: 'Generate a key set with octet keys (JWK format)',)]
#[AsCommand(name: 'keyset:generate:oct', description: 'Generate a key set with octet keys (JWK format)')]
final class OctKeysetGeneratorCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/OkpKeyGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:generate:okp', description: 'Generate an Octet Key Pair key (JWK format)',)]
#[AsCommand(name: 'key:generate:okp', description: 'Generate an Octet Key Pair key (JWK format)')]
final class OkpKeyGeneratorCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/OptimizeRsaKeyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:optimize', description: 'Optimize a RSA key by calculating additional primes (CRT).',)]
#[AsCommand(name: 'key:optimize', description: 'Optimize a RSA key by calculating additional primes (CRT).')]
final class OptimizeRsaKeyCommand extends ObjectOutputCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/P12CertificateLoaderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:load:p12', description: 'Load a key from a P12 certificate file.',)]
#[AsCommand(name: 'key:load:p12', description: 'Load a key from a P12 certificate file.')]
final class P12CertificateLoaderCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/PemConverterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:convert:pkcs1', description: 'Converts a RSA or EC key into PKCS#1 key.',)]
#[AsCommand(name: 'key:convert:pkcs1', description: 'Converts a RSA or EC key into PKCS#1 key.')]
final class PemConverterCommand extends ObjectOutputCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/RotateKeysetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:rotate', description: 'Rotate a key set.',)]
#[AsCommand(name: 'keyset:rotate', description: 'Rotate a key set.')]
final class RotateKeysetCommand extends ObjectOutputCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/RsaKeyGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:generate:rsa', description: 'Generate a RSA key (JWK format)',)]
#[AsCommand(name: 'key:generate:rsa', description: 'Generate a RSA key (JWK format)')]
final class RsaKeyGeneratorCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/RsaKeysetGeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:generate:rsa', description: 'Generate a key set with RSA keys (JWK format)',)]
#[AsCommand(name: 'keyset:generate:rsa', description: 'Generate a key set with RSA keys (JWK format)')]
final class RsaKeysetGeneratorCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Console/X509CertificateLoaderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'key:load:x509', description: 'Load a key from a X.509 certificate file.',)]
#[AsCommand(name: 'key:load:x509', description: 'Load a key from a X.509 certificate file.')]
final class X509CertificateLoaderCommand extends GeneratorCommand
{
protected function configure(): void
Expand Down
5 changes: 2 additions & 3 deletions src/Component/Console/X5ULoaderCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'keyset:load:x5u', description: 'Loads a key set from an url.',)]
#[AsCommand(name: 'keyset:load:x5u', description: 'Loads a key set from an url.')]
final class X5ULoaderCommand extends ObjectOutputCommand
{
public function __construct(
private readonly X5UFactory $x5uFactory,
?string $name = null
private readonly X5UFactory $x5uFactory
) {
parent::__construct();
}
Expand Down
6 changes: 3 additions & 3 deletions src/Component/KeyManagement/JWKFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,23 @@ public static function createOKPKey(string $curve, array $values = []): JWK
switch ($curve) {
case 'X25519':
$keyPair = sodium_crypto_box_keypair();
$secret = $keyPair;
$d = sodium_crypto_box_secretkey($keyPair);
$x = sodium_crypto_box_publickey($keyPair);

break;

case 'Ed25519':
$keyPair = sodium_crypto_sign_keypair();
$secret = sodium_crypto_sign_secretkey($keyPair);
$secretLength = mb_strlen($secret, '8bit');
$d = mb_substr($secret, 0, -$secretLength / 2, '8bit');
$x = sodium_crypto_sign_publickey($keyPair);

break;

default:
throw new InvalidArgumentException(sprintf('Unsupported "%s" curve', $curve));
}
$secretLength = mb_strlen($secret, '8bit');
$d = mb_substr($secret, 0, -$secretLength / 2, '8bit');

$values = array_merge(
$values,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ private function createOKPKey(string $curve): JWK

case 'Ed25519':
$keyPair = sodium_crypto_sign_keypair();
$d = sodium_crypto_sign_secretkey($keyPair);
$secret = sodium_crypto_sign_secretkey($keyPair);
$secretLength = mb_strlen($secret, '8bit');
$d = mb_substr($secret, 0, -$secretLength / 2, '8bit');
$x = sodium_crypto_sign_publickey($keyPair);

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ final class ECDHESKeyAgreementTest extends TestCase
*
* @test
*/
public function getAgreementKey(): void
public function getAgreementKeyWithEllipticCurveKey(): void
{
$receiver = new JWK([
'kty' => 'EC',
Expand All @@ -51,6 +51,76 @@ public function getAgreementKey(): void
static::assertArrayHasKey('y', $additional_header_values['epk']);
}

/**
* @see https://tools.ietf.org/html/rfc7518#appendix-C
*
* @test
*/
public function getAgreementKeyWithA128KeyWrapAndWithOctetKeyPairKey(): void
{
$header = [
'enc' => 'A128GCM',
];

$private = new JWK([
'kty' => 'OKP',
'crv' => 'X25519',
'd' => 'uns2Byv3po_cjjG8XRCtU-lEOrOgLbsDr5cXHmgjVvA',
'x' => 'k8IkMMO9I0foCYqEcbfM49DjEoWpHdho_GKNMXk1rFw',
]);
$public = $private->toPublic();

$cek = [
4,
211,
31,
197,
84,
157,
252,
254,
11,
100,
157,
250,
63,
170,
106,
206,
107,
124,
212,
45,
111,
107,
9,
219,
200,
177,
0,
240,
143,
156,
44,
207,
];
foreach ($cek as $key => $value) {
$cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
}
$cek = hex2bin(implode('', $cek));

$ecdh_es = new ECDHESA128KW();
$encrypted_cek = $ecdh_es->wrapAgreementKey($public, null, $cek, 128, $header, $header);
static::assertArrayHasKey('epk', $header);
static::assertArrayHasKey('crv', $header['epk']);
static::assertArrayHasKey('kty', $header['epk']);
static::assertArrayHasKey('x', $header['epk']);
static::assertArrayNotHasKey('y', $header['epk']);
static::assertSame('X25519', $header['epk']['crv']);
static::assertSame('OKP', $header['epk']['kty']);
static::assertSame($cek, $ecdh_es->unwrapAgreementKey($private, null, $encrypted_cek, 128, $header));
}

/**
* @test
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,82 @@ public function getAgreementKey(): void
static::assertArrayNotHasKey('epk', $additional_header_values);
}

/**
* @test
*/
public function getAgreementKeyWithA128KeyWrapAndOctetKeyPairKey(): void
{
$additional_header_values = [
'enc' => 'A128GCM',
];
$sender = new JWK([
'kty' => 'OKP',
'crv' => 'X25519',
'd' => 'uns2Byv3po_cjjG8XRCtU-lEOrOgLbsDr5cXHmgjVvA',
'x' => 'k8IkMMO9I0foCYqEcbfM49DjEoWpHdho_GKNMXk1rFw',
]);
$receiver = new JWK([
'kty' => 'EC',
'crv' => 'X25519',
'd' => 'tzF6dJQtUYj2G60lzzw70A8BGeE_KDDofUdwwm9qIEU',
'x' => 'q9mRLLKfK-_SosZoBFs5LaDxSB9KaqbRaenvzy1_lAA',
]);

$cek = [
4,
211,
31,
197,
84,
157,
252,
254,
11,
100,
157,
250,
63,
170,
106,
206,
107,
124,
212,
45,
111,
107,
9,
219,
200,
177,
0,
240,
143,
156,
44,
207,
];
foreach ($cek as $key => $value) {
$cek[$key] = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
}
$cek = hex2bin(implode('', $cek));

$ecdh_ss = new ECDHSSA128KW();
$encrypted_cek = $ecdh_ss->wrapAgreementKey(
$receiver->toPublic(),
$sender,
$cek,
128,
$additional_header_values,
$additional_header_values
);
static::assertArrayNotHasKey('epk', $additional_header_values);
static::assertSame(
$cek,
$ecdh_ss->unwrapAgreementKey($sender->toPublic(), $receiver, $encrypted_cek, 128, $additional_header_values)
);
}

/**
* @test
*/
Expand Down