Updated private key generation to use os.urandom.