Monday 3 July 2023

How to use .pem and .key certificate files in vugen load runner scripting | How to import .pem & .Key certificates in vugen

To use ".pem" and ".key" certificate files in LoadRunner VuGen scripting, you can follow these steps:


1. Place the ".pem" and ".key" files in a location accessible to your VuGen script, such as the script folder or a shared location.

2. Open your VuGen script and navigate to the appropriate section where you need to use the certificate.

3. In the script editor, add the following lines of code to load and use the certificate files:


web_set_certificate_ex("<pem_file_path>", "<key_file_path>", "cert_password");

Replace "<pem_file_path>" with the path to your ".pem" file and "<key_file_path>" with the path to your ".key" file. If the certificate is password-protected, replace "cert_password" with the actual password.

4. Save your script.

By using the 'web_set_certificate_ex' function, you instruct VuGen to load the specified ".pem' and ".key" files and use them for SSL/TLS communication during script execution.

Make sure the certificate files are valid and properly formatted. If there are any issues with the certificate files, the script may fail to execute or encounter SSL/TLS errors.


Method 2:

1. Launch VuGen: Open LoadRunner VuGen and create a new script or open an existing one.

2. Recording Options: In the VuGen toolbar, click on "Recording Options" to open the recording settings dialog box.

3. Proxy Recording: In the recording settings dialog box, select the "Proxy" tab. Enable the "Enable proxy recording" option if it is not already enabled.

4. Certificate Settings: Click on the "Certificate" button in the recording settings dialog box. This will open the certificate settings dialog box.

5. Import Certificates: In the certificate settings dialog box, click on the "Import" button to import the .pem and .key certificates. Browse to the location where the certificates are stored and select the appropriate files.

6. Verify Certificates: After importing the certificates, verify that they appear in the certificate list in the settings dialog box. Make sure that the certificates are associated with the correct domains or URLs that you want to record.

7. Apply and Close: Click on the "OK" button to apply the certificate settings and close the certificate settings dialog box.

8. Save Recording Options: Back in the recording settings dialog box, click on the "OK" button to save the recording options.

9. Start Recording: Start the recording process by clicking on the "Start Recording" button in the VuGen toolbar. Make sure to set the browser's proxy settings to the address and port specified in the recording options.

10. Proceed with Recording: Perform the actions that you want to record in the web application or system under test. VuGen will capture the network traffic, including the HTTPS requests and responses.During the recording process, VuGen will use the imported .pem and .key certificates to handle SSL/TLS connections and decrypt the HTTPS traffic. This allows VuGen to record and analyze the encrypted data exchanged between the client and the server.