PKISharp / ACMESharpCore

An ACME v2 client library for .NET Standard (Let's Encrypt)
MIT License
325 stars 72 forks source link

How do I export domain TLS private key from ACMECLI? #72

Open sensboston opened 1 year ago

sensboston commented 1 year ago

Hello, could you please suggest or provide a code snippet, how to export domain TLS private key used for certificate(s) generation, from console client ACMECLI? For example, following this guide, it's a file domain.key , generated by command openssl genrsa 4096 > domain.key and used for command

openssl req -new -sha256 -key domain.key -subj "/" \
-reqexts SAN -config <(cat /etc/ssl/openssl.cnf \
<(printf "\n[SAN]\nsubjectAltName=DNS:foo.com,DNS:www.foo.com")) 

I've added some automation for ACMECLI (automatically passing file challenges by using FTP access to website/domain. If you want/need, I can create a pull request for that feature, it's really useful) and it works pretty fine, obtained certificate is good and valid, but FXDomains.com also requires a private key to install certificate.

So, for now I need to get it somehow in the text (not binary) form, could you help?

P.S. I'm very sorry, I definitely not a computer security & certificates expert so this area is pretty new for me.

sensboston commented 1 year ago

You may close this question, I already figured out.

P.S. If someone interested in the automated ACMECLI, with Http01 challenge type (you need to provide your ftp account credentials in options, sample command file provided) and private key export in .pem format, you can download archive from https://senssoft.com/ACMECLI.zip

qcjxberin commented 10 months ago

@sensboston Can you provide the source code? Your compressed package file is actually effective

sensboston commented 10 months ago

@qcjxberin, sure! I don't have time to create PR or diff, just use this source (for ACMECLI project): https://senssoft.com/Program.cs.zip Don't forget to add FluentFTP package.

P.S. By the way, I did this mode just 'cause I've hosted on stupid FXDomains (it was a free hosting with domain name purchase), they have pretty limited access and I can't use a certbot. This year they cancelled free hosting and asked for some money, so I successfully migrated to the Oracle Cloud Always Free tier, installed certbot and forgot about free SSL cert problem at all 😉