Skip to content

Commit

Permalink
2006-05-09 Sebastien Pouliot <sebastien@ximian.com>
Browse files Browse the repository at this point in the history
	* Driver.cs: Move up the loading of the strongname key pair to allow
	embedding the public part into the assembly. Also don't try to sign
	netmodules.


svn path=/branches/mono-1-1-13/mcs/; revision=60450
  • Loading branch information
Sebastien Pouliot committed May 9, 2006
1 parent b71dfbe commit 5197eff
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
6 changes: 6 additions & 0 deletions mcs/ilasm/ChangeLog
@@ -1,3 +1,9 @@
2006-05-09 Sebastien Pouliot <sebastien@ximian.com>

* Driver.cs: Move up the loading of the strongname key pair to allow
embedding the public part into the assembly. Also don't try to sign
netmodules.

2006-04-24 Ankit Jain <jankit@novell.com>

* Driver.cs (DriverMain.Run): Update use of CodeGen.ctor .
Expand Down
23 changes: 17 additions & 6 deletions mcs/ilasm/Driver.cs
Expand Up @@ -52,6 +52,7 @@ private class DriverMain {
private CodeGen codegen;
private bool keycontainer = false;
private string keyname;
private StrongName sn;

public DriverMain (string[] args)
{
Expand All @@ -78,6 +79,13 @@ public bool Run ()
if (target != Target.Dll && !codegen.HasEntryPoint)
Report.Error ("No entry point found.");

// if we have a key and aren't assembling a netmodule
if ((keyname != null) && !codegen.IsThisAssembly (null)) {
LoadKey ();
// this overrides any attribute or .publickey directive in the source
codegen.SetAssemblyPublicKey (sn.PublicKey);
}

try {
codegen.Write ();
} catch {
Expand All @@ -93,7 +101,7 @@ public bool Run ()
}

try {
if (keyname != null) {
if (sn != null) {
Console.WriteLine ("Signing assembly with the specified strongname keypair");
return Sign (output_file);
}
Expand All @@ -110,12 +118,8 @@ private void Error (string message)
Console.WriteLine ("***** FAILURE *****\n");
}

private bool Sign (string filename)
private void LoadKey ()
{
// note: if the file cannot be signed (no public key in it) then
// we do not show an error, or a warning, if the key file doesn't
// exists
StrongName sn = null;
if (keycontainer) {
CspParameters csp = new CspParameters ();
csp.KeyContainerName = keyname;
Expand All @@ -130,6 +134,13 @@ private bool Sign (string filename)
}
sn = new StrongName (data);
}
}

private bool Sign (string filename)
{
// note: if the file cannot be signed (no public key in it) then
// we do not show an error, or a warning, if the key file doesn't
// exists
return sn.Sign (filename);
}

Expand Down

0 comments on commit 5197eff

Please sign in to comment.