Re: CryptImportKey



The following .NET 2 utility tool helps with enumerating all the
keycontainers (either User or Machine) and indicates if that keypair has an
associated certificate in the CryptoAPI cert stores:
http://www.jensign.com/KeyPal

- Mitch Gallant
MVP Security
JavaScience Consulting

"lelteto" <lelteto@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:19301B5A-A967-4910-B2E8-EA8B98BD9F87@xxxxxxxxxxxxxxxx
One more note:

If you want to enumerate the imported keys You would need to enumerate
first
the containers (get a context with CRYPT_MACHINE_KEYSET +
CRYPT_VERIFYCONTEXT) then use CryptGetProvParam with PP_ENUMCONTAINERS,
for
each container name you get you would again get the context to it then
call
CryptGetUserKey with AT_KEYEXCHANGE and AT_SIGNATURE to see if they have
private keys.
Note that most MACHINE_KEYSET (and probably most user-specific) container
will NOT allow to export the private key. You can also check - after you
get
the key handle - if the key has corresponding certificate: call
CryptGetKeyParam with KP_CERTIFICATE.



.