Digitally Signing Javascript

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Digitally Signing Javascript

Post by Todd_Z »

I don't know whether I am an idiot or the online references I've been reading are crap, but here it is:

I'm simply trying to digitally sign a javascript file using a test certificate I create. In doing so, I hope to get the extended privileges in firefox associated with signed scripts.

Code: Select all

todd@diesel:~/Desktop/Cert$ makecert -sv test.pvk -n "CN=Tornado" test.cer
Mono MakeCert - version 1.2.3.1
X.509 Certificate Builder
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.

Success
todd@diesel:~/Desktop/Cert$ cert2spc test.cer test.spc
Mono Cert2Spc - version 1.2.3.1
Transform a set of X.509 certificates and CRLs into an Authenticode(TM) "Software Publisher Certificate"
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.

Success
todd@diesel:~/Desktop/Cert$ signcode -V -spc test.spc -v test.pvk -n "Tornado" -t "http://timestamp.verisign.com/scripts/timstamp.dll" -tr 10 -tw 10 test.js
Mono SignCode - version 1.2.3.1
Sign assemblies and PE files using Authenticode(tm).
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2006 Novell. BSD licensed.

System.ArgumentException: inputCount
  at System.Security.Cryptography.HashAlgorithm.TransformFinalBlock (System.Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) [0x00000] 
  at Mono.Security.Authenticode.AuthenticodeBase.GetHash (System.Security.Cryptography.HashAlgorithm hash) [0x00000] 
  at Mono.Security.Authenticode.AuthenticodeFormatter.Sign (System.String fileName) [0x00000] 
Couldn't sign file 'test.js'.
What is wrong with this? Am i even on the right track...?[/syntax]
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: Digitally Signing Javascript

Post by volka »

Todd_Z wrote:Sign assemblies and PE files using Authenticode(tm).
That's for dotnet, not javascript.
Post Reply