ISecureRandom¶
-
interface
OCP\Security\
ISecureRandom
¶ - Class SecureRandom provides a wrapper around the random_int function to generatesecure random strings. For PHP 7 the native CSPRNG is used, older versions douse a fallback.Usage:\OC::$server->getSecureRandom()->generate(10);
Implemented by: OC\Security\SecureRandom
Source: lib/public/Security/ISecureRandom.php#42
Constants¶
-
CHAR_UPPER = ABCDEFGHIJKLMNOPQRSTUVWXYZ
- Flags for characters that can be used for <code>generate($length, $characters)</code>
Source: lib/public/Security/ISecureRandom.php#47
-
CHAR_LOWER = abcdefghijklmnopqrstuvwxyz
Source: lib/public/Security/ISecureRandom.php#48
-
CHAR_DIGITS = 0123456789
Source: lib/public/Security/ISecureRandom.php#49
-
CHAR_SYMBOLS = !\"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~
Source: lib/public/Security/ISecureRandom.php#50
-
CHAR_HUMAN_READABLE = abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789
- Characters that can be used for <code>generate($length, $characters)</code>, togenerate human readable random strings. Lower- and upper-case characters and digitsare included. Characters which are ambiguous are excluded, such as I, l, and 1 and so on.
Source: lib/public/Security/ISecureRandom.php#57
Methods¶
-
public
OCP\Security\ISecureRandom::
generate
($length, $characters=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)¶ - Generate a random string of specified length.
Source: Parameters: - $length (int) The length of the generated string
- $characters (string) An optional list of characters to use if no character list is
specified all valid base64 characters are used.
Returns: string
Since: 8.0.0