Page 1 of 1

Digitally Signing Javascript

Posted: Sat May 05, 2007 12:25 pm
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]

Re: Digitally Signing Javascript

Posted: Sun May 06, 2007 6:41 am
by volka
Todd_Z wrote:Sign assemblies and PE files using Authenticode(tm).
That's for dotnet, not javascript.