OpenSSL selfsigned cert and extract keys from .pfx file

Self-signed cert

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256 -days 365 -nodes

Extract keys from .pfx

openssl pkcs12 -in client.pfx -nocerts -out client.key -nodes
openssl pkcs12 -in client.pfx -nokeys -out client.crt
openssl rsa -in client.key -out client.key