Check self signature status

StewartBW 285 Reputation points
2024-04-16T05:13:06.1+00:00

Hello

Using VB.net or C# .net framework 4.0, is it possible to add a self check for the digital signature of assembly file?

So assembly file should check itself to make sure if it's signed using my code signing certificate and if not, or file is modified and the certificate is invalid, terminate the app.

Thanks for the help.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,264 questions
VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,575 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 26,591 Reputation points Microsoft Vendor
    2024-04-16T05:57:25.2833333+00:00

    Hi @StewartBW ,

    You can use AssemblyName.GetPublicKey Method to retrieve the public key from the assembly. Then compare the retrieved public key with the public key of your code signing certificate.

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.