#include <random.h>
Link against: random.lib
class TRandom |
Public Member Functions | |
---|---|
IMPORT_C void | Random(TDes8 &) |
IMPORT_C void | RandomL(TDes8 &) |
IMPORT_C void | SecureRandomL(TDes8 &) |
The user interface to the random number generator.
IMPORT_C void | Random | ( | TDes8 & | aDestination | ) | [static] |
Fills the provided buffer with pseudo-random data up to its current length, discarding any current content.
This method will not return secure random numbers for some time after the phone boot-up. Because, pseudo-random number generator will take some time to attain a secure state by collecting enough entropy samples after the boot-up. Till that time, the pseudo-random numbers generated may not be cryptographically secure and there is no way to get to know about it with this API. So, if explcit notification on the strength of the random numbers is necessary, use TRandom::SecureRandomL.
Parameters | |
---|---|
aDestination | The buffer in which to write the random data. |
Panic Codes | |
---|---|
This | function can panic under low memory conditions |
IMPORT_C void | RandomL | ( | TDes8 & | aDestination | ) | [static] |
Fills the provided buffer with pseudo-random data up to its current length, discarding any current content.
This method will not return secure random numbers for some time after the phone boot-up. Because, pseudo-random number generator will take some time to attain a secure state by collecting enough entropy samples after the boot-up. Till that time, the pseudo-random numbers generated may not be cryptographically secure and there is no way to get to know about it with this API. So, if explcit notification on the strength of the random numbers is necessary, use TRandom::SecureRandomL.
Parameters | |
---|---|
aDestination | The buffer in which to write the random data. |
Leave Codes | |
---|---|
This | function can leave under low memory conditions |
IMPORT_C void | SecureRandomL | ( | TDes8 & | aDestination | ) | [static] |
Fills the provided buffer with the pseudo-random data up to its current length, discarding any current content of the descriptor. When this method returns normally (with out leave), the system state is secure and hence the random numbers generated are cryptographically secure as well. When this method leaves with the error code KErrNotSecure, the system internal state is not secure and hence the random numbers too.
Though this method leaves when the system internal state is not secure, still the descriptor will be filled with pseudo-random bytes. This random data may or may not be secure enough. Recommended to treat these numbers as not secure.
Parameters | |
---|---|
aDestination | The buffer in which to write the random data. |
Leave Codes | |
---|---|
KErrNotSecure | The generated random numbers is not secure enough for cryptographic operations. Otherwise, leaves with some other system wide error codes. |