By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,321 Members | 1,909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,321 IT Pros & Developers. It's quick & easy.

How to convert privatekey(string) to XML

P: n/a
Hi all,

I need to convert privatekey toXML format.

I read privatekey from file. Here is how:
--------------------------------
Dim myStream As System.IO.StringWriter = New
System.IO.StringWriter
Dim testfile As String = "c:\RSAprivate.txt"
Dim objStreamReader As System.IO.StreamReader
objStreamReader = System.IO.File.OpenText(testfile)

Dim readfile As String = objStreamReader.ReadToEnd()

TextBox1.Text = readfile

objStreamReader.Close()
--------------------------------

and the privatekey looks like this:

-----BEGIN RSA PRIVATE KEY-----
MIICWwIBAAKBgQCwYClyixsZHKii1YBsgb7rrQ6JyZywREQHMD 6esaSw5ilknyKx
enFW2QrpH4d56evYz46oprNwYXYO4WuV67ne2bfG1fCoUcJ4+c mCcgm3pSb1l+cW
d/DCzYP38wa+AdLFbbW6Bp9ukL/4uiLIa1/VppovQZojweuTBZgGx/HHFQIBIwKB
gDx4vcDfPH2jbQSg+NS12R2aa2JxAoWTv41voHDscvrSkdlbId ZzH4t9nVc+ApAy
8catj/9PGPNUnYFx275fcuy/5+eg2370gXOD9pHmz6zLrJFJvqyFOE2fllVhoEqF
d3NqfnW40zNB6fBXCsyDSPL5NK0MvUdN0lada1pzPne7AkEA46 qjSMRki/3g0MP9
O0uzl+UafcIuWmOE68Z1Rz/GLcLCj3he+knV1xM9S8hw15XMyi5ZAPQhu4JphrNc
K6OFJwJBAMZTaqKsEXygXJLLsQA1oedf3gMOG5j+W3rxtE8IyS QeR5JMg7FC7eQX
vnB62Go1RDA83YYonLjDrN5rjXbYD2MCQHuXJXClIKPEVXik6I 3nRDyDr0uVTFz0
MjbZct2JBS7I0AS9r+b04cyGyYDpJ1B15DM9u0mpGaBOHAdLbI y32pECQQCY/oV2
LPeMBq3QU/2ScoPSPvu5NsTVG/1teKEJxPLv+hn0hCsTt0nNNuNeFZ+iY5sAo/tY
3YA2wtXQJxVbrf09AkEApgfmOTAqnBvclrlUr9hD3bBOQe62v0 rmlPvjDbd5GPSW
E5ijiJa898qlQPA7i4kdcoE6KLtyTmZXrkS3oX7tAg==
-----END RSA PRIVATE KEY-----

I don't know how to conver to XML to look like this:

<RSAKeyValue><Modulus>sGApcosbGRyootWAbIG+660Oicmc sEREBzA+nrGksOYpZJ8isXpxVtkK6R+Heenr2M+OqKazcGF212 Frleu53tm3xtXwqFHCePnJgnIJt6Um9ZfnFnfwws2D9/MGvgHSxW21ugafbpC/+LoiyGtf1aaaL0GaI8HrkwWYBsfxxxU=</Modulus><Exponent>Iw==</Exponent><P>46qjSMRki/3g0MP9O0uzl+UafcIuWmOE68Z1Rz/GLcLCj3he+knV1xM9S8hw15XMyi5ZAPQhu4JphrNcK6OFJw==</P><Q>xlNqoqwRfKBcksuxADWhZd/eAw4bmP5bevG0TwjJJB5HkkyDsULt5Be+cHrYajVEMDzdhiicu MOs3muNdtgPYw==</Q><DP>e5clcKUgo8RVeKTojedEPIOvS5VMXPQyNtly3YkFLsjQ BL2v5vThzIbJgOknUHXkMz27SakZoE4cB0tsjLfakQ==</DP><DQ>mP6Fdiz3jAat0FP9knKD0j77uTbE1Rv9bXihCcTy7/oZ9IQrE7dJzTbjXhWfomObAKP7WN2ANsLV0CcVW639PQ==</DQ><InverseQ>pgfmOTAqnBvclrlUr9hD3bBOQe62v0rmlPvjD bd5GPSWE5ijiJa898qlQPA7i4kdcoE6KLtyTmZXrkS3oX7tAg= =</InverseQ><D>PHi9wN88faNtBKD41L7FHZprYnEChZO/jW+gcOxy+tKR2Vsh1nMfi32dVz4CkDLxxq2P/08Y81SdgXHbvl9y7L/n56DbfvSBc4P2kebPrMuskUm+rIU4TZ+WVWGgSoV3c2p+dbjTM 0Hp8FcKzINI8vk0rQy9R03SVp1rWnM+d7s=</D></RSAKeyValue>

Please help.
Regards,
Drazen

Aug 29 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.