Skip to content

Commit abfe735

Browse files
committed
Use new openssl builtin to replace constants
1 parent 7bd7960 commit abfe735

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

src/Backend/OpenSSL.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use function chr;
1616
use function mb_strlen;
1717
use function openssl_cipher_iv_length;
18+
use function openssl_cipher_key_length;
1819
use function openssl_decrypt;
1920
use function openssl_encrypt;
2021
use function openssl_sign;
@@ -251,7 +252,7 @@ public function setCipher(string $cipher): void
251252
default:
252253
$this->cipher = C::$BLOCK_CIPHER_ALGORITHMS[$cipher];
253254
$this->blocksize = C::$BLOCK_SIZES[$cipher];
254-
$this->keysize = C::$BLOCK_CIPHER_KEY_SIZES[$cipher];
255+
$this->keysize = openssl_cipher_key_length(C::$BLOCK_CIPHER_ALGORITHMS[$cipher]);
255256
}
256257
}
257258

src/Constants.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,6 @@ class Constants extends \SimpleSAML\XML\Constants
117117
self::BLOCK_ENC_AES256_GCM => 16,
118118
];
119119

120-
/** @var array<string, positive-int> */
121-
public static array $BLOCK_CIPHER_KEY_SIZES = [
122-
self::BLOCK_ENC_3DES => 24,
123-
self::BLOCK_ENC_AES128 => 16,
124-
self::BLOCK_ENC_AES192 => 24,
125-
self::BLOCK_ENC_AES256 => 32,
126-
self::BLOCK_ENC_AES128_GCM => 16,
127-
self::BLOCK_ENC_AES192_GCM => 24,
128-
self::BLOCK_ENC_AES256_GCM => 32,
129-
];
130-
131120

132121
/**
133122
* Key transport algorithms

0 commit comments

Comments
 (0)