Here we will be creating local certificate authority.
Used commands :
openssl genrsa -out rootCA.key 2048
openssl genrsa -des3 -out rootCA.key 2048
Self sign the certificate: openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem
Add that cert to macos keychain to trust it.
openssl genrsa -out device.key 2048
openssl req -new -key device.key -out device.csr
openssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 365 -sha256
Reference: