Sign Method
Signs a script stored in a string.
Object.
Sign (FileExtension, Text, Certificate, Store)
Arguments
object
Scripting.SignerFileExtension
A string designating the script extension type (.vbs, .js, or .wsf). This provides a mechanism by which the operating system can determine the type of script file being verified.Text
A string containing the script to be signed.Certificate
A string designating the author's certificate name.Store
Optional. A string designating the name of the certificate store. Typically certificates that contain private keys — i.e., certificates you can use for code signing — are in a certificate store called "my". The default value is "my".
Remarks
The Sign method is used to digitally sign a script stored in a string. In order to create a digital signature, the caller must have a valid certificate.
Example
Dim Signer, UnsignedText, SignedText
Set Signer = CreateObject("Scripting.Signer")
UnsignedText = _
"Dim X " & vbCrLf & _
"X = 123" & vbCrLf & _
"WScript.Echo X" & vbCrLf
SignedText = Signer.Sign(".VBS", UnsignedText, "Your Certificate Name Here")
Applies To:
See Also
Concepts
Signing a Script (Windows Script Host)