Fix a bug where non-binary csr was given for hmac calculation and fix the test for it, add csr to binary method to utilities