Error when code signing VBS script

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 17 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
dlethe
Posts: 6
Last visit: Wed Feb 14, 2007 7:45 am

Error when code signing VBS script

Post by dlethe »

I can't get primalscript to sign a VBS script. The error message is "Could not load the specified certificate".

I am using a verisign-generated code signing cert. As primalscript doesn't like .SPC and .PVK files, I used the standard microsoft utility pvkimprt to incorporate both keys into a .pfx file. The certificate has been imported into my certificate store, and it doesn't show any errors, and the certificate certainly hasn't expired.

If I leave the tools->options->wsh certificate field blank, then it says I must enter the .PFX file before signing, so at least I know it is trying to look at this file.

I also imported the certificate into my default store.

My development PC is Windows XP 64, is that a problem?


User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Error when code signing VBS script

Post by jhicks »

Under Options - Script Settings - Script Security, when you click View Certificates do you see your certificate under the Personal tab? The certificate needs to be installed in the personal or user store.
User avatar
dlethe
Posts: 6
Last visit: Wed Feb 14, 2007 7:45 am

Error when code signing VBS script

Post by dlethe »

Yes ... It reports under Personal
Issued To: SANtools, Inc.
Issued BY: Verisign Class 3 Code Signing
Experiation date 9/13/2007
Friendly Name <None>
Nothing unexpected in the Genera/Details area if I inspect it, other than it says I have a private key that corresponds to this certificate.
The Certification Path is
Verisign Class 3 Public Primary CA -> Verisign Class 3 Code Signing 2004 CA -> SANtools, Inc.

Certificate Status reports: "This certificate is OK"
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Error when code signing VBS script

Post by jhicks »

Under Options, where it says Certificate, type in SANtools, Inc. click OK and then try signing a script.
User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Error when code signing VBS script

Post by Alexander Riedel »

PrimalScript uses Microsoft's Script Signer component to sign scripts. It is not impossible that this simply does not work under a 64bit OS.

Try to run the script used in this article:

http://msdn.microsoft.com/library/defau ... 2a262e.asp

Alex
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
dlethe
Posts: 6
Last visit: Wed Feb 14, 2007 7:45 am

Error when code signing VBS script

Post by dlethe »

No luck, but hopefully problem is with input parameters.
I stripped it down to a 2-line VBS script called TestSigner.VBS

If I enter "cscript TestSigner.VBS" using code below then it works fine on my WinXP64 system.

Set objSigner = WScript.CreateObject("Scripting.Signer")objSigner.SignFile "C:ScratchScriptTosign.vbs", "SANtools, Inc.", "my"
So this points to some incompatibility with the .PFX file ? When I used the MSFT utility to build a PFX cert out of my .SPC / .PVK files it did give me a few choices. Do you have specifics of what responses I should say?
Otherwise, any way to just read it out of the certificate store?




User avatar
Alexander Riedel
Posts: 8488
Last visit: Tue Apr 16, 2024 8:42 am
Answers: 20
Been upvoted: 37 times

Error when code signing VBS script

Post by Alexander Riedel »

Does the script still work when you leave the last parameter off?

Set objSigner = WScript.CreateObject("Scripting.Signer")objSigner.SignFile "C:ScratchScriptTosign.vbs", "SANtools, Inc."

Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
dlethe
Posts: 6
Last visit: Wed Feb 14, 2007 7:45 am

Error when code signing VBS script

Post by dlethe »

Yes, it works. Not only that, but if I truncate "SANtools, Inc." to just "SANtools" then it works. (If I remove this parameter completely, then I get error msg about wrong number of parameters.
User avatar
dlethe
Posts: 6
Last visit: Wed Feb 14, 2007 7:45 am

Error when code signing VBS script

Post by dlethe »

Re:

If I just enter "SANtools, Inc." as certificate name in tools->options, then it gives me the error message below when I attempt to sign it via PrimalScript

An exception occured when signing the script".
dlethe2007-02-14 14:35:03
User avatar
jhicks
Posts: 1789
Last visit: Mon Oct 19, 2015 9:21 am

Error when code signing VBS script

Post by jhicks »

So if "SANtools" works with the script signer object, then use that name as the certificate.
This topic is 17 years and 2 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.