aqFileCertificateInfo Object

Applies to TestComplete 15.45, last modified on December 01, 2022

Description

The aqFileCertificateInfo object provides various information about the authentication certificate. You can get this object by using the CertificateInfo property of the aqFileInfo object.

Members

Example

The following example demonstrates how you can obtain information about a files’s certificate and post this information to the test log.

JavaScript, JScript

function CertificateInfoSample()
{
  var fileName = Sys.Process("TestComplete").Path; // Specify the file name here
  var certInfo = aqFileSystem.GetFileInfo(fileName).CertificateInfo;

  Log.Message("Version: " + certInfo.Version);
  Log.Message("Serial number: " + certInfo.SerialNumber);
  Log.Message("Signature algorithm: " + certInfo.Algorithm);
  Log.Message("Issuer: " + certInfo.Issuer);
  Log.Message("Valid from: " + aqConvert.DateTimeToFormatStr(certInfo.NotBefore, "%#c"));
  Log.Message("Valid to: " + aqConvert.DateTimeToFormatStr(certInfo.NotAfter, "%#c"));
  Log.Message("Subject: " + certInfo.Subject);
  Log.Message("Public key: " + certInfo.PublicKey);
}

Python

def CertificateInfoSample():
  fileName = Sys.Process("TestComplete").Path # Specify the file name here
  certInfo = aqFileSystem.GetFileInfo(fileName).CertificateInfo
  Log.Message("Version: " + certInfo.Version)
  Log.Message("Serial number: " + certInfo.SerialNumber)
  Log.Message("Signature algorithm: " + certInfo.Algorithm)
  Log.Message("Issuer: " + certInfo.Issuer)
  Log.Message("Valid from: " + aqConvert.DateTimeToFormatStr(certInfo.NotBefore, "%#c"))
  Log.Message("Valid to: " + aqConvert.DateTimeToFormatStr(certInfo.NotAfter, "%#c"))
  Log.Message("Subject: " + certInfo.Subject)
  Log.Message("Public key: " + certInfo.PublicKey)

VBScript

Sub CertificateInfoSample
  Dim fileName, certInfo

  fileName = Sys.Process("TestComplete").Path ' Replace this expression with your file name
  Set certInfo = aqFileSystem.GetFileInfo(fileName).CertificateInfo

  Log.Message "Version: " & certInfo.Version
  Log.Message "Serial number: " & certInfo.SerialNumber
  Log.Message "Signature algorithm: " & certInfo.Algorithm
  Log.Message "Issuer: " & certInfo.Issuer
  Log.Message "Valid from: " & aqConvert.DateTimeToFormatStr(certInfo.NotBefore, "%#c")
  Log.Message "Valid to: " & aqConvert.DateTimeToFormatStr(certInfo.NotAfter, "%#c")
  Log.Message "Subject: " & certInfo.Subject
  Log.Message "Public key: " & certInfo.PublicKey
End Sub

DelphiScript

procedure CertificateInfoSample;
var fileName, certInfo;
begin
  fileName := Sys.Process('TestComplete').Path; // Replace this expression with your file name
  certInfo := aqFileSystem.GetFileInfo(fileName).CertificateInfo;

  Log.Message('Version: ' + certInfo.Version);
  Log.Message('Serial number: ' + certInfo.SerialNumber);
  Log.Message('Signature algorithm: ' + certInfo.Algorithm);
  Log.Message('Issuer: ' + certInfo.Issuer);
  Log.Message('Valid from: ' + aqConvert.DateTimeToFormatStr(certInfo.NotBefore, '%#c'));
  Log.Message('Valid to: ' + aqConvert.DateTimeToFormatStr(certInfo.NotAfter, '%#c'));
  Log.Message('Subject: ' + certInfo.Subject);
  Log.Message('Public key: ' + certInfo.PublicKey);
end;

C++Script, C#Script

function CertificateInfoSample()
{
  var fileName = Sys["Process"]("TestComplete")["Path"]; // Replace this expression with your file name
  var certInfo = aqFileSystem["GetFileInfo"](fileName)["CertificateInfo"];

  Log["Message"]("Version: " + certInfo["Version"]);
  Log["Message"]("Serial number: " + certInfo["SerialNumber"]);
  Log["Message"]("Signature algorithm: " + certInfo["Algorithm"]);
  Log["Message"]("Issuer: " + certInfo["Issuer"]);
  Log["Message"]("Valid from: " + aqConvert["DateTimeToFormatStr"](certInfo["NotBefore"], "%#c"));
  Log["Message"]("Valid to: " + aqConvert["DateTimeToFormatStr"](certInfo["NotAfter"], "%#c"));
  Log["Message"]("Subject: " + certInfo["Subject"]);
  Log["Message"]("Public key: " + certInfo["PublicKey"]);
}

See Also

CertificateInfo Property

Highlight search results