Save keyfile with a new password.
Namespace:
FirmaSATAssembly: diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.50.0.29531
Syntax
C# |
---|
public static int NewKeyFile( string newFile, string newPassword, string keyFile, string keyPassword, KeyFormat format ) |
Visual Basic (Declaration) |
---|
Public Shared Function NewKeyFile ( _ newFile As String, _ newPassword As String, _ keyFile As String, _ keyPassword As String, _ format As KeyFormat _ ) As Integer |
Parameters
- newFile
- Type: System..::.String
Name of new output file to be created.
- newPassword
- Type: System..::.String
Password for new key file.
- keyFile
- Type: System..::.String
Name of input key file (or a string containing the key in PEM form).
- keyPassword
- Type: System..::.String
Password for existing key file.
- format
- Type: FirmaSAT..::.KeyFormat
Format to save file [default = DER binary].
Return Value
Zero (0) if output file is successfully created, or a negative error code.
Examples

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-----