Skip to content

Commit e63569a

Browse files
committed
LDAP: Fix encrypted password generation to use the api function which is updated and not the local function that ended being different - refs BT#20849 and BT#22020
1 parent 4cef771 commit e63569a

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

tests/scripts/ldap_encrypt_admin_password.php

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,8 @@
2525
}
2626

2727
if (!empty(api_get_configuration_value('ldap_admin_password_salt'))) {
28-
echo "The encrypted password is : " . encrypt(api_get_configuration_value('ldap_admin_password_salt'), $password) .PHP_EOL;
28+
echo "The encrypted password is : " . api_encrypt_hash($password, api_get_configuration_value('ldap_admin_password_salt')) .PHP_EOL;
2929
} else {
3030
echo "There is no salt defined in app/config/configuration.php for variable 'ldap_admin_password_salt'".PHP_EOL.PHP_EOL;
3131
}
3232

33-
34-
function encrypt($secret, $data)
35-
{
36-
$secret = hex2bin($secret);
37-
$iv = random_bytes(12);
38-
$tag = '';
39-
40-
$encrypted = openssl_encrypt(
41-
$data,
42-
'aes-256-gcm',
43-
$secret,
44-
OPENSSL_RAW_DATA,
45-
$iv,
46-
$tag,
47-
'',
48-
16
49-
);
50-
51-
return base64_encode($iv) . base64_encode($encrypted . $tag);
52-
}

0 commit comments

Comments
 (0)