#CA
openssl genrsa -out cacert.key 2048
openssl req -x509 -new -nodes -key cacert.key -sha256 -days 3650 -subj "/CN=MyCA" -out cacert.pem
#Server
openssl genrsa -out key.pem 2048
openssl req -new -key ./key.pem -out cert.csr -subj "/CN=x.xx.com"
openssl x509 -req -in ./cert.csr -CA cacert.pem -CAkey cacert.key -CAcreateserial -out cert.pem -days 3650 -sha256
#client
openssl genrsa -out client-key.pem 2048
openssl req -new -key ./client-key.pem -out client.csr -subj "/CN=client"
openssl x509 -req -in ./client.csr -CA cacert.pem -CAkey cacert.key -CAcreateserial -out client.pem -days 3650 -sha256