I have generated an ssl certificate using openssl using the documentation given by them. I have followed the step by step perfectly. However, the certificate is showing that it is an invalid certificate and it is showing red line cross over on https. I had done further R&D on that and i came to know that the certificate which i had generated will be good for local testing purpose at the development time, and when we go for publishing our website we should buy a certificate from a valid domain seller (ex: godaddy). My question is whether we can generate a valid ssl certificate using openssl so that we can change http to https for my already existed website. can any one please solve my query.
In order to be globally trusted, an SSL certificate must be signed by a trusted Authority. Otherwise the certificate will only provide encryption, but not trust.
Self-signed certificates are signed by yourself, hence they are not trusted as you can't guarantee for yourself. That's why they are good for local testing (or networks where you can configure the certificate to be trusted), but not when you deploy a site.
In order for you to properly configure HTTPS, you need to acquire a certificate from a Certificate Authority. You can't sign it yourself with OpenSSL.