[Mono-bugs] [Bug 49555][Nor] Changed - private extern Assembly LoadAssembly (AssemblyName assemblyRef, Evidence securityEvidence) does not expose strongname publickey
Sat, 11 Oct 2003 13:07:28 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by firstname.lastname@example.org.
--- shadow/49555 2003-10-11 12:39:26.000000000 -0400
+++ shadow/49555.tmp.20421 2003-10-11 13:07:28.000000000 -0400
@@ -100,6 +100,46 @@
Note: We'll (eventually) need to check the signature (using this
public key) and throw an exception if the signature can't be
validated. Most of the code for doing so is in the class library.
Where should the validation/exception be thrown ? the managed class
library or the unmanaged runtime ?
+------- Additional Comments From email@example.com 2003-10-11 13:07 -------
+this is from in /mono/mono/metadata/reflection.c
+line 2697 (at least today)
+values [MONO_ASSEMBLY_PUBLIC_KEY] = load_public_key (assemblyb-
+Ah, it happens that the hello.snk file is 596 bytes - just the size
+of the public key inserted into the assembly (instead of 160 bytes).
+This is because there are 2 formats for SNK (well maybe more than 2).
+When you generate a SNK file (sn -k) you get a SNK file with BOTH a
+public and private key. However you ONLY embed the public key inside
+the assembly. It's worth mentioning that many people use the SNK
+extension for both the keypair (public/private) or the public key.
+So this can be misleading.
+sn -p hello.snk hello.pub
+extracts the public key from the SNK file - giving us a 160 bytes
+file. This is the file to embed into the assembly.
+There is some managed code for converting CAPI structures(both
+private/public and public
+An unmanaged version of something like this:
+byte snkeypair = ...
+// read data from private/public SNK file into snkbuf
+RSA rsa = CryptoConvert.FromCapiPrivateKeyBlob (snkbuf);
+byte snpubkey = CryptoConvert.ToCapiPublicKeyBlob (rsa);
+// save data into assembly
+should do the trick.