### Install AcmeshWrapper Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Shows how to install the AcmeshWrapper library using the .NET CLI, either via NuGet package management or by adding a project reference. ```bash # NuGet üzerinden kurulum dotnet add package AcmeshWrapper # Veya proje referansı ekleyin dotnet add reference path/to/AcmeshWrapper.csproj ``` -------------------------------- ### Install Certificate with AcmeshWrapper Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Demonstrates installing a certificate to specific file paths and executing a reload command for web servers. It requires providing paths to the certificate, key, and full chain files. ```csharp var installOptions = new InstallCertOptions { Domain = "example.com", CertFile = "/etc/nginx/ssl/cert.pem", KeyFile = "/etc/nginx/ssl/key.pem", FullChainFile = "/etc/nginx/ssl/fullchain.pem", ReloadCmd = "systemctl reload nginx" }; var result = await client.InstallCertAsync(installOptions); if (result.IsSuccess) { Console.WriteLine($"Installed at: {result.InstalledAt}"); Console.WriteLine($"Reload executed: {result.ReloadCommandExecuted}"); } ``` -------------------------------- ### Install AcmeshWrapper via NuGet Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Installs the AcmeshWrapper library using the .NET CLI. This is the standard way to add the package to your project. ```bash # Install via NuGet dotnet add package AcmeshWrapper ``` -------------------------------- ### Pre-release Version Tagging Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/version-management.md Illustrates how to create tags for pre-release versions, such as beta or release candidates, following Semantic Versioning conventions. ```bash git tag v2.0.0-beta.1 git tag v2.0.0-rc.1 ``` -------------------------------- ### Install Certificate Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Installs a certificate and its associated private key and full chain into a specified location, typically for web servers. It can also trigger a reload command for the web server. ```csharp var installOptions = new InstallCertOptions { Domain = "example.com", CertFile = "/etc/nginx/ssl/cert.pem", KeyFile = "/etc/nginx/ssl/key.pem", FullChainFile = "/etc/nginx/ssl/fullchain.pem", ReloadCmd = "systemctl reload nginx" }; var result = await client.InstallCertAsync(installOptions); if (result.IsSuccess) { Console.WriteLine($"Kurulum zamanı: {result.InstalledAt}"); Console.WriteLine($"Yenileme komutu çalıştırıldı: {result.ReloadCommandExecuted}"); } ``` -------------------------------- ### Release Preparation and Tagging Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/version-management.md Details the steps for preparing a release, including updating the CHANGELOG, committing changes, creating a version tag, and pushing it to the origin. This is a crucial part of the release process. ```bash # Update CHANGELOG.md # Commit all changes git add . git commit -m "Prepare release v1.2.0" git tag v1.2.0 -m "Release v1.2.0: Add new features" git push origin v1.2.0 ``` -------------------------------- ### Error Handling Example Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Provides an example of how to handle errors when using the AcmeshWrapper. It checks the `IsSuccess` property of the result and logs either the raw output or specific error messages from the `ErrorOutput` array. ```csharp var result = await client.IssueAsync(options); if (!result.IsSuccess) { // Log raw output for debugging Console.WriteLine(result.RawOutput); // Display user-friendly errors foreach (var error in result.ErrorOutput) { Console.WriteLine($"Error: {error}"); } } ``` -------------------------------- ### Git Tag-Based Releases Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/version-management.md This snippet demonstrates how to create and push a Git tag for version management. This process automates project updates, builds, testing, NuGet packaging, and publishing. ```bash git tag v1.2.0 -m "Release version 1.2.0" git push origin v1.2.0 ``` -------------------------------- ### Local Testing and Build Commands Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/version-management.md Shows the commands to update the version locally, build the project in release mode, run tests, and pack the project for distribution. This is performed before creating a release tag to ensure stability. ```bash # Update version locally ./scripts/Update-Version.ps1 -Version 1.2.0 # Build and test dotnet build -c Release dotnet test dotnet pack -c Release # If everything passes, create tag git tag v1.2.0 git push origin v1.2.0 ``` -------------------------------- ### C# Certificate Issuance Example Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Demonstrates how to issue a certificate using the AcmeWrapper client and handle potential errors. It shows how to access raw output and specific error messages for debugging. ```csharp var result = await client.IssueAsync(options); if (!result.IsSuccess) { // Hata ayıklama için ham çıktıyı kaydet Console.WriteLine(result.RawOutput); // Kullanıcı dostu hataları göster foreach (var error in result.ErrorOutput) { Console.WriteLine($"Hata: {error}"); } } ``` -------------------------------- ### Manual Version Updates Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/version-management.md Provides scripts for manually updating the project version locally. Supports both PowerShell for cross-platform compatibility and Bash for Linux/macOS environments. It also includes an option to update from the latest Git tag. ```powershell ./scripts/Update-Version.ps1 -Version 1.2.0 ``` ```bash ./scripts/update-version.sh 1.2.0 ./scripts/update-version.sh --from-tag ``` -------------------------------- ### GitHub Actions Version Update Example Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/scripts/README.md Example snippet demonstrating how to use a script to update the project version within a GitHub Actions workflow. It assumes the version is available in an output variable. ```yaml - name: Update project version run: | sed -i "s/.*<\/Version>/${{ steps.version.outputs.VERSION }}<\/Version>/” "$PROJECT_FILE" ``` -------------------------------- ### Get Certificate Content Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Retrieves the content of a certificate, including the private key, full chain, and CA bundle if requested. The retrieved content can be saved to files. ```csharp var getCertOptions = new GetCertificateOptions { Domain = "example.com", Ecc = false, IncludeKey = true, // Özel anahtarı dahil et IncludeFullChain = true, // Tam sertifika zincirini dahil et IncludeCa = true // CA paketini dahil et }; var result = await client.GetCertificateAsync(getCertOptions); if (result.IsSuccess) { Console.WriteLine($"Sertifika: {result.Certificate}"); Console.WriteLine($"Özel anahtar: {result.PrivateKey}"); Console.WriteLine($"Tam zincir: {result.FullChain}"); Console.WriteLine($"CA paketi: {result.CaBundle}"); // Dosyalara kaydet await File.WriteAllTextAsync("cert.pem", result.Certificate); await File.WriteAllTextAsync("key.pem", result.PrivateKey); } ``` -------------------------------- ### Get Certificate Information Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Retrieves detailed information about a specific certificate, including its domain, key length, alternative names, next renewal time, and API endpoint used. ```csharp var infoOptions = new InfoOptions { Domain = "example.com", Ecc = false // ECC sertifikaları için true yapın }; var result = await client.InfoAsync(infoOptions); if (result.IsSuccess) { Console.WriteLine($"Alan adı: {result.Domain}"); Console.WriteLine($"Anahtar uzunluğu: {result.KeyLength}"); Console.WriteLine($"Alternatif isimler: {result.AltNames}"); Console.WriteLine($"Sonraki yenileme: {result.NextRenewTimeStr}"); Console.WriteLine($"API endpoint: {result.ApiEndpoint}"); } ``` -------------------------------- ### Get Certificate Information Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Shows how to retrieve detailed information about a certificate using the InfoAsync method. It takes domain and ECC status as input and returns details like domain name, key length, alternative names, next renewal time, and API endpoint. ```csharp var infoOptions = new InfoOptions { Domain = "example.com", Ecc = false // Set to true for ECC certificates }; var result = await client.InfoAsync(infoOptions); if (result.IsSuccess) { Console.WriteLine($"Domain: {result.Domain}"); Console.WriteLine($"Key Length: {result.KeyLength}"); Console.WriteLine($"Alt Names: {result.AltNames}"); Console.WriteLine($"Next Renewal: {result.NextRenewTimeStr}"); Console.WriteLine($"API Endpoint: {result.ApiEndpoint}"); } ``` -------------------------------- ### Update Project Version using C# and dotnet-script Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/scripts/README.md Updates the version of a .NET project file using a C# script executed with `dotnet-script`. Requires `dotnet-script` to be installed globally. Supports specific versions, Git tags, and alternative project paths. ```bash dotnet tool install -g dotnet-script ``` ```csharp # Update to specific version dotnet script UpdateVersion.cs 1.2.3 # Get version from current git tag dotnet script UpdateVersion.cs # Update a different project file dotnet script UpdateVersion.cs 1.2.3 --project path/to/project.csproj # Get help dotnet script UpdateVersion.cs --help ``` -------------------------------- ### Create and Use AcmeClient Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Demonstrates how to create an instance of the AcmeClient, either with the default path to acme.sh or a custom path. ```csharp using AcmeshWrapper; // Default constructor uses "acme.sh" from PATH var client = new AcmeClient(); // Or specify custom path var client = new AcmeClient("/usr/local/bin/acme.sh"); ``` -------------------------------- ### AcmeClient Creation Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Demonstrates how to create an instance of the AcmeClient. It shows the default constructor which uses the 'acme.sh' found in the system's PATH, and an alternative constructor that allows specifying a custom path to the acme.sh executable. ```csharp using AcmeshWrapper; // Varsayılan yapıcı PATH'ten "acme.sh" kullanır var client = new AcmeClient(); // Veya özel yol belirtin var client = new AcmeClient("/usr/local/bin/acme.sh"); ``` -------------------------------- ### List Certificates with AcmeshWrapper Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Shows how to list all managed certificates using the ListAsync method. It includes options for raw output and handling the results, including errors. ```csharp var listOptions = new ListOptions { Raw = true // Get raw output format }; var result = await client.ListAsync(listOptions); if (result.IsSuccess) { foreach (var cert in result.Certificates) { Console.WriteLine($"Domain: {cert.Domain}"); Console.WriteLine($"Next Renewal: {cert.Le_Next_Renew_Time}"); Console.WriteLine($"Key Length: {cert.Le_Keylength}"); } } else { Console.WriteLine("Error listing certificates:"); foreach (var error in result.ErrorOutput) { Console.WriteLine(error); } } ``` -------------------------------- ### Local Development Version Update and Build Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/scripts/README.md Demonstrates the local development workflow for updating a project's version using a script and then building and packing the project. Includes creating and pushing Git tags. ```bash # Update version locally ./scripts/update-version.sh 1.2.3-beta.1 # Build and pack dotnet build -c Release dotnet pack -c Release ``` -------------------------------- ### Issue New Certificate with AcmeshWrapper Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Demonstrates issuing a new SSL/TLS certificate for one or more domains. It covers specifying domains, webroot, key length, and using staging environment. ```csharp var issueOptions = new IssueOptions { Domains = new List { "example.com", "www.example.com" }, WebRoot = "/var/www/html", KeyLength = "4096", Staging = false // Use true for testing }; var result = await client.IssueAsync(issueOptions); if (result.IsSuccess) { Console.WriteLine($"Certificate: {result.CertificateFile}"); Console.WriteLine($"Key: {result.KeyFile}"); Console.WriteLine($"CA: {result.CaFile}"); Console.WriteLine($"Full Chain: {result.FullChainFile}"); } ``` -------------------------------- ### Renew All Certificates Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Demonstrates how to renew all certificates using the RenewAllAsync method. It shows how to configure options like stopping on error and how to interpret the results, including counts of total, successful, skipped, and failed renewals, as well as a list of failed domains. ```csharp var renewAllOptions = new RenewAllOptions { StopRenewOnError = true // Stop if any renewal fails }; var result = await client.RenewAllAsync(renewAllOptions); Console.WriteLine($"Total certificates: {result.TotalCertificates}"); Console.WriteLine($"Successful renewals: {result.SuccessfulRenewals}"); Console.WriteLine($"Skipped (not due): {result.SkippedRenewals}"); Console.WriteLine($"Failed: {result.FailedRenewals}"); if (result.FailedDomains.Any()) { Console.WriteLine("Failed domains:"); foreach (var domain in result.FailedDomains) { Console.WriteLine($" - {domain}"); } } ``` -------------------------------- ### Retrieve Certificate Contents Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Demonstrates how to fetch the contents of a certificate, including the private key, full chain, and CA bundle, using the GetCertificateAsync method. It allows specifying which components to include and shows how to save these contents to files. ```csharp var getCertOptions = new GetCertificateOptions { Domain = "example.com", Ecc = false, IncludeKey = true, // Include private key IncludeFullChain = true, // Include full certificate chain IncludeCa = true // Include CA bundle }; var result = await client.GetCertificateAsync(getCertOptions); if (result.IsSuccess) { Console.WriteLine($"Certificate: {result.Certificate}"); Console.WriteLine($"Private Key: {result.PrivateKey}"); Console.WriteLine($"Full Chain: {result.FullChain}"); Console.WriteLine($"CA Bundle: {result.CaBundle}"); // Save to files await File.WriteAllTextAsync("cert.pem", result.Certificate); await File.WriteAllTextAsync("key.pem", result.PrivateKey); } ``` -------------------------------- ### List Certificates Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Retrieves a list of all managed certificates. The `ListOptions` can be used to specify the output format, such as raw. ```csharp var listOptions = new ListOptions { Raw = true // Ham çıktı formatını al }; var result = await client.ListAsync(listOptions); if (result.IsSuccess) { foreach (var cert in result.Certificates) { Console.WriteLine($"Alan adı: {cert.Domain}"); Console.WriteLine($"Sonraki yenileme: {cert.Le_Next_Renew_Time}"); Console.WriteLine($"Anahtar uzunluğu: {cert.Le_Keylength}"); } } else { Console.WriteLine("Sertifikaları listelerken hata:"); foreach (var error in result.ErrorOutput) { Console.WriteLine(error); } } ``` -------------------------------- ### Issue New Certificate Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Issues a new SSL/TLS certificate for one or more domains. You can specify the web root, key length, and whether to use staging environment for testing. ```csharp var issueOptions = new IssueOptions { Domains = new List { "example.com", "www.example.com" }, WebRoot = "/var/www/html", KeyLength = "4096", Staging = false // Test için true kullanın }; var result = await client.IssueAsync(issueOptions); if (result.IsSuccess) { Console.WriteLine($"Sertifika: {result.CertificateFile}"); Console.WriteLine($"Anahtar: {result.KeyFile}"); Console.WriteLine($"CA: {result.CaFile}"); Console.WriteLine($"Tam zincir: {result.FullChainFile}"); } ``` -------------------------------- ### Revoke Certificate with AcmeshWrapper Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Shows how to revoke a certificate for a given domain. It allows specifying the reason for revocation, such as key compromise. ```csharp var revokeOptions = new RevokeOptions { Domain = "example.com", Reason = RevokeReason.KeyCompromise }; var result = await client.RevokeAsync(revokeOptions); if (result.IsSuccess) { Console.WriteLine($"Revoked at: {result.RevokedAt}"); Console.WriteLine($"Thumbprint: {result.CertificateThumbprint}"); } ``` -------------------------------- ### Renew Certificate with AcmeshWrapper Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Shows how to renew an existing certificate for a specific domain. Options include forcing renewal and specifying ECC certificate usage. ```csharp var renewOptions = new RenewOptions { Domain = "example.com", Force = false, // Force renewal even if not due Ecc = false // Use ECC certificate }; var result = await client.RenewAsync(renewOptions); if (result.IsSuccess) { Console.WriteLine($"Renewed at: {result.RenewedAt}"); Console.WriteLine($"Certificate: {result.CertificatePath}"); } ``` -------------------------------- ### Update Project Version using Bash Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/scripts/README.md Updates the version of a .NET project file using a Bash script. It accepts a specific version or uses the current Git tag. Allows specifying an alternative project file path. ```bash # Update to specific version ./update-version.sh 1.2.3 # Get version from current git tag ./update-version.sh # Update a different project file ./update-version.sh -p path/to/project.csproj 1.2.3 # Get help ./update-version.sh --help ``` -------------------------------- ### Update Project Version using PowerShell Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/scripts/README.md Updates the version of a .NET project file using PowerShell. It can take a specific version or infer it from the current Git tag. Supports specifying a different project file path. ```powershell # Update to specific version ./Update-Version.ps1 -Version 1.2.3 # Get version from current git tag ./Update-Version.ps1 # Update a different project file ./Update-Version.ps1 -Version 1.2.3 -ProjectPath path/to/project.csproj # Get help ./Update-Version.ps1 -? ``` -------------------------------- ### Remove a Certificate Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Illustrates how to remove a certificate using the RemoveAsync method. It requires specifying the domain and whether it's an ECC certificate. The result indicates success and provides the timestamp of removal. ```csharp var removeOptions = new RemoveOptions { Domain = "example.com", Ecc = false }; var result = await client.RemoveAsync(removeOptions); if (result.IsSuccess) { Console.WriteLine($"Removed: {result.Domain} at {result.RemovedAt}"); } ``` -------------------------------- ### Revoke Certificate Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Revokes a certificate for a given domain. You can specify the reason for revocation, such as key compromise. ```csharp var revokeOptions = new RevokeOptions { Domain = "example.com", Reason = RevokeReason.KeyCompromise }; var result = await client.RevokeAsync(revokeOptions); if (result.IsSuccess) { Console.WriteLine($"İptal zamanı: {result.RevokedAt}"); Console.WriteLine($"Parmak izi: {result.CertificateThumbprint}"); } ``` -------------------------------- ### Renew All Certificates Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Attempts to renew all certificates managed by the system. It provides options to stop renewal if any error occurs and reports the total number of certificates, successful renewals, skipped renewals, and failures. ```csharp var renewAllOptions = new RenewAllOptions { StopRenewOnError = true // Herhangi bir yenileme başarısız olursa dur }; var result = await client.RenewAllAsync(renewAllOptions); Console.WriteLine($"Toplam sertifika: {result.TotalCertificates}"); Console.WriteLine($"Başarılı yenilemeler: {result.SuccessfulRenewals}"); Console.WriteLine($"Atlananlar (süresi dolmamış): {result.SkippedRenewals}"); Console.WriteLine($"Başarısız: {result.FailedRenewals}"); if (result.FailedDomains.Any()) { Console.WriteLine("Başarısız alan adları:"); foreach (var domain in result.FailedDomains) { Console.WriteLine($" - {domain}"); } } ``` -------------------------------- ### Renew Certificate Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Renews an existing certificate for a specific domain. You can force renewal even if the certificate has not expired and choose between RSA or ECC keys. ```csharp var renewOptions = new RenewOptions { Domain = "example.com", Force = false, // Süresi dolmasa bile yenilemeyi zorla Ecc = false // ECC sertifikası kullan }; var result = await client.RenewAsync(renewOptions); if (result.IsSuccess) { Console.WriteLine($"Yenilenme zamanı: {result.RenewedAt}"); Console.WriteLine($"Sertifika: {result.CertificatePath}"); } ``` -------------------------------- ### Remove Certificate Source: https://github.com/ersintarhan/acmeshwrapper/blob/main/README.md Removes a certificate and its associated files from the system. You can specify the domain and whether it's an ECC certificate. ```csharp var removeOptions = new RemoveOptions { Domain = "example.com", Ecc = false }; var result = await client.RemoveAsync(removeOptions); if (result.IsSuccess) { Console.WriteLine($"Kaldırıldı: {result.Domain} - {result.RemovedAt}"); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.