In my web service I need to generate passwords that are strong and can be represented as a string. Currently I use System.Security.Cryptography.RandomNumberGenerator
and generate a large enough (let's just assume it is really large enough) array of random bytes and then encode it using base 64 and return that to the user.
This way I have a random password which is generated using a suitable-for-cryptography PRNG (not class Random
, see this question for details on why class Random
is not okay here) and which can be represented as a string and sent in an email, shown in an interface or typed in or copy-pasted by the user.
Is anything inherently wrong with this scheme from the security standpoint?