Failed to decode server's CA:

I have the below script and the client and server are residing in different keystores.
Server is residing in truststore and client is residing in keystore file.
Below is the script

 * This script shows how to load certificates and keys from
 * a JKS keystore, so that they can be used in a configuring TLS.
 * This is just a showcase, and not a complete script.
 * The keystore MUST be created with JKS storetype.
 * ⚠️ The PKCS#12 format is not supported.

import { LoadJKS, TLS_1_2 } from "k6/x/kafka";

// If server and client keystore are separate, then you must
// call LoadJKS twice, once for each keystore.
// This will load the certificates and keys from the keystore
// and write them to the disk, so that they can be used in
// the TLS configuration.

const jks = LoadJKS({
  path: "/Users/arpita.sood/Documents/Maersk_code/xk6-kafka/fixtures/keystore.jks",
  password: "password",
  clientCertAlias: "localhost",
  clientKeyAlias: "localhost",
  clientKeyPassword: "password",

 jks = LoadJKS({
  path: "/Users/arpita.sood/Documents/Maersk_code/xk6-kafka/fixtures/truststore.jks",
  password: "password",
  serverCaAlias: "caroot",

const tlsConfig = {
  enableTls: true,
  insecureSkipTlsVerify: false,
  minVersion: TLS_1_2,

  // The certificates and keys can be loaded from a JKS keystore:
  // clientCertsPem is an array of PEM-encoded certificates, and the filenames
  // will be named "client-cert-0.pem", "client-cert-1.pem", etc.
  // clientKeyPem is the PEM-encoded private key and the filename will be
  // named "client-key.pem".
  // serverCaPem is the PEM-encoded CA certificate and the filename will be
  // named "server-ca.pem".
  clientCertPem: jks["clientCertsPem"][0], // The first certificate in the chain
 clientKeyPem: jks["clientKeyPem"],
  serverCaPem: jks["serverCaPem"],

export default function () {

But i get the below error

ERRO[0000] GoError: Failed to decode server's CA: /Users/arpita.sood/Documents/Maersk_code/xk6-kafka/fixtures/kafka-keystore.jks, OriginalError: %!w(*errors.errorString=&{entry not found})
        at*Kafka).loadJKSFunction-fm (native)
        at file:///Users/arpita.sood/Documents/Maersk_code/xk6-kafka/scripts/test_tls_with_jks.js:20:20(31)  hint="script exception"

@inanc can you please help here.

@eyeveebe can you please help here?

@olha can you please help here?

Hi @arpita

Welcome to the community forum :wave:

I kindly ask you to avoid pinging several users in the forum. When you create a topic community users will help out if they can/know how to, and when they have the time. You have to be patient. Thanks for understanding :pray:t2:



I answered your question on the GH issue.