Forum Discussion
HKosova
13 years agoSmartBear Alumni (Retired)
Hi Vince,
You're right, TestComplete's CertificateInfo object doesn't contain the timestamp info. I've filed a feature request for it on your behalf.
Meanwhile, if CAMICOM isn't an option, you can use PowerShell as you originally suggested.
The PowerShell engine is available as .NET class System.Management.Automation.PowerShell, and you can script it from TestComplete via the dotNET object. For this purpose, you need to add the System.Management.Automation assembly to Tools > Current Project Properties > CLR Bridge and, of course, you must have PowerShell installed on the computer.
Here's a TestComplete VBScript equivalent of your PowerShell script (it's a bit lengthy but should do what you need :))
You're right, TestComplete's CertificateInfo object doesn't contain the timestamp info. I've filed a feature request for it on your behalf.
Meanwhile, if CAMICOM isn't an option, you can use PowerShell as you originally suggested.
The PowerShell engine is available as .NET class System.Management.Automation.PowerShell, and you can script it from TestComplete via the dotNET object. For this purpose, you need to add the System.Management.Automation assembly to Tools > Current Project Properties > CLR Bridge and, of course, you must have PowerShell installed on the computer.
Here's a TestComplete VBScript equivalent of your PowerShell script (it's a bit lengthy but should do what you need :))
Sub Test
Dim fileName, sig
fileName = Sys.Process("TestComplete").Path ' Replace this expression with your file name
Set sig = GetAuthenticodeSignature(fileName)
If sig.TimeStamperCertificate Is Nothing Then
Log.Warning "The file has no time stamp!"
Else
Log.Message "The file is timestamped. See Additional Info for time stamper's certificate info.", sig.TimeStamperCertificate.ToString.OleValue
End If
End Sub
' Returns the System.Management.Automation.Signature object
' corresponding to the file's digital signature
' http://msdn.microsoft.com/en-us/library/system.management.automation.signature.aspx
Function GetAuthenticodeSignature(strFileName)
Dim powerShell, res
Set powerShell = dotNET.System_Management_Automation.PowerShell.Create
powerShell.AddScript "Get-AuthenticodeSignature """ & strFileName & """"
Set res = powerShell.Invoke_3(Nothing)
Set GetAuthenticodeSignature = res.Item(0).BaseObject
End Function
Related Content
- 6 years ago
- 6 years ago
- 7 years ago
- 7 years ago
Recent Discussions
- 3 days ago