Create private key:
openssl genrsa -des3 -out CAPrivate.key 2048
Generate root certificate:
openssl req -x509 -new -nodes -key CAPrivate.key -sha256 -days 365 -out CAPrivate.pem
Generate CSR:
generate private key:
openssl genrsa -out MyPrivate.key 2048
generate CSR:
openssl req -new -key MyPrivate.key -out MyRequest.csr
generate certificate:
openssl x509 -req -in MyRequest.csr -CA CAPrivate.pem -CAkey CAPrivate.key -CAcreateserial -out X509Certificate.crt -days 365 -sha256
TEST:
openssl dgst -sha256 -sign MyPrivate.key -out signature.txt sign.txt openssl x509 -in X509Certificate.crt openssl dgst -sha256 -verify <(openssl x509 -in X509Certificate.crt -pubkey -noout) -signature signature.txt sign.txt