Permalink
Browse files

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.


svn path=/branches/mono-1-1-13/mcs/; revision=60450
  • Loading branch information...
1 parent b71dfbe commit 5197eff4859342c1e3b1ceff563c0533c4f16dc3 Sebastien Pouliot committed May 9, 2006
Showing with 23 additions and 6 deletions.
  1. +6 −0 mcs/ilasm/ChangeLog
  2. +17 −6 mcs/ilasm/Driver.cs
View
@@ -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 .
View
@@ -52,6 +52,7 @@ private class DriverMain {
private CodeGen codegen;
private bool keycontainer = false;
private string keyname;
+ private StrongName sn;
public DriverMain (string[] args)
{
@@ -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 {
@@ -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);
}
@@ -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;
@@ -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);
}

0 comments on commit 5197eff

Please sign in to comment.