Overview
The signing process involves:- Loading your P12 certificate file (from local file or URL)
- Signing the XML document with your certificate and password
- The result is a signed XML ready for SRI submission
Loading P12 Certificates
Load from local file
Use This returns an
getP12FromLocalFile() to load a certificate from your filesystem:ArrayBuffer containing the certificate data.Signing XML Documents
Prepare your inputs
You need three things to sign a document:
- The P12 certificate (as ArrayBuffer)
- The certificate password
- The XML string to sign
Sign the document
Call The function returns a signed XML string with the digital signature embedded.
signXml() with your certificate, password, and XML:Certificate Validation
ThesignXml() function automatically validates your certificate:
Validity Period Check
Supported Certificate Types
Open Factura supports certificates from:- Banco Central del Ecuador - Looks for “BANCO CENTRAL” in the friendly name
- Security Data - Looks for “SECURITY DATA” in the friendly name
Complete Example
Environment Variables
Store sensitive certificate information in environment variables:Error Handling
Always wrap signing operations in try-catch blocks:Next Steps
Submit to SRI
Send the signed document to SRI’s reception endpoint
Authorize Documents
Check authorization status with SRI