Skip to content

Commit a951f78

Browse files
committed
Deprecating the OpenSslRandomByteGenerator
1 parent 28c0def commit a951f78

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/Robin/Ntlm/Crypt/Random/OpenSslRandomByteGenerator.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* "openssl" extension.
1616
*
1717
* @link http://php.net/openssl
18+
* @deprectated NOTE! This implementation is deprecated, as it's been found to
19+
* be insecure. More info: https://github.com/robinpowered/php-ntlm/issues/7
1820
*/
1921
class OpenSslRandomByteGenerator implements RandomByteGeneratorInterface
2022
{
@@ -25,9 +27,17 @@ class OpenSslRandomByteGenerator implements RandomByteGeneratorInterface
2527

2628
/**
2729
* {@inheritDoc}
30+
*
31+
* @deprectated NOTE! This implementation is deprecated, as it's been found
32+
* to be insecure.
2833
*/
2934
public function generate($size)
3035
{
36+
trigger_error(
37+
'This implementation is deprecated, as it can be insecure in some circumstances',
38+
E_USER_DEPRECATED
39+
);
40+
3141
$generated = openssl_random_pseudo_bytes($size, $strong);
3242

3343
if (false === $generated || strlen($generated) !== $size || false === $strong) {

0 commit comments

Comments
 (0)