-
-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathA128KWBench.php
113 lines (105 loc) · 3.17 KB
/
A128KWBench.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
declare(strict_types=1);
namespace Jose\Performance\JWE;
use Override;
use PhpBench\Benchmark\Metadata\Annotations\Groups;
use PhpBench\Benchmark\Metadata\Annotations\Revs;
/**
* @Revs(4096)
* @Groups({"JWE", "KW", "A128KW"})
*/
final class A128KWBench extends EncryptionBench
{
#[Override]
public function dataHeadersAndAlgorithms(): array
{
return [
[
'shared_protected_header' => [
'alg' => 'A128KW',
'enc' => 'A128CBC-HS256',
],
'shared_header' => [],
'recipient_header' => [],
],
[
'shared_protected_header' => [
'alg' => 'A128KW',
'enc' => 'A192CBC-HS384',
],
'shared_header' => [],
'recipient_header' => [],
],
[
'shared_protected_header' => [
'alg' => 'A128KW',
'enc' => 'A256CBC-HS512',
],
'shared_header' => [],
'recipient_header' => [],
],
[
'shared_protected_header' => [
'alg' => 'A128KW',
'enc' => 'A128GCM',
],
'shared_header' => [],
'recipient_header' => [],
],
[
'shared_protected_header' => [
'alg' => 'A128KW',
'enc' => 'A192GCM',
],
'shared_header' => [],
'recipient_header' => [],
],
[
'shared_protected_header' => [
'alg' => 'A128KW',
'enc' => 'A256GCM',
],
'shared_header' => [],
'recipient_header' => [],
],
];
}
public function dataInputs(): array
{
return [
[
'input' => '{"ciphertext":"CGRKzNX-H6vQCdP3T_1ftzz6hFMMBWKSysDWPVmTG9TCviDXZh0u8k9WX42PiX-BrdRxxjIw9JMKgq3pxw8kQu4KyHeta4iio8OHr1Qjy24LPGRg9_Dv4Yt2i_ytHV_QbUX1Dg_YPMcca9G4BJA56927fvtGXA0ke0pjmPYceWSdZGxKO4MLLGJCHmi5xceIxhCy7QZnEfQOEv5bR2v_G0UDAi_eQM8","iv":"_PsWB_V0xIxq8ulL","tag":"RkfU2WT1DKGXFLgGZeCTnA","aad":"QSxCLEMsRA","protected":"eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMjU2R0NNIn0","encrypted_key":"BX5Kx_b0rd5qUH0UqJe3h8Tu6bAPHLg-ZMFi7qHnEO7t46orRoW-xQ"}',
],
];
}
public function dataPrivateKeys(): array
{
return [
[
'recipient_keys' => [
'keys' => [[
'kty' => 'oct',
'k' => 'GZy6sIZ6wl9NJOKB-jnmVQ',
]],
],
],
];
}
#[Override]
public function dataRecipientPublicKeys(): array
{
return [
[
'recipient_key' => [
'kty' => 'oct',
'k' => 'GZy6sIZ6wl9NJOKB-jnmVQ',
],
],
];
}
#[Override]
protected function getAAD(): ?string
{
return 'A,B,C,D';
}
}