A different couple security issues, relating to e-signatures:
1. For compliance w/ esign laws, it's best if the text being signed is locked down somehow, so that instead of just setting a "Yes they put their name in the box" flag somewhere, you save a signed version of the whole document.
One obvious way to do this is PGP. If the user has PGP, it's trivial: get and store their pubkey, offer them plain text to sign, confirm the sig and signed plaintext, and sign the whole with the server's key.
Suppose however that the user doesn't have PGP. You could generate a keypair for them, keep it stored on the server, and only look at the privkey password in transit for use during creation and signing.
Since you don't keep the password — only the user does — only the user could have authorized signing the document, and the document can't have been modified afterwards. This satisfies all the major requirements of esign laws.
However, it's not clear what to do if they forget their privkey password; PGP has 'revoke the whole thing' but it doesn't have 'revoke it as of date X and replace with this new key, the old sigs are still valid before X'.
Also, it'd be better if the privkey could be stored more securely than just being locked with a user submitted password. I'm not aware of any client-side PGP signing JS (there's PGP encryption to a known pubkey), and client side storage would break if they use a different browser or clear cache; it's not persistent enough. Server side is better than nothing, but still.
2. Further, it would be good to make the document such that its timestamp is provably true (at least, within a day or so).
You can prevent forging a later sign date by e.g. including that day's closing stock market prices or NYT headline within the signed plaintext.
However, how can you prevent forging an earlier sign date — ideally in a way that doesn't require a network of other repositories to trust?