Update README.md
5f180160ec34caa64b8c7c328d0e403b3541ffa8
1 files changed
README.md
diff --git a/README.md b/README.md
index 2287045..27a3efc 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,82 @@
# Vimexx_API
Vimexx_API partly implementation for making the LetsEcnrypt DNS challenge (needed for wildcard certs)
-First create the WHMCS API credentials on the Vimexx website https://my.vimexx.nl/api
+Call LetsEncryptAsync to make the challenge record in DNS.
-You also need your userid and password of your account.
+The challenge can be obtained by the https://github.com/fszlin/certes project.
-Call LetsEncryptAsync to make the challenge record in DNS.
+```C#
+var order = await acme.NewOrder(new[] { "*.example.com" });
-Happy Cert-wild-carding.
+var authz = (await order.Authorizations()).First();
+var dnsChallenge = await authz.Dns();
+var dnsTxt = acme.AccountKey.DnsTxt(dnsChallenge.Token);
+```
+And use the dnsTxt to make the challende entry in DNS.
+
+First create the WHMCS API credentials on the Vimexx website https://my.vimexx.nl/api
+You also need your userid and password of your account for login to the Vimexx systems.
```C#
using Vimexx_API.Api;
var api = new Api();
-await api.LoginAsync("<clientid>", "<client-secret>", "<userid>", "<password>");
+await api.LoginAsync("<vimexx-clientid>", "<vimexx-client-secret>", "<vimexx-userid>", "<vimexx-password>");
-var result = await api.LetsEncryptAsync("voorbeeld.nl", "<challenge>");
+var result = await api.LetsEncryptAsync("example.com", dnsTxt);
+```
+
+Now the DNS at Vimexx is setup to make the LetsEncryt validate call.
+
+```C#
+await dnsChallenge.Validate();
+```
+
+Download the certificate once validation is done (put in here your own credentials please)
-Console.WriteLine($"result: {result.message}");
+```C#
+var privateKey = KeyFactory.NewKey(KeyAlgorithm.ES256);
+var cert = await order.Generate(new CsrInfo
+{
+ CountryName = "NL",
+ State = "Flevoland",
+ Locality = "Lelystad",
+ Organization = "Van der Heijden BV",
+ OrganizationUnit = "ICT"
+ //CommonName = "example.com",
+}, privateKey);
```
+
+Export PFX data
+
+```C#
+var pfxBuilder = cert.ToPfx(privateKey);
+var pfxData = pfxBuilder.Build("cert-friendly-name", "<some-password>");
+```
+
+Save the pfx data and import them into a cert store.
+
+```C#
+await File.WriteAllBytesAsync("cert-name.pfx", pfxData);
+
+var store = new X509Store("WebHosting", StoreLocation.LocalMachine))
+store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
+
+var certificate = new X509Certificate2("cert-name.pfx",
+ "<some-password>",
+ X509KeyStorageFlags.MachineKeySet |
+ X509KeyStorageFlags.PersistKeySet |
+ X509KeyStorageFlags.Exportable);
+
+store.Add(certificate);
+store.Close();
+```
+Now the cert can for example be selected in the IIS admin when binding to its https address.
+
+For more information on getting the cert see the certes project.
+
+
+Happy Cert-wild-carding.
+