下面的脚本将演示如何创建用于验证过程中的签名。该脚本使用 Signer 对象和 SignFile 方法创建数字签名。
// JScript。 <job> <runtime> <named name="file" helpstring="the file to sign" required="true" type="string"/> <named name="cert" helpstring="the name of the signing certificate" required="true" type="string"/> <named name="store" helpstring="the name of the certificate store" required="false" type="string"/> </runtime> <script language="JScript"> var Signer,File,Cert,Store; if (!(WScript.Arguments.Named.Exists("cert") && WScript.Arguments.Named.Exists("file"))) { WScript.Arguments.ShowUsage(); WScript.Quit(); } Signer = new ActiveXObject("Scripting.Signer"); File = WScript.Arguments.Named("file"); Cert = WScript.Arguments.Named("cert"); Store = WScript.Arguments.Named("store"); Signer.SignFile(File,Cert,Store); </script> </job> 'VBScript <job> <runtime> <named name="file" helpstring="the file to sign" required="true" type="string"/> <named name="cert" helpstring="the name of the signing certificate" required="true" type="string"/> <named name="store" helpstring="the name of the certificate store" required="false" type="string"/> </runtime> <script language="VBScript"> Dim Signer,File,Cert,Store If Not (WScript.Arguments.Named.Exists("cert")) And WScript.Arguments.Named.Exists("file")) Then WScript.Arguments.ShowUsage WScript.Quit End If Set Signer = CreateObject("Scripting.Signer") File = WScript.Arguments.Named("file") Cert = WScript.Arguments.Named("cert") Store = WScript.Arguments.Named("store") Signer.SignFile File,Cert,Store </script> </job>