Signs a script stored in a string.
Object. Sign (FileExtension, Text, Certificate, Store)
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.
A string containing the script to be signed.
A string designating the author's certificate name.
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".
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.
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")