下面的腳本將演示如何創(chuàng)建用于驗(yàn)證過程中的簽名。該腳本使用 Signer 對(duì)象和 SignFile 方法創(chuàng)建數(shù)字簽名。
// 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,F(xiàn)ile,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,F(xiàn)ile,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>