modularized the code for re-use in other programs

To test, just compile (change the serval-dna directories in the Makefile first), and run serval-sign and serval-verify as you normally would.