File tree Expand file tree Collapse file tree 4 files changed +27
-4
lines changed
src/Library/Encryption/Algorithm/KeyEncryption Expand file tree Collapse file tree 4 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace Jose \Component \Encryption \Algorithm \KeyEncryption ;
6
6
7
+ use AESKW \Wrapper as WrapperInterface ;
7
8
use InvalidArgumentException ;
8
9
use Jose \Component \Core \JWK ;
9
10
use ParagonIE \ConstantTime \Base64UrlSafe ;
@@ -20,6 +21,9 @@ public function __construct()
20
21
if (! extension_loaded ('openssl ' )) {
21
22
throw new RuntimeException ('Please install the OpenSSL extension ' );
22
23
}
24
+ if (! interface_exists (WrapperInterface::class)) {
25
+ throw new RuntimeException ('Please install "spomky-labs/aes-key-wrap" to use AES-KW algorithms ' );
26
+ }
23
27
}
24
28
25
29
public function allowedKeyTypes (): array
Original file line number Diff line number Diff line change 8
8
use InvalidArgumentException ;
9
9
use Jose \Component \Core \JWK ;
10
10
use ParagonIE \ConstantTime \Base64UrlSafe ;
11
+ use RuntimeException ;
11
12
use function in_array ;
12
13
use function is_string ;
13
14
14
15
abstract class AESKW implements KeyWrapping
15
16
{
17
+ public function __construct ()
18
+ {
19
+ if (! interface_exists (WrapperInterface::class)) {
20
+ throw new RuntimeException ('Please install "spomky-labs/aes-key-wrap" to use AES-KW algorithms ' );
21
+ }
22
+ }
23
+
16
24
public function allowedKeyTypes (): array
17
25
{
18
26
return ['oct ' ];
Original file line number Diff line number Diff line change 4
4
5
5
namespace Jose \Component \Encryption \Algorithm \KeyEncryption ;
6
6
7
- use AESKW \A128KW ;
8
- use AESKW \A192KW ;
9
- use AESKW \A256KW ;
7
+ use AESKW \Wrapper as WrapperInterface ;
8
+ use RuntimeException ;
10
9
11
10
abstract class AbstractECDHAESKW implements KeyAgreementWithKeyWrapping
12
11
{
12
+ public function __construct ()
13
+ {
14
+ if (! interface_exists (WrapperInterface::class)) {
15
+ throw new RuntimeException ('Please install "spomky-labs/aes-key-wrap" to use AES-KW algorithms ' );
16
+ }
17
+ }
18
+
13
19
public function allowedKeyTypes (): array
14
20
{
15
21
return ['EC ' , 'OKP ' ];
@@ -20,7 +26,7 @@ public function getKeyManagementMode(): string
20
26
return self ::MODE_WRAP ;
21
27
}
22
28
23
- abstract protected function getWrapper (): A128KW | A192KW | A256KW ;
29
+ abstract protected function getWrapper (): WrapperInterface ;
24
30
25
31
abstract protected function getKeyLength (): int ;
26
32
}
Original file line number Diff line number Diff line change 7
7
use AESKW \A128KW ;
8
8
use AESKW \A192KW ;
9
9
use AESKW \A256KW ;
10
+ use AESKW \Wrapper as WrapperInterface ;
10
11
use InvalidArgumentException ;
11
12
use Jose \Component \Core \JWK ;
12
13
use ParagonIE \ConstantTime \Base64UrlSafe ;
14
+ use RuntimeException ;
13
15
use function in_array ;
14
16
use function is_int ;
15
17
use function is_string ;
@@ -20,6 +22,9 @@ public function __construct(
20
22
private readonly int $ salt_size = 64 ,
21
23
private readonly int $ nb_count = 4096
22
24
) {
25
+ if (! interface_exists (WrapperInterface::class)) {
26
+ throw new RuntimeException ('Please install "spomky-labs/aes-key-wrap" to use AES-KW algorithms ' );
27
+ }
23
28
}
24
29
25
30
public function allowedKeyTypes (): array
You can’t perform that action at this time.
0 commit comments