473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 6716
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stephen | last post by:
I need to generate input XML for another application by serialising classes defined in an XSD document. The code below will generate the XML I require but I need to generate this in memory rather...
2
by: PeterW | last post by:
I have an xml file from which I want to generate an xsd schema and at a later stage a cs class. The xml file has a mix of defined namespaces and also an empty namespace. These are defined as...
8
by: Bill Rust | last post by:
I've created an "Add Item" wizard for VB.NET 2003 that allows a user to add a specialized class that works with my application framework. In the wizard, the user can select the interfaces they...
6
by: comp.lang.php | last post by:
/** * Generate the random security image * * @access public * @param $willUseFilePath (default false) boolean to determine if you will be using a file path * @param mixed $filePath (optional)...
13
by: vm98123 | last post by:
Hi, could someone please give me a clue to this one: I do have an xml-File and an xslt-File so that a browser can display the xml-file. What I am trying to do is convert this to pdf or...
3
by: joshblair | last post by:
Hello, Has anyone ever seen or created such a code generator? I'm looking for a sample of a code generator that will generate code (preferably one that uses C# and the XMLTextWriter) to create...
82
by: robert bristow-johnson | last post by:
here is a post i put out (using Google Groups) that got dropped by google: i am using gcc as so: $ gcc -v Using built-in specs. Target: i386-redhat-linux Configured with: ../configure...
13
by: gamernaveen | last post by:
I am coding a script , where basically the user has to enter his name , choose file , file comments if required and upload. The file comments , name , filename will be stored in the database with...
1
by: ergolargo | last post by:
Hello all Apologies if I've picked the wrong forum, but can anybody offer assistance to me? I'm definitely struggling to get my first data access layer generated using the Dataset Designer in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.