Bug 799734 - browser id crypto library

This is a significantly reworked version of some old code, taking into account 9 month old review comments.  (That must be a record for me.)