Documentation
¶
Overview ¶
Package utils provides certificate and utility functions for SUNAT XML signing
Package utils provides validation utilities for SUNAT documents
Index ¶
- func CheckXMLSec1Available() error
- func CleanTextForXML(text string) string
- func ExtractPEMFromPFX(pfxPath, password, outputDir string) (privateKeyPath, certPath string, err error)
- func GenerateLineID(index int) int
- func GetCertificateInfo(certPath string) (map[string]string, error)
- func ValidateCertificate(certPath string) (*x509.Certificate, error)
- func ValidateDocumentNumber(number string) bool
- func ValidateDocumentSeries(series string) bool
- func ValidateDocumentType(docType string) bool
- func ValidateRUC(ruc string) bool
- func ValidateSpecialCharacters(text string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckXMLSec1Available ¶
func CheckXMLSec1Available() error
CheckXMLSec1Available checks if xmlsec1 is available in the system
func CleanTextForXML ¶ added in v1.3.0
CleanTextForXML prepares text for safe inclusion in XML
func ExtractPEMFromPFX ¶
func ExtractPEMFromPFX(pfxPath, password, outputDir string) (privateKeyPath, certPath string, err error)
ExtractPEMFromPFX extracts PEM private key and certificate from PFX file
func GenerateLineID ¶ added in v1.3.0
GenerateLineID generates a line ID for voided documents
func GetCertificateInfo ¶
GetCertificateInfo returns basic information about a certificate
func ValidateCertificate ¶
func ValidateCertificate(certPath string) (*x509.Certificate, error)
ValidateCertificate validates a certificate file
func ValidateDocumentNumber ¶ added in v1.3.0
ValidateDocumentNumber validates a document number format
func ValidateDocumentSeries ¶ added in v1.3.0
ValidateDocumentSeries validates a document series format
func ValidateDocumentType ¶ added in v1.3.0
ValidateDocumentType validates document type codes
func ValidateRUC ¶ added in v1.3.0
ValidateRUC validates a Peruvian RUC number format
func ValidateSpecialCharacters ¶ added in v1.3.0
ValidateSpecialCharacters validates and cleans special characters for SUNAT XML This is equivalent to the ValidarCaracteresInv function in PHP
Types ¶
This section is empty.