Sign a CA and a server certificate
# Generate a private key for server
openssl genrsa -out server.key 1024
# Generate a public key for server
openssl rsa -in server.key -pubout -out server.pem
# Sign a CA
openssl genrsa -out ca.key 1024
openssl req -new -key ca.key -out ca.csr
openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt
# Sign a certificate by using CA
openssl req -new -key server.key -out server.csr
openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt