Re: Need the equivalent of CryptGenKey for PUBLIC/PRIVATE pairs

From: [MSFT] (lukezhan_at_online.microsoft.com)
Date: 03/25/05

  • Next message: Renzo: "Problem using AzMan url Authorization and HttpHandler"
    Date: Fri, 25 Mar 2005 07:16:26 GMT
    
    

    Hello,

    (1) If a key container is specified and there is already a key in it, the
    key will be remained in the container even we new a
    RSACryptoServiceProvider object. this can be confirm with following code:

    CspParameters cp = new CspParameters();
    cp.KeyContainerName = ContainerName;

    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cp);
    Console.WriteLine("Key added to container: \n {0}", rsa.ToXmlString(true));

    rsa = new RSACryptoServiceProvider(cp);
    Console.WriteLine("Key added to container: \n {0}", rsa.ToXmlString(true));

    (2) You may refer to this article to see how to use ExportParameters()

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
    frlrfsystemsecuritycryptographyrsacryptoserviceproviderclasssigndatatopic.as
    p

    (3) It is a undocument item and We don't recommend using it yet.

    (5a) It means whether the key should be persisted in the cryptographic
    service provider
    (5b) Yes. ANd its defualt value is true.
    (5c) The key removed form the store right away.

    (4&6) This may deal with the cource code of RSACryptoServiceProvider class,
    I have to say I have no idea yet.

    Hope this help,

    Luke


  • Next message: Renzo: "Problem using AzMan url Authorization and HttpHandler"