fix global leaks and support for specifying ID attribute when producing a signature

Summary

* Fix global leaks
* Support for specifying the attribute you want to use as reference when producing a signature
* There was an error in the string used for sha256 hash algo, fixed.