Create PFX (PKCS-12) file in PEM format suitable for a Cancelación.

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

Syntax

C#
public static int WritePfxFile(
	string pfxFile,
	string pfxPassword,
	string keyFile,
	string keyPassword,
	string certFile,
	PfxFormat pfxFormat
)
Visual Basic (Declaration)
Public Shared Function WritePfxFile ( _
	pfxFile As String, _
	pfxPassword As String, _
	keyFile As String, _
	keyPassword As String, _
	certFile As String, _
	pfxFormat As PfxFormat _
) As Integer

Parameters

pfxFile
Type: System..::.String
Name of output PFX file to be created
pfxPassword
Type: System..::.String
Password to open new PFX file
keyFile
Type: System..::.String
Name of encrypted key file
keyPassword
Type: System..::.String
Password for encrypted key file
certFile
Type: System..::.String
Name of X.509 certificate file
pfxFormat
Type: FirmaSAT..::.PfxFormat
Output format for PFX file (optional, default=plain base64)

Return Value

Zero (0) if output file is successfully created, or a negative error code.

Examples

CopyC#
string password = "12345678a";
string newpassword = "clavedesalida";
int n = Sat.WritePfxFile("archivo_new-pfx.txt", newpassword, "emisor.key", password, "emisor.cer");
Debug.Assert(n == 0, "Sat.WritePfxFile failed");
Console.WriteLine(File.ReadAllText("archivo_new-pfx.txt"));
// MIIMOQIBAzCCC/8GCSqGSIb3DQEHAaCCC/AEggvsMIIL6DCCBp8GCSqGSIb3DQEH ...

See Also