There are a number of unicode() calls as part of the signing process.  I'm concerned that if the data is not ascii, these unicode() calls could fail.  Do we know what type is being passed into each of these calls?  If byte strings, do we know their encodings?  It would be better to be more explicit if these are converting byte strings to unicode.