//import { check } from "k6";
import {
Writer,
SchemaRegistry,
SCHEMA_TYPE_AVRO,
SCHEMA_TYPE_JSON,
SASL_SSL,
TLS_1_2,
TLS_1_1,
TLS_1_3,
TLS_1_0
//SCHEMA_TYPE_JSON,
} from "k6/x/kafka"; // import kafka extension
const saslConfig= {
username: "v1",
password: "g",
algorithm: SASL_SSL,
}
const t= {
enableTls:true
}
const writer = new Writer({
brokers: ["digital.net:443"],
topic: "any.v1",
sasl: saslConfig,
tls: t
});
const tlsConfig={
enableTls: true,
insecureSkipTlsVerify:true,
clientCertPem:"./truststore_rootca.pem",
clientKeyPem:"./keystore_retina.pem",
serverCaPem:"./serverca1.pem",
}
const schemaReg = new SchemaRegistry
(
{
url: "https://sk-digital.net",
tls: tlsConfig
}
);
export default function () {
{
let messages = [
{
value: schemaReg.serialize({
data: {
Name:"SHABDA_PRODUCT",
domain:"sHABD_DOMAIN",
ordernumber:"M123",
},
schemaType: SCHEMA_TYPE_JSON,
}),
},
];
writer.produce({ messages: messages });
}
}
Hi team , when am trying to execute the above code , am getting below error
GoError: Error creating x509 key pair from "./truststore_rootca.pem" and "./keystore_retina.pem"., OriginalError: %!w(*errors.errorString=&{tls: found a certificate rather than a key in the PEM for the private key})
Can you please help.
We had truststore.jks and keystore.jks files which we converted to .pem files and placed them in the code above
and we have a ca.p12 server ca file which we again converted to pem file for server ca pem field .
@mostafa Can you please help here