This is an incredibly simple piece of code to create a Root CA cert and then create a Server cert signed by the Root CA. I wrote it to help me test TLS configs for SQL Server in a VM or on-prem. It is emphatically NOT production quality.
Hopefully, the comments in the code make it obvious what's going on.