diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 164198c9d4..47cc09326f 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -181,7 +181,7 @@ function dfrn_confirm_post(App $a, $handsfree = null) * random key which is encrypted with their site public key. */ - $src_aes_key = openssl_random_pseudo_bytes(64); + $src_aes_key = random_bytes(64); $result = ''; openssl_private_encrypt($dfrn_id, $result, $user['prvkey']); diff --git a/src/Module/Api/Mastodon/Apps.php b/src/Module/Api/Mastodon/Apps.php index b5d98d455f..3d06cdbb05 100644 --- a/src/Module/Api/Mastodon/Apps.php +++ b/src/Module/Api/Mastodon/Apps.php @@ -46,8 +46,8 @@ class Apps extends BaseApi DI::mstdnError()->RecordNotFound(); } - $client_id = bin2hex(openssl_random_pseudo_bytes(32)); - $client_secret = bin2hex(openssl_random_pseudo_bytes(32)); + $client_id = bin2hex(random_bytes(32)); + $client_secret = bin2hex(random_bytes(32)); $fields = ['client_id' => $client_id, 'client_secret' => $client_secret, 'name' => $name, 'redirect_uri' => $redirect]; diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index 739d400e3c..9e7ee38365 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -216,8 +216,8 @@ class BaseApi extends BaseModule public static function getTokenForUser(array $application, int $uid) { - $code = bin2hex(openssl_random_pseudo_bytes(32)); - $access_token = bin2hex(openssl_random_pseudo_bytes(32)); + $code = bin2hex(random_bytes(32)); + $access_token = bin2hex(random_bytes(32)); $fields = ['application-id' => $application['id'], 'uid' => $uid, 'code' => $code, 'access_token' => $access_token, 'created_at' => DateTimeFormat::utcNow(DateTimeFormat::MYSQL)]; if (!DBA::insert('application-token', $fields, Database::INSERT_UPDATE)) { diff --git a/src/Protocol/DFRN.php b/src/Protocol/DFRN.php index df974729ba..a24fbaa033 100644 --- a/src/Protocol/DFRN.php +++ b/src/Protocol/DFRN.php @@ -1272,7 +1272,7 @@ class DFRN switch ($rino_remote_version) { case 1: - $key = openssl_random_pseudo_bytes(16); + $key = random_bytes(16); $data = self::aesEncrypt($postvars['data'], $key); break; diff --git a/src/Protocol/Diaspora.php b/src/Protocol/Diaspora.php index 16f934eccf..00da7d3915 100644 --- a/src/Protocol/Diaspora.php +++ b/src/Protocol/Diaspora.php @@ -2870,9 +2870,9 @@ class Diaspora return false; } - $aes_key = openssl_random_pseudo_bytes(32); + $aes_key = random_bytes(32); $b_aes_key = base64_encode($aes_key); - $iv = openssl_random_pseudo_bytes(16); + $iv = random_bytes(16); $b_iv = base64_encode($iv); $ciphertext = self::aesEncrypt($aes_key, $iv, $msg);