2 using System.Reflection;
4 using System.Security.Permissions;
6 public abstract class AbstractProgram {
10 internal static bool IsSigned ()
12 AssemblyName an = Assembly.GetExecutingAssembly ().GetName ();
13 byte[] pk = an.GetPublicKey ();
14 return ((pk != null) && (pk.Length > 0));
17 public AbstractProgram ()
19 rc = IsSigned () ? 0 : 1;
20 Console.WriteLine ("*{0}* AbstractProgram", rc);
23 [StrongNameIdentityPermission (SecurityAction.InheritanceDemand, PublicKey="0024000004800000940000000602000000240000525341310004000011000000db294bcb78b7361ed6eb5656b612ce266fc81da8c8c6cb04116fc29b5e1d09a02f6c0f387f6d97a1ce9bdbbeb2d874832ae2d2971e70144ea039c710dccab5fb0a36cb14268a83c9b435c1e7318e7915518b68c8ed056b104e76166d6cabe9b77383f26bcf6a0a0b09d04f37b2a407b47d39421a34f2fbc6e6701a1d5c2e8cbb")]
24 public virtual int InstanceTest ()
30 public class Program : AbstractProgram {
32 public override int InstanceTest ()
34 // exception even if base class isn't called
41 return new Program ().InstanceTest ();
43 catch (SecurityException se) {
44 // if unsigned the SecurityException will be unhandled
45 Console.WriteLine ("*1* Unexpected SecurityException\n{0}", se);
49 Console.WriteLine ("*2* Unexpected Exception\n{0}", e);