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.
It was found that in MacOS the default OpenSSL config does not include the configuration for v3_ca certificate generation.
This can be fixed by below steps :
Open the file : /etc/ssl/openssl.cnf and add blow content
[ v3_ca ]
basicConstraints = critical,CA:TRUE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always