Sign XML file writing output to a byte array.

Namespace:  FirmaSAT
Assembly:  diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.50.0.29531

Syntax

C#
public static byte[] SignXmlToBytes(
	string xmlFile,
	string keyFile,
	string password,
	string certFile,
	SignOptions signOpts
)
Visual Basic (Declaration)
Public Shared Function SignXmlToBytes ( _
	xmlFile As String, _
	keyFile As String, _
	password As String, _
	certFile As String, _
	signOpts As SignOptions _
) As Byte()

Parameters

xmlFile
Type: System..::.String
Name of base XML file to be signed
keyFile
Type: System..::.String
Name of private key file (or string containing key data in PEM format)
password
Type: System..::.String
Password for key file
certFile
Type: System..::.String
(optional) name of X.509 certificate file to be included in output XML (or string containing certificate data in base64 or PEM format)
signOpts
Type: FirmaSAT..::.SignOptions
Options for output format

Return Value

Signed XML data in a byte array

Remarks

Output XML is always UTF-8 encoded

Remarks

Examples

CopyC#
byte[] b = Sat.SignXmlToBytes("cfdv40-ejemplo.xml", "emisor.key", "12345678a", "emisor.cer", SignOptions.Default);
Console.WriteLine(System.Text.Encoding.UTF8.GetString(b));
// <?xml version="1.0" encoding="UTF-8"?>
// <cfdi:Comprobante xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cfdi="http://www.sat.gob.mx/cfd/3" ...

See Also