A method and a corresponding device for generating true random numbers for
use in encryption of a message for secure transmission of said message
from a sending device to a receiver, or for authentication of a sent
message. An optical image represented by optical data is obtained by an
optical sensor and processed in order to improve the stochasticity of the
optical data. The thus processed data is then used for generating random
numbers which can be used as an encryption key, or for generating an
encryption key, for subsequent use in an encryption algorithm for
encrypting the message. The method is implemented in a digital pen (DP)
to be used in an information management system.