Resolve SSL Certificate Errors in LoadRunner

Typically you will face errors while working with HTTPS protocols in HP LoadRunner. The errors you encounter is due to improper configuration of your SSL certificates. In this article, we will see how to resolve SSL certificate errors in LoadRunner and the common mistakes done by performance testers.

By default, you will get below SSL error:

Error -27770: Cannot set Key File for certificate "yourcertificate.cer". Please check file format (should be PEM), password correctness, and matching to the certificate file.   [MsgId: MERR-27770]

Usually your web request will be as shown below:

web_set_certificate_ex("CertFilePath=yourcertificate.cer",
  "CertFormat=PEM",
  "KeyFilePath=yourcertificate.cer",
  "KeyFormat=PEM",
  "Password=yourpassword",
  //"CertIndex=1",
  LAST);

How to Resolve SSL Certificate Errors in LoadRunner?

To use this function, you have to add the certificate to the Vuser’s list in the Controller by navigating to Group Information > More > Files or you can copy the certificate to all the machines.

To extract the certificate information, launch Internet Explorer and follow below steps:

  1. Choose Tools > Internet Options. Select the Content tab and click Certificates.
  2. Select a certificate from the list and click
  3. Click Next several times until you are prompted for a password.
  4. Enter a password and click Next.
  5. Enter a file name and click Next.
  6. Click Finish

LoadRunner supports only the certificates which has *.PEM extensions. You can convert your SSL certificates by using this online tool https://www.sslshopper.com/ssl-converter.html

Also, make sure that you are using CertIndex parameter, if you are not using it, the security level will be high, and you MUST provide the valid password. The above function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Let me summarize the points, you must use the SSL certificate which has PEM extension, you must place your certificates on all the machines(in bin folder), and you must provide CertIndex value.

Happy Testing!

Do not miss any posts, subscribe now.

Image courtesy of ddpavumba at FreeDigitalPhotos.net

About the Author

10 thoughts on “Resolve SSL Certificate Errors in LoadRunner”

  1. Even I am getting this issue during my scripting SAP Web protocol.
    /* The value of CertIndex in the following API web_set_certificate_ex is not correctly generated.
    Please change this value manually according to the order in “Internet Options”->”Content”->”Certificate” */

    web_set_certificate_ex(“CertFilePath=WinINetCert1.pem”,
    “CertFormat=PEM”,
    “KeyFilePath=WinINetCert1.pem”,
    “KeyFormat=PEM”,
    “Password=5a3a83fa”,
    “CertIndex=1”,
    LAST);

    Error: Action.c(15): Error -27492: “HttpSendRequest” failed, Windows error code=12029 (cannot connect) and retry limit (0) exceeded

    Reply
      • Action.c(23): Warning -27760: Request “https://” failed [MsgId: MWAR-27760]

        @Vivek, Looks like you had recently had this issue were you able to find the solution for this ? if so please share that would be helpful. Thank you

        Reply
  2. Hello Naveen. I’m stuck with an issue. Please help me to resolve.
    I’m running web services (json) request using web_custom_request. I have received certificate 2 certificate files. One is cer and another one is pkcs8.

    I tried hard and searched all over the internet to convert pkcs8 to pem but no luck. I don’t see many tools to convert pkcs8 file particularly.

    I couldn’t follow the steps mentioned above using IE browser because this is a web service request.

    Please help.

    Reply
  3. Hi Naveen,

    can you please help me with setting up the SSL authentication for a JAVA record replay in LoadRunner.

    Used below function but didn’t work.. I guess I am missing something

    web.set_certificate_ex(
    new String []{
    “CertFilePath=cert1.pem”,
    “CertFormat=PEM”,
    “KeyFilePath=key1.pem”,
    “KeyFormat=PEM”,
    web.LAST
    });

    Reply
  4. Hi Naveen, I am trying to add certificate to truclient script, but it is failing. The certificate is in .p12 format. Do we need to convert client certificate for truclient protocol?

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hamster Pro - Launch JMeter Recent Test Plans SwiftlyI want this.
+
Share via
Copy link