utils

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package utils provides certificate and utility functions for SUNAT XML signing

Package utils provides validation utilities for SUNAT documents

Index

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

func CleanTextForXML(text string) string

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

func GenerateLineID(index int) int

GenerateLineID generates a line ID for voided documents

func GetCertificateInfo

func GetCertificateInfo(certPath string) (map[string]string, error)

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

func ValidateDocumentNumber(number string) bool

ValidateDocumentNumber validates a document number format

func ValidateDocumentSeries added in v1.3.0

func ValidateDocumentSeries(series string) bool

ValidateDocumentSeries validates a document series format

func ValidateDocumentType added in v1.3.0

func ValidateDocumentType(docType string) bool

ValidateDocumentType validates document type codes

func ValidateRUC added in v1.3.0

func ValidateRUC(ruc string) bool

ValidateRUC validates a Peruvian RUC number format

func ValidateSpecialCharacters added in v1.3.0

func ValidateSpecialCharacters(text string) string

ValidateSpecialCharacters validates and cleans special characters for SUNAT XML This is equivalent to the ValidarCaracteresInv function in PHP

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL