Creating a self signed certificate using openSSL
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
Extract public key from crt :
openssl x509 -pubkey -noout -in /home/tyson/Desktop/PGP/SelfSignedCertificate/temp.crt > /home/tyson/Desktop/PGP/SelfSignedCertificate/pubkeytemp.pem
Reference :
https://stackoverflow.com/questions/17143606/how-to-save-public-key-from-a-certificate-in-pem-format
Ubuntu :
https://www.liquidweb.com/kb/how-to-create-a-self-signed-ssl-certificate-on-ubuntu/
Create a self signed certificate in Windows :
https://support.sophos.com/support/s/article/KB-000038223?language=en_US#:~:text=Create%20the%20SSL%20Certificate,-Click%20on%20the&text=Click%20on%20the%20name%20of,certificate%2C%20and%20then%20click%20OK.