mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-24 08:14:15 +00:00
MWCryptRand::generate() is deprecated
Change-Id: I7cd7a145265abe1bcb036c9b7d34201729b569b8
This commit is contained in:
parent
f6181cf82d
commit
a4f0de6b8d
|
@ -49,7 +49,7 @@ class OATHAuthKey {
|
||||||
*/
|
*/
|
||||||
public static function newFromRandom() {
|
public static function newFromRandom() {
|
||||||
$object = new self(
|
$object = new self(
|
||||||
Base32::encode( MWCryptRand::generate( 10 ) ),
|
Base32::encode( random_bytes( 10 ) ),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ class OATHAuthKey {
|
||||||
public function regenerateScratchTokens() {
|
public function regenerateScratchTokens() {
|
||||||
$scratchTokens = [];
|
$scratchTokens = [];
|
||||||
for ( $i = 0; $i < 5; $i++ ) {
|
for ( $i = 0; $i < 5; $i++ ) {
|
||||||
$scratchTokens[] = Base32::encode( MWCryptRand::generate( 10 ) );
|
$scratchTokens[] = Base32::encode( random_bytes( 10 ) );
|
||||||
}
|
}
|
||||||
$this->scratchTokens = $scratchTokens;
|
$this->scratchTokens = $scratchTokens;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ class OATHAuthUtils {
|
||||||
* @return string $hmac.$iv.$ciphertext, each component b64 encoded
|
* @return string $hmac.$iv.$ciphertext, each component b64 encoded
|
||||||
*/
|
*/
|
||||||
private static function seal( $data, $encKey, $hmacKey ) {
|
private static function seal( $data, $encKey, $hmacKey ) {
|
||||||
$iv = MWCryptRand::generate( 16 );
|
$iv = random_bytes( 16 );
|
||||||
$ciphertext = openssl_encrypt(
|
$ciphertext = openssl_encrypt(
|
||||||
$data,
|
$data,
|
||||||
'aes-256-ctr',
|
'aes-256-ctr',
|
||||||
|
|
Loading…
Reference in a new issue