Decrypt my World

Cryptography, Security, Debugging and more!

How to get info from client certificates issued by a CA (C#, VS 2010)

How to get info from client certificates issued by a CA (C#, VS 2010)

Rate This
  • Comments 3

Hi all,

 

I developed this sample some time ago: How to get info from client certificates issued by a CA (C#). The other day I tried it on a new machine with Windows 7, Visual Studio 2010 and .NET Framework 4.0, and it didn't even compile. I had to do the following to make it work:

1) Install this to be able to use certadmin.dll in a client machine:

Remote Server Administration Tools for Windows 7 with Service Pack 1 (SP1)

Or this depending on your OS version:

Microsoft Remote Server Administration Tools for Windows Vista

And turn the feature on from "Control Panel" > "Programs and Features" > "Turn Windows features on or off".

2) Generate certadminlib.dll with "tlbimp certadm.dll" and add it as a reference to the project.

3) Change this

CERTADMINLib.CCertViewClass

to this:

CERTADMINLib.CCertView

4) Add Microsoft.CSharp reference.

 

I hope this helps.

Regards,

 

Alex (Alejandro Campos Magencio)

  • Hi, tried to post before but it might have gotten lost. I have tried the above solution but can't get it to work. I have tried with different tlbimp, different .net version and to target different platforms. But it just wont work. When i try to use any methods it gives me an error indicating that it haven't been registered. Using the remote administrative tools works just fine so it has to be something with the code when i try to use it. Any suggestions?

  • I get following error: REGDB_E_CLASSNOTREG. Complete error message is:

    Retrieving the COM class factory for component with CLSID {A12D0F7A-1E84-11D1-9BD6-00C04FB683FA} failed due to the following error: 80040154 Class have not been registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

    But it doesn't complain when i use regsvr32 or any other tool.

    Please anyone, suggesions?

  • Some follow up:

    I got help from Microsoft to solve this all Credit to Helge Mahrt.

    If trying to run the program in any other way than x64 compile this will result in above error.

    So

    1) Compile with x64 option otherwise the program will look in C:\Windows\SysWOW64 for certadmin.dll.

    2) It's not necessary to remove the "Class" ending, it all depends on if you choose to use the option "False" or "True" on Embed interop types for CERTADMINLib

    Thanks

Page 1 of 1 (3 items)
Leave a Comment
  • Please add 8 and 1 and type the answer here:
  • Post
Translate This Page