Home All Groups Group Topic Archive Search About

RSACryptoServiceProvider

Author
12 Sep 2005 9:15 PM
Tim Wallace
I need to create and store a public/private key pair in a container.  I'm
using RSACryptoServiceProvider to create the keys, store them in the
container and retrieve them.  My problem is this:  I need to get the actual
public key value, not the components used to create the key.  Whenever I
call RSACryptoServiceProvider.ToXmlString(), it gives me the components.
How can I just get the resultant key?

Tim

Author
12 Sep 2005 9:49 PM
William Stacey [MVP]
When you get the RSACSP from the container, you have the key/pair.  If you
just want the public key, to a ToXmlString(false) and FromXML on a new
RSACSP object.  You then just have the public key.  What are you trying to
do?

--
William Stacey [MVP]

Show quoteHide quote
"Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
news:O4sDk89tFHA.2540@TK2MSFTNGP09.phx.gbl...
>I need to create and store a public/private key pair in a container.  I'm
>using RSACryptoServiceProvider to create the keys, store them in the
>container and retrieve them.  My problem is this:  I need to get the actual
>public key value, not the components used to create the key.  Whenever I
>call RSACryptoServiceProvider.ToXmlString(), it gives me the components.
>How can I just get the resultant key?
>
> Tim
>
Author
13 Sep 2005 5:57 AM
Tim Wallace
I want to be able to give out a public key for others to use when I am the
recipient of a document.  Then, I can use my private key to decrypt
(obviously ;-).  When I issue the ToXmlString, I get XML that contains what
looks like the values used to create a key.  Is one of the values the
"actual" key?

Tim

Show quoteHide quote
"William Stacey [MVP]" <stac***@mvps.org> wrote in message
news:%23w7abP%23tFHA.3068@TK2MSFTNGP14.phx.gbl...
> When you get the RSACSP from the container, you have the key/pair.  If you
> just want the public key, to a ToXmlString(false) and FromXML on a new
> RSACSP object.  You then just have the public key.  What are you trying to
> do?
>
> --
> William Stacey [MVP]
>
> "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
> news:O4sDk89tFHA.2540@TK2MSFTNGP09.phx.gbl...
>>I need to create and store a public/private key pair in a container.  I'm
>>using RSACryptoServiceProvider to create the keys, store them in the
>>container and retrieve them.  My problem is this:  I need to get the
>>actual public key value, not the components used to create the key.
>>Whenever I call RSACryptoServiceProvider.ToXmlString(), it gives me the
>>components. How can I just get the resultant key?
>>
>> Tim
>>
>
>
Author
13 Sep 2005 12:53 PM
Tim Wallace
OK, I did some more research on the RSA algorithm, and I think I just
managed to muddy the waters a bit more.  Apparently one give the modulus and
public exponent to others and keep the private exponent private.  When I
looked at the values again that ToXmlString produces, I see non-numeric
characters in the values (such as '=' and '+').  Can someone shed some light
for this RSA newbie?

Tim

Show quoteHide quote
"William Stacey [MVP]" <stac***@mvps.org> wrote in message
news:%23w7abP%23tFHA.3068@TK2MSFTNGP14.phx.gbl...
> When you get the RSACSP from the container, you have the key/pair.  If you
> just want the public key, to a ToXmlString(false) and FromXML on a new
> RSACSP object.  You then just have the public key.  What are you trying to
> do?
>
> --
> William Stacey [MVP]
>
> "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
> news:O4sDk89tFHA.2540@TK2MSFTNGP09.phx.gbl...
>>I need to create and store a public/private key pair in a container.  I'm
>>using RSACryptoServiceProvider to create the keys, store them in the
>>container and retrieve them.  My problem is this:  I need to get the
>>actual public key value, not the components used to create the key.
>>Whenever I call RSACryptoServiceProvider.ToXmlString(), it gives me the
>>components. How can I just get the resultant key?
>>
>> Tim
>>
>
>
Author
13 Sep 2005 1:20 PM
William Stacey [MVP]
When you export the key using ToXmlString(false), that *is the public key.
All those different elements make up the public key.  You could give that
string to someone and they could do a FromXml() to import the key.  Now they
have your public key.  If you sign your assemblies, they also contain the
public key, so the client can get the public key from your client assembly.
You can also create a Snk with just the public key and give people that.
Then you can import the public key from the snk.  The snk is just a binary
blob format of the same info in the XML.

--
William Stacey [MVP]

Show quoteHide quote
"Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
news:OpKRmIGuFHA.3500@TK2MSFTNGP09.phx.gbl...
> OK, I did some more research on the RSA algorithm, and I think I just
> managed to muddy the waters a bit more.  Apparently one give the modulus
> and public exponent to others and keep the private exponent private.  When
> I looked at the values again that ToXmlString produces, I see non-numeric
> characters in the values (such as '=' and '+').  Can someone shed some
> light for this RSA newbie?
>
> Tim
>
> "William Stacey [MVP]" <stac***@mvps.org> wrote in message
> news:%23w7abP%23tFHA.3068@TK2MSFTNGP14.phx.gbl...
>> When you get the RSACSP from the container, you have the key/pair.  If
>> you just want the public key, to a ToXmlString(false) and FromXML on a
>> new RSACSP object.  You then just have the public key.  What are you
>> trying to do?
>>
>> --
>> William Stacey [MVP]
>>
>> "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in
>> message news:O4sDk89tFHA.2540@TK2MSFTNGP09.phx.gbl...
>>>I need to create and store a public/private key pair in a container.  I'm
>>>using RSACryptoServiceProvider to create the keys, store them in the
>>>container and retrieve them.  My problem is this:  I need to get the
>>>actual public key value, not the components used to create the key.
>>>Whenever I call RSACryptoServiceProvider.ToXmlString(), it gives me the
>>>components. How can I just get the resultant key?
>>>
>>> Tim
>>>
>>
>>
>
>
Author
13 Sep 2005 1:30 PM
Tim Wallace
William:

