## Error CS1548: Error during assembly signing.

_Submitted by Chris Hardy \[MSFT\] \[MSFT\] on 2011-09-10 14:33 UTC_

error CS1548: Error during assembly signing. The specified key file \`xxx.key.pfx' has incorrect formatWhen I signing a class type project, it build success on Visual Studio 2010

* * *



_Xamarin Bugzilla comment 2 by Marek Safar [MSFT] on 2011-09-12 11:22 UTC_

Could you attach the actual key or generate one which causes same problem

* * *

_Xamarin Bugzilla comment 3 by Sebastien Pouliot [MSFT] on 2011-09-12 16:01 UTC_

.pfx are PKCS#12 files. It looks like newer (2010?) version of Visual Studio allows people to strong name assemblies using them.

Mono.Security.dll support PKCS#12 files (mscorlib.dll too but only when used with X.509 certificates) but it's not clear that we want to embed all that code into the compiler!?!

* * *

_Xamarin Bugzilla comment 4 by Marek Safar [MSFT] on 2011-09-12 17:12 UTC_

Sebastian, can you attach example of such key

* * *

_Xamarin Bugzilla comment 5 by a community member on 2011-09-12 20:43 UTC_


it contains passord:123456

* * *

_Xamarin Bugzilla comment 6 by a community member on 2011-09-12 20:52 UTC_

The sn key file were created by virsual studio 2010.
If I create a sn key file by %Program Files%\\Mono-2.10.5\\bin\\sn.bat, both virsual studio 2010 and monodevelop 2.6 works, but no password.

* * *

_Xamarin Bugzilla comment 7 by Sebastien Pouliot [MSFT] on 2011-09-13 11:33 UTC_

Marek, I don't have a windows VM running at the moment but Minco's attachment is a valid pkcs#12 file, but without a certificate - i.e. only an encrypted keypair.

Minco, Mono's 'sn' tool (sn.bat on windows) currently only supports .snk (password-less files) and key containers. The same is true for the xMCS compilers.

* * *

_Xamarin Bugzilla comment 8 by Marek Safar [MSFT] on 2011-09-16 09:09 UTC_

I have done some further investigation and the way how it works with VS is that the file does not have to be installed but VS asks for a password and creates temporary container, the command line to C# compiler then contains key container

\-keycontainer:VS\_KEY\_XXXXXXXXXXXXXXXX

I don't know whether XXXX is some file hash

I am leaving this as MD bug as it cannot send such files to compiler using -keyfile option

* * *

<br />

_Reference: <https://bugzilla.xamarin.com/show_bug.cgi?id=725>_