Skip to content

Commit 2c61846

Browse files
authored
Merge pull request #12907 from nextcloud/td/securerandom/remove_deprecated_functions
Remove deprecated functions from SecureRandom
2 parents e54e616 + 372f3d2 commit 2c61846

File tree

5 files changed

+0
-61
lines changed

5 files changed

+0
-61
lines changed

apps/encryption/tests/Crypto/EncryptAllTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ function setUp() {
126126
$this->userInterface->expects($this->any())->method('getUsers')->willReturn(['user1', 'user2']);
127127

128128
$this->secureRandom = $this->getMockBuilder(ISecureRandom::class)->disableOriginalConstructor()->getMock();
129-
$this->secureRandom->expects($this->any())->method('getMediumStrengthGenerator')->willReturn($this->secureRandom);
130-
$this->secureRandom->expects($this->any())->method('getLowStrengthGenerator')->willReturn($this->secureRandom);
131129
$this->secureRandom->expects($this->any())->method('generate')->willReturn('12345678');
132130

133131

apps/federation/tests/Controller/OCSAuthAPIControllerTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ public function testGetSharedSecret($isTrustedServer, $isValidToken, $ok) {
177177
$this->trustedServers->expects($this->once())
178178
->method('addSharedSecret')->willReturn($url, 'secret');
179179
} else {
180-
$this->secureRandom->expects($this->never())->method('getMediumStrengthGenerator');
181180
$this->secureRandom->expects($this->never())->method('generate');
182181
$this->trustedServers->expects($this->never())->method('addSharedSecret');
183182
}

lib/private/Security/SecureRandom.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,34 +36,6 @@
3636
* @package OC\Security
3737
*/
3838
class SecureRandom implements ISecureRandom {
39-
/**
40-
* Convenience method to get a low strength random number generator.
41-
*
42-
* Low Strength should be used anywhere that random strings are needed
43-
* in a non-cryptographical setting. They are not strong enough to be
44-
* used as keys or salts. They are however useful for one-time use tokens.
45-
*
46-
* @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
47-
* @return $this
48-
*/
49-
public function getLowStrengthGenerator() {
50-
return $this;
51-
}
52-
53-
/**
54-
* Convenience method to get a medium strength random number generator.
55-
*
56-
* Medium Strength should be used for most needs of a cryptographic nature.
57-
* They are strong enough to be used as keys and salts. However, they do
58-
* take some time and resources to generate, so they should not be over-used
59-
*
60-
* @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
61-
* @return $this
62-
*/
63-
public function getMediumStrengthGenerator() {
64-
return $this;
65-
}
66-
6739
/**
6840
* Generate a random string of specified length.
6941
* @param int $length The length of the generated string

lib/public/Security/ISecureRandom.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,6 @@ interface ISecureRandom {
5454
*/
5555
const CHAR_HUMAN_READABLE = 'abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789';
5656

57-
/**
58-
* Convenience method to get a low strength random number generator.
59-
*
60-
* Low Strength should be used anywhere that random strings are needed
61-
* in a non-cryptographical setting. They are not strong enough to be
62-
* used as keys or salts. They are however useful for one-time use tokens.
63-
*
64-
* @return $this
65-
* @since 8.0.0
66-
* @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
67-
*/
68-
public function getLowStrengthGenerator();
69-
70-
/**
71-
* Convenience method to get a medium strength random number generator.
72-
*
73-
* Medium Strength should be used for most needs of a cryptographic nature.
74-
* They are strong enough to be used as keys and salts. However, they do
75-
* take some time and resources to generate, so they should not be over-used
76-
*
77-
* @return $this
78-
* @since 8.0.0
79-
* @deprecated 9.0.0 Use \OC\Security\SecureRandom::generate directly or random_bytes() / random_int()
80-
*/
81-
public function getMediumStrengthGenerator();
82-
8357
/**
8458
* Generate a random string of specified length.
8559
* @param int $length The length of the generated string

tests/lib/Share20/ManagerTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,8 +1707,6 @@ public function testCreateShareLink() {
17071707
->with('password')
17081708
->willReturn('hashed');
17091709

1710-
$this->secureRandom->method('getMediumStrengthGenerator')
1711-
->will($this->returnSelf());
17121710
$this->secureRandom->method('generate')
17131711
->willReturn('token');
17141712

@@ -1818,8 +1816,6 @@ public function testCreateShareMail() {
18181816
$manager->expects($this->never())
18191817
->method('setLinkParent');
18201818

1821-
$this->secureRandom->method('getMediumStrengthGenerator')
1822-
->will($this->returnSelf());
18231819
$this->secureRandom->method('generate')
18241820
->willReturn('token');
18251821

0 commit comments

Comments
 (0)