Ask a Question related to ASP.NET Security, Design and Development.
-
Roy Chastain #1
Need the equivalent of CryptGenKey for PUBLIC/PRIVATE pairs
I have found the GenerateKey method for SymmerticAlgorithm based CSP classes, but I can not find any way to create a
public/private pair for use with AsymmerticAlgorithm classes. In particular I need a key that I can use to sign hashes with.
Thanks for a pointer to the right item.
-------------------------------------------
Roy Chastain
KMSystems, Inc.
Roy Chastain Guest
-
Sharing Constants in Multiple Applications - Public vs.Private
I use private and public constants throughout my application to store hardcoded WSDL URLs and WebService methods. Many of these are the same in... -
#40372 [NEW]: Unlogical behaviour with private/public properties and __get
From: djungowski at chipxonio dot de Operating system: Ubuntu PHP version: 5.2.0 PHP Bug Type: Class/Object related Bug... -
private/public sub?
I have the following like in an asp.net application in the vb.net codebehind page: Compiler Error Message: BC30390: 'Care.Search.Private Sub... -
Question about "Public Sub" vs "Private Sub" vs "Sub"
In my INCLUDE.INC file I have noticed that I can create subs three ways... Public Sub Test1(x) response.write(x) End Sub Private Sub Test2(x)... -
Private Fotopages - private Web Galleries WANTED!
Hello NG I am still seeking links to private (hobby / non professional/ amateur) fotopages in Australia -or any other Country to be used at... -
[MSFT] #2
RE: Need the equivalent of CryptGenKey for PUBLIC/PRIVATE pairs
Hello Roy,
A public/private key pair is generated whenever a new instance of an
asymmetric algorithm class is created. Once a new instance of the class is
created, the key information can be extracted using one of two methods:
1. The ToXMLString method, which returns an XML representation of the key
information.
2. The ExportParameters method, which returns an RSAParameters enumeration
to hold the key information.
For more information on this, you may refer to this article:
Generating Keys for Encryption and Decryption
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm[/url]
l/cpcongeneratingkeysforencryptiondecryption.asp
Hope this help,
Luke
[MSFT] Guest
-
Roy Chastain #3
Re: Need the equivalent of CryptGenKey for PUBLIC/PRIVATE pairs
Luke,
Thanks for the pointer to the article. I had not found that one. It has cleared up some issues, but it has left others even more
confused.
1) - Am I to understand that EVERY 'new RSACryptoServiceProvider()' call creates a NEW key. Is this true even if a key container
is specified and there is already a key in it?
2) - You indicate that ExportParameters actually exports a key along with the parameters used to create the key. Is that really
true? I don't see any reference to the key in the RSAParameters documentation.
3) - Speaking of documentation, the CspProviderFlags enum has a UseExistingKey flag that is not even mentioned in the
documentation. Is it really valid and operational? If so, I would assume that its use would really prevent the creation of a new
key when new RSACryptoServiceProvider() is called.
4) - The routines in the article GenKey_SaveInContainer and GetKeyFromContainer are identical with the exception of the text of
the WriteLine. This would make be believe that a key being generated each time.
5) - The flag PersistKeyInCsp?
5a) - Does that really mean "keep the key in the key store (machine or user as specified"?
5b) - If I create a key (call new RSACryptoServiceProvider()) and set PersistKeyInCsp, is the key stored right then?
5c) - If I open an existing key (assuming that can be done with UseExistingKey in the CspParameters in the call to new
RSACryptoServiceProvider(csp_parameters)), and then clear PersistKeyInCsp, is the key removed form the store right then or does it
get removed when the RSACryptoServiceProvider object is destroyed?
6) - Exporting a key. What the heck happened to the concept of opaque key blobs. Exporting to XML hardly makes it opaque
anymore?
Thanks
On Thu, 24 Mar 2005 02:27:41 GMT, [email]lukezhan@online.microsoft.com[/email] ([MSFT]) wrote:
------------------------------------------->Hello Roy,
>
>A public/private key pair is generated whenever a new instance of an
>asymmetric algorithm class is created. Once a new instance of the class is
>created, the key information can be extracted using one of two methods:
>
>1. The ToXMLString method, which returns an XML representation of the key
>information.
>2. The ExportParameters method, which returns an RSAParameters enumeration
>to hold the key information.
>
>For more information on this, you may refer to this article:
>
>Generating Keys for Encryption and Decryption
>[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm[/url]
>l/cpcongeneratingkeysforencryptiondecryption.asp
>
>Hope this help,
>
>Luke
Roy Chastain
KMSystems, Inc.
Roy Chastain Guest
-
[MSFT] #4
Re: Need the equivalent of CryptGenKey for PUBLIC/PRIVATE pairs
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()
[url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/[/url]
frlrfsystemsecuritycryptographyrsacryptoservicepro viderclasssigndatatopic.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
[MSFT] Guest



Reply With Quote

