Search code examples
.netcryptographydigital-signaturegnupg

How to verify GPG signatures (.asc files) with .NET Framework System.Security.Cryptography routines


How can I verify the signature of a file that was signed by gpg?

I have: the exported public key that signed it, the file, and the .asc file with the signature in it.

This routine seems to be the guts of what I need, now it's basically a problem of format conversion: http://msdn.microsoft.com/en-us/library/system.security.cryptography.dsa.verifysignature.aspx

Actually calling gpg is out as (1) I don't want to ship it and (2) I don't want to mess with the user's keyring if they already have it installed.


Solution

  • "Format conversion" is merely writing part of OpenPGP code - take RFC 4880 and start writing. An alternative is to take an existing implementation of OpenPGP standard for .NET, such as our OpenPGPBlackbox or BouncyCastle.