Skip to main content

Mutual TLS

image

Introduction

mTLS (Mutual Transport Layer Security) is a security mechanism in which both the client and the server authenticate each other using X.509 certificates during the TLS handshake. Primus zkTLS SDKs support mTLS by allowing the client certificate to be examined during the handshake phase.

Using mTLS in the Network-Core-SDK

sing mTLS in the SDKs is straightforward. Developers simply provide the client certificate and corresponding private key via the mTLS parameter, and then invoke the attest function. For platform independence, the certificate and private key should be provided as strings.

// Compose params for attest
const mTLS = {
clientKey: fs.readFileSync(CLIENT_KEY).toString(),
clientCrt: fs.readFileSync(CLIENT_CRT).toString(),
}
const attestParams = {
...submitTaskParams,
...submitTaskResult,
requests,
responseResolves,
mTLS
};
let attestResult = await primusNetwork.attest(attestParams);

You can check this demo example for more details.