Bug 312938 (MONO49542) - MCS doesn't correctly include the strongname public key inside an assembly.
Summary: MCS doesn't correctly include the strongname public key inside an assembly.
Status: RESOLVED MOVED
Alias: MONO49542
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other All
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-11 02:31 UTC by Sebastien Pouliot
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:16:45 UTC


---- Reported by spouliot@videotron.ca 2003-10-10 19:31:42 MST ----

Description of Problem:

MCS doesn't correctly include the strongname public key inside an 
assembly. 


Steps to reproduce the problem:
*** Must be executed under Windows ***

1. Create a new strongname keypair named hello.snk
   sn -k hello.snk

2. compile the following source with CSC
   csc helloworld.cs

using System;
using System.Reflection;

[assembly: AssemblyKeyFile ("hello.snk")]
[assembly: AssemblyDelaySign (true)]

public class MainClass {
     public static void Main (string[] args)
     {
          Console.WriteLine ("Hello world!");
     }
}

3. Sign the assembly (which already contains the public key)
   sn -R helloworld.exe hello.snk

4. Validate the strongname signature on the CSC generated assembly
   sn -v helloworld.exe

   Result should be: Assembly 'helloworld.exe' is valid

5. Now compile the same source code using MCS
   mcs helloworld.exe

6. Sign the assembly (which SHOULD contains the public key)
   sn -R helloworld.exe hello.snk

7. Validate the strongname signature on the MCS generated assembly

   This results in the following message:
   Failed to verify assembly -- Unable to format error message 80131414

Now from an internal point of view...

AssemblyName an = AssemblyName.GetAssemblyName (assemblyName);
Console.WriteLine (an.GetPublicKey ().Length);

Actual Results (for MCS):
596

Expected Results (as CSC):
160



---- Additional Comments From spouliot@videotron.ca 2003-10-11 11:59:46 MST ----

There'is maybe something missing (or not exposed) in the runtime 
(see 49555).



---- Additional Comments From spouliot@videotron.ca 2003-10-11 12:08:32 MST ----

Here's some results using the "snkey" tool from 49555.

C:\Temp\snhard\snhard\bin\Debug>csc helloworld.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.


C:\Temp\snhard\snhard\bin\Debug>snkey helloworld.exe
160

C:\Temp\snhard\snhard\bin\Debug>mono snkey.exe helloworld.exe
0

C:\Temp\snhard\snhard\bin\Debug>mcs helloworld.cs
Compilation succeeded

C:\Temp\snhard\snhard\bin\Debug>snkey helloworld.exe
596

C:\Temp\snhard\snhard\bin\Debug>mono snkey.exe helloworld.exe
0

So it seems, IMHO, that both MCS and the runtime needs to be fixed 
for strongnames.



---- Additional Comments From spouliot@videotron.ca 2003-10-11 14:15:07 MST ----

The bug is in the runtime - no changes are required in mcs. 
See 49555 for more details.

*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO49555 ***

This bug depended on bug(s) 49555.

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Need Windows to reproduce</cf_op_sys_details>
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"