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

Re: Generate key file in code by Michael

Michael
Wed Feb 01 11:58:17 CST 2006

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 Nietzsch



Re: Generate key file in code by Nicholas

Nicholas
Wed Feb 01 12:32:12 CST 2006

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]
- mvp@spam.guard.caspershouse.com

"Gnic" <gasxxx@hotmail.com> wrote in message
news:udtTKL0JGHA.1676@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
>



Re: Generate key file in code by William

William
Wed Feb 01 20:50:31 CST 2006

I made a getkey util on Channel9 sandbox that may help you.
http://channel9.msdn.com/ShowPost.aspx?PostID=80076#80076

--
William Stacey [MVP]

"Gnic" <gasxxx@hotmail.com> wrote in message
news:udtTKL0JGHA.1676@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
|
|



Re: Generate key file in code by Nick

Nick
Thu Feb 02 02:27:58 CST 2006

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]" <william.stacey@gmail.com> wrote in message
news:OMeVwN6JGHA.3960@TK2MSFTNGP09.phx.gbl...
>I made a getkey util on Channel9 sandbox that may help you.
> http://channel9.msdn.com/ShowPost.aspx?PostID=80076#80076
>
> --
> William Stacey [MVP]
>
> "Gnic" <gasxxx@hotmail.com> wrote in message
> news:udtTKL0JGHA.1676@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
> |
> |
>
>



Re: Generate key file in code by William

William
Thu Feb 02 11:23:08 CST 2006

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" <nh002@nickhounsome.me.uk> wrote in message
news:iojEf.236173$vl2.108544@fe2.news.blueyonder.co.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]" <william.stacey@gmail.com> wrote in message
| news:OMeVwN6JGHA.3960@TK2MSFTNGP09.phx.gbl...
| >I made a getkey util on Channel9 sandbox that may help you.
| > http://channel9.msdn.com/ShowPost.aspx?PostID=80076#80076
| >
| > --
| > William Stacey [MVP]
| >
| > "Gnic" <gasxxx@hotmail.com> wrote in message
| > news:udtTKL0JGHA.1676@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
| > |
| > |
| >
| >
|
|



Re: Generate key file in code by Richard

Richard
Sun Feb 05 16:02:03 CST 2006

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