The problem was that I didn't handle the case where the value of the headers - for example - the Signature-Agent contained quotes.
In that case - the value in the signature base also should contain quotes.