Re: Enumerating KeyContainers in C#

From: Michel Gallant (neutron_at_NOSPAMistar.ca)
Date: 04/06/04

  • Next message: Nguyen: "Re: Windows Server 2003 - 403 Errors - WEB DAV - .Config Files"
    Date: Mon, 5 Apr 2004 20:55:30 -0400
    
    

    There is also the more comprehensive .NET utility "KeyPal" with source code here:
       http://www.jensign.com/JavaScience/dotnet/keypal
    Cheers,
    - MIAG

    ""Shawn Farkas"" <shawnfa@online.microsoft.com> wrote in message
    news:6YRwmt2GEHA.616@cpmsftngxa06.phx.gbl...
    > Hi Dirk,
    >
    > Unfortunately there's no way to do that built into the framework. However, you can P/Invoke to
    CAPI and accomplish this task. The
    > function you're looking for is CryptGetProvParam(), (MSDN:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-
    > us/security/security/cryptgetprovparam.asp). You'll want to pass in a query parameter of
    PP_ENUMCONTAINERS.
    > Mich Gallant has written a sample bit of code that does exactly what you're looking for, and
    published it on MSDN:
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncapi/html/netcryptoapi.asp
    >
    > Scroll down to the section entitled ".NET and CryptoAPI via P/Invoke: Part 2" for the code that's
    relavent to your problem.
    >
    > -Shawn
    > http://blogs.msdn.com/shawnfa
    >
    > --
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    > Note: For the benefit of the community-at-large, all responses to this message are best directed
    to the newsgroup/thread from which they
    > originated.
    > --------------------
    > >From: "D. Janknecht" <fda@dfsdasd.com>
    > >Subject: Enumerating KeyContainers in C#
    > >Date: Mon, 5 Apr 2004 17:18:53 +0200
    > >Lines: 23
    > >X-Priority: 3
    > >X-MSMail-Priority: Normal
    > >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    > >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    > >Message-ID: <uFi8SFyGEHA.3636@TK2MSFTNGP12.phx.gbl>
    > >Newsgroups: microsoft.public.dotnet.security
    > >NNTP-Posting-Host: 62.217.38.130
    > >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
    > >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.security:5649
    > >X-Tomcat-NG: microsoft.public.dotnet.security
    > >
    > >Hello,
    > >
    > >i use the following code to access a keycontainer on the local machine:
    > >
    > >CspParameters parms = new CspParameters(1); // PROV_RSA_FULLparms.Flags =
    > >CspProviderFlags.UseMachineKeyStore; // Use Machine store
    > >parms.KeyContainerName MyContainerName; // Name of the key-container
    > >parms.KeyNumber = 2; // AT_SIGNATURE
    > >RSACryptoServiceProvider csp = new RSACryptoServiceProvider(parms);
    > >
    > >This works fine as long as i pass the value of an existing key container in
    > >the "MyContainerName" string . By passing a non-exisiting container name, a
    > >new key is generated but no error occurs.
    > >So my tought was it to enumerate all key containers and test if the given
    > >name exists, but how can i do this?
    > >
    > >Any ideas?
    > >
    > >Thanks in advance,
    > >
    > >Dirk
    > >
    > >
    > >
    >
    >


  • Next message: Nguyen: "Re: Windows Server 2003 - 403 Errors - WEB DAV - .Config Files"

    Relevant Pages

    • Re: Correcting my time servers clock drift on Alpha ES40s / Tru64
      ... You claim to have built from v4.2.0, but your log banner shows an earlier version. ... Moreover, since the logged lines in question do not come from our source code, they either have to come from the kernel, or they have to come from a version of our code which has been modified. ... "thingamabob" instead of "xntpd", the application part of the message would be ...
      (comp.protocols.time.ntp)
    • Re: Anomalies analyzing Dr. Watson crash dump files
      ... immediately see the stack and the source code, ... would usually be able to open a dump file without any problems. ... built with VS6 or VS2003). ...
      (microsoft.public.vc.language)
    • Re: MSDN- DialIt sample source code
      ... > Does anybody have the source code of the dialit application in MSDN? ... I found the DIALIT sample code on the MSDN Library CDs/DVD Oct'01. ... When you access the article "Creating a TAPI Connection Using CTapiConnection" ...
      (microsoft.public.win32.programmer.tapi)
    • Re: DR Concurrent DOS
      ... CP/M-86 Plus system, my 12-MHz TANDON 286. ... I have built a custom 400-MHz system ... source code (since then, CLEAR was found also ...
      (comp.os.cpm)
    • Re: Problem related to creating the msi for the compact framework.
      ... MSDN has an article that covers this, including source code and projects. ... I m trying to make the msi for my project, i have made the cab project ... But i want to build msi for that. ...
      (microsoft.public.pocketpc.developer)

  • Quantcast