error Can someone help me with a virtual invoice xml before signing?
public void GenerateSinginvoice()
{
XmlDocument eInvoice = new XmlDocument();
eInvoice.Load("invFile.xml");
string privateKeyPath = "ec-secp256k1-priv-key.pem";
string csrPath = "cert.csr";
string csrContent = System.IO.File.ReadAllText(csrPath);
string privateKeyContent = System.IO.File.ReadAllText(privateKeyPath);
EInvoiceSigner signer = new EInvoiceSigner();
SignResult sigingResult = signer.SignDocument(eInvoice, csrContent, privateKeyContent); //
var hashGenerator = new EInvoiceHashGenerator();
var hashResult = hashGenerator.GenerateEInvoiceHashing(sigingResult.SignedEInvoice); //
if (sigingResult.IsValid)
{
sigingResult.SaveSignedEInvoice("readyinv.xml");
}
else
{
string errormsg = sigingResult.ErrorMessage;
}
}
lalomar
2
Dear @alroaini2030 ,
Thank you for reaching out, and welcome to our community.
Kindly make sure that you are using the Private Key that was generated with the CSR.
Additionally, please find the signing docs that explain the signing process manually to understand the exact behavior of the signing method.
SigningProcessUpdated.pdf (392.7 KB)
If you still face issues, please don’t hesitate to reach out with our support team via email:
SP email: sp_support@zatca.gov.sa
Thanks,
Madleen
3
Dear @alroaini2030,
It’s working with standard invoice, but not working in simplified invoice?
Can you tell me how signing simplified Invoice ?