We introduce a symmetrization technique that can be used as an extra step in some continuous-variable quantum key distribution protocols. By randomizing the data in phase space, one can dramatically simplify the security analysis of the protocols, in particular in the case of collective attacks. The main application of this procedure concerns protocols with postselection, for which security was established only against Gaussian attacks until now. Here, we prove that under some experimentally verifiable conditions, Gaussian attacks are optimal among all collective attacks.