471,319 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

Generate key file in code

Hi,

Instead of running "sn-k" to generate a key pair, I need to generate the key
file in code, is there anyone know how to generate key files in .NET code?

Any help is appreciated.

Gnic
Feb 1 '06 #1
6 6643
Hello Gnic,

sn.exe even is not .net app.
Seems that you can't get key programmatically.

G> Instead of running "sn-k" to generate a key pair, I need to generate
G> the key file in code, is there anyone know how to generate key files
G> in .NET code?

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Feb 1 '06 #2
Gnic,

Michael pointed out that sn.exe is not a managed application, so we
can't reflect it to determine what the code is that it is using.

What you could do is use an instance of the Process class to run the
utility, and then open the file and read the contents.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gnic" <ga****@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
Hi,

Instead of running "sn-k" to generate a key pair, I need to generate the
key file in code, is there anyone know how to generate key files in .NET
code?

Any help is appreciated.

Gnic

Feb 1 '06 #3
I made a getkey util on Channel9 sandbox that may help you.
http://channel9.msdn.com/ShowPost.as...ID=80076#80076

--
William Stacey [MVP]

"Gnic" <ga****@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
| Hi,
|
| Instead of running "sn-k" to generate a key pair, I need to generate the
key
| file in code, is there anyone know how to generate key files in .NET code?
|
| Any help is appreciated.
|
| Gnic
|
|
Feb 2 '06 #4
I'm sure William is a very decent chap however you should be aware that you
should never use crypto key generators from someone you do not trust totally
to be both accurate and honest as it may not be secure.

Also I'm curious to know why you would want a lot of RSA key pairs. private
key crypto fine but public key crypto?

"William Stacey [MVP]" <wi************@gmail.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...
I made a getkey util on Channel9 sandbox that may help you.
http://channel9.msdn.com/ShowPost.as...ID=80076#80076

--
William Stacey [MVP]

"Gnic" <ga****@hotmail.com> wrote in message
news:ud**************@TK2MSFTNGP09.phx.gbl...
| Hi,
|
| Instead of running "sn-k" to generate a key pair, I need to generate the
key
| file in code, is there anyone know how to generate key files in .NET
code?
|
| Any help is appreciated.
|
| Gnic
|
|

Feb 2 '06 #5
I would not either. But the source is there, and it just calls MS libs, so
I guess the user can decide. Cheers.

--
William Stacey [MVP]

"Nick Hounsome" <nh***@nickhounsome.me.uk> wrote in message
news:io*********************@fe2.news.blueyonder.c o.uk...
| I'm sure William is a very decent chap however you should be aware that
you
| should never use crypto key generators from someone you do not trust
totally
| to be both accurate and honest as it may not be secure.
|
| Also I'm curious to know why you would want a lot of RSA key pairs.
private
| key crypto fine but public key crypto?
|
| "William Stacey [MVP]" <wi************@gmail.com> wrote in message
| news:OM**************@TK2MSFTNGP09.phx.gbl...
| >I made a getkey util on Channel9 sandbox that may help you.
| > http://channel9.msdn.com/ShowPost.as...ID=80076#80076
| >
| > --
| > William Stacey [MVP]
| >
| > "Gnic" <ga****@hotmail.com> wrote in message
| > news:ud**************@TK2MSFTNGP09.phx.gbl...
| > | Hi,
| > |
| > | Instead of running "sn-k" to generate a key pair, I need to generate
the
| > key
| > | file in code, is there anyone know how to generate key files in .NET
| > code?
| > |
| > | Any help is appreciated.
| > |
| > | Gnic
| > |
| > |
| >
| >
|
|
Feb 2 '06 #6
Nicholas Paldino [.NET/C# MVP] wrote:
Gnic,

Michael pointed out that sn.exe is not a managed application, so we
can't reflect it to determine what the code is that it is using.

What you could do is use an instance of the Process class to run
the utility, and then open the file and read the contents.


SSCLI shows that it uses the methods exported from mscoree.dll. Of
course, you'll have to call these though platform invoke. Thy are
documented either in MSDN or in the strong name header file in the tools
developers guide. StrongNameKeyGen looks like a good one to try :-)

Richard
--
Fusion Tutorial: http://www.grimes.demon.co.uk/workshops/fusionWS.htm
Security Tutorial:
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Feb 5 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by PeterW | last post: by
6 posts views Thread by comp.lang.php | last post: by
13 posts views Thread by vm98123 | last post: by
82 posts views Thread by robert bristow-johnson | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.