Verify that the public key in an X.509 certificate matches the private key.
Namespace:
FirmaSATAssembly: diFirmaSatNet (in diFirmaSatNet.dll) Version: 10.50.0.29531
Syntax
C# |
---|
public static int CheckKeyAndCert( string keyFile, string password, string certFile ) |
Visual Basic (Declaration) |
---|
Public Shared Function CheckKeyAndCert ( _ keyFile As String, _ password As String, _ certFile As String _ ) As Integer |
Parameters
- keyFile
- Type: System..::.String
Name of private key file
- password
- Type: System..::.String
Password for encrypted private key
- certFile
- Type: System..::.String
X.509 certificate file or XML document with embedded certificado node
Return Value
Zero (0) if keys match or a negative error code.
Examples

int n = Sat.CheckKeyAndCert("emisor.key", "12345678a", "emisor.cer"); Console.WriteLine("Sat.CheckKeyAndCert returns {0}", n); // Sat.CheckKeyAndCert returns 0 // Cert and key do not match ... n = Sat.CheckKeyAndCert("emisor.key", "12345678a", "pac.cer"); Console.WriteLine("Sat.CheckKeyAndCert returns {0}", n); // Sat.CheckKeyAndCert returns -21 Console.WriteLine(General.ErrorLookup(n)); // Match not found/No se pudo encontrar datos coincidente (NO_MATCH_ERROR) Console.WriteLine(General.LastError()); // Private key does not match key in certificate/La clave privada no coincide con la clave del certificado