2 // StrongNameIdentityPermissionTest.cs -
3 // NUnit Test Cases for StrongNameIdentityPermission
6 // Sebastien Pouliot <sebastien@ximian.com>
8 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 using NUnit.Framework;
32 using System.Security;
33 using System.Security.Permissions;
35 namespace MonoTests.System.Security.Permissions {
38 public class StrongNameIdentityPermissionTest {
40 static byte[] ecma = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
42 private StrongNameIdentityPermission GetUnion ()
44 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
45 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
46 StrongNamePublicKeyBlob blob2 = new StrongNamePublicKeyBlob (new byte[16]);
47 StrongNameIdentityPermission diffPk = new StrongNameIdentityPermission (blob2, "mono", new Version (1, 2, 3, 4));
48 return (StrongNameIdentityPermission)snip.Union (diffPk);
52 public void PermissionStateNone ()
54 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
55 Assert.AreEqual (String.Empty, snip.Name, "Name");
56 Assert.IsNull (snip.PublicKey, "PublicKey");
57 Assert.AreEqual ("0.0", snip.Version.ToString (), "Version");
59 SecurityElement se = snip.ToXml ();
60 Assert.IsNull (se.Attribute ("Name"), "Xml-Name");
61 Assert.IsNull (se.Attribute ("AssemblyVersion"), "Xml-AssemblyVersion");
62 Assert.IsNull (se.Attribute ("PublicKeyBlob"), "Xml-PublicKeyBlob");
64 // because Name == String.Empty, which is illegal using the other constructor
65 StrongNameIdentityPermission copy = (StrongNameIdentityPermission) snip.Copy ();
66 Assert.AreEqual (String.Empty, copy.Name, "Copy-Name");
67 // Strangely once copied the Name becomes equals to String.Empty in 2.0 [FDBK19351]
68 Assert.IsNull (se.Attribute ("AssemblyVersion"), "Copy-Version");
69 Assert.IsNull (copy.PublicKey, "Copy-PublicKey");
72 public void PermissionStateUnrestricted ()
74 // In 2.0 Unrestricted are permitted for identity permissions
75 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.Unrestricted);
76 Assert.AreEqual (String.Empty, snip.Name, "Name");
77 Assert.IsNull (snip.PublicKey, "PublicKey");
78 Assert.AreEqual ("0.0", snip.Version.ToString (), "Version");
79 SecurityElement se = snip.ToXml ();
80 Assert.IsNull (se.Attribute ("Name"), "Xml-Name");
81 Assert.IsNull (se.Attribute ("PublicKeyBlob"), "Xml-PublicKeyBlob");
82 Assert.IsNull (se.Attribute ("AssemblyVersion"), "Xml-AssemblyVersion");
83 StrongNameIdentityPermission copy = (StrongNameIdentityPermission)snip.Copy ();
84 Assert.IsTrue (snip.Equals (copy), "snip Equals copy");
85 Assert.IsTrue (copy.Equals (snip), "copy Equals snip");
86 // and they aren't equals to None
87 Assert.IsFalse (snip.Equals (new StrongNameIdentityPermission (PermissionState.None)), "Not Equals None");
90 [ExpectedException (typeof (ArgumentException))]
91 public void PermissionStateInvalid ()
93 StrongNameIdentityPermission snip = new StrongNameIdentityPermission ((PermissionState)2);
97 [ExpectedException (typeof (ArgumentNullException))]
98 public void StrongNameIdentityPermission_BlobNull ()
100 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (null, "mono", new Version (0,0));
104 public void StrongNameIdentityPermission_NameNull ()
106 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
107 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, null, new Version (1, 2));
108 Assert.IsNull (snip.Name, "Name");
109 Assert.AreEqual ("00000000000000000400000000000000", snip.PublicKey.ToString (), "PublicKey");
110 Assert.AreEqual ("1.2", snip.Version.ToString (), "Version");
112 SecurityElement se = snip.ToXml ();
113 Assert.IsNull (se.Attribute ("Name"), "Xml-Name");
114 Assert.AreEqual ("00000000000000000400000000000000", se.Attribute ("PublicKeyBlob"), "Xml-PublicKeyBlob");
115 Assert.AreEqual ("1.2", se.Attribute ("AssemblyVersion"), "Xml-AssemblyVersion");
117 StrongNameIdentityPermission copy = (StrongNameIdentityPermission)snip.Copy ();
119 Assert.IsNull (se.Attribute ("Name"), "Copy-Name");
120 Assert.AreEqual ("00000000000000000400000000000000", se.Attribute ("PublicKeyBlob"), "Copy-PublicKeyBlob");
121 Assert.AreEqual ("1.2", se.Attribute ("AssemblyVersion"), "Copy-AssemblyVersion");
125 [ExpectedException (typeof (ArgumentException))]
126 public void StrongNameIdentityPermission_NameEmpty ()
128 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
129 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, String.Empty, new Version (1, 2));
133 public void StrongNameIdentityPermission_VersionNull ()
135 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
136 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", null);
137 Assert.AreEqual ("mono", snip.Name, "Name");
138 Assert.AreEqual ("00000000000000000400000000000000", snip.PublicKey.ToString (), "PublicKey");
139 Assert.IsNull (snip.Version, "Version");
141 SecurityElement se = snip.ToXml ();
142 Assert.AreEqual ("mono", se.Attribute ("Name"), "Xml-Name");
143 Assert.AreEqual ("00000000000000000400000000000000", se.Attribute ("PublicKeyBlob"), "Xml-PublicKeyBlob");
144 Assert.IsNull (se.Attribute ("AssemblyVersion"), "Xml-AssemblyVersion");
146 StrongNameIdentityPermission copy = (StrongNameIdentityPermission)snip.Copy ();
147 Assert.AreEqual ("mono", se.Attribute ("Name"), "Copy-Name");
148 Assert.AreEqual ("00000000000000000400000000000000", se.Attribute ("PublicKeyBlob"), "Copy-PublicKeyBlob");
149 Assert.IsNull (se.Attribute ("AssemblyVersion"), "Copy-AssemblyVersion");
153 public void StrongNameIdentityPermission_All ()
155 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
156 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
157 Assert.AreEqual ("mono", snip.Name, "Name");
158 Assert.AreEqual ("00000000000000000400000000000000", snip.PublicKey.ToString (), "PublicKey");
159 Assert.AreEqual ("1.2.3.4", snip.Version.ToString (), "Version");
161 SecurityElement se = snip.ToXml ();
162 Assert.AreEqual ("mono", se.Attribute ("Name"), "Xml-Name");
163 Assert.AreEqual ("00000000000000000400000000000000", se.Attribute ("PublicKeyBlob"), "Xml-PublicKeyBlob");
164 Assert.AreEqual ("1.2.3.4", se.Attribute ("AssemblyVersion"), "Xml-AssemblyVersion");
166 StrongNameIdentityPermission copy = (StrongNameIdentityPermission)snip.Copy ();
167 Assert.AreEqual ("mono", se.Attribute ("Name"), "Copy-Name");
168 Assert.AreEqual ("00000000000000000400000000000000", se.Attribute ("PublicKeyBlob"), "Copy-PublicKeyBlob");
169 Assert.AreEqual ("1.2.3.4", se.Attribute ("AssemblyVersion"), "Copy-AssemblyVersion");
175 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
176 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
177 Assert.AreEqual ("mono", snip.Name, "Name-1");
179 Assert.IsNull (snip.Name, "Name-2");
181 Assert.AreEqual ("mono", snip.Name, "Name-3");
185 [ExpectedException (typeof (ArgumentException))]
186 public void Name_Empty ()
188 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
189 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
190 snip.Name = String.Empty;
194 [ExpectedException (typeof (NotSupportedException))]
195 public void Name_Multiple_Get ()
197 StrongNameIdentityPermission union = GetUnion ();
198 string s = union.Name;
202 public void Name_Multiple_Set ()
204 StrongNameIdentityPermission union = GetUnion ();
206 Assert.AreEqual ("oops", union.Name, "Name");
207 Assert.IsNull (union.PublicKey, "PublicKey");
208 Assert.AreEqual ("0.0", union.Version.ToString (), "Version");
212 [ExpectedException (typeof (ArgumentNullException))]
213 public void PublicKey_Null ()
215 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
216 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
217 snip.PublicKey = null;
220 [ExpectedException (typeof (NotSupportedException))]
221 public void PublicKey_Multiple_Get ()
223 StrongNameIdentityPermission union = GetUnion ();
224 StrongNamePublicKeyBlob snpkb = union.PublicKey;
228 public void PublicKey_Multiple_Set ()
230 StrongNameIdentityPermission union = GetUnion ();
231 union.PublicKey = new StrongNamePublicKeyBlob (ecma);
232 Assert.AreEqual (String.Empty, union.Name, "Name");
233 Assert.IsNotNull (union.PublicKey, "PublicKey");
234 Assert.AreEqual ("0.0", union.Version.ToString (), "Version");
237 public void Version ()
239 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
240 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
241 Assert.AreEqual ("1.2.3.4", snip.Version.ToString (), "Version-1");
243 Assert.IsNull (snip.Version, "Version-2");
244 snip.Version = new Version (1, 2, 3);
245 Assert.AreEqual ("1.2.3", snip.Version.ToString (), "Version-3");
248 [ExpectedException (typeof (NotSupportedException))]
249 public void Version_Multiple_Get ()
251 StrongNameIdentityPermission union = GetUnion ();
252 Version v = union.Version;
256 public void Version_Multiple_Set ()
258 StrongNameIdentityPermission union = GetUnion ();
259 union.Version = new Version ("1.2.3.4");
260 Assert.AreEqual (String.Empty, union.Name, "Name");
261 Assert.IsNull (union.PublicKey, "PublicKey");
262 Assert.AreEqual ("1.2.3.4", union.Version.ToString (), "Version");
265 public void Copy_NameEmpty ()
267 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
268 snip.PublicKey = new StrongNamePublicKeyBlob (ecma);
269 snip.Version = new Version ("1.2.3.4");
271 // because Name == String.Empty, which is illegal using the other constructor
272 // but (somewhat) required to copy the teo other informations
273 StrongNameIdentityPermission copy = (StrongNameIdentityPermission)snip.Copy ();
274 Assert.IsTrue (copy.Equals (snip), "Equals");
277 private void Compare (StrongNameIdentityPermission p1, StrongNameIdentityPermission p2, string prefix)
279 Assert.AreEqual (p1.Name, p2.Name, prefix + ".Name");
280 Assert.AreEqual (p1.PublicKey, p2.PublicKey, prefix + ".PublicKey");
281 Assert.AreEqual (p1.Version, p2.Version, prefix + ".Version");
282 Assert.IsFalse (Object.ReferenceEquals (p1, p2), "ReferenceEquals");
286 public void Intersect ()
288 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
289 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
291 StrongNameIdentityPermission intersect = (StrongNameIdentityPermission)snip.Intersect (null);
292 Assert.IsNull (intersect, "snip N null");
294 StrongNameIdentityPermission empty = new StrongNameIdentityPermission (PermissionState.None);
295 intersect = (StrongNameIdentityPermission)snip.Intersect (empty);
296 Assert.IsNull (intersect, "snip N empty");
297 intersect = (StrongNameIdentityPermission)snip.Intersect (snip);
298 Compare (snip, intersect, "snip U snip");
300 StrongNameIdentityPermission samePk = new StrongNameIdentityPermission (blob, "novell", new Version (1, 2));
301 intersect = (StrongNameIdentityPermission)snip.Intersect (samePk);
302 Assert.IsNull (intersect, "(snip N samePk)");
303 // strange, I would have expected a SNIP with the same public key...
307 [ExpectedException (typeof (ArgumentException))]
308 public void Intersect_DifferentPermissions ()
310 StrongNameIdentityPermission a = new StrongNameIdentityPermission (PermissionState.None);
311 SecurityPermission b = new SecurityPermission (PermissionState.None);
312 Assert.IsNull (a.Intersect (b));
316 public void IsSubsetOf ()
318 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
319 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
320 Assert.IsFalse (snip.IsSubsetOf (null), "snip.IsSubsetOf (null)");
322 StrongNameIdentityPermission empty = new StrongNameIdentityPermission (PermissionState.None);
323 Assert.IsTrue (empty.IsSubsetOf (null), "empty.IsSubsetOf (null)");
327 public void IsSubsetOf_Corlib ()
329 Version fx11 = new Version (1, 0, 5000, 0);
330 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
331 StrongNameIdentityPermission granted = new StrongNameIdentityPermission (blob, "mscorlib", fx11);
333 StrongNameIdentityPermission demanded = new StrongNameIdentityPermission (blob, null, null);
334 Assert.IsTrue (demanded.IsSubsetOf (granted), "pk");
336 demanded = new StrongNameIdentityPermission (blob, "mscorlib", null);
337 Assert.IsTrue (demanded.IsSubsetOf (granted), "pk+name");
339 demanded = new StrongNameIdentityPermission (blob, null, fx11);
340 Assert.IsTrue (demanded.IsSubsetOf (granted), "pk+v");
342 demanded = new StrongNameIdentityPermission (blob, "mscorlib", fx11);
343 Assert.IsTrue (demanded.IsSubsetOf (granted), "pk+name+v");
347 [ExpectedException (typeof (ArgumentException))]
348 public void IsSubsetOf_DifferentPermissions ()
350 StrongNameIdentityPermission a = new StrongNameIdentityPermission (PermissionState.None);
351 SecurityPermission b = new SecurityPermission (PermissionState.None);
358 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
359 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
361 StrongNameIdentityPermission union = (StrongNameIdentityPermission)snip.Union (null);
362 Compare (snip, union, "snip U null");
364 StrongNameIdentityPermission empty = new StrongNameIdentityPermission (PermissionState.None);
365 union = (StrongNameIdentityPermission)snip.Union (empty);
366 Compare (snip, union, "snip U empty");
368 union = (StrongNameIdentityPermission)snip.Union (snip);
369 Compare (snip, union, "snip U snip");
371 // note: can't be tested with PermissionState.Unrestricted
373 StrongNameIdentityPermission samePk = new StrongNameIdentityPermission (blob, null, null);
374 union = (StrongNameIdentityPermission)snip.Union (samePk);
375 Assert.IsTrue (snip.IsSubsetOf (union), "snip.IsSubsetOf (union)");
377 union = (StrongNameIdentityPermission)samePk.Union (snip);
378 Assert.IsTrue (samePk.IsSubsetOf (union), "snip.IsSubsetOf (union)");
382 public void Union_DifferentPk ()
384 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
385 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
386 StrongNamePublicKeyBlob blob2 = new StrongNamePublicKeyBlob (new byte [16]);
387 StrongNameIdentityPermission diffPk = new StrongNameIdentityPermission (blob2, "mono", new Version (1, 2, 3, 4));
388 StrongNameIdentityPermission result = (StrongNameIdentityPermission) snip.Union (diffPk);
389 Assert.IsNotNull (result, "DifferentPk");
390 // new XML format is used to contain more than one site
391 SecurityElement se = result.ToXml ();
392 Assert.AreEqual (2, se.Children.Count, "Childs");
393 Assert.AreEqual ("00000000000000000400000000000000", (se.Children [0] as SecurityElement).Attribute ("PublicKeyBlob"), "Blob#1");
394 Assert.AreEqual ("00000000000000000000000000000000", (se.Children [1] as SecurityElement).Attribute ("PublicKeyBlob"), "Blob#2");
395 // strangely it is still versioned as 'version="1"'.
396 Assert.AreEqual ("1", se.Attribute ("version"), "Version");
400 public void Union_SamePublicKey_DifferentName ()
402 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
403 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
404 StrongNameIdentityPermission diffName = new StrongNameIdentityPermission (blob, "novell", null);
405 StrongNameIdentityPermission result = (StrongNameIdentityPermission) snip.Union (diffName);
406 Assert.IsNotNull (result, "DifferentName");
407 // new XML format is used to contain more than one site
408 SecurityElement se = result.ToXml ();
409 Assert.AreEqual (2, se.Children.Count, "Childs");
410 Assert.AreEqual ("mono", (se.Children [0] as SecurityElement).Attribute ("Name"), "Name#1");
411 Assert.AreEqual ("novell", (se.Children [1] as SecurityElement).Attribute ("Name"), "Name#2");
412 // strangely it is still versioned as 'version="1"'.
413 Assert.AreEqual ("1", se.Attribute ("version"), "Version");
417 public void Union_SamePublicKey_DifferentVersion ()
419 StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
420 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
421 StrongNameIdentityPermission diffVersion = new StrongNameIdentityPermission (blob, null, new Version (1, 2));
422 StrongNameIdentityPermission result = (StrongNameIdentityPermission) snip.Union (diffVersion);
423 Assert.IsNotNull (result, "DifferentVersion");
424 // new XML format is used to contain more than one site
425 SecurityElement se = result.ToXml ();
426 Assert.AreEqual (2, se.Children.Count, "Childs");
427 Assert.AreEqual ("1.2.3.4", (se.Children [0] as SecurityElement).Attribute ("AssemblyVersion"), "AssemblyVersion#1");
428 Assert.AreEqual ("1.2", (se.Children [1] as SecurityElement).Attribute ("AssemblyVersion"), "AssemblyVersion#2");
429 // strangely it is still versioned as 'version="1"'.
430 Assert.AreEqual ("1", se.Attribute ("version"), "Version");
434 [ExpectedException (typeof (ArgumentException))]
435 public void Union_DifferentPermissions ()
437 StrongNameIdentityPermission a = new StrongNameIdentityPermission (PermissionState.None);
438 SecurityPermission b = new SecurityPermission (PermissionState.None);
443 [ExpectedException (typeof (ArgumentNullException))]
444 public void FromXml_Null ()
446 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
451 [ExpectedException (typeof (ArgumentException))]
452 public void FromXml_WrongTag ()
454 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
455 SecurityElement se = snip.ToXml ();
461 [ExpectedException (typeof (ArgumentException))]
462 public void FromXml_WrongTagCase ()
464 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
465 SecurityElement se = snip.ToXml ();
466 se.Tag = "IPERMISSION"; // instead of IPermission
471 public void FromXml_WrongClass ()
473 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
474 SecurityElement se = snip.ToXml ();
476 SecurityElement w = new SecurityElement (se.Tag);
477 w.AddAttribute ("class", "Wrong" + se.Attribute ("class"));
478 w.AddAttribute ("version", se.Attribute ("version"));
480 // doesn't care of the class name at that stage
481 // anyway the class has already be created so...
485 public void FromXml_NoClass ()
487 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
488 SecurityElement se = snip.ToXml ();
490 SecurityElement w = new SecurityElement (se.Tag);
491 w.AddAttribute ("version", se.Attribute ("version"));
493 // doesn't even care of the class attribute presence
497 [ExpectedException (typeof (ArgumentException))]
498 public void FromXml_WrongVersion ()
500 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
501 SecurityElement se = snip.ToXml ();
502 se.Attributes.Remove ("version");
503 se.Attributes.Add ("version", "2");
508 public void FromXml_NoVersion ()
510 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
511 SecurityElement se = snip.ToXml ();
513 SecurityElement w = new SecurityElement (se.Tag);
514 w.AddAttribute ("class", se.Attribute ("class"));
519 public void FromXml_NameEmpty ()
521 StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.None);
522 SecurityElement se = snip.ToXml ();
525 snip.PublicKey = new StrongNamePublicKeyBlob (ecma);
526 snip.Version = new Version ("1.2.3.4");