strong key problems



Dear readers,

I have some problems with strong keys.

What I want to do is basically this.
A - create an application (f.x. strongHello.dll) with a strong key.
B - import the functions of this dll into a console application (f.x
StrongConsoleApp.exe) and run it if I have somehow specified the public
part of the strong key and not otherwise.

(think of it as A being me and B my users that may continue developing
my exuisite application)

My question is pretty much: How do I/my users run my strongly named
applications.

I have found some relatively nice info out on the web, but only info
that deals with
i - how to create a strong key and use it in your applications.
ii - how to create the public part of a strong key (not how another
developer can use this public part).
iii - that reverse engineering of strongly named files is still
possible
iv - any referencer to any app with strong name must also have a strong
name


What I had expected
------------------------
a) my dll-file uses a strong key
b) extract public part from this key
c) import public part in new app
d) any app referencing a strong named app must also have a strong name
(thus: create a 2nd strong key (end users key))
e) rejoyce


What I got (Long version below this line)
------------------------
(1)
I create an empty class library with the following (in MS visual c++
2005 express edition)

//ugly way of writing "hell o world!"
namespace A
{
public class B
{
public string C(int pos1, int pos2)
{
string s = "HELLOWORLD!";
s = s.Substring(0, pos1) + " " + s.Substring(pos1, pos2 - pos1) +
" " + s.Substring(pos2);
s.Insert(pos1, " ");
return s;
}
}
}

(2)
I remove the assembly info file (getting version 0.0.0.0 which is ok),
right click my project and sign with my myStrength.snk (just created
with "Long path\sn.exe" -k myStrength.snk)

(3)
Close this solution and start a new one (StrongConsoleApp) with the
following:

namespace strongHello
{
class Program
{
static void Main(string[] args)
{
A.B s = new A.B();
Console.WriteLine(s.C(4, 5));
}
}
}

to my surprise (since I have not used any key for this solution) I get
HELL O WORLD!

I did not expect this to be possible - does the program know that I did
both of these applications?

(4)
I copy strongHello.dll and StrongConsoleApp.exe to a shared folder and
try the same. I get an exception (as expected, but not the one I had
expected)
Unhandled Exception: System.Security.SecurityException: That assembly
does not allow partially trusted callers.

I had however expected another exception - a complaint about the
application not having a strong name (This is what happened with my
real application. I was trying to reproduce that with this smaller
issue.)

(5)
I sign my exe file with the same key. On my harddrive it still works.
In the shared folder it still fails. with the same exception.

(6)
The application has security under it's properties - I set the project
to be a partial trust application. But the dll does not allow partial
trust, nor has it got a security tab under it's properties (really
confusing).

Can someone please give a helping hand?
/Per

.



Relevant Pages

  • Re: strong key problems
    ... it is not clear what you are actually trying to accomplish by somehow ... i - how to create a strong key and use it in your applications. ... iv - any referencer to any app with strong name must also have a strong ... Unhandled Exception: System.Security.SecurityException: That assembly ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Error: (Type initializer threw an exception)
    ... Vista and VB 2008 + Framework 3.5, but while testing our applications the ... Questions about the VB.Net and the DotNet framework should be posted ... An unhandled exception of type 'System.InvalidOperationException' occurred ... 1 app and 3 class libraries which are ...
    (microsoft.public.vb.general.discussion)
  • RE: More on Shatter
    ... Latency for the WM_TIMER message is irrelevant. ... load, and you code an app to fire WM_TIMER's at every 50ms, your WM_TIMERS ... > try to do real-time things (as I wager most applications ...
    (Vuln-Dev)
  • Re: Application xxx has encountered a serious error and must shut
    ... Chris Tacke, Embedded MVP ... use of Queueacross multiple threads - and even my exception ... stopped my Serial port thread - last time it stopped the whole app:-O. ... NB I replaced the MS SerialPort with OpenNetCF Serial and this seems ...
    (microsoft.public.windowsce.app.development)
  • Re: Safely SHUTDOWN Device from Application
    ... If you have only specific applications then you could designate one to be ... How you handle suspend is very much hardware dependent, ... It's then up to the app to take ... By 'Safe Shutdown', I meant that any application writing/reading to/ ...
    (microsoft.public.windowsce.platbuilder)