Completed
Push — v2.0.x ( 255948...c24837 )
by Florent
03:51
created

SignerTest::getKeyset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
/*
4
 * The MIT License (MIT)
5
 *
6
 * Copyright (c) 2014-2016 Spomky-Labs
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license.  See the LICENSE file for details.
10
 */
11
12
use Jose\Factory\SignerFactory;
13
use Jose\Factory\VerifierFactory;
14
use Jose\Loader;
15
use Jose\Object\JWK;
16
use Jose\Object\JWKSet;
17
use Jose\Test\TestCase;
18
19
/**
20
 * @group Signer
21
 */
22
class SignerTest extends TestCase
23
{
24
    /**
25
     * @expectedException \InvalidArgumentException
26
     * @expectedExceptionMessage Unsupported input type.
27
     */
28
    public function testUnsupportedInputType()
29
    {
30
        $resource = fopen(__FILE__, 'r');
31
        $signer = SignerFactory::createSigner([]);
32
        $signer->sign($resource, [], JSONSerializationModes::JSON_COMPACT_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
    }
34
35
    /**
36
     * @expectedException \InvalidArgumentException
37
     * @expectedExceptionMessage No "alg" parameter set in the header.
38
     */
39
    public function testAlgParameterIsMissing()
40
    {
41
        $signer = SignerFactory::createSigner([]);
42
        $input = $this->getKey3();
43
44
        $instruction = new SignatureInstruction($this->getKey1());
45
46
        $signer->sign($input, [$instruction], JSONSerializationModes::JSON_COMPACT_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
47
    }
48
49
    /**
50
     * @expectedException \InvalidArgumentException
51
     * @expectedExceptionMessage The algorithm "foo" is not supported.
52
     */
53
    public function testAlgParameterIsNotSupported()
54
    {
55
        $signer = SignerFactory::createSigner([]);
56
        $input = $this->getKey3();
57
58
        $instruction = new SignatureInstruction($this->getKey1(), ['alg' => 'foo']);
59
60
        $signer->sign($input, [$instruction], JSONSerializationModes::JSON_COMPACT_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
    }
62
63
    /**
64
     * @expectedException \InvalidArgumentException
65
     * @expectedExceptionMessage The serialization method "foo_serialization" is not supported.
66
     */
67
    public function testSerializationIsNotSupported()
68
    {
69
        $signer = SignerFactory::createSigner(['HS512']);
70
        $input = $this->getKey3();
71
72
        $instruction = new SignatureInstruction($this->getKey1(), ['alg' => 'HS512']);
73
74
        $signer->sign($input, [$instruction], 'foo_serialization');
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
75
    }
76
77
    /**
78
     *
79
     */
80
    public function testSignAndLoadCompact()
81
    {
82
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
83
        $loader = LoaderFactory::createLoader($this->getPayloadConverters());
0 ignored issues
show
Bug introduced by
The method getPayloadConverters() does not seem to exist on object<SignerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Unused Code introduced by
$loader is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
84
85
        $input = $this->getKey3();
86
87
        $instruction1 = new SignatureInstruction($this->getKey1(), ['alg' => 'HS512']);
88
        $instruction2 = new SignatureInstruction($this->getKey2(), ['alg' => 'RS512']);
89
90
        $signatures = $signer->sign($input, [$instruction1, $instruction2], JSONSerializationModes::JSON_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
91
92
        $this->assertTrue(is_string($signatures));
93
94
        /*
95
         * @var \Jose\Object\JWSInterface[]
96
         */
97
        $loaded = Loader::load($signatures);
98
99
        $this->assertEquals(2, count($loaded));
100
101
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded[0]);
102
        $this->assertInstanceOf('\Jose\Object\JWKInterface', $loaded[0]->getPayload());
103
        $this->assertEquals('HS512', $loaded[0]->getHeader('alg'));
104
105
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded[1]);
106
        $this->assertInstanceOf('\Jose\Object\JWKInterface', $loaded[1]->getPayload());
107
        $this->assertEquals('RS512', $loaded[1]->getHeader('alg'));
108
    }
109
110
    /**
111
     *
112
     */
113
    public function testSignMultipleInstructionWithCompactRepresentation()
114
    {
115
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
116
117
        $instruction1 = new SignatureInstruction($this->getKey1(), ['alg' => 'HS512']);
118
        $instruction2 = new SignatureInstruction($this->getKey2(), ['alg' => 'RS512']);
119
120
        $jws = $signer->sign('Je suis Charlie', [$instruction1, $instruction2], JSONSerializationModes::JSON_COMPACT_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
121
122
        $this->assertTrue(is_array($jws));
123
        $this->assertEquals(2, count($jws));
124
        $this->assertEquals('eyJhbGciOiJIUzUxMiJ9.SmUgc3VpcyBDaGFybGll.di3mwSN9cb9OTIJ-V53TMlX6HiCZQnvP9uFTCF4NPXOnPsmH_M74vIUr3O_jpkII1Bim6aUZVlzmhwfsUpAazA', $jws[0]);
125
        $this->assertEquals('eyJhbGciOiJSUzUxMiJ9.SmUgc3VpcyBDaGFybGll.JFGAhEsQvMYOAfV5ShYK3Z_VS0Lz-jhwmucIudCT9gtSMdv1B4NTJfvuEnGkPnGCTW0j09eZxJSkT6-iU2YlyN22LD9nGuxCzBPLrz3JFETRNws77jfc2F7Jcc3MfCA5yhRbTZuyVL02LoQhOlgFvuUz9VaNuPCogarU3UxOgu1VPnrb2VMi6HCXHylmrSrQBrHShYtW0KEEkmN4X6HLtebnAuFIwhe8buy-aDURmFeqq2a6v92v69v1bqqZYA6YkOU5OzA-VLC8-MYM4ltFEUvGUPB3NGztg7r0QjImDdI5S13yV4IXsl6_XEgi3ilUXI1-tYgwZssSaRPdiOCBUg', $jws[1]);
126
    }
127
128
    /**
129
     *
130
     */
131
    public function testSignMultipleInstructionWithFlattenedRepresentation()
132
    {
133
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
134
135
        $instruction1 = new SignatureInstruction($this->getKey1(), ['alg' => 'HS512']);
136
        $instruction2 = new SignatureInstruction($this->getKey2(), ['alg' => 'RS512']);
137
138
        $jws = $signer->sign('Je suis Charlie', [$instruction1, $instruction2], JSONSerializationModes::JSON_FLATTENED_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
139
140
        $this->assertTrue(is_array($jws));
141
        $this->assertEquals(2, count($jws));
142
        $this->assertEquals('{"payload":"SmUgc3VpcyBDaGFybGll","signature":"di3mwSN9cb9OTIJ-V53TMlX6HiCZQnvP9uFTCF4NPXOnPsmH_M74vIUr3O_jpkII1Bim6aUZVlzmhwfsUpAazA","protected":"eyJhbGciOiJIUzUxMiJ9"}', $jws[0]);
143
        $this->assertEquals('{"payload":"SmUgc3VpcyBDaGFybGll","signature":"JFGAhEsQvMYOAfV5ShYK3Z_VS0Lz-jhwmucIudCT9gtSMdv1B4NTJfvuEnGkPnGCTW0j09eZxJSkT6-iU2YlyN22LD9nGuxCzBPLrz3JFETRNws77jfc2F7Jcc3MfCA5yhRbTZuyVL02LoQhOlgFvuUz9VaNuPCogarU3UxOgu1VPnrb2VMi6HCXHylmrSrQBrHShYtW0KEEkmN4X6HLtebnAuFIwhe8buy-aDURmFeqq2a6v92v69v1bqqZYA6YkOU5OzA-VLC8-MYM4ltFEUvGUPB3NGztg7r0QjImDdI5S13yV4IXsl6_XEgi3ilUXI1-tYgwZssSaRPdiOCBUg","protected":"eyJhbGciOiJSUzUxMiJ9"}', $jws[1]);
144
    }
145
146
    /**
147
     * @expectedException \InvalidArgumentException
148
     * @expectedExceptionMessage The algorithm "RS512" is allowed with this key.
149
     */
150
    public function testAlgorithmNotAllowedForTheKey()
151
    {
152
        $signer = SignerFactory::createSigner([]);
153
154
        $instruction = new SignatureInstruction($this->getKey4(), ['alg' => 'RS512']);
155
156
        $signer->sign('FOO', [$instruction], JSONSerializationModes::JSON_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
157
    }
158
159
    /**
160
     * @expectedException \InvalidArgumentException
161
     * @expectedExceptionMessage Key cannot be used to sign
162
     */
163
    public function testOperationNotAllowedForTheKey()
164
    {
165
        $signer = SignerFactory::createSigner(['PS512']);
166
        $instruction = new SignatureInstruction($this->getKey4(), ['alg' => 'PS512']);
167
168
        $signer->sign('FOO', [$instruction], JSONSerializationModes::JSON_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
169
    }
170
171
    /**
172
     *
173
     */
174
    public function testSignAndLoadFlattened()
175
    {
176
        $signer = SignerFactory::createSigner(['HS512']);
177
        $loader = LoaderFactory::createLoader($this->getPayloadConverters());
0 ignored issues
show
Bug introduced by
The method getPayloadConverters() does not seem to exist on object<SignerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Unused Code introduced by
$loader is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
178
179
        $instruction1 = new SignatureInstruction($this->getKey1(), ['alg'   => 'HS512'], ['foo' => 'bar']);
180
181
        $signatures = $signer->sign(['baz', 'ban'], [$instruction1], JSONSerializationModes::JSON_FLATTENED_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
182
183
        $this->assertTrue(is_string($signatures));
184
185
        /*
186
         * @var \Jose\Object\JWSInterface
187
         */
188
        $loaded = Loader::load($signatures);
189
190
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded);
191
        $this->assertTrue(is_array($loaded->getPayload()));
192
        $this->assertEquals('HS512', $loaded->getHeader('alg'));
193
    }
194
195
    /**
196
     *
197
     */
198
    public function testSignAndLoad()
199
    {
200
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
201
        $loader = LoaderFactory::createLoader($this->getPayloadConverters());
0 ignored issues
show
Bug introduced by
The method getPayloadConverters() does not seem to exist on object<SignerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Unused Code introduced by
$loader is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
202
        $verifier = VerifierFactory::createVerifier(['HS512', 'RS512'], $this->getCheckers());
203
204
        $instruction1 = new SignatureInstruction($this->getKey1(), ['alg'   => 'HS512'], ['foo' => 'bar']);
205
        $instruction2 = new SignatureInstruction($this->getKey2(), ['alg' => 'RS512']);
206
207
        $signatures = $signer->sign('Je suis Charlie', [$instruction1, $instruction2], JSONSerializationModes::JSON_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
208
        $this->assertTrue(is_string($signatures));
209
210
        $loaded = Loader::load($signatures);
211
212
        /*
213
         * @var \Jose\Object\JWSInterface[] $loaded
214
         */
215
        $this->assertTrue(is_array($loaded));
216
        $this->assertEquals(2, count($loaded));
217
218
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded[0]);
219
        $this->assertEquals('Je suis Charlie', $loaded[0]->getPayload());
220
        $this->assertTrue($verifier->verify($loaded[0], $this->getSymmetricKeySet()));
0 ignored issues
show
Bug introduced by
The method verify() does not exist on Jose\Verifier. Did you maybe mean verifyWithKey()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
221
        $this->assertEquals('HS512', $loaded[0]->getHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getHeader() does not seem to exist on object<Jose\Object\JWSInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
222
223
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded[1]);
224
        $this->assertEquals('Je suis Charlie', $loaded[1]->getPayload());
225
        $this->assertTrue($verifier->verify($loaded[1], $this->getPublicKeySet()));
0 ignored issues
show
Bug introduced by
The method verify() does not exist on Jose\Verifier. Did you maybe mean verifyWithKey()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
226
        $this->assertEquals('RS512', $loaded[1]->getHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getHeader() does not seem to exist on object<Jose\Object\JWSInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
227
    }
228
229
    /**
230
     *
231
     */
232
    public function testSignAndLoadJWKSet()
233
    {
234
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
235
        $loader = LoaderFactory::createLoader($this->getPayloadConverters());
0 ignored issues
show
Bug introduced by
The method getPayloadConverters() does not seem to exist on object<SignerTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Unused Code introduced by
$loader is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
236
        $verifier = VerifierFactory::createVerifier(['HS512', 'RS512'], $this->getCheckers());
237
238
        $instruction1 = new SignatureInstruction($this->getKey1(), ['alg'   => 'HS512'], ['foo' => 'bar']);
239
        $instruction2 = new SignatureInstruction($this->getKey2(), ['alg' => 'RS512']);
240
241
        $signatures = $signer->sign($this->getKeyset(), [$instruction1, $instruction2], JSONSerializationModes::JSON_SERIALIZATION);
0 ignored issues
show
Bug introduced by
The method sign() does not seem to exist on object<Jose\Signer>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
242
        $this->assertTrue(is_string($signatures));
243
244
        $loaded = Loader::load($signatures);
245
246
        /*
247
         * @var \Jose\Object\JWSInterface[] $loaded
248
         */
249
        $this->assertTrue(is_array($loaded));
250
        $this->assertEquals(2, count($loaded));
251
252
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded[0]);
253
        $this->assertEquals($this->getKeyset(), $loaded[0]->getPayload());
254
        $this->assertFalse($verifier->verify($loaded[0], new JWKSet()));
0 ignored issues
show
Bug introduced by
The method verify() does not exist on Jose\Verifier. Did you maybe mean verifyWithKey()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
255
        $this->assertFalse($verifier->verify($loaded[0], $this->getPublicKeySet()));
0 ignored issues
show
Bug introduced by
The method verify() does not exist on Jose\Verifier. Did you maybe mean verifyWithKey()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
256
        $this->assertTrue($verifier->verify($loaded[0], $this->getSymmetricKeySet()));
0 ignored issues
show
Bug introduced by
The method verify() does not exist on Jose\Verifier. Did you maybe mean verifyWithKey()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
257
        $this->assertEquals('HS512', $loaded[0]->getHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getHeader() does not seem to exist on object<Jose\Object\JWSInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
258
259
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded[1]);
260
        $this->assertEquals($this->getKeyset(), $loaded[1]->getPayload());
261
        $this->assertTrue($verifier->verify($loaded[1], $this->getPublicKeySet()));
0 ignored issues
show
Bug introduced by
The method verify() does not exist on Jose\Verifier. Did you maybe mean verifyWithKey()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
262
        $this->assertEquals('RS512', $loaded[1]->getHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getHeader() does not seem to exist on object<Jose\Object\JWSInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
263
    }
264
265
    /**
266
     * @return \Jose\Object\JWKInterface
267
     */
268
    protected function getKey1()
269
    {
270
        $key = new JWK([
271
            'kty' => 'oct',
272
            'k'   => 'AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow',
273
        ]);
274
275
        return $key;
276
    }
277
278
    /**
279
     * @return \Jose\Object\JWKInterface
280
     */
281
    protected function getKey2()
282
    {
283
        $key = new JWK([
284
            'kty'     => 'RSA',
285
            'use'     => 'sig',
286
            'key_ops' => ['sign'],
287
            'n'       => 'ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddxHmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMsD1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSHSXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ',
288
            'e'       => 'AQAB',
289
            'd'       => 'Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97IjlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYTCBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLhBOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ',
290
            'p'       => '4BzEEOtIpmVdVEZNCqS7baC4crd0pqnRH_5IB3jw3bcxGn6QLvnEtfdUdiYrqBdss1l58BQ3KhooKeQTa9AB0Hw_Py5PJdTJNPY8cQn7ouZ2KKDcmnPGBY5t7yLc1QlQ5xHdwW1VhvKn-nXqhJTBgIPgtldC-KDV5z-y2XDwGUc',
291
            'q'       => 'uQPEfgmVtjL0Uyyx88GZFF1fOunH3-7cepKmtH4pxhtCoHqpWmT8YAmZxaewHgHAjLYsp1ZSe7zFYHj7C6ul7TjeLQeZD_YwD66t62wDmpe_HlB-TnBA-njbglfIsRLtXlnDzQkv5dTltRJ11BKBBypeeF6689rjcJIDEz9RWdc',
292
            'dp'      => 'BwKfV3Akq5_MFZDFZCnW-wzl-CCo83WoZvnLQwCTeDv8uzluRSnm71I3QCLdhrqE2e9YkxvuxdBfpT_PI7Yz-FOKnu1R6HsJeDCjn12Sk3vmAktV2zb34MCdy7cpdTh_YVr7tss2u6vneTwrA86rZtu5Mbr1C1XsmvkxHQAdYo0',
293
            'dq'      => 'h_96-mK1R_7glhsum81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0ajaHF-NKJnwgjMd2w9cjz3_-kyNlxAr2v4IKhGNpmM5iIgOS1VZnOZ68m6_pbLBSp3nssTdlqvd0tIiTHU',
294
            'qi'      => 'IYd7DHOhrWvxkwPQsRM2tOgrjbcrfvtQJipd-DlcxyVuuM9sQLdgjVk2oy26F0EmpScGLq2MowX7fhd_QJQ3ydy5cY7YIBi87w93IKLEdfnbJtoOPLUW0ITrJReOgo1cq9SbsxYawBgfp_gh6A5603k2-ZQwVK0JKSHuLFkuQ3U',
295
        ]);
296
297
        return $key;
298
    }
299
300
    /**
301
     * @return \Jose\Object\JWKInterface
302
     */
303
    protected function getKey3()
304
    {
305
        $key = new JWK([
306
            'kty'     => 'EC',
307
            'crv'     => 'P-256',
308
            'use'     => 'sig',
309
            'key_ops' => ['sign'],
310
            'x'       => 'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',
311
            'y'       => 'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0',
312
            'd'       => 'jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI',
313
        ]);
314
315
        return $key;
316
    }
317
318
    /**
319
     * @return \Jose\Object\JWKInterface
320
     */
321
    protected function getKey4()
322
    {
323
        $key = new JWK([
324
            'kty'     => 'RSA',
325
            'alg'     => 'PS512',
326
            'key_ops' => ['encrypt', 'decrypt'],
327
            'n'       => 'ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddxHmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMsD1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSHSXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ',
328
            'e'       => 'AQAB',
329
            'd'       => 'Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97IjlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYTCBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLhBOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ',
330
            'p'       => '4BzEEOtIpmVdVEZNCqS7baC4crd0pqnRH_5IB3jw3bcxGn6QLvnEtfdUdiYrqBdss1l58BQ3KhooKeQTa9AB0Hw_Py5PJdTJNPY8cQn7ouZ2KKDcmnPGBY5t7yLc1QlQ5xHdwW1VhvKn-nXqhJTBgIPgtldC-KDV5z-y2XDwGUc',
331
            'q'       => 'uQPEfgmVtjL0Uyyx88GZFF1fOunH3-7cepKmtH4pxhtCoHqpWmT8YAmZxaewHgHAjLYsp1ZSe7zFYHj7C6ul7TjeLQeZD_YwD66t62wDmpe_HlB-TnBA-njbglfIsRLtXlnDzQkv5dTltRJ11BKBBypeeF6689rjcJIDEz9RWdc',
332
            'dp'      => 'BwKfV3Akq5_MFZDFZCnW-wzl-CCo83WoZvnLQwCTeDv8uzluRSnm71I3QCLdhrqE2e9YkxvuxdBfpT_PI7Yz-FOKnu1R6HsJeDCjn12Sk3vmAktV2zb34MCdy7cpdTh_YVr7tss2u6vneTwrA86rZtu5Mbr1C1XsmvkxHQAdYo0',
333
            'dq'      => 'h_96-mK1R_7glhsum81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0ajaHF-NKJnwgjMd2w9cjz3_-kyNlxAr2v4IKhGNpmM5iIgOS1VZnOZ68m6_pbLBSp3nssTdlqvd0tIiTHU',
334
            'qi'      => 'IYd7DHOhrWvxkwPQsRM2tOgrjbcrfvtQJipd-DlcxyVuuM9sQLdgjVk2oy26F0EmpScGLq2MowX7fhd_QJQ3ydy5cY7YIBi87w93IKLEdfnbJtoOPLUW0ITrJReOgo1cq9SbsxYawBgfp_gh6A5603k2-ZQwVK0JKSHuLFkuQ3U',
335
        ]);
336
337
        return $key;
338
    }
339
340
    /**
341
     * @return \Jose\Object\JWKInterface
342
     */
343
    protected function getKey5()
344
    {
345
        $key = new JWK([
346
            'kty'     => 'RSA',
347
            'alg'     => 'PS512',
348
            'use'     => 'sig',
349
            'n'       => 'ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddxHmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMsD1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSHSXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdVMTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ',
350
            'e'       => 'AQAB',
351
            'd'       => 'Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97IjlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYTCBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLhBOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ',
352
            'p'       => '4BzEEOtIpmVdVEZNCqS7baC4crd0pqnRH_5IB3jw3bcxGn6QLvnEtfdUdiYrqBdss1l58BQ3KhooKeQTa9AB0Hw_Py5PJdTJNPY8cQn7ouZ2KKDcmnPGBY5t7yLc1QlQ5xHdwW1VhvKn-nXqhJTBgIPgtldC-KDV5z-y2XDwGUc',
353
            'q'       => 'uQPEfgmVtjL0Uyyx88GZFF1fOunH3-7cepKmtH4pxhtCoHqpWmT8YAmZxaewHgHAjLYsp1ZSe7zFYHj7C6ul7TjeLQeZD_YwD66t62wDmpe_HlB-TnBA-njbglfIsRLtXlnDzQkv5dTltRJ11BKBBypeeF6689rjcJIDEz9RWdc',
354
            'dp'      => 'BwKfV3Akq5_MFZDFZCnW-wzl-CCo83WoZvnLQwCTeDv8uzluRSnm71I3QCLdhrqE2e9YkxvuxdBfpT_PI7Yz-FOKnu1R6HsJeDCjn12Sk3vmAktV2zb34MCdy7cpdTh_YVr7tss2u6vneTwrA86rZtu5Mbr1C1XsmvkxHQAdYo0',
355
            'dq'      => 'h_96-mK1R_7glhsum81dZxjTnYynPbZpHziZjeeHcXYsXaaMwkOlODsWa7I9xXDoRwbKgB719rrmI2oKr6N3Do9U0ajaHF-NKJnwgjMd2w9cjz3_-kyNlxAr2v4IKhGNpmM5iIgOS1VZnOZ68m6_pbLBSp3nssTdlqvd0tIiTHU',
356
            'qi'      => 'IYd7DHOhrWvxkwPQsRM2tOgrjbcrfvtQJipd-DlcxyVuuM9sQLdgjVk2oy26F0EmpScGLq2MowX7fhd_QJQ3ydy5cY7YIBi87w93IKLEdfnbJtoOPLUW0ITrJReOgo1cq9SbsxYawBgfp_gh6A5603k2-ZQwVK0JKSHuLFkuQ3U',
357
        ]);
358
359
        return $key;
360
    }
361
362
    /**
363
     * @return \Jose\Object\JWKSetInterface
364
     */
365
    protected function getKeyset()
366
    {
367
        $keyset = new JWKSet();
368
        $keyset->addKey($this->getKey1());
369
        $keyset->addKey($this->getKey2());
370
371
        return $keyset;
372
    }
373
}
374