Skip to content

Instantly share code, notes, and snippets.

@SumindaD
Created January 5, 2020 07:36
Show Gist options
  • Select an option

  • Save SumindaD/05150796efc5bcfe649a9e7f82996bc0 to your computer and use it in GitHub Desktop.

Select an option

Save SumindaD/05150796efc5bcfe649a9e7f82996bc0 to your computer and use it in GitHub Desktop.
/// <summary>
/// Verify the integrity of the image by checking the signature using the certificate public key
/// </summary>
/// <param name="xmlFilePath">Path to the signed xml image document</param>
/// <param name="certificateBuffer">The public key certificate byte[] to verify the integrity of the signed xml image document</param>
/// <param name="certPassword">Private key certificate Password</param>
/// <returns>True - If image integrity is intact. False - If image has been tampered with</returns>
public static bool VerifyImage(string xmlFilePath, byte[] certificateBuffer, string certPassword)
{
var certificate = new X509Certificate2(certificateBuffer, certPassword);
return VerifyXMLDocument(xmlFilePath, certificate);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment