Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignTool Error: ISignedCode::Sign returned error: 0x80092006

Tags:

code-signing

I'm signing an EXE program with a certificate issued by a trusted CA. I'm using signtool.exe from the Windows SDK v6.0a.

The certificate is located in the computer store and it is in the "Personals" folder.

My command line is :

sign /sm /n "My company" /d MyProductName /du http://my.url.com "C:\Setup\setup.exe"

When I run this command on the command line, it works fine. When I run this command in a batch process (called by a webservice, so there is no user logged in when the command is executed), the following error occur :

Number of errors: 1 SignTool Error: ISignedCode::Sign returned error: 0x80092006 No provider was specified for the store or object.

Anybody can help on this ?

like image 233
Sebastien Avatar asked Jun 25 '09 19:06

Sebastien


3 Answers

To save someone time, I had this problem. It turned out my certificate somehow got corrupted. After I removed it from the certificate store and imported it again, the problem went away. I'd suggest creating the PFX file all over or copying it from a location where you know it is not corrupted.

like image 121
coder_2007 Avatar answered Dec 20 '22 03:12

coder_2007


The problem is that your service process cannot access your private key, which is stored under your account.

Log on into the account that is running the web service and import the private key into a key container. You can do this for example using the strong name tool (sn.exe) of .NET:

sn -i MyCertificate.pfx MyCodeSigningKey

Now, change your build script to use this key container:

signtool sign /sm /a /v /csp "Microsoft Strong Cryptographic Provider" /kc MyCodeSigningKey <other parameters...>

/kc specifies the key container. /kc requires that you specify the "CSP" (Cryptographic Service Provider) via the /csp switch. "Microsoft Strong Cryptographic Provider" is the default provider used by sn.

like image 21
oefe Avatar answered Dec 20 '22 03:12

oefe


I've [just now, just once] experienced the same condition (immediately after a successful invocation with the same parameters except on a different MSI file). Rerunning succeeded on the next execution of the build script. Also using, like you

/sm /d /du
Not using
/n
Additionally using
/t
like image 27
Ruben Bartelink Avatar answered Dec 20 '22 04:12

Ruben Bartelink