Skip to content

Commit c699932

Browse files
committed
Increase 2FA key size
When scanning the 2FA codes with FreeOTP it reports that the tokens contain insecure cryptographic parameters. The key is too short. Google authenicator standard is 32 characters.
1 parent 1921346 commit c699932

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

plugins/TwoFactorAuth/Dao/TwoFaSecretRandomGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ class TwoFaSecretRandomGenerator
1616
public function generateSecret()
1717
{
1818
$authenticator = new \TwoFactorAuthenticator();
19-
return $authenticator->createSecret(16);
19+
return $authenticator->createSecret(32);
2020
}
2121
}

plugins/TwoFactorAuth/tests/Integration/Dao/TwoFaSecretRandomGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function setUp(): void
3333

3434
public function testGeneratorCodeLength()
3535
{
36-
$this->assertSame(16, mb_strlen($this->generator->generateSecret()));
36+
$this->assertSame(32, mb_strlen($this->generator->generateSecret()));
3737
}
3838

3939
public function testGeneratorCodeAlwaysDifferent()

plugins/TwoFactorAuth/tests/Integration/TwoFactorAuthenticationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function setUp(): void
5656

5757
public function testGenerateSecret()
5858
{
59-
$this->assertSame(16, mb_strlen($this->twoFa->generateSecret()));
59+
$this->assertSame(32, mb_strlen($this->twoFa->generateSecret()));
6060
}
6161

6262
public function testIsUserRequiredToHaveTwoFactorEnabledNotByDefault()

0 commit comments

Comments
 (0)