viernes, 27 de mayo de 2022

Sellar con FirmaSAT

 

sMiArchivo1 is string = EDT_XMLFile
sMiArchivo2 is string =   fExtractPath(sMiArchivo1, fDrive + fDirectory) + "miXMLSellado.xml"

///*******************************************************************************************
nOpcion is int = 0
nResultado is int
sP2buf is string  = Charact(0)
sPbuf is string = Charact(0)
hInst is int
nLongitud is int = 4096
nL2ongitud is int = 20

hInst = LoadDLL("diFirmaSAT2.DLL")
IF hInst = 0 THEN
    Error("Error al cargar dll para colocar sello en el XML")
ELSE
    //Info(Left(sPbuf,20))
    nResultado = CallDLL32("diFirmaSAT2", "SAT_ValidateXml", sMiArchivo1, nOpcion)
    IF nResultado <> 0 THEN
        Info("ERROR", "SAT_ValidateXML regresa el valor: " + nResultado + " fallidamente")
    ELSE
        nResultado = CallDLL32("diFirmaSAT2", "SAT_SignXml", sMiArchivo2, sMiArchivo1, EDT_Llave,EDT_password,EDT_Certificado,nOpcion)
        IF nResultado <> 0 THEN
            Info("ERROR AL SELLAR EL XML","RESULTADO :" + nResultado)
        ELSE
            nResultado = CallDLL32("diFirmaSAT2", "SAT_VerifySignature", sMiArchivo2, sP2buf,nOpcion)
            IF nResultado <> 0 THEN
                Info("Verificación Fallida de Firma" + sMiArchivo2, "returns: " + nResultado)
            ELSE
                Info("Verificación correcta de Firma" + sMiArchivo2, "returns: " + nResultado)
                nResultado = CallDLL32("diFirmaSAT2", "SAT_FixBOM", sMiArchivo2, sMiArchivo2,nOpcion)
            END
        END
    END
    FreeDLL(hInst)
END

No hay comentarios.:

Publicar un comentario

Try catch end

 // -------------------------------------------------- // Procedure principal que executa uma query com tratamento de exceção // -----------...