separate out SSLStream::generateSelfSignedCertificate