-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathKeySizeTrait.php
More file actions
36 lines (30 loc) · 839 Bytes
/
KeySizeTrait.php
File metadata and controls
36 lines (30 loc) · 839 Bytes
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
<?php
declare(strict_types=1);
namespace SimpleSAML\XMLSecurity\Assert;
use InvalidArgumentException;
/**
* @package simplesamlphp/xml-security
*/
trait KeySizeTrait
{
/**
* The size in bits of the key to be derived from the shared secret as the UTF-8 string for the corresponding
* decimal integer with only digits in the string and no leading zeros.
*
* @var string
*/
private static string $keySize_regex = '/^([1-9]\d*)$/D';
/**
* @param string $value
* @param string $message
*/
protected static function validKeySize(string $value, string $message = ''): void
{
parent::regex(
$value,
self::$keySize_regex,
$message ?: '%s is not a valid xenc:keySizeType',
InvalidArgumentException::class,
);
}
}