Completed
Push — v2.0.x ( c24837...59a3d4 )
by Florent
19:58
created

SignerTest::testKeySetIsEmpty()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 18

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 24
rs 8.9713
cc 1
eloc 18
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\JWSFactory;
14
use Jose\Factory\VerifierFactory;
15
use Jose\Loader;
16
use Jose\Object\JWK;
17
use Jose\Object\JWKSet;
18
use Jose\Test\TestCase;
19
20
/**
21
 * @group Signer
22
 */
23
class SignerTest extends TestCase
24
{
25
    /**
26
     * @expectedException \InvalidArgumentException
27
     * @expectedExceptionMessage No "alg" parameter set in the header.
28
     */
29
    public function testAlgParameterIsMissing()
30
    {
31
        $signer = SignerFactory::createSigner([]);
32
33
        $jws = JWSFactory::createJWS($this->getKey3());
34
        $signer->addSignature(
35
            $jws,
36
            $this->getKey1()
37
        );
38
    }
39
40
    /**
41
     * @expectedException \InvalidArgumentException
42
     * @expectedExceptionMessage The algorithm "foo" is not supported.
43
     */
44
    public function testAlgParameterIsNotSupported()
45
    {
46
        $signer = SignerFactory::createSigner([]);
47
48
        $jws = JWSFactory::createJWS($this->getKey3());
49
        $signer->addSignature(
50
            $jws,
51
            $this->getKey1(),
52
            ['alg' => 'foo']
53
        );
54
    }
55
56
    /**
57
     *
58
     */
59
    public function testSignAndLoadCompact()
60
    {
61
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
62
63
        $jws = JWSFactory::createJWS($this->getKey3());
64
        $jws = $signer->addSignature(
65
            $jws,
66
            $this->getKey1(),
67
            ['alg' => 'HS512']
68
        );
69
        $jws = $signer->addSignature(
70
            $jws,
71
            $this->getKey2(),
72
            ['alg' => 'RS512']
73
        );
74
75
        $this->assertEquals(2, $jws->countSignatures());
76
77
        $loaded = Loader::load($jws->toJSON());
78
79
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded);
80
        $this->assertTrue(is_array($loaded->getPayload()));
81
        $this->assertEquals('HS512', $loaded->getSignature(0)->getProtectedHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getSignature does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
82
        $this->assertEquals('RS512', $loaded->getSignature(1)->getProtectedHeader('alg'));
83
    }
84
85
    /**
86
     *
87
     */
88
    public function testSignMultipleInstructionWithCompactRepresentation()
89
    {
90
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
91
92
        $jws = JWSFactory::createJWS('Je suis Charlie');
93
        $jws = $signer->addSignature(
94
            $jws,
95
            $this->getKey1(),
96
            ['alg' => 'HS512']
97
        );
98
        $jws = $signer->addSignature(
99
            $jws,
100
            $this->getKey2(),
101
            ['alg' => 'RS512']
102
        );
103
104
        $this->assertEquals(2, $jws->countSignatures());
105
        $this->assertEquals('eyJhbGciOiJIUzUxMiJ9.SmUgc3VpcyBDaGFybGll.di3mwSN9cb9OTIJ-V53TMlX6HiCZQnvP9uFTCF4NPXOnPsmH_M74vIUr3O_jpkII1Bim6aUZVlzmhwfsUpAazA', $jws->toCompactJSON(0));
106
        $this->assertEquals('eyJhbGciOiJSUzUxMiJ9.SmUgc3VpcyBDaGFybGll.JFGAhEsQvMYOAfV5ShYK3Z_VS0Lz-jhwmucIudCT9gtSMdv1B4NTJfvuEnGkPnGCTW0j09eZxJSkT6-iU2YlyN22LD9nGuxCzBPLrz3JFETRNws77jfc2F7Jcc3MfCA5yhRbTZuyVL02LoQhOlgFvuUz9VaNuPCogarU3UxOgu1VPnrb2VMi6HCXHylmrSrQBrHShYtW0KEEkmN4X6HLtebnAuFIwhe8buy-aDURmFeqq2a6v92v69v1bqqZYA6YkOU5OzA-VLC8-MYM4ltFEUvGUPB3NGztg7r0QjImDdI5S13yV4IXsl6_XEgi3ilUXI1-tYgwZssSaRPdiOCBUg', $jws->toCompactJSON(1));
107
    }
108
109
    /**
110
     *
111
     */
112
    public function testSignMultipleInstructionWithFlattenedRepresentation()
113
    {
114
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
115
116
        $jws = JWSFactory::createJWS('Je suis Charlie');
117
        $jws = $signer->addSignature(
118
            $jws,
119
            $this->getKey1(),
120
            ['alg' => 'HS512']
121
        );
122
        $jws = $signer->addSignature(
123
            $jws,
124
            $this->getKey2(),
125
            ['alg' => 'RS512']
126
        );
127
128
        $this->assertEquals(2, $jws->countSignatures());
129
        $this->assertEquals('{"payload":"SmUgc3VpcyBDaGFybGll","protected":"eyJhbGciOiJIUzUxMiJ9","signature":"di3mwSN9cb9OTIJ-V53TMlX6HiCZQnvP9uFTCF4NPXOnPsmH_M74vIUr3O_jpkII1Bim6aUZVlzmhwfsUpAazA"}', $jws->toFlattenedJSON(0));
130
        $this->assertEquals('{"payload":"SmUgc3VpcyBDaGFybGll","protected":"eyJhbGciOiJSUzUxMiJ9","signature":"JFGAhEsQvMYOAfV5ShYK3Z_VS0Lz-jhwmucIudCT9gtSMdv1B4NTJfvuEnGkPnGCTW0j09eZxJSkT6-iU2YlyN22LD9nGuxCzBPLrz3JFETRNws77jfc2F7Jcc3MfCA5yhRbTZuyVL02LoQhOlgFvuUz9VaNuPCogarU3UxOgu1VPnrb2VMi6HCXHylmrSrQBrHShYtW0KEEkmN4X6HLtebnAuFIwhe8buy-aDURmFeqq2a6v92v69v1bqqZYA6YkOU5OzA-VLC8-MYM4ltFEUvGUPB3NGztg7r0QjImDdI5S13yV4IXsl6_XEgi3ilUXI1-tYgwZssSaRPdiOCBUg"}', $jws->toFlattenedJSON(1));
131
    }
132
133
    /**
134
     * @expectedException \InvalidArgumentException
135
     * @expectedExceptionMessage The algorithm "RS512" is allowed with this key.
136
     */
137
    public function testAlgorithmNotAllowedForTheKey()
138
    {
139
        $signer = SignerFactory::createSigner([]);
140
141
        $jws = JWSFactory::createJWS('Je suis Charlie');
142
        $signer->addSignature(
143
            $jws,
144
            $this->getKey5(),
145
            ['alg' => 'RS512']
146
        );
147
    }
148
149
    /**
150
     * @expectedException \InvalidArgumentException
151
     * @expectedExceptionMessage Key cannot be used to sign
152
     */
153
    public function testOperationNotAllowedForTheKey()
154
    {
155
        $signer = SignerFactory::createSigner(['PS512']);
156
157
        $jws = JWSFactory::createJWS('Je suis Charlie');
158
        $signer->addSignature(
159
            $jws,
160
            $this->getKey4(),
161
            ['alg' => 'PS512']
162
        );
163
    }
164
165
    /**
166
     *
167
     */
168
    public function testSignAndLoadFlattened()
169
    {
170
        $signer = SignerFactory::createSigner(['HS512']);
171
172
        $jws = JWSFactory::createJWS(['baz', 'ban']);
173
        $jws = $signer->addSignature(
174
            $jws,
175
            $this->getKey1(),
176
            ['alg' => 'HS512'],
177
            ['foo' => 'bar']
178
        );
179
180
        $loaded = Loader::load($jws->toJSON());
181
182
        $this->assertEquals(1, $loaded->countSignatures());
0 ignored issues
show
Bug introduced by
The method countSignatures does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
183
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded);
184
        $this->assertTrue(is_array($loaded->getPayload()));
185
        $this->assertEquals('HS512', $loaded->getSignature(0)->getProtectedHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getSignature does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
186
    }
187
188
    /**
189
     *
190
     */
191
    public function testSignAndLoad()
192
    {
193
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
194
        $verifier = VerifierFactory::createVerifier(['HS512', 'RS512'], $this->getCheckers());
195
196
        $jws = JWSFactory::createJWS('Je suis Charlie');
197
        $jws = $signer->addSignature(
198
            $jws,
199
            $this->getKey1(),
200
            ['alg' => 'HS512'],
201
            ['foo' => 'bar']
202
        );
203
        $jws = $signer->addSignature(
204
            $jws,
205
            $this->getKey2(),
206
            ['alg' => 'RS512']
207
        );
208
209
        $loaded = Loader::load($jws->toJSON());
210
211
        $this->assertEquals(2, $loaded->countSignatures());
0 ignored issues
show
Bug introduced by
The method countSignatures does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
212
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded);
213
        $this->assertEquals('Je suis Charlie', $loaded->getPayload());
214
        $this->assertTrue($verifier->verifyWithKeySet($loaded, $this->getSymmetricKeySet()));
0 ignored issues
show
Bug introduced by
It seems like $loaded defined by \Jose\Loader::load($jws->toJSON()) on line 209 can also be of type object<Jose\Object\JWE>; however, Jose\Verifier::verifyWithKeySet() does only seem to accept object<Jose\Object\JWSInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
215
        $this->assertTrue($verifier->verifyWithKeySet($loaded, $this->getPublicKeySet()));
0 ignored issues
show
Bug introduced by
It seems like $loaded defined by \Jose\Loader::load($jws->toJSON()) on line 209 can also be of type object<Jose\Object\JWE>; however, Jose\Verifier::verifyWithKeySet() does only seem to accept object<Jose\Object\JWSInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
216
217
        $this->assertEquals('HS512', $loaded->getSignature(0)->getProtectedHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getSignature does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
218
        $this->assertEquals('RS512', $loaded->getSignature(1)->getProtectedHeader('alg'));
219
    }
220
221
    /**
222
     *
223
     */
224
    public function testSignAndLoadJWKSet()
225
    {
226
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
227
        $verifier = VerifierFactory::createVerifier(['HS512', 'RS512'], $this->getCheckers());
228
229
        $jws = JWSFactory::createJWS($this->getKeyset());
230
        $jws = $signer->addSignature(
231
            $jws,
232
            $this->getKey1(),
233
            ['alg' => 'HS512'],
234
            ['foo' => 'bar']
235
        );
236
        $jws = $signer->addSignature(
237
            $jws,
238
            $this->getKey2(),
239
            ['alg' => 'RS512']
240
        );
241
242
        $loaded = Loader::load($jws->toJSON());
243
        $this->assertEquals(2, $loaded->countSignatures());
0 ignored issues
show
Bug introduced by
The method countSignatures does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
244
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded);
245
        $this->assertEquals($this->getKeyset(), new JWKSet($loaded->getPayload()));
246
        $this->assertTrue($verifier->verifyWithKeySet($loaded, $this->getPublicKeySet()));
0 ignored issues
show
Bug introduced by
It seems like $loaded defined by \Jose\Loader::load($jws->toJSON()) on line 242 can also be of type object<Jose\Object\JWE>; however, Jose\Verifier::verifyWithKeySet() does only seem to accept object<Jose\Object\JWSInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
247
        $this->assertTrue($verifier->verifyWithKeySet($loaded, $this->getSymmetricKeySet()));
0 ignored issues
show
Bug introduced by
It seems like $loaded defined by \Jose\Loader::load($jws->toJSON()) on line 242 can also be of type object<Jose\Object\JWE>; however, Jose\Verifier::verifyWithKeySet() does only seem to accept object<Jose\Object\JWSInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
248
249
        $this->assertEquals('HS512', $loaded->getSignature(0)->getProtectedHeader('alg'));
0 ignored issues
show
Bug introduced by
The method getSignature does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
250
        $this->assertEquals('RS512', $loaded->getSignature(1)->getProtectedHeader('alg'));
251
    }
