c# - CryptGetProvParam PP_ENUMCONTAINERS shows me only default certificate on smart card -


I have Gemalto.NET smart card.
I imported using Gemleto Tool 2 certificates in it, I suspect using Crypto API to do this when you use the IP).

I

  certutil -key -csp "Microsoft Base Smart card crypto provider runs"  

The following results have

Microsoft base smart card crypto provider:
7c168bc3-dc1d-a627-c218-cd45729b42cb [default container] AT_KEYEXCHANGE

badd537a-a377-431b-cbc9-8699dbe15e0e AT_KEYEXCHANGE

The loaded layer key is missing 0x8009000d (-2146893811) CertUtil: -key command successfully completed

Now I have to find those keys in my C # program. To do this, I've written the following method, which should return all keys to specific smart cards.

  Fixed list & lt; String & gt; Enemment Containers (string card) {var list = new list & lt; String & gt; (); Var Provider = IntPtr.Zero; If (! CryptAcquireContext (referring provider, @ "+ \." + "+ Card + @", "Microsoft Base Smart Card Crypto Provider", 1, Sispiproverflagskyuesmaciinkeostor)) Dibgkprkashit ( "+); UIT Buffer Size = 40 9 6; Var container = new Stringbilder ((Int) buffer size); Uaiaiti flags = CRYPT_FIRST; while (CryptGetProvParam (provider, PP_ENUMCONTAINERS, container, referee buffer size, flags)) {list.Add (containers. ToString () ); flag = 0;} return list;}  

but my method only 7c168bc3-dc1d-a627-c218-cd45729 b42cb key is the default one who searches. to find all the key / containers stored on the smart card should I do ??

and then

I have a new import using I delete how those keys and C #?

I have the same problem and I've seen similar posts on the web, but finally I got the answer ... by examining the error code!

e Could cause that is being implemented Value Pisibeedata (to reflect the length of the returned data) and should be set on the size of the buffer before each call.

GetLastError after the failure shows error 234 which is actually!

In fact this "promoting a bug in the sample" with Captcha and P. ()

  dwFlags = CRYPT_FIRST; // essential originality StringBuilder sb = new string builder (BUFFSIZE); While (Win32.CryptGetProvParam (hProv, enumflags, sb, referee Pisibeedeta, dwFlags)) {dwFlags = 0; // is required to continue the containero names of the entire enumeration. Add (SB toString ()); }  

Where pcbData = BUFFSIZE; is missing in the loop.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -