Skip to content

TLS Auth supports accessing windows certificate store for the private key with the id of the private key #2434

@xiananfan

Description

@xiananfan

Feature Description

Currently, the TLS Auth section of the Options inside the javascript only supports clear text private key. This is generally considered insecure in a production environment.

  tlsAuth: [
    {
      domains: ['example.com'],
      cert: open('./mycert.pem'),
      key: open('./mycert-key.pem'),
    },
  ]

For the Windows platform, usually, the certificate is installed into the windows local certificate store. I would like to request that K6 supports accessing the Windows certificate store for accessing the private key instead of providing a cleartext private key.
For example, something like below:

  tlsAuth: [
    {
      domains: ['example.com'],
      cert: open('./mycert.pem'),
      keyid: 'LocalMachine/My/1cdb52270cde175e62e876551bcd56b21bad84c4',
    },
  ],

On a Windows machine, this Powershell command can be used to list all the certs installed in the local machine's certificate store:
Get-ChildItem -path cert:\LocalMachine\My
And the thumbprint string from above output for a specific cert would be the string to use in the configuration.

A library I have found online implemented in GO seems to have this functionality already: https://github.com/google/certtostore/blob/master/certtostore_windows.go

Suggested Solution (optional)

No response

Already existing or connected issues / PRs (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    evaluation neededproposal needs to be validated or tested before fully implementing it in k6featurehelp wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions