DSA signing support

This is a continuation of @skeuomorf's work in #960, all credit to him.

The PR after this will add multibackend support and change the codeblocks into doctests.