Re: strong key problems



Sorry, it is not clear what you are actually trying to accomplish by somehow
splitting out the key, or what it is you are trying to do, and your post is
rather long.

First off, you should only need one key. You should have 1 key for your
organization, and every assembly that is signed coming from your
organization should be signed with the same key.

Additionally, an application does not need to have a strong name, just to
use an assembly that does. That is not true vice versa. But you were saying
that in order to use the assembly with the strong name,your application
needed one too - this is not the case.

You should be able to reference your assembly that has been signed by any
application, and it should just work regardless of whether or not your
application is signed.

<per9000@xxxxxxxxx> wrote in message
news:1154356867.314967.53730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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

  • strong key problems
    ... 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 ... In the shared folder it still fails. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Exception management question...
    ... There is code in my app that follows this general pattern: ... This allows an exception to be thrown with the next line of code attempts to ... >> to propagate up to a global exception handler which logs the exception ... > has determined that the app should terminate the UE handler has no means ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: SqlceException.SqlceException
    ... First of all, i found the cause of the exception and corrected it, it was ... > same challenge in terms of deploying the initial SQL CE database. ... > db along with your app. ... it is the first time i am doing mobile applications and the first ...
    (microsoft.public.sqlserver.ce)
  • Re: wtf?
    ... > called by the ASP classic app, ... >> other than error translation. ... > exception that comes from the command's execute method doesn't seem to ... > the time we might be content saying "SqlException", in this case, we ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: 500 error while GetResponse()
    ... You would of course need to handle any Exception thrown by this method with ... >> The first would mean that the server that your WebRequest sent a Request ... >> The second would mean that your ASP.Net app has a problem. ... >> ..Net Developer ...
    (microsoft.public.dotnet.framework.aspnet)