Generation of self siged certificates for TLS communication

For my TCP with TLS communication, I want to generate self-signed certificates and keys how to generate them?

Related