[Mono-bugs] [Bug 49785][Nor] New - AssemblyBuilder should extract the public key from the .snk file
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 17 Oct 2003 09:03:12 -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 vargaz@freemail.hu.
http://bugzilla.ximian.com/show_bug.cgi?id=49785
--- shadow/49785 2003-10-17 09:03:12.000000000 -0400
+++ shadow/49785.tmp.3357 2003-10-17 09:03:12.000000000 -0400
@@ -0,0 +1,48 @@
+Bug#: 49785
+Product: Mono/Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: vargaz@freemail.hu
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: AssemblyBuilder should extract the public key from the .snk file
+
+When a user specifies a AssemblyKeyFile attribute for an assembly,
+AssemblyBuilder should extract the public key from the file, instead of
+treating the whole file as a public key, as it is done now.
+
+From Sebastien Pouliot:
+
+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.
+
+So doing:
+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
+formats) /mcs/class/Mono.Security/Mono.Security.Cryptography/CryptoCo
+nvert.cs
+
+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
+
+We should probably extract this code from Mono.Security and put a copy into
+AssemblyBuilder.