0

what will be the Key value for my PFX certificate, i am using password as string and then getting error failed to find any PEM data in certificate input -

Also want to know is there any sample code to pass key, What would be key for my certificate, as it have only password.

Sample code :

import https from "k6/http";
export let options = {
  tlsAuth: [ {
    domains: ["example.com"],
    cert: open("./TESTGCY.PFX"),
    key:'saxobank0'
  } ]
};

export default function() {
  var url = "url/AooLive/Login.svc";
  var payload = JSON.stringify({ UserName: "TESTGCY", Password: "xxxxx" });
  var params = { headers: { "Content-Type": "application/json" } }
  var res= https.post(url, payload, params);
  console.log("Response time was " + String(res.timings.duration) + " ms");
  var ses= https.get(url, payload, params);
};
knittl
  • 246,190
  • 53
  • 318
  • 364
  • Just an update i am able to create key for my certificate but now its saying. tls: failed to find any PEM data in certificate input - – Gautam Choudhary Oct 16 '19 at 07:03
  • Can you try converting your PFX cert to PEM format, then retry. – cuonglm Oct 16 '19 at 08:39
  • after converting pfx to PEM now getting error.. tls: private key does not match public key import https from "k6/http"; export let options = { tlsAuth: [ { domains: ["tst2.dom"], cert: open("D:/AutomationPOC/PerfromanceTest/GCYTEST.pem"), key: open("D:/AutomationPOC/PerfromanceTest/GCYTEST.pem")} ] }; – Gautam Choudhary Oct 17 '19 at 03:47
  • I hope that's not your real password – knittl Dec 21 '21 at 19:22

0 Answers0