What about people not using .NET?  I've seen people in newsgroups, etc. that
include a big number in there signature and call it their public key.  It
doesn't look a thing like the XML we're discussing.  Am I missing something?
I want to be able for anyone to be able to use my public key, regardless of
platform.

Tim

Show quoteHide quote
"William Stacey [MVP]" <stac***@mvps.org> wrote in message
news:OEk$4XGuFHA.1264@TK2MSFTNGP12.phx.gbl...
> When you export the key using ToXmlString(false), that *is the public key.
> All those different elements make up the public key.  You could give that
> string to someone and they could do a FromXml() to import the key.  Now
> they have your public key.  If you sign your assemblies, they also contain
> the public key, so the client can get the public key from your client
> assembly. You can also create a Snk with just the public key and give
> people that. Then you can import the public key from the snk.  The snk is
> just a binary blob format of the same info in the XML.
>
> --
> William Stacey [MVP]
>
> "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
> news:OpKRmIGuFHA.3500@TK2MSFTNGP09.phx.gbl...
>> OK, I did some more research on the RSA algorithm, and I think I just
>> managed to muddy the waters a bit more.  Apparently one give the modulus
>> and public exponent to others and keep the private exponent private.
>> When I looked at the values again that ToXmlString produces, I see
>> non-numeric characters in the values (such as '=' and '+').  Can someone
>> shed some light for this RSA newbie?
>>
>> Tim
>>
>> "William Stacey [MVP]" <stac***@mvps.org> wrote in message
>> news:%23w7abP%23tFHA.3068@TK2MSFTNGP14.phx.gbl...
>>> When you get the RSACSP from the container, you have the key/pair.  If
>>> you just want the public key, to a ToXmlString(false) and FromXML on a
>>> new RSACSP object.  You then just have the public key.  What are you
>>> trying to do?
>>>
>>> --
>>> William Stacey [MVP]
>>>
>>> "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in
>>> message news:O4sDk89tFHA.2540@TK2MSFTNGP09.phx.gbl...
>>>>I need to create and store a public/private key pair in a container.
>>>>I'm using RSACryptoServiceProvider to create the keys, store them in the
>>>>container and retrieve them.  My problem is this:  I need to get the
>>>>actual public key value, not the components used to create the key.
>>>>Whenever I call RSACryptoServiceProvider.ToXmlString(), it gives me the
>>>>components. How can I just get the resultant key?
>>>>
>>>> Tim
>>>>
>>>
>>>
>>
>>
>
>
Author
13 Sep 2005 1:47 PM
William Stacey [MVP]
Use the key blob format then.  FW 2.0 has the ExportCspBlob also.  If your
using Certs, most platforms have a way to get the public key out of the
Cert.

--
William Stacey [MVP]

Show quoteHide quote
"Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in message
news:ezySddGuFHA.3864@TK2MSFTNGP12.phx.gbl...
> William:
>
> What about people not using .NET?  I've seen people in newsgroups, etc.
> that include a big number in there signature and call it their public key.
> It doesn't look a thing like the XML we're discussing.  Am I missing
> something? I want to be able for anyone to be able to use my public key,
> regardless of platform.
>
> Tim
>
> "William Stacey [MVP]" <stac***@mvps.org> wrote in message
> news:OEk$4XGuFHA.1264@TK2MSFTNGP12.phx.gbl...
>> When you export the key using ToXmlString(false), that *is the public
>> key. All those different elements make up the public key.  You could give
>> that string to someone and they could do a FromXml() to import the key.
>> Now they have your public key.  If you sign your assemblies, they also
>> contain the public key, so the client can get the public key from your
>> client assembly. You can also create a Snk with just the public key and
>> give people that. Then you can import the public key from the snk.  The
>> snk is just a binary blob format of the same info in the XML.
>>
>> --
>> William Stacey [MVP]
>>
>> "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in
>> message news:OpKRmIGuFHA.3500@TK2MSFTNGP09.phx.gbl...
>>> OK, I did some more research on the RSA algorithm, and I think I just
>>> managed to muddy the waters a bit more.  Apparently one give the modulus
>>> and public exponent to others and keep the private exponent private.
>>> When I looked at the values again that ToXmlString produces, I see
>>> non-numeric characters in the values (such as '=' and '+').  Can someone
>>> shed some light for this RSA newbie?
>>>
>>> Tim
>>>
>>> "William Stacey [MVP]" <stac***@mvps.org> wrote in message
>>> news:%23w7abP%23tFHA.3068@TK2MSFTNGP14.phx.gbl...
>>>> When you get the RSACSP from the container, you have the key/pair.  If
>>>> you just want the public key, to a ToXmlString(false) and FromXML on a
>>>> new RSACSP object.  You then just have the public key.  What are you
>>>> trying to do?
>>>>
>>>> --
>>>> William Stacey [MVP]
>>>>
>>>> "Tim Wallace" <twallace-ThisDoesNotBelong-AT-emailDOTcom> wrote in
>>>> message news:O4sDk89tFHA.2540@TK2MSFTNGP09.phx.gbl...
>>>>>I need to create and store a public/private key pair in a container.
>>>>>I'm using RSACryptoServiceProvider to create the keys, store them in
>>>>>the container and retrieve them.  My problem is this:  I need to get
>>>>>the actual public key value, not the components used to create the key.
>>>>>Whenever I call RSACryptoServiceProvider.ToXmlString(), it gives me the
>>>>>components. How can I just get the resultant key?
>>>>>
>>>>> Tim
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>