Create and store a secret from within a notebook

Is it possible to generate a secret within a notebook and then store it for later use?