Click or drag to resize

SatNewKeyFile Method

Save keyfile with a new password.

Namespace: FirmaSAT
Assembly: diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.70.0.38178 (10.70.0.0)
Syntax
public static int NewKeyFile(
	string newFile,
	string newPassword,
	string keyFile,
	string keyPassword,
	KeyFormat format
)

Parameters

newFile  String
Name of new output file to be created.
newPassword  String
Password for new key file.
keyFile  String
Name of input key file (or a string containing the key in PEM form).
keyPassword  String
Password for existing key file.
format  KeyFormat
Format to save file [default = DER binary].

Return Value

Int32
Zero (0) if output file is successfully created, or a negative error code.
Example
C#
string password = "12345678a";
string newpassword = "password123";
int n = Sat.NewKeyFile("emisor_new.pem", newpassword, "emisor.key", password, KeyFormat.PEM);
Debug.Assert(n == 0, "Sat.NewKeyFile failed");
Console.WriteLine(File.ReadAllText("emisor_new.pem"));
// -----BEGIN ENCRYPTED PRIVATE KEY-----
// MIIFDjBABgkqhkiG9w0BBQ0wMzAbBgkqhkiG9w0BBQwwDgQIn2sl+Cj3VtgCAggA ...
// -----END ENCRYPTED PRIVATE KEY-----
See Also