252
253
    /**
254
     * @expectedException \InvalidArgumentException
255
     * @expectedExceptionMessage No key in the key set.
256
     */
257
    public function testKeySetIsEmpty()
258
    {
259
        $signer = SignerFactory::createSigner(['HS512', 'RS512']);
260
        $verifier = VerifierFactory::createVerifier(['HS512', 'RS512'], $this->getCheckers());
261
262
        $jws = JWSFactory::createJWS($this->getKeyset());
263
        $jws = $signer->addSignature(
264
            $jws,
265
            $this->getKey1(),
266
            ['alg' => 'HS512'],
267
            ['foo' => 'bar']
268
        );
269
        $jws = $signer->addSignature(
270
            $jws,
271
            $this->getKey2(),
272
            ['alg' => 'RS512']
273
        );
274
275
        $loaded = Loader::load($jws->toJSON());
276
        $this->assertEquals(2, $loaded->countSignatures());
0 ignored issues
show
Bug introduced by
The method countSignatures does only exist in Jose\Object\JWS, but not in Jose\Object\JWE.

It seems like the method you are trying to call exists only in some of the possible types.

Let’s take a look at an example:

class A
{
    public function foo() { }
}

class B extends A
{
    public function bar() { }
}

/**
 * @param A|B $x
 */
function someFunction($x)
{
    $x->foo(); // This call is fine as the method exists in A and B.
    $x->bar(); // This method only exists in B and might cause an error.
}

Available Fixes

  1. Add an additional type-check:

    /**
     * @param A|B $x
     */
    function someFunction($x)
    {
        $x->foo();
    
        if ($x instanceof B) {
            $x->bar();
        }
    }
    
  2. Only allow a single type to be passed if the variable comes from a parameter:

    function someFunction(B $x) { /** ... */ }
    
Loading history...
277
        $this->assertInstanceOf('\Jose\Object\JWSInterface', $loaded);
278
        $this->assertEquals($this->getKeyset(), new JWKSet($loaded->getPayload()));
279
        $this->assertFalse($verifier->verifyWithKeySet($loaded, new JWKSet()));
0 ignored issues
show
Bug introduced by
It seems like $loaded defined by \Jose\Loader::load($jws->toJSON()) on line 275 can also be of type object<Jose\Object\JWE>; however, Jose\Verifier::verifyWithKeySet() does only seem to accept object<Jose\Object\JWSInterface>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

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