I have a question regarding the xml that the invoice hash is extracted from, and the final xml after signing it in Simplified Tax Invoices.
Invoice Hashing
When removing the tags using the giving XPaths, should i remove all the whitespaces and newline breaks in the process of canonicalization or keep them.
The process i am doing is as follows:
- Remove tags
- Canonicalize output using C14N, I don’t know if it’s C14N11 since I am using python lxml library.
- hash the output using sha256 hasher (normal version not HEX).
- encode the hash to base64
Another question, how should i get the public key and what is its format should it be?
I am extracting it directly from the private key i generated in the onboarding process.
I used both bytes format and base64 encoded format, and both resulted in Invalid QR format (something like that)
Another way to get the public key is to get it from the certificate in a HEX format, then encode it to bytes format. This way changed the error from “Invalid QR Format” to “Public key error in QRCODE” (I don’t remember exactly).
The final XML file
The xml sample of simplified tax invoice in SDK has random spaces at the biggening or end of some lines. Are these mandatory to have before encoding the final xml file to base64 or it doesn’t matter?