From: Peter Duniho on
Tony Johansson wrote:
> [...]
> If I have created a strong name for an assembly and this assembly has been
> placed in the GAC how do I get this private
> key that is mentioned in the text.

You don't. That's the point!

If you or anyone else could retrieve the private key from an assembly
that's been placed in the GAC, then it would negate the whole point of
having a private key. Anyone could then impersonate you and your
original private key.

There's a reason the key is described as "private". You should keep it
to yourself. :)

> I have never thought about this private key because I have never used it so
> I just curious how I can get it ?

Generally, you would be issued a certificate by some certificate
provider, who essentially provides a private key for you.

Hopefully, you should never have to actually know the private key
itself. Rather, it's encapsulated in a certificate that you can use for
encryption/strong-naming/etc.

My recollection is that you can self-issue a certificate for
low-security purposes. It won't be trusted when a root authority is
needed, but it's enough for strong-naming. Unfortunately (or
fortunately? :) ) I haven't had a need to sign my .NET programs and so
have no first-hand, practical experience with it, so I can't tell you
all the specifics.

I can tell you that you should keep your private key to yourself. :)

Pete
From: Alberto Poblacion on
"Tony Johansson" <johansson.andersson(a)telia.com> wrote in message
news:OeSB4z$rKHA.5036(a)TK2MSFTNGP02.phx.gbl...
> If I have created a strong name for an assembly and this assembly has been
> placed in the GAC how do I get this private
> key that is mentioned in the text.
> I have never thought about this private key because I have never used it
> so I just curious how I can get it ?

If you have created a strong name for an assembly, then at some point
you must have created a key file (.snk). You either created it manually with
"sn -k", or you used the project properties in Visual Studio to select the
option "new key file". In both cases, a .snk file is created on disk. This
..snk file contains both the private and the public key. You can extract the
public key from the .snk file by means of the SN.EXE utility. From a Visual
Studio command prompt, type "sn -?" to see the options. I don't remember
seeing an option to extract the private key, but it is there anyway; for all
practical purposes the .snk file IS your private key. You just provide the
file when you need to encrypt something with the private key.


From: Tony Johansson on
"Alberto Poblacion" <earthling-quitaestoparacontestar(a)poblacion.org> skrev i
meddelandet news:upJ7W1BsKHA.3908(a)TK2MSFTNGP05.phx.gbl...
> "Tony Johansson" <johansson.andersson(a)telia.com> wrote in message
> news:OeSB4z$rKHA.5036(a)TK2MSFTNGP02.phx.gbl...
>> If I have created a strong name for an assembly and this assembly has
>> been placed in the GAC how do I get this private
>> key that is mentioned in the text.
>> I have never thought about this private key because I have never used it
>> so I just curious how I can get it ?
>
> If you have created a strong name for an assembly, then at some point
> you must have created a key file (.snk). You either created it manually
> with "sn -k", or you used the project properties in Visual Studio to
> select the option "new key file". In both cases, a .snk file is created on
> disk. This .snk file contains both the private and the public key. You can
> extract the public key from the .snk file by means of the SN.EXE utility.
> From a Visual Studio command prompt, type "sn -?" to see the options. I
> don't remember seeing an option to extract the private key, but it is
> there anyway; for all practical purposes the .snk file IS your private
> key. You just provide the file when you need to encrypt something with the
> private key.
>

Good answer!

//Tony


From: Arne Vajhøj on
On 17-02-2010 12:29, Tony Johansson wrote:
> "Alberto Poblacion"<earthling-quitaestoparacontestar(a)poblacion.org> skrev i
> meddelandet news:OuZxfw%23rKHA.6140(a)TK2MSFTNGP05.phx.gbl...
>> "Tony Johansson"<johansson.andersson(a)telia.com> wrote in message
>> news:eywm%23o%23rKHA.3968(a)TK2MSFTNGP02.phx.gbl...
>>> I just wonder how can I see if ngen has been run on an assembly(dll or
>>> exe)
>>
>> You can run "ngen display [assembly name]". If the assembly is not
>> installed in the native images cache, ngen will respond with "Error: The
>> specified assembly is not installed."
>
> I just wonder if anyone have any experience how much in performance profit
> it might give when uses this ngen utility.
> I'm just curious to know.

Execution: using NGEN will either not improve the performance or
make the app run slower (due to less information being available
when generating the native code).

Startup: using NGEN may result in faster startup.

In general you should not use NGEN.

Arne


From: Tony Johansson on
"Arne Vajh�j" <arne(a)vajhoej.dk> skrev i meddelandet
news:4b7c8a28$0$280$14726298(a)news.sunsite.dk...
> On 17-02-2010 12:29, Tony Johansson wrote:
>> "Alberto Poblacion"<earthling-quitaestoparacontestar(a)poblacion.org>
>> skrev i
>> meddelandet news:OuZxfw%23rKHA.6140(a)TK2MSFTNGP05.phx.gbl...
>>> "Tony Johansson"<johansson.andersson(a)telia.com> wrote in message
>>> news:eywm%23o%23rKHA.3968(a)TK2MSFTNGP02.phx.gbl...
>>>> I just wonder how can I see if ngen has been run on an assembly(dll or
>>>> exe)
>>>
>>> You can run "ngen display [assembly name]". If the assembly is not
>>> installed in the native images cache, ngen will respond with "Error: The
>>> specified assembly is not installed."
>>
>> I just wonder if anyone have any experience how much in performance
>> profit
>> it might give when uses this ngen utility.
>> I'm just curious to know.
>
> Execution: using NGEN will either not improve the performance or
> make the app run slower (due to less information being available
> when generating the native code).
>
> Startup: using NGEN may result in faster startup.
>
> In general you should not use NGEN.
>
> Arne
>

I don't understand your mail what is it that you try to say about Execution
/Startup.

What I have heard is that instead of letting the CLR in a way compile MSIL
code into native during runtime
you can do this by using ngen so the startup should be faster. This is what
I have heard.

//Tony