Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

How can I determine if a Windows Driver is Digitally signed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rymfax - 13 Mar 2008 21:24 GMT
Hey all.

I need to determine whether or not a Windows Driver is digitally
signed using a C# application.  Can anyone point me in the right
direction for doing this?  I know it has something to do with the .cat
file, but I'm not sure exactly what else I need to do.

TIA!
Willy Denoyette [MVP] - 13 Mar 2008 22:42 GMT
> Hey all.
>
[quoted text clipped - 4 lines]
>
> TIA!

If the driver file is signed, then it should contain a valid X509
certificate, so one way to check this is by using using the
System.Security.Cryptography.X509Certificates namespace.
Here a small snip to get you started..

using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
...

  X509Certificate certp =
X509Certificate2.CreateFromSignedFile(@"C:\Windows\System32\drivers\tcpip.sys");
  X509Certificate2 x509 = new X509Certificate2(certp.Handle);
  // if valid, dump some properties to the console
  Console.WriteLine("{0}Subject: {1}{0}",
Environment.NewLine,x509.Subject);
  Console.WriteLine("{0}Issuer: {1}{0}", Environment.NewLine,x509.Issuer);
  Console.WriteLine("{0}Version: {1}{0}",
Environment.NewLine,x509.Version);
  Console.WriteLine("{0}Valid Date: {1}{0}",
Environment.NewLine,x509.NotBefore);
  Console.WriteLine("{0}Expiry Date: {1}{0}",
Environment.NewLine,x509.NotAfter);
  Console.WriteLine("{0}Thumbprint: {1}{0}",
Environment.NewLine,x509.Thumbprint);
  Console.WriteLine("{0}Serial Number: {1}{0}",
Environment.NewLine,x509.SerialNumber);
  Console.WriteLine("{0}Friendly Name: {1}{0}",
       Environment.NewLine,x509.PublicKey.Oid.FriendlyName);
  Console.WriteLine("{0}Public Key Format: {1}{0}",
        Environment.NewLine,x509.PublicKey.EncodedKeyValue.Format(true));
  Console.WriteLine("{0}Raw Data Length: {1}{0}",
Environment.NewLine,x509.RawData.Length);
  Console.WriteLine("{0}Certificate to string: {1}{0}",
Environment.NewLine,x509.ToString(true));

Willy.
Rymfax - 14 Mar 2008 23:16 GMT
On Mar 13, 4:42 pm, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.be> wrote:

> > Hey all.
>
[quoted text clipped - 42 lines]
>
> Willy.

You Rock Willy! That worked perfectly...THANKS!

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.