Yes, they are legal. The only exception may be if you enter a game competition for money that requires you to sign a legal document guaranteeing that you will not cheat.
Hold CTRL-Shift-C all at once, and release.
A console should appear, then type in whatever cheat you want, e.g addDNA and hit Enter.
http://www.sporecheats.com/ ^ Got a huge list of cheats, and...