Creating CSR

Hi support team

I`m trying to find out how to create a CSR on HSM6 with function create_public_key_file() , please could help us giving a sample of this with input data ( CN, , OU, …) ?

def zymkey.module.Zymkey.create_public_key_file (
slot = 0,
foreign = False )
Create a file with the PEM-formatted public key.
This method is useful for generating a Certificate Signing Request.


To generate a CSR, you don’t need to first export the public key to a file. You can use openssl and include -engine zymkey_ssl to use the Zymkey keys. There is an example you can find here:

You can specify an environment variable ZK_SSL_SLOT to openssl with the slot you would like to use.

For example, to use ATTEC slot 2,

ZK_SSL_SLOT=2 openssl req -key bogus.key -new -out myCert.csr -engine zymkey_ssl -keyform e

This is particularly useful with the HSM6 which allows you to generate up to 512 additional key pairs.