MWCryptRand::generate() is deprecated

Change-Id: I7cd7a145265abe1bcb036c9b7d34201729b569b8
This commit is contained in:
Max Semenik 2018-07-17 00:20:57 -07:00
parent f6181cf82d
commit a4f0de6b8d
2 changed files with 3 additions and 3 deletions

View file

@ -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;
} }

View file

@ -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',