Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Our company purchased a certificate to sign our assemblies. But if I go the signing tab in project properties and select the certificate there, I'll get the following error: "an attempt was made to reference a token that does not exist"

My colleague got this to work with a post build command that uses the signtool, which works perfect for console applications etc. but not for sharepoint assemblies.

If I use the post build command and don't check "sign the assembly" in the signing tab, I can't deploy or debug and get this error: "Value cannot be null. Parameter name: PublicKey"

If I use the post build command and check "sign the assembly" and use the key.snk, I can deploy and debug, but my assembly isn't signed with the custom certificate.

Is there anyone who knows how to sign the assembly using a custom certificate? Or is this just not possible at all?

share|improve this question
    
You need to sign SharePoint assemblies!? –  Amit Kumawat Nov 30 '11 at 10:36
    
I don't think he's attempting to sign "Microsoft.SharePoint.dll" - but his own assemblies. But then this is my assumption - OP can you clarify the name of the assembly you are trying to sign. –  Ryan Nov 30 '11 at 15:06
1  
You're right, I didn't mean the Microsoft.SharePoint.dll, but my custom dll's to use in sharepoint :) –  Marlou Dec 1 '11 at 9:09
add comment

2 Answers 2

up vote 1 down vote accepted

Strong naming an assembly and code signing (Authenticode) are two entirely separate things (despite the fact that they use very similar technology and similar names) - and you are mixing these up.

You can not use a Code Signing SSL certificate to 'strong name' an assembly - this has to be an .snk file in he "Signging - Sign the assembly" section of visual studio properties.

If you want to code sign (Authenticode) an assembly then this has to be done by SIGNTOOL.EXE in postbuild - and again you can't use a strong name .snk file for this it has to be your code signing ssl certificate (.pfx)

http://msdn.microsoft.com/en-us/library/ms180786(VS.80).aspx

https://connect.microsoft.com/VisualStudio/feedback/details/321492/signing-an-assembly-using-a-pfx-file-with-keyspec-set-to-1-at-keyexchange-results-in-error-message-object-already-exists

share|improve this answer
    
Thanx for explaining, I thought this was the same. :) I'm going to use an .snk to strong name my assembly. –  Marlou Dec 1 '11 at 9:10
add comment

SharePoint assemblies are already signed from Microsoft, You can(read have to) trust the code's authenticity.May be you want to sign your assemblies.

If you want to sign your own assembly, Check this out http://msdn.microsoft.com/en-us/library/windows/desktop/aa374228(v=vs.85).aspx

If you want to sign an existing assembly for which you don't have source code, Check this http://stackoverflow.com/questions/899856/can-i-sign-an-assembly-for-which-i-do-not-have-source-code

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.