If you get this issue while generating certificates using openssl command verify the openssl configuration file. This issue was found while running openssl in MacOS.
Open the file : /etc/ssl/openssl.cnf and add blow content
[ v3_req ]
basicConstraints = CA:TRUE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment