text:
using JetBrains.Annotations;
using Newtonsoft.Json;
using Nuke.Common;
using Nuke.Common.Execution;
using Nuke.Common.Tooling;
using Nuke.Common.Tools;
using Nuke.Common.Utilities.Collections;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text;

namespace Nuke.Common.Tools.SignTool
{
    ///
    ///
Sign Tool is a command-line tool that digitally signs files, verifies signatures in files, and time-stamps files.

    ///
For more details, visit the official website.

    ///
    [PublicAPI]
    [ExcludeFromCodeCoverage]
    public static partial class SignToolTasks
    {
        ///
        ///   Path to the SignTool executable.
        ///
        public static string SignToolPath =>
            ToolPathResolver.TryGetEnvironmentExecutable("SIGNTOOL_EXE") ??
            GetToolPath();
        public static Action<OutputType, string> SignToolLogger { get; set; } = ProcessTasks.DefaultLogger;
        ///
        ///
Sign Tool is a command-line tool that digitally signs files, verifies signatures in files, and time-stamps files.

        ///
For more details, visit the official website.

        ///
        public static IReadOnlyCollection<Output> SignTool(string arguments, string workingDirectory = null, IReadOnlyDictionary<string, string> environmentVariables = null, int? timeout = null, bool? logOutput = null, bool? logInvocation = null, Func<string, string> outputFilter = null)
        {
            using var process = ProcessTasks.StartProcess(SignToolPath, arguments, workingDirectory, environmentVariables, timeout, logOutput, logInvocation, SignToolLogger, outputFilter);
            process.AssertZeroExitCode();
            return process.Output;
        }
        ///
        ///
Use the <c>sign</c> command to sign files using embedded signatures. Signing protects a file from tampering, and allows users to verify the signer (you) based on a signing certificate. The options below allow you to specify signing parameters and to select the signing certificate you wish to use.

        ///
For more details, visit the official website.

        ///
        /// <remarks>
        ///
This is a CLI wrapper with fluent API that allows to modify the following arguments:

        ///

        ///
<c><files></c> via <see cref="SignToolSettings.Files"/>

        ///
<c>/a</c> via <see cref="SignToolSettings.AutomaticSelection"/>

        ///
<c>/ac</c> via <see cref="SignToolSettings.AdditionalCertificate"/>

        ///
<c>/as</c> via <see cref="SignToolSettings.AppendSignature"/>

        ///
<c>/c</c> via <see cref="SignToolSettings.CertificateTemplateName"/>

        ///
<c>/csp</c> via <see cref="SignToolSettings.Csp"/>

        ///
<c>/d</c> via <see cref="SignToolSettings.Description"/>

        ///
<c>/debug</c> via <see cref="SignToolSettings.Debug"/>

        ///
<c>/dg</c> via <see cref="SignToolSettings.SignedDigestAndUnsignedPkcs7Path"/>

        ///
<c>/di</c> via <see cref="SignToolSettings.GenerateSignature"/>

        ///
<c>/dlib</c> via <see cref="SignToolSettings.AuthenticodeDigestSignLibDll"/>

        ///
<c>/dmdf</c> via <see cref="SignToolSettings.AuthenticodeDigestSignPassUnmodified"/>

        ///
<c>/ds</c> via <see cref="SignToolSettings.SignDigestOnly"/>

        ///
<c>/du</c> via <see cref="SignToolSettings.Url"/>

        ///
<c>/dxml</c> via <see cref="SignToolSettings.XmlFile"/>

        ///
<c>/f</c> via <see cref="SignToolSettings.File"/>

        ///
<c>/fd</c> via <see cref="SignToolSettings.FileDigestAlgorithm"/>

        ///
<c>/force</c> via <see cref="SignToolSettings.Force"/>

        ///
<c>/i</c> via <see cref="SignToolSettings.Issuer"/>

        ///
<c>/itos</c> via <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
<c>/kc</c> via <see cref="SignToolSettings.KeyContainer"/>

        ///
<c>/n</c> via <see cref="SignToolSettings.SigningSubjectName"/>

        ///
<c>/nosealwarn</c> via <see cref="SignToolSettings.NoSealWarn"/>

        ///
<c>/nph</c> via <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
<c>/p</c> via <see cref="SignToolSettings.Password"/>

        ///
<c>/p7</c> via <see cref="SignToolSettings.ContentFileToPkcs7"/>

        ///
<c>/p7ce</c> via <see cref="SignToolSettings.SignedContentMethod"/>

        ///
<c>/p7co</c> via <see cref="SignToolSettings.SignedContentIdentifier"/>

        ///
<c>/ph</c> via <see cref="SignToolSettings.PageHashes"/>

        ///
<c>/q</c> via <see cref="SignToolSettings.Quiet"/>

        ///
<c>/r</c> via <see cref="SignToolSettings.RootSubjectName"/>

        ///
<c>/rmc</c> via <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
<c>/s</c> via <see cref="SignToolSettings.Store"/>

        ///
<c>/sa</c> via <see cref="SignToolSettings.AuthenticatedAttributes"/>

        ///
<c>/seal</c> via <see cref="SignToolSettings.SealingSignature"/>

        ///
<c>/sha1</c> via <see cref="SignToolSettings.Sha1Thumbprint"/>

        ///
<c>/sm</c> via <see cref="SignToolSettings.MachineStore"/>

        ///
<c>/t</c> via <see cref="SignToolSettings.TimestampServerUrl"/>

        ///
<c>/td</c> via <see cref="SignToolSettings.TimestampServerDigestAlgorithm"/>

        ///
<c>/tr</c> via <see cref="SignToolSettings.Rfc3161TimestampServerUrl"/>

        ///
<c>/tseal</c> via <see cref="SignToolSettings.Rfc3161TimestampServerUrlSealed"/>

        ///
<c>/u</c> via <see cref="SignToolSettings.EnhancedKeyUsage"/>

        ///
<c>/uw</c> via <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
<c>/v</c> via <see cref="SignToolSettings.Verbose"/>

        ///

        /// </remarks>
        public static IReadOnlyCollection<Output> SignTool(SignToolSettings toolSettings = null)
        {
            toolSettings = toolSettings ?? new SignToolSettings();
            using var process = ProcessTasks.StartProcess(toolSettings);
            process.AssertZeroExitCode();
            return process.Output;
        }
        ///
        ///
Use the <c>sign</c> command to sign files using embedded signatures. Signing protects a file from tampering, and allows users to verify the signer (you) based on a signing certificate. The options below allow you to specify signing parameters and to select the signing certificate you wish to use.

        ///
For more details, visit the official website.

        ///
        /// <remarks>
        ///
This is a CLI wrapper with fluent API that allows to modify the following arguments:

        ///

        ///
<c><files></c> via <see cref="SignToolSettings.Files"/>

        ///
<c>/a</c> via <see cref="SignToolSettings.AutomaticSelection"/>

        ///
<c>/ac</c> via <see cref="SignToolSettings.AdditionalCertificate"/>

        ///
<c>/as</c> via <see cref="SignToolSettings.AppendSignature"/>

        ///
<c>/c</c> via <see cref="SignToolSettings.CertificateTemplateName"/>

        ///
<c>/csp</c> via <see cref="SignToolSettings.Csp"/>

        ///
<c>/d</c> via <see cref="SignToolSettings.Description"/>

        ///
<c>/debug</c> via <see cref="SignToolSettings.Debug"/>

        ///
<c>/dg</c> via <see cref="SignToolSettings.SignedDigestAndUnsignedPkcs7Path"/>

        ///
<c>/di</c> via <see cref="SignToolSettings.GenerateSignature"/>

        ///
<c>/dlib</c> via <see cref="SignToolSettings.AuthenticodeDigestSignLibDll"/>

        ///
<c>/dmdf</c> via <see cref="SignToolSettings.AuthenticodeDigestSignPassUnmodified"/>

        ///
<c>/ds</c> via <see cref="SignToolSettings.SignDigestOnly"/>

        ///
<c>/du</c> via <see cref="SignToolSettings.Url"/>

        ///
<c>/dxml</c> via <see cref="SignToolSettings.XmlFile"/>

        ///
<c>/f</c> via <see cref="SignToolSettings.File"/>

        ///
<c>/fd</c> via <see cref="SignToolSettings.FileDigestAlgorithm"/>

        ///
<c>/force</c> via <see cref="SignToolSettings.Force"/>

        ///
<c>/i</c> via <see cref="SignToolSettings.Issuer"/>

        ///
<c>/itos</c> via <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
<c>/kc</c> via <see cref="SignToolSettings.KeyContainer"/>

        ///
<c>/n</c> via <see cref="SignToolSettings.SigningSubjectName"/>

        ///
<c>/nosealwarn</c> via <see cref="SignToolSettings.NoSealWarn"/>

        ///
<c>/nph</c> via <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
<c>/p</c> via <see cref="SignToolSettings.Password"/>

        ///
<c>/p7</c> via <see cref="SignToolSettings.ContentFileToPkcs7"/>

        ///
<c>/p7ce</c> via <see cref="SignToolSettings.SignedContentMethod"/>

        ///
<c>/p7co</c> via <see cref="SignToolSettings.SignedContentIdentifier"/>

        ///
<c>/ph</c> via <see cref="SignToolSettings.PageHashes"/>

        ///
<c>/q</c> via <see cref="SignToolSettings.Quiet"/>

        ///
<c>/r</c> via <see cref="SignToolSettings.RootSubjectName"/>

        ///
<c>/rmc</c> via <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
<c>/s</c> via <see cref="SignToolSettings.Store"/>

        ///
<c>/sa</c> via <see cref="SignToolSettings.AuthenticatedAttributes"/>

        ///
<c>/seal</c> via <see cref="SignToolSettings.SealingSignature"/>

        ///
<c>/sha1</c> via <see cref="SignToolSettings.Sha1Thumbprint"/>

        ///
<c>/sm</c> via <see cref="SignToolSettings.MachineStore"/>

        ///
<c>/t</c> via <see cref="SignToolSettings.TimestampServerUrl"/>

        ///
<c>/td</c> via <see cref="SignToolSettings.TimestampServerDigestAlgorithm"/>

        ///
<c>/tr</c> via <see cref="SignToolSettings.Rfc3161TimestampServerUrl"/>

        ///
<c>/tseal</c> via <see cref="SignToolSettings.Rfc3161TimestampServerUrlSealed"/>

        ///
<c>/u</c> via <see cref="SignToolSettings.EnhancedKeyUsage"/>

        ///
<c>/uw</c> via <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
<c>/v</c> via <see cref="SignToolSettings.Verbose"/>

        ///

        /// </remarks>
        public static IReadOnlyCollection<Output> SignTool(Configure<SignToolSettings> configurator)
        {
            return SignTool(configurator(new SignToolSettings()));
        }
        ///
        ///
Use the <c>sign</c> command to sign files using embedded signatures. Signing protects a file from tampering, and allows users to verify the signer (you) based on a signing certificate. The options below allow you to specify signing parameters and to select the signing certificate you wish to use.

        ///
For more details, visit the official website.

        ///
        /// <remarks>
        ///
This is a CLI wrapper with fluent API that allows to modify the following arguments:

        ///

        ///
<c><files></c> via <see cref="SignToolSettings.Files"/>

        ///
<c>/a</c> via <see cref="SignToolSettings.AutomaticSelection"/>

        ///
<c>/ac</c> via <see cref="SignToolSettings.AdditionalCertificate"/>

        ///
<c>/as</c> via <see cref="SignToolSettings.AppendSignature"/>

        ///
<c>/c</c> via <see cref="SignToolSettings.CertificateTemplateName"/>

        ///
<c>/csp</c> via <see cref="SignToolSettings.Csp"/>

        ///
<c>/d</c> via <see cref="SignToolSettings.Description"/>

        ///
<c>/debug</c> via <see cref="SignToolSettings.Debug"/>

        ///
<c>/dg</c> via <see cref="SignToolSettings.SignedDigestAndUnsignedPkcs7Path"/>

        ///
<c>/di</c> via <see cref="SignToolSettings.GenerateSignature"/>

        ///
<c>/dlib</c> via <see cref="SignToolSettings.AuthenticodeDigestSignLibDll"/>

        ///
<c>/dmdf</c> via <see cref="SignToolSettings.AuthenticodeDigestSignPassUnmodified"/>

        ///
<c>/ds</c> via <see cref="SignToolSettings.SignDigestOnly"/>

        ///
<c>/du</c> via <see cref="SignToolSettings.Url"/>

        ///
<c>/dxml</c> via <see cref="SignToolSettings.XmlFile"/>

        ///
<c>/f</c> via <see cref="SignToolSettings.File"/>

        ///
<c>/fd</c> via <see cref="SignToolSettings.FileDigestAlgorithm"/>

        ///
<c>/force</c> via <see cref="SignToolSettings.Force"/>

        ///
<c>/i</c> via <see cref="SignToolSettings.Issuer"/>

        ///
<c>/itos</c> via <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
<c>/kc</c> via <see cref="SignToolSettings.KeyContainer"/>

        ///
<c>/n</c> via <see cref="SignToolSettings.SigningSubjectName"/>

        ///
<c>/nosealwarn</c> via <see cref="SignToolSettings.NoSealWarn"/>

        ///
<c>/nph</c> via <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
<c>/p</c> via <see cref="SignToolSettings.Password"/>

        ///
<c>/p7</c> via <see cref="SignToolSettings.ContentFileToPkcs7"/>

        ///
<c>/p7ce</c> via <see cref="SignToolSettings.SignedContentMethod"/>

        ///
<c>/p7co</c> via <see cref="SignToolSettings.SignedContentIdentifier"/>

        ///
<c>/ph</c> via <see cref="SignToolSettings.PageHashes"/>

        ///
<c>/q</c> via <see cref="SignToolSettings.Quiet"/>

        ///
<c>/r</c> via <see cref="SignToolSettings.RootSubjectName"/>

        ///
<c>/rmc</c> via <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
<c>/s</c> via <see cref="SignToolSettings.Store"/>

        ///
<c>/sa</c> via <see cref="SignToolSettings.AuthenticatedAttributes"/>

        ///
<c>/seal</c> via <see cref="SignToolSettings.SealingSignature"/>

        ///
<c>/sha1</c> via <see cref="SignToolSettings.Sha1Thumbprint"/>

        ///
<c>/sm</c> via <see cref="SignToolSettings.MachineStore"/>

        ///
<c>/t</c> via <see cref="SignToolSettings.TimestampServerUrl"/>

        ///
<c>/td</c> via <see cref="SignToolSettings.TimestampServerDigestAlgorithm"/>

        ///
<c>/tr</c> via <see cref="SignToolSettings.Rfc3161TimestampServerUrl"/>

        ///
<c>/tseal</c> via <see cref="SignToolSettings.Rfc3161TimestampServerUrlSealed"/>

        ///
<c>/u</c> via <see cref="SignToolSettings.EnhancedKeyUsage"/>

        ///
<c>/uw</c> via <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
<c>/v</c> via <see cref="SignToolSettings.Verbose"/>

        ///

        /// </remarks>
        public static IEnumerable<(SignToolSettings Settings, IReadOnlyCollection<Output> Output)> SignTool(CombinatorialConfigure<SignToolSettings> configurator, int degreeOfParallelism = 1, bool completeOnFailure = false)
        {
            return configurator.Invoke(SignTool, SignToolLogger, degreeOfParallelism, completeOnFailure);
        }
    }
    #region SignToolSettings
    ///
    ///   Used within <see cref="SignToolTasks"/>.
    ///
    [PublicAPI]
    [ExcludeFromCodeCoverage]
    [Serializable]
    public partial class SignToolSettings : ToolSettings
    {
        ///
        ///   Path to the SignTool executable.
        ///
        public override string ProcessToolPath => base.ProcessToolPath ?? SignToolTasks.SignToolPath;
        public override Action<OutputType, string> ProcessCustomLogger => SignToolTasks.SignToolLogger;
        ///
        ///   Select the best signing cert automatically. SignTool will find all valid certs that satisfy all specified conditions and select the one that is valid for the longest. If this option is not present, SignTool will expect to find only one valid signing cert.
        ///
        public virtual bool? AutomaticSelection { get; internal set; }
        ///
        ///   Add an additional certificate to the signature block.
        ///
        public virtual string AdditionalCertificate { get; internal set; }
        ///
        ///   Specify the Certificate Template Name (Microsoft extension) of the signing cert.
        ///
        public virtual string CertificateTemplateName { get; internal set; }
        ///
        ///   Specify the signing cert in a file. If this file is a PFX with a password, the password may be supplied with the <c>/p</c> option. If the file does not contain private keys, use the <c>/csp</c> and <c>/kc</c> options to specify the CSP and container name of the private key.
        ///
        public virtual string File { get; internal set; }
        ///
        ///   Specify the Issuer of the signing cert, or a substring.
        ///
        public virtual string Issuer { get; internal set; }
        ///
        ///   Specify the Subject Name of the signing cert, or a substring.
        ///
        public virtual string SigningSubjectName { get; internal set; }
        ///
        ///   Specify a password to use when opening the PFX file.
        ///
        public virtual string Password { get; internal set; }
        ///
        ///   Specify the Subject Name of a Root cert that the signing cert must chain to.
        ///
        public virtual string RootSubjectName { get; internal set; }
        ///
        ///   Specify the Store to open when searching for the cert. The default is the <c>MY</c> Store.
        ///
        public virtual string Store { get; internal set; }
        ///
        ///   Open a Machine store instead of a User store.
        ///
        public virtual bool? MachineStore { get; internal set; }
        ///
        ///   Specify the SHA1 thumbprint of the signing cert.
        ///
        public virtual string Sha1Thumbprint { get; internal set; }
        ///
        ///   Specifies the file digest algorithm to use for creating file signatures. (Default is <c>SHA1</c>)
        ///
        public virtual SignToolDigestAlgorithm FileDigestAlgorithm { get; internal set; }
        ///
        ///   Specify the Enhanced Key Usage that must be present in the cert.<para/>The parameter may be specified by OID or by string. The default usage is Code Signing (1.3.6.1.5.5.7.3.3).
        ///
        public virtual string EnhancedKeyUsage { get; internal set; }
        ///
        ///   Specify usage of Windows System Component Verification (1.3.6.1.4.1.311.10.3.6).
        ///
        public virtual bool? WindowsSystemComponentVerification { get; internal set; }
        ///
        ///   Specify the CSP containing the Private Key Container.
        ///
        public virtual string Csp { get; internal set; }
        ///
        ///   Specify the Key Container Name of the Private Key.
        ///
        public virtual string KeyContainer { get; internal set; }
        ///
        ///   Append this signature. If no primary signature is present, this signature will be made the primary signature instead.
        ///
        public virtual bool? AppendSignature { get; internal set; }
        ///
        ///   Provide a description of the signed content.
        ///
        public virtual string Description { get; internal set; }
        ///
        ///   Provide a URL with more information about the signed content.
        ///
        public virtual string Url { get; internal set; }
        ///
        ///   Specify the timestamp server's URL. If this option is not present, the signed file will not be timestamped. A warning is generated if timestamping fails.
        ///
        public virtual string TimestampServerUrl { get; internal set; }
        ///
        ///   Specifies the RFC 3161 timestamp server's URL. If this option (or <c>/t</c>) is not specified, the signed file will not be timestamped. A warning is generated if timestamping fails. This switch cannot be used with the <c>/t</c> switch.
        ///
        public virtual string Rfc3161TimestampServerUrl { get; internal set; }
        ///
        ///   Specifies the RFC 3161 timestamp server's URL for timestamping a sealed file.
        ///
        public virtual string Rfc3161TimestampServerUrlSealed { get; internal set; }
        ///
        ///   Used with the <c>/tr</c> or <c>/tseal</c> switch to request a digest algorithm used by the RFC 3161 timestamp server.
        ///
        public virtual SignToolDigestAlgorithm TimestampServerDigestAlgorithm { get; internal set; }
        ///
        ///   Specify an OID and value to be included as an authenticated attribute in the signature. The value will be encoded as an ASN1 UTF8 string. This option may be given multiple times.
        ///
        public virtual IReadOnlyDictionary<string, string> AuthenticatedAttributes => AuthenticatedAttributesInternal.AsReadOnly();
        internal Dictionary<string, string> AuthenticatedAttributesInternal { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
        ///
        ///   Add a sealing signature if the file format supports it.
        ///
        public virtual bool? SealingSignature { get; internal set; }
        ///
        ///   Create a primary signature with the intent-to-seal attribute.
        ///
        public virtual bool? IntentToSealAttribute { get; internal set; }
        ///
        ///   Continue to seal or sign in situations where the existing signature or sealing signature needs to be removed to support sealing.
        ///
        public virtual bool? Force { get; internal set; }
        ///
        ///   Sealing-related warnings do not affect SignTool's return code.
        ///
        public virtual bool? NoSealWarn { get; internal set; }
        ///
        ///   Generates the to be signed digest and the unsigned PKCS7 files. The output digest and PKCS7 files will be: <c><path>\<file>.dig</c> and <c><path>\<file>.p7u</c>. To output an additional XML file, see <c>/dxml</c>.
        ///
        public virtual string SignedDigestAndUnsignedPkcs7Path { get; internal set; }
        ///
        ///   Signs the digest only. The input file should be the digest generated by the <c>/dg</c> option. The output file will be: <c><file>.signed</c>.
        ///
        public virtual bool? SignDigestOnly { get; internal set; }
        ///
        ///   Creates the signature by ingesting the signed digest to the unsigned PKCS7 file. The input signed digest and unsigned PKCS7 files should be: <c><path>\<file>.dig.signed</c> and <c><path>\<file>.p7u</c>.
        ///
        public virtual string GenerateSignature { get; internal set; }
        ///
        ///   When used with the <c>/dg</c> option, produces an XML file. The output file will be: <c><path>\<file>.dig.xml</c>.
        ///
        public virtual bool? XmlFile { get; internal set; }
        ///
        ///   Specifies the DLL implementing the AuthenticodeDigestSign function to sign the digest with. This option is equivalent to using SignTool separately with the <c>/dg</c>, <c>/ds</c>, and <c>/di</c> switches, except this option invokes all three as one atomic operation.
        ///
        public virtual string AuthenticodeDigestSignLibDll { get; internal set; }
        ///
        ///   When used with the <c>/dlib</c> option, passes the file's contents to the AuthenticodeDigestSign function without modification.
        ///
        public virtual string AuthenticodeDigestSignPassUnmodified { get; internal set; }
        ///
        ///   Specifies that for each specified content file a PKCS7 file is produced. The PKCS7 file will be named: <c><path>\<file>.p7</c>
        ///
        public virtual string ContentFileToPkcs7 { get; internal set; }
        ///
        ///   Specifies the <c><OID></c> that identifies the signed content.
        ///
        public virtual string SignedContentIdentifier { get; internal set; }
        ///
        ///   efined values:

Embedded: Embeds the signed content in the PKCS7.

DetachedSignedData: Produces the signed data part of a detached PKCS7.

The default is <c>Embedded</c>.
        ///
        public virtual SignToolContentMethod SignedContentMethod { get; internal set; }
        ///
        ///   Generate page hashes for executable files if supported.
        ///
        public virtual bool? PageHashes { get; internal set; }
        ///
        ///   Suppress page hashes for executable files if supported. The default is determined by the <c>SIGNTOOL_PAGE_HASHES</c> environment variable and by the wintrust.dll version.
        ///
        public virtual bool? SuppressPageHashes { get; internal set; }
        ///
        ///   Specifies signing a PE file with the relaxed marker check semantic. The flag is ignored for non-PE files. During verification, certain authenticated sections of the signature will bypass invalid PE markers check. This option should only be used after careful consideration and reviewing the details of MSRC case MS12-024 to ensure that no vulnerabilities are introduced.
        ///
        public virtual bool? RelaxedMarkerCheck { get; internal set; }
        ///
        ///   No output on success and minimal output on failure.
        ///
        public virtual bool? Quiet { get; internal set; }
        ///
        ///   Print verbose success and status messages. This may also provide slightly more information on error.
        ///
        public virtual bool? Verbose { get; internal set; }
        ///
        ///   Display additional debug information.
        ///
        public virtual bool? Debug { get; internal set; }
        ///
        ///   Files to sign.
        ///
        public virtual IReadOnlyList<string> Files => FilesInternal.AsReadOnly();
        internal List<string> FilesInternal { get; set; } = new List<string>();
        protected override Arguments ConfigureProcessArguments(Arguments arguments)
        {
            arguments
              .Add("sign")
              .Add("/a", AutomaticSelection)
              .Add("/ac {value}", AdditionalCertificate)
              .Add("/c {value}", CertificateTemplateName)
              .Add("/f {value}", File)
              .Add("/i {value}", Issuer)
              .Add("/n {value}", SigningSubjectName)
              .Add("/p {value}", Password, secret: true)
              .Add("/r {value}", RootSubjectName)
              .Add("/s {value}", Store)
              .Add("/sm", MachineStore)
              .Add("/sha1 {value}", Sha1Thumbprint, secret: true)
              .Add("/fd {value}", FileDigestAlgorithm)
              .Add("/u {value}", EnhancedKeyUsage)
              .Add("/uw", WindowsSystemComponentVerification)
              .Add("/csp {value}", Csp)
              .Add("/kc {value}", KeyContainer)
              .Add("/as", AppendSignature)
              .Add("/d {value}", Description)
              .Add("/du {value}", Url)
              .Add("/t {value}", TimestampServerUrl)
              .Add("/tr {value}", Rfc3161TimestampServerUrl)
              .Add("/tseal {value}", Rfc3161TimestampServerUrlSealed)
              .Add("/td {value}", TimestampServerDigestAlgorithm)
              .Add("/sa {value}", AuthenticatedAttributes, "{key} {value}")
              .Add("/seal", SealingSignature)
              .Add("/itos", IntentToSealAttribute)
              .Add("/force", Force)
              .Add("/nosealwarn", NoSealWarn)
              .Add("/dg {value}", SignedDigestAndUnsignedPkcs7Path)
              .Add("/ds", SignDigestOnly)
              .Add("/di {value}", GenerateSignature)
              .Add("/dxml", XmlFile)
              .Add("/dlib {value}", AuthenticodeDigestSignLibDll)
              .Add("/dmdf {value}", AuthenticodeDigestSignPassUnmodified)
              .Add("/p7 {value}", ContentFileToPkcs7)
              .Add("/p7co {value}", SignedContentIdentifier)
              .Add("/p7ce {value}", SignedContentMethod)
              .Add("/ph", PageHashes)
              .Add("/nph", SuppressPageHashes)
              .Add("/rmc", RelaxedMarkerCheck)
              .Add("/q", Quiet)
              .Add("/v", Verbose)
              .Add("/debug", Debug)
              .Add("{value}", Files);
            return base.ConfigureProcessArguments(arguments);
        }
    }
    #endregion
    #region SignToolSettingsExtensions
    ///
    ///   Used within <see cref="SignToolTasks"/>.
    ///
    [PublicAPI]
    [ExcludeFromCodeCoverage]
    public static partial class SignToolSettingsExtensions
    {
        #region AutomaticSelection
        ///
        ///
Sets <see cref="SignToolSettings.AutomaticSelection"/>

        ///
Select the best signing cert automatically. SignTool will find all valid certs that satisfy all specified conditions and select the one that is valid for the longest. If this option is not present, SignTool will expect to find only one valid signing cert.

        ///
        [Pure]
        public static T SetAutomaticSelection<T>(this T toolSettings, bool? automaticSelection) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AutomaticSelection = automaticSelection;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.AutomaticSelection"/>

        ///
Select the best signing cert automatically. SignTool will find all valid certs that satisfy all specified conditions and select the one that is valid for the longest. If this option is not present, SignTool will expect to find only one valid signing cert.

        ///
        [Pure]
        public static T ResetAutomaticSelection<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AutomaticSelection = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.AutomaticSelection"/>

        ///
Select the best signing cert automatically. SignTool will find all valid certs that satisfy all specified conditions and select the one that is valid for the longest. If this option is not present, SignTool will expect to find only one valid signing cert.

        ///
        [Pure]
        public static T EnableAutomaticSelection<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AutomaticSelection = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.AutomaticSelection"/>

        ///
Select the best signing cert automatically. SignTool will find all valid certs that satisfy all specified conditions and select the one that is valid for the longest. If this option is not present, SignTool will expect to find only one valid signing cert.

        ///
        [Pure]
        public static T DisableAutomaticSelection<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AutomaticSelection = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.AutomaticSelection"/>

        ///
Select the best signing cert automatically. SignTool will find all valid certs that satisfy all specified conditions and select the one that is valid for the longest. If this option is not present, SignTool will expect to find only one valid signing cert.

        ///
        [Pure]
        public static T ToggleAutomaticSelection<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AutomaticSelection = !toolSettings.AutomaticSelection;
            return toolSettings;
        }
        #endregion
        #region AdditionalCertificate
        ///
        ///
Sets <see cref="SignToolSettings.AdditionalCertificate"/>

        ///
Add an additional certificate to the signature block.

        ///
        [Pure]
        public static T SetAdditionalCertificate<T>(this T toolSettings, string additionalCertificate) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AdditionalCertificate = additionalCertificate;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.AdditionalCertificate"/>

        ///
Add an additional certificate to the signature block.

        ///
        [Pure]
        public static T ResetAdditionalCertificate<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AdditionalCertificate = null;
            return toolSettings;
        }
        #endregion
        #region CertificateTemplateName
        ///
        ///
Sets <see cref="SignToolSettings.CertificateTemplateName"/>

        ///
Specify the Certificate Template Name (Microsoft extension) of the signing cert.

        ///
        [Pure]
        public static T SetCertificateTemplateName<T>(this T toolSettings, string certificateTemplateName) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.CertificateTemplateName = certificateTemplateName;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.CertificateTemplateName"/>

        ///
Specify the Certificate Template Name (Microsoft extension) of the signing cert.

        ///
        [Pure]
        public static T ResetCertificateTemplateName<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.CertificateTemplateName = null;
            return toolSettings;
        }
        #endregion
        #region File
        ///
        ///
Sets <see cref="SignToolSettings.File"/>

        ///
Specify the signing cert in a file. If this file is a PFX with a password, the password may be supplied with the <c>/p</c> option. If the file does not contain private keys, use the <c>/csp</c> and <c>/kc</c> options to specify the CSP and container name of the private key.

        ///
        [Pure]
        public static T SetFile<T>(this T toolSettings, string file) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.File = file;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.File"/>

        ///
Specify the signing cert in a file. If this file is a PFX with a password, the password may be supplied with the <c>/p</c> option. If the file does not contain private keys, use the <c>/csp</c> and <c>/kc</c> options to specify the CSP and container name of the private key.

        ///
        [Pure]
        public static T ResetFile<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.File = null;
            return toolSettings;
        }
        #endregion
        #region Issuer
        ///
        ///
Sets <see cref="SignToolSettings.Issuer"/>

        ///
Specify the Issuer of the signing cert, or a substring.

        ///
        [Pure]
        public static T SetIssuer<T>(this T toolSettings, string issuer) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Issuer = issuer;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Issuer"/>

        ///
Specify the Issuer of the signing cert, or a substring.

        ///
        [Pure]
        public static T ResetIssuer<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Issuer = null;
            return toolSettings;
        }
        #endregion
        #region SigningSubjectName
        ///
        ///
Sets <see cref="SignToolSettings.SigningSubjectName"/>

        ///
Specify the Subject Name of the signing cert, or a substring.

        ///
        [Pure]
        public static T SetSigningSubjectName<T>(this T toolSettings, string signingSubjectName) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SigningSubjectName = signingSubjectName;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.SigningSubjectName"/>

        ///
Specify the Subject Name of the signing cert, or a substring.

        ///
        [Pure]
        public static T ResetSigningSubjectName<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SigningSubjectName = null;
            return toolSettings;
        }
        #endregion
        #region Password
        ///
        ///
Sets <see cref="SignToolSettings.Password"/>

        ///
Specify a password to use when opening the PFX file.

        ///
        [Pure]
        public static T SetPassword<T>(this T toolSettings, [Secret] string password) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Password = password;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Password"/>

        ///
Specify a password to use when opening the PFX file.

        ///
        [Pure]
        public static T ResetPassword<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Password = null;
            return toolSettings;
        }
        #endregion
        #region RootSubjectName
        ///
        ///
Sets <see cref="SignToolSettings.RootSubjectName"/>

        ///
Specify the Subject Name of a Root cert that the signing cert must chain to.

        ///
        [Pure]
        public static T SetRootSubjectName<T>(this T toolSettings, string rootSubjectName) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.RootSubjectName = rootSubjectName;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.RootSubjectName"/>

        ///
Specify the Subject Name of a Root cert that the signing cert must chain to.

        ///
        [Pure]
        public static T ResetRootSubjectName<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.RootSubjectName = null;
            return toolSettings;
        }
        #endregion
        #region Store
        ///
        ///
Sets <see cref="SignToolSettings.Store"/>

        ///
Specify the Store to open when searching for the cert. The default is the <c>MY</c> Store.

        ///
        [Pure]
        public static T SetStore<T>(this T toolSettings, string store) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Store = store;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Store"/>

        ///
Specify the Store to open when searching for the cert. The default is the <c>MY</c> Store.

        ///
        [Pure]
        public static T ResetStore<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Store = null;
            return toolSettings;
        }
        #endregion
        #region MachineStore
        ///
        ///
Sets <see cref="SignToolSettings.MachineStore"/>

        ///
Open a Machine store instead of a User store.

        ///
        [Pure]
        public static T SetMachineStore<T>(this T toolSettings, bool? machineStore) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.MachineStore = machineStore;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.MachineStore"/>

        ///
Open a Machine store instead of a User store.

        ///
        [Pure]
        public static T ResetMachineStore<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.MachineStore = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.MachineStore"/>

        ///
Open a Machine store instead of a User store.

        ///
        [Pure]
        public static T EnableMachineStore<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.MachineStore = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.MachineStore"/>

        ///
Open a Machine store instead of a User store.

        ///
        [Pure]
        public static T DisableMachineStore<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.MachineStore = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.MachineStore"/>

        ///
Open a Machine store instead of a User store.

        ///
        [Pure]
        public static T ToggleMachineStore<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.MachineStore = !toolSettings.MachineStore;
            return toolSettings;
        }
        #endregion
        #region Sha1Thumbprint
        ///
        ///
Sets <see cref="SignToolSettings.Sha1Thumbprint"/>

        ///
Specify the SHA1 thumbprint of the signing cert.

        ///
        [Pure]
        public static T SetSha1Thumbprint<T>(this T toolSettings, [Secret] string sha1Thumbprint) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Sha1Thumbprint = sha1Thumbprint;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Sha1Thumbprint"/>

        ///
Specify the SHA1 thumbprint of the signing cert.

        ///
        [Pure]
        public static T ResetSha1Thumbprint<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Sha1Thumbprint = null;
            return toolSettings;
        }
        #endregion
        #region FileDigestAlgorithm
        ///
        ///
Sets <see cref="SignToolSettings.FileDigestAlgorithm"/>

        ///
Specifies the file digest algorithm to use for creating file signatures. (Default is <c>SHA1</c>)

        ///
        [Pure]
        public static T SetFileDigestAlgorithm<T>(this T toolSettings, SignToolDigestAlgorithm fileDigestAlgorithm) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.FileDigestAlgorithm = fileDigestAlgorithm;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.FileDigestAlgorithm"/>

        ///
Specifies the file digest algorithm to use for creating file signatures. (Default is <c>SHA1</c>)

        ///
        [Pure]
        public static T ResetFileDigestAlgorithm<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.FileDigestAlgorithm = null;
            return toolSettings;
        }
        #endregion
        #region EnhancedKeyUsage
        ///
        ///
Sets <see cref="SignToolSettings.EnhancedKeyUsage"/>

        ///
Specify the Enhanced Key Usage that must be present in the cert.<para/>The parameter may be specified by OID or by string. The default usage is Code Signing (1.3.6.1.5.5.7.3.3).

        ///
        [Pure]
        public static T SetEnhancedKeyUsage<T>(this T toolSettings, string enhancedKeyUsage) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.EnhancedKeyUsage = enhancedKeyUsage;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.EnhancedKeyUsage"/>

        ///
Specify the Enhanced Key Usage that must be present in the cert.<para/>The parameter may be specified by OID or by string. The default usage is Code Signing (1.3.6.1.5.5.7.3.3).

        ///
        [Pure]
        public static T ResetEnhancedKeyUsage<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.EnhancedKeyUsage = null;
            return toolSettings;
        }
        #endregion
        #region WindowsSystemComponentVerification
        ///
        ///
Sets <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
Specify usage of Windows System Component Verification (1.3.6.1.4.1.311.10.3.6).

        ///
        [Pure]
        public static T SetWindowsSystemComponentVerification<T>(this T toolSettings, bool? windowsSystemComponentVerification) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.WindowsSystemComponentVerification = windowsSystemComponentVerification;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
Specify usage of Windows System Component Verification (1.3.6.1.4.1.311.10.3.6).

        ///
        [Pure]
        public static T ResetWindowsSystemComponentVerification<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.WindowsSystemComponentVerification = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
Specify usage of Windows System Component Verification (1.3.6.1.4.1.311.10.3.6).

        ///
        [Pure]
        public static T EnableWindowsSystemComponentVerification<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.WindowsSystemComponentVerification = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
Specify usage of Windows System Component Verification (1.3.6.1.4.1.311.10.3.6).

        ///
        [Pure]
        public static T DisableWindowsSystemComponentVerification<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.WindowsSystemComponentVerification = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.WindowsSystemComponentVerification"/>

        ///
Specify usage of Windows System Component Verification (1.3.6.1.4.1.311.10.3.6).

        ///
        [Pure]
        public static T ToggleWindowsSystemComponentVerification<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.WindowsSystemComponentVerification = !toolSettings.WindowsSystemComponentVerification;
            return toolSettings;
        }
        #endregion
        #region Csp
        ///
        ///
Sets <see cref="SignToolSettings.Csp"/>

        ///
Specify the CSP containing the Private Key Container.

        ///
        [Pure]
        public static T SetCsp<T>(this T toolSettings, string csp) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Csp = csp;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Csp"/>

        ///
Specify the CSP containing the Private Key Container.

        ///
        [Pure]
        public static T ResetCsp<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Csp = null;
            return toolSettings;
        }
        #endregion
        #region KeyContainer
        ///
        ///
Sets <see cref="SignToolSettings.KeyContainer"/>

        ///
Specify the Key Container Name of the Private Key.

        ///
        [Pure]
        public static T SetKeyContainer<T>(this T toolSettings, string keyContainer) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.KeyContainer = keyContainer;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.KeyContainer"/>

        ///
Specify the Key Container Name of the Private Key.

        ///
        [Pure]
        public static T ResetKeyContainer<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.KeyContainer = null;
            return toolSettings;
        }
        #endregion
        #region AppendSignature
        ///
        ///
Sets <see cref="SignToolSettings.AppendSignature"/>

        ///
Append this signature. If no primary signature is present, this signature will be made the primary signature instead.

        ///
        [Pure]
        public static T SetAppendSignature<T>(this T toolSettings, bool? appendSignature) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AppendSignature = appendSignature;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.AppendSignature"/>

        ///
Append this signature. If no primary signature is present, this signature will be made the primary signature instead.

        ///
        [Pure]
        public static T ResetAppendSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AppendSignature = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.AppendSignature"/>

        ///
Append this signature. If no primary signature is present, this signature will be made the primary signature instead.

        ///
        [Pure]
        public static T EnableAppendSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AppendSignature = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.AppendSignature"/>

        ///
Append this signature. If no primary signature is present, this signature will be made the primary signature instead.

        ///
        [Pure]
        public static T DisableAppendSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AppendSignature = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.AppendSignature"/>

        ///
Append this signature. If no primary signature is present, this signature will be made the primary signature instead.

        ///
        [Pure]
        public static T ToggleAppendSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AppendSignature = !toolSettings.AppendSignature;
            return toolSettings;
        }
        #endregion
        #region Description
        ///
        ///
Sets <see cref="SignToolSettings.Description"/>

        ///
Provide a description of the signed content.

        ///
        [Pure]
        public static T SetDescription<T>(this T toolSettings, string description) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Description = description;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Description"/>

        ///
Provide a description of the signed content.

        ///
        [Pure]
        public static T ResetDescription<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Description = null;
            return toolSettings;
        }
        #endregion
        #region Url
        ///
        ///
Sets <see cref="SignToolSettings.Url"/>

        ///
Provide a URL with more information about the signed content.

        ///
        [Pure]
        public static T SetUrl<T>(this T toolSettings, string url) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Url = url;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Url"/>

        ///
Provide a URL with more information about the signed content.

        ///
        [Pure]
        public static T ResetUrl<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Url = null;
            return toolSettings;
        }
        #endregion
        #region TimestampServerUrl
        ///
        ///
Sets <see cref="SignToolSettings.TimestampServerUrl"/>

        ///
Specify the timestamp server's URL. If this option is not present, the signed file will not be timestamped. A warning is generated if timestamping fails.

        ///
        [Pure]
        public static T SetTimestampServerUrl<T>(this T toolSettings, string timestampServerUrl) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.TimestampServerUrl = timestampServerUrl;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.TimestampServerUrl"/>

        ///
Specify the timestamp server's URL. If this option is not present, the signed file will not be timestamped. A warning is generated if timestamping fails.

        ///
        [Pure]
        public static T ResetTimestampServerUrl<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.TimestampServerUrl = null;
            return toolSettings;
        }
        #endregion
        #region Rfc3161TimestampServerUrl
        ///
        ///
Sets <see cref="SignToolSettings.Rfc3161TimestampServerUrl"/>

        ///
Specifies the RFC 3161 timestamp server's URL. If this option (or <c>/t</c>) is not specified, the signed file will not be timestamped. A warning is generated if timestamping fails. This switch cannot be used with the <c>/t</c> switch.

        ///
        [Pure]
        public static T SetRfc3161TimestampServerUrl<T>(this T toolSettings, string rfc3161TimestampServerUrl) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Rfc3161TimestampServerUrl = rfc3161TimestampServerUrl;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Rfc3161TimestampServerUrl"/>

        ///
Specifies the RFC 3161 timestamp server's URL. If this option (or <c>/t</c>) is not specified, the signed file will not be timestamped. A warning is generated if timestamping fails. This switch cannot be used with the <c>/t</c> switch.

        ///
        [Pure]
        public static T ResetRfc3161TimestampServerUrl<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Rfc3161TimestampServerUrl = null;
            return toolSettings;
        }
        #endregion
        #region Rfc3161TimestampServerUrlSealed
        ///
        ///
Sets <see cref="SignToolSettings.Rfc3161TimestampServerUrlSealed"/>

        ///
Specifies the RFC 3161 timestamp server's URL for timestamping a sealed file.

        ///
        [Pure]
        public static T SetRfc3161TimestampServerUrlSealed<T>(this T toolSettings, string rfc3161TimestampServerUrlSealed) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Rfc3161TimestampServerUrlSealed = rfc3161TimestampServerUrlSealed;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Rfc3161TimestampServerUrlSealed"/>

        ///
Specifies the RFC 3161 timestamp server's URL for timestamping a sealed file.

        ///
        [Pure]
        public static T ResetRfc3161TimestampServerUrlSealed<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Rfc3161TimestampServerUrlSealed = null;
            return toolSettings;
        }
        #endregion
        #region TimestampServerDigestAlgorithm
        ///
        ///
Sets <see cref="SignToolSettings.TimestampServerDigestAlgorithm"/>

        ///
Used with the <c>/tr</c> or <c>/tseal</c> switch to request a digest algorithm used by the RFC 3161 timestamp server.

        ///
        [Pure]
        public static T SetTimestampServerDigestAlgorithm<T>(this T toolSettings, SignToolDigestAlgorithm timestampServerDigestAlgorithm) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.TimestampServerDigestAlgorithm = timestampServerDigestAlgorithm;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.TimestampServerDigestAlgorithm"/>

        ///
Used with the <c>/tr</c> or <c>/tseal</c> switch to request a digest algorithm used by the RFC 3161 timestamp server.

        ///
        [Pure]
        public static T ResetTimestampServerDigestAlgorithm<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.TimestampServerDigestAlgorithm = null;
            return toolSettings;
        }
        #endregion
        #region AuthenticatedAttributes
        ///
        ///
Sets <see cref="SignToolSettings.AuthenticatedAttributes"/> to a new dictionary

        ///
Specify an OID and value to be included as an authenticated attribute in the signature. The value will be encoded as an ASN1 UTF8 string. This option may be given multiple times.

        ///
        [Pure]
        public static T SetAuthenticatedAttributes<T>(this T toolSettings, IDictionary<string, string> authenticatedAttributes) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticatedAttributesInternal = authenticatedAttributes.ToDictionary(x => x.Key, x => x.Value, StringComparer.OrdinalIgnoreCase);
            return toolSettings;
        }
        ///
        ///
Clears <see cref="SignToolSettings.AuthenticatedAttributes"/>

        ///
Specify an OID and value to be included as an authenticated attribute in the signature. The value will be encoded as an ASN1 UTF8 string. This option may be given multiple times.

        ///
        [Pure]
        public static T ClearAuthenticatedAttributes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticatedAttributesInternal.Clear();
            return toolSettings;
        }
        ///
        ///
Adds a new key-value-pair <see cref="SignToolSettings.AuthenticatedAttributes"/>

        ///
Specify an OID and value to be included as an authenticated attribute in the signature. The value will be encoded as an ASN1 UTF8 string. This option may be given multiple times.

        ///
        [Pure]
        public static T AddAuthenticatedAttribute<T>(this T toolSettings, string authenticatedAttributeKey, string authenticatedAttributeValue) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticatedAttributesInternal.Add(authenticatedAttributeKey, authenticatedAttributeValue);
            return toolSettings;
        }
        ///
        ///
Removes a key-value-pair from <see cref="SignToolSettings.AuthenticatedAttributes"/>

        ///
Specify an OID and value to be included as an authenticated attribute in the signature. The value will be encoded as an ASN1 UTF8 string. This option may be given multiple times.

        ///
        [Pure]
        public static T RemoveAuthenticatedAttribute<T>(this T toolSettings, string authenticatedAttributeKey) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticatedAttributesInternal.Remove(authenticatedAttributeKey);
            return toolSettings;
        }
        ///
        ///
Sets a key-value-pair in <see cref="SignToolSettings.AuthenticatedAttributes"/>

        ///
Specify an OID and value to be included as an authenticated attribute in the signature. The value will be encoded as an ASN1 UTF8 string. This option may be given multiple times.

        ///
        [Pure]
        public static T SetAuthenticatedAttribute<T>(this T toolSettings, string authenticatedAttributeKey, string authenticatedAttributeValue) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticatedAttributesInternal[authenticatedAttributeKey] = authenticatedAttributeValue;
            return toolSettings;
        }
        #endregion
        #region SealingSignature
        ///
        ///
Sets <see cref="SignToolSettings.SealingSignature"/>

        ///
Add a sealing signature if the file format supports it.

        ///
        [Pure]
        public static T SetSealingSignature<T>(this T toolSettings, bool? sealingSignature) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SealingSignature = sealingSignature;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.SealingSignature"/>

        ///
Add a sealing signature if the file format supports it.

        ///
        [Pure]
        public static T ResetSealingSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SealingSignature = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.SealingSignature"/>

        ///
Add a sealing signature if the file format supports it.

        ///
        [Pure]
        public static T EnableSealingSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SealingSignature = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.SealingSignature"/>

        ///
Add a sealing signature if the file format supports it.

        ///
        [Pure]
        public static T DisableSealingSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SealingSignature = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.SealingSignature"/>

        ///
Add a sealing signature if the file format supports it.

        ///
        [Pure]
        public static T ToggleSealingSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SealingSignature = !toolSettings.SealingSignature;
            return toolSettings;
        }
        #endregion
        #region IntentToSealAttribute
        ///
        ///
Sets <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
Create a primary signature with the intent-to-seal attribute.

        ///
        [Pure]
        public static T SetIntentToSealAttribute<T>(this T toolSettings, bool? intentToSealAttribute) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.IntentToSealAttribute = intentToSealAttribute;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
Create a primary signature with the intent-to-seal attribute.

        ///
        [Pure]
        public static T ResetIntentToSealAttribute<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.IntentToSealAttribute = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
Create a primary signature with the intent-to-seal attribute.

        ///
        [Pure]
        public static T EnableIntentToSealAttribute<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.IntentToSealAttribute = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
Create a primary signature with the intent-to-seal attribute.

        ///
        [Pure]
        public static T DisableIntentToSealAttribute<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.IntentToSealAttribute = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.IntentToSealAttribute"/>

        ///
Create a primary signature with the intent-to-seal attribute.

        ///
        [Pure]
        public static T ToggleIntentToSealAttribute<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.IntentToSealAttribute = !toolSettings.IntentToSealAttribute;
            return toolSettings;
        }
        #endregion
        #region Force
        ///
        ///
Sets <see cref="SignToolSettings.Force"/>

        ///
Continue to seal or sign in situations where the existing signature or sealing signature needs to be removed to support sealing.

        ///
        [Pure]
        public static T SetForce<T>(this T toolSettings, bool? force) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Force = force;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Force"/>

        ///
Continue to seal or sign in situations where the existing signature or sealing signature needs to be removed to support sealing.

        ///
        [Pure]
        public static T ResetForce<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Force = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.Force"/>

        ///
Continue to seal or sign in situations where the existing signature or sealing signature needs to be removed to support sealing.

        ///
        [Pure]
        public static T EnableForce<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Force = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.Force"/>

        ///
Continue to seal or sign in situations where the existing signature or sealing signature needs to be removed to support sealing.

        ///
        [Pure]
        public static T DisableForce<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Force = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.Force"/>

        ///
Continue to seal or sign in situations where the existing signature or sealing signature needs to be removed to support sealing.

        ///
        [Pure]
        public static T ToggleForce<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Force = !toolSettings.Force;
            return toolSettings;
        }
        #endregion
        #region NoSealWarn
        ///
        ///
Sets <see cref="SignToolSettings.NoSealWarn"/>

        ///
Sealing-related warnings do not affect SignTool's return code.

        ///
        [Pure]
        public static T SetNoSealWarn<T>(this T toolSettings, bool? noSealWarn) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.NoSealWarn = noSealWarn;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.NoSealWarn"/>

        ///
Sealing-related warnings do not affect SignTool's return code.

        ///
        [Pure]
        public static T ResetNoSealWarn<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.NoSealWarn = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.NoSealWarn"/>

        ///
Sealing-related warnings do not affect SignTool's return code.

        ///
        [Pure]
        public static T EnableNoSealWarn<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.NoSealWarn = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.NoSealWarn"/>

        ///
Sealing-related warnings do not affect SignTool's return code.

        ///
        [Pure]
        public static T DisableNoSealWarn<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.NoSealWarn = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.NoSealWarn"/>

        ///
Sealing-related warnings do not affect SignTool's return code.

        ///
        [Pure]
        public static T ToggleNoSealWarn<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.NoSealWarn = !toolSettings.NoSealWarn;
            return toolSettings;
        }
        #endregion
        #region SignedDigestAndUnsignedPkcs7Path
        ///
        ///
Sets <see cref="SignToolSettings.SignedDigestAndUnsignedPkcs7Path"/>

        ///
Generates the to be signed digest and the unsigned PKCS7 files. The output digest and PKCS7 files will be: <c><path>\<file>.dig</c> and <c><path>\<file>.p7u</c>. To output an additional XML file, see <c>/dxml</c>.

        ///
        [Pure]
        public static T SetSignedDigestAndUnsignedPkcs7Path<T>(this T toolSettings, string signedDigestAndUnsignedPkcs7Path) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignedDigestAndUnsignedPkcs7Path = signedDigestAndUnsignedPkcs7Path;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.SignedDigestAndUnsignedPkcs7Path"/>

        ///
Generates the to be signed digest and the unsigned PKCS7 files. The output digest and PKCS7 files will be: <c><path>\<file>.dig</c> and <c><path>\<file>.p7u</c>. To output an additional XML file, see <c>/dxml</c>.

        ///
        [Pure]
        public static T ResetSignedDigestAndUnsignedPkcs7Path<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignedDigestAndUnsignedPkcs7Path = null;
            return toolSettings;
        }
        #endregion
        #region SignDigestOnly
        ///
        ///
Sets <see cref="SignToolSettings.SignDigestOnly"/>

        ///
Signs the digest only. The input file should be the digest generated by the <c>/dg</c> option. The output file will be: <c><file>.signed</c>.

        ///
        [Pure]
        public static T SetSignDigestOnly<T>(this T toolSettings, bool? signDigestOnly) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignDigestOnly = signDigestOnly;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.SignDigestOnly"/>

        ///
Signs the digest only. The input file should be the digest generated by the <c>/dg</c> option. The output file will be: <c><file>.signed</c>.

        ///
        [Pure]
        public static T ResetSignDigestOnly<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignDigestOnly = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.SignDigestOnly"/>

        ///
Signs the digest only. The input file should be the digest generated by the <c>/dg</c> option. The output file will be: <c><file>.signed</c>.

        ///
        [Pure]
        public static T EnableSignDigestOnly<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignDigestOnly = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.SignDigestOnly"/>

        ///
Signs the digest only. The input file should be the digest generated by the <c>/dg</c> option. The output file will be: <c><file>.signed</c>.

        ///
        [Pure]
        public static T DisableSignDigestOnly<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignDigestOnly = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.SignDigestOnly"/>

        ///
Signs the digest only. The input file should be the digest generated by the <c>/dg</c> option. The output file will be: <c><file>.signed</c>.

        ///
        [Pure]
        public static T ToggleSignDigestOnly<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignDigestOnly = !toolSettings.SignDigestOnly;
            return toolSettings;
        }
        #endregion
        #region GenerateSignature
        ///
        ///
Sets <see cref="SignToolSettings.GenerateSignature"/>

        ///
Creates the signature by ingesting the signed digest to the unsigned PKCS7 file. The input signed digest and unsigned PKCS7 files should be: <c><path>\<file>.dig.signed</c> and <c><path>\<file>.p7u</c>.

        ///
        [Pure]
        public static T SetGenerateSignature<T>(this T toolSettings, string generateSignature) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.GenerateSignature = generateSignature;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.GenerateSignature"/>

        ///
Creates the signature by ingesting the signed digest to the unsigned PKCS7 file. The input signed digest and unsigned PKCS7 files should be: <c><path>\<file>.dig.signed</c> and <c><path>\<file>.p7u</c>.

        ///
        [Pure]
        public static T ResetGenerateSignature<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.GenerateSignature = null;
            return toolSettings;
        }
        #endregion
        #region XmlFile
        ///
        ///
Sets <see cref="SignToolSettings.XmlFile"/>

        ///
When used with the <c>/dg</c> option, produces an XML file. The output file will be: <c><path>\<file>.dig.xml</c>.

        ///
        [Pure]
        public static T SetXmlFile<T>(this T toolSettings, bool? xmlFile) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.XmlFile = xmlFile;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.XmlFile"/>

        ///
When used with the <c>/dg</c> option, produces an XML file. The output file will be: <c><path>\<file>.dig.xml</c>.

        ///
        [Pure]
        public static T ResetXmlFile<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.XmlFile = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.XmlFile"/>

        ///
When used with the <c>/dg</c> option, produces an XML file. The output file will be: <c><path>\<file>.dig.xml</c>.

        ///
        [Pure]
        public static T EnableXmlFile<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.XmlFile = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.XmlFile"/>

        ///
When used with the <c>/dg</c> option, produces an XML file. The output file will be: <c><path>\<file>.dig.xml</c>.

        ///
        [Pure]
        public static T DisableXmlFile<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.XmlFile = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.XmlFile"/>

        ///
When used with the <c>/dg</c> option, produces an XML file. The output file will be: <c><path>\<file>.dig.xml</c>.

        ///
        [Pure]
        public static T ToggleXmlFile<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.XmlFile = !toolSettings.XmlFile;
            return toolSettings;
        }
        #endregion
        #region AuthenticodeDigestSignLibDll
        ///
        ///
Sets <see cref="SignToolSettings.AuthenticodeDigestSignLibDll"/>

        ///
Specifies the DLL implementing the AuthenticodeDigestSign function to sign the digest with. This option is equivalent to using SignTool separately with the <c>/dg</c>, <c>/ds</c>, and <c>/di</c> switches, except this option invokes all three as one atomic operation.

        ///
        [Pure]
        public static T SetAuthenticodeDigestSignLibDll<T>(this T toolSettings, string authenticodeDigestSignLibDll) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticodeDigestSignLibDll = authenticodeDigestSignLibDll;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.AuthenticodeDigestSignLibDll"/>

        ///
Specifies the DLL implementing the AuthenticodeDigestSign function to sign the digest with. This option is equivalent to using SignTool separately with the <c>/dg</c>, <c>/ds</c>, and <c>/di</c> switches, except this option invokes all three as one atomic operation.

        ///
        [Pure]
        public static T ResetAuthenticodeDigestSignLibDll<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticodeDigestSignLibDll = null;
            return toolSettings;
        }
        #endregion
        #region AuthenticodeDigestSignPassUnmodified
        ///
        ///
Sets <see cref="SignToolSettings.AuthenticodeDigestSignPassUnmodified"/>

        ///
When used with the <c>/dlib</c> option, passes the file's contents to the AuthenticodeDigestSign function without modification.

        ///
        [Pure]
        public static T SetAuthenticodeDigestSignPassUnmodified<T>(this T toolSettings, string authenticodeDigestSignPassUnmodified) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticodeDigestSignPassUnmodified = authenticodeDigestSignPassUnmodified;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.AuthenticodeDigestSignPassUnmodified"/>

        ///
When used with the <c>/dlib</c> option, passes the file's contents to the AuthenticodeDigestSign function without modification.

        ///
        [Pure]
        public static T ResetAuthenticodeDigestSignPassUnmodified<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.AuthenticodeDigestSignPassUnmodified = null;
            return toolSettings;
        }
        #endregion
        #region ContentFileToPkcs7
        ///
        ///
Sets <see cref="SignToolSettings.ContentFileToPkcs7"/>

        ///
Specifies that for each specified content file a PKCS7 file is produced. The PKCS7 file will be named: <c><path>\<file>.p7</c>

        ///
        [Pure]
        public static T SetContentFileToPkcs7<T>(this T toolSettings, string contentFileToPkcs7) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.ContentFileToPkcs7 = contentFileToPkcs7;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.ContentFileToPkcs7"/>

        ///
Specifies that for each specified content file a PKCS7 file is produced. The PKCS7 file will be named: <c><path>\<file>.p7</c>

        ///
        [Pure]
        public static T ResetContentFileToPkcs7<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.ContentFileToPkcs7 = null;
            return toolSettings;
        }
        #endregion
        #region SignedContentIdentifier
        ///
        ///
Sets <see cref="SignToolSettings.SignedContentIdentifier"/>

        ///
Specifies the <c><OID></c> that identifies the signed content.

        ///
        [Pure]
        public static T SetSignedContentIdentifier<T>(this T toolSettings, string signedContentIdentifier) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignedContentIdentifier = signedContentIdentifier;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.SignedContentIdentifier"/>

        ///
Specifies the <c><OID></c> that identifies the signed content.

        ///
        [Pure]
        public static T ResetSignedContentIdentifier<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignedContentIdentifier = null;
            return toolSettings;
        }
        #endregion
        #region SignedContentMethod
        ///
        ///
Sets <see cref="SignToolSettings.SignedContentMethod"/>

        ///
efined values:

Embedded: Embeds the signed content in the PKCS7.

DetachedSignedData: Produces the signed data part of a detached PKCS7.

The default is <c>Embedded</c>.

        ///
        [Pure]
        public static T SetSignedContentMethod<T>(this T toolSettings, SignToolContentMethod signedContentMethod) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignedContentMethod = signedContentMethod;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.SignedContentMethod"/>

        ///
efined values:

Embedded: Embeds the signed content in the PKCS7.

DetachedSignedData: Produces the signed data part of a detached PKCS7.

The default is <c>Embedded</c>.

        ///
        [Pure]
        public static T ResetSignedContentMethod<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SignedContentMethod = null;
            return toolSettings;
        }
        #endregion
        #region PageHashes
        ///
        ///
Sets <see cref="SignToolSettings.PageHashes"/>

        ///
Generate page hashes for executable files if supported.

        ///
        [Pure]
        public static T SetPageHashes<T>(this T toolSettings, bool? pageHashes) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.PageHashes = pageHashes;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.PageHashes"/>

        ///
Generate page hashes for executable files if supported.

        ///
        [Pure]
        public static T ResetPageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.PageHashes = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.PageHashes"/>

        ///
Generate page hashes for executable files if supported.

        ///
        [Pure]
        public static T EnablePageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.PageHashes = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.PageHashes"/>

        ///
Generate page hashes for executable files if supported.

        ///
        [Pure]
        public static T DisablePageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.PageHashes = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.PageHashes"/>

        ///
Generate page hashes for executable files if supported.

        ///
        [Pure]
        public static T TogglePageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.PageHashes = !toolSettings.PageHashes;
            return toolSettings;
        }
        #endregion
        #region SuppressPageHashes
        ///
        ///
Sets <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
Suppress page hashes for executable files if supported. The default is determined by the <c>SIGNTOOL_PAGE_HASHES</c> environment variable and by the wintrust.dll version.

        ///
        [Pure]
        public static T SetSuppressPageHashes<T>(this T toolSettings, bool? suppressPageHashes) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SuppressPageHashes = suppressPageHashes;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
Suppress page hashes for executable files if supported. The default is determined by the <c>SIGNTOOL_PAGE_HASHES</c> environment variable and by the wintrust.dll version.

        ///
        [Pure]
        public static T ResetSuppressPageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SuppressPageHashes = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
Suppress page hashes for executable files if supported. The default is determined by the <c>SIGNTOOL_PAGE_HASHES</c> environment variable and by the wintrust.dll version.

        ///
        [Pure]
        public static T EnableSuppressPageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SuppressPageHashes = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
Suppress page hashes for executable files if supported. The default is determined by the <c>SIGNTOOL_PAGE_HASHES</c> environment variable and by the wintrust.dll version.

        ///
        [Pure]
        public static T DisableSuppressPageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SuppressPageHashes = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.SuppressPageHashes"/>

        ///
Suppress page hashes for executable files if supported. The default is determined by the <c>SIGNTOOL_PAGE_HASHES</c> environment variable and by the wintrust.dll version.

        ///
        [Pure]
        public static T ToggleSuppressPageHashes<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.SuppressPageHashes = !toolSettings.SuppressPageHashes;
            return toolSettings;
        }
        #endregion
        #region RelaxedMarkerCheck
        ///
        ///
Sets <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
Specifies signing a PE file with the relaxed marker check semantic. The flag is ignored for non-PE files. During verification, certain authenticated sections of the signature will bypass invalid PE markers check. This option should only be used after careful consideration and reviewing the details of MSRC case MS12-024 to ensure that no vulnerabilities are introduced.

        ///
        [Pure]
        public static T SetRelaxedMarkerCheck<T>(this T toolSettings, bool? relaxedMarkerCheck) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.RelaxedMarkerCheck = relaxedMarkerCheck;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
Specifies signing a PE file with the relaxed marker check semantic. The flag is ignored for non-PE files. During verification, certain authenticated sections of the signature will bypass invalid PE markers check. This option should only be used after careful consideration and reviewing the details of MSRC case MS12-024 to ensure that no vulnerabilities are introduced.

        ///
        [Pure]
        public static T ResetRelaxedMarkerCheck<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.RelaxedMarkerCheck = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
Specifies signing a PE file with the relaxed marker check semantic. The flag is ignored for non-PE files. During verification, certain authenticated sections of the signature will bypass invalid PE markers check. This option should only be used after careful consideration and reviewing the details of MSRC case MS12-024 to ensure that no vulnerabilities are introduced.

        ///
        [Pure]
        public static T EnableRelaxedMarkerCheck<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.RelaxedMarkerCheck = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
Specifies signing a PE file with the relaxed marker check semantic. The flag is ignored for non-PE files. During verification, certain authenticated sections of the signature will bypass invalid PE markers check. This option should only be used after careful consideration and reviewing the details of MSRC case MS12-024 to ensure that no vulnerabilities are introduced.

        ///
        [Pure]
        public static T DisableRelaxedMarkerCheck<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.RelaxedMarkerCheck = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.RelaxedMarkerCheck"/>

        ///
Specifies signing a PE file with the relaxed marker check semantic. The flag is ignored for non-PE files. During verification, certain authenticated sections of the signature will bypass invalid PE markers check. This option should only be used after careful consideration and reviewing the details of MSRC case MS12-024 to ensure that no vulnerabilities are introduced.

        ///
        [Pure]
        public static T ToggleRelaxedMarkerCheck<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.RelaxedMarkerCheck = !toolSettings.RelaxedMarkerCheck;
            return toolSettings;
        }
        #endregion
        #region Quiet
        ///
        ///
Sets <see cref="SignToolSettings.Quiet"/>

        ///
No output on success and minimal output on failure.

        ///
        [Pure]
        public static T SetQuiet<T>(this T toolSettings, bool? quiet) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Quiet = quiet;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Quiet"/>

        ///
No output on success and minimal output on failure.

        ///
        [Pure]
        public static T ResetQuiet<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Quiet = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.Quiet"/>

        ///
No output on success and minimal output on failure.

        ///
        [Pure]
        public static T EnableQuiet<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Quiet = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.Quiet"/>

        ///
No output on success and minimal output on failure.

        ///
        [Pure]
        public static T DisableQuiet<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Quiet = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.Quiet"/>

        ///
No output on success and minimal output on failure.

        ///
        [Pure]
        public static T ToggleQuiet<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Quiet = !toolSettings.Quiet;
            return toolSettings;
        }
        #endregion
        #region Verbose
        ///
        ///
Sets <see cref="SignToolSettings.Verbose"/>

        ///
Print verbose success and status messages. This may also provide slightly more information on error.

        ///
        [Pure]
        public static T SetVerbose<T>(this T toolSettings, bool? verbose) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Verbose = verbose;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Verbose"/>

        ///
Print verbose success and status messages. This may also provide slightly more information on error.

        ///
        [Pure]
        public static T ResetVerbose<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Verbose = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.Verbose"/>

        ///
Print verbose success and status messages. This may also provide slightly more information on error.

        ///
        [Pure]
        public static T EnableVerbose<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Verbose = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.Verbose"/>

        ///
Print verbose success and status messages. This may also provide slightly more information on error.

        ///
        [Pure]
        public static T DisableVerbose<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Verbose = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.Verbose"/>

        ///
Print verbose success and status messages. This may also provide slightly more information on error.

        ///
        [Pure]
        public static T ToggleVerbose<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Verbose = !toolSettings.Verbose;
            return toolSettings;
        }
        #endregion
        #region Debug
        ///
        ///
Sets <see cref="SignToolSettings.Debug"/>

        ///
Display additional debug information.

        ///
        [Pure]
        public static T SetDebug<T>(this T toolSettings, bool? debug) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Debug = debug;
            return toolSettings;
        }
        ///
        ///
Resets <see cref="SignToolSettings.Debug"/>

        ///
Display additional debug information.

        ///
        [Pure]
        public static T ResetDebug<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Debug = null;
            return toolSettings;
        }
        ///
        ///
Enables <see cref="SignToolSettings.Debug"/>

        ///
Display additional debug information.

        ///
        [Pure]
        public static T EnableDebug<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Debug = true;
            return toolSettings;
        }
        ///
        ///
Disables <see cref="SignToolSettings.Debug"/>

        ///
Display additional debug information.

        ///
        [Pure]
        public static T DisableDebug<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Debug = false;
            return toolSettings;
        }
        ///
        ///
Toggles <see cref="SignToolSettings.Debug"/>

        ///
Display additional debug information.

        ///
        [Pure]
        public static T ToggleDebug<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.Debug = !toolSettings.Debug;
            return toolSettings;
        }
        #endregion
        #region Files
        ///
        ///
Sets <see cref="SignToolSettings.Files"/> to a new list

        ///
Files to sign.

        ///
        [Pure]
        public static T SetFiles<T>(this T toolSettings, params string[] files) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.FilesInternal = files.ToList();
            return toolSettings;
        }
        ///
        ///
Sets <see cref="SignToolSettings.Files"/> to a new list

        ///
Files to sign.

        ///
        [Pure]
        public static T SetFiles<T>(this T toolSettings, IEnumerable<string> files) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.FilesInternal = files.ToList();
            return toolSettings;
        }
        ///
        ///
Adds values to <see cref="SignToolSettings.Files"/>

        ///
Files to sign.

        ///
        [Pure]
        public static T AddFiles<T>(this T toolSettings, params string[] files) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.FilesInternal.AddRange(files);
            return toolSettings;
        }
        ///
        ///
Adds values to <see cref="SignToolSettings.Files"/>

        ///
Files to sign.

        ///
        [Pure]
        public static T AddFiles<T>(this T toolSettings, IEnumerable<string> files) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.FilesInternal.AddRange(files);
            return toolSettings;
        }
        ///
        ///
Clears <see cref="SignToolSettings.Files"/>

        ///
Files to sign.

        ///
        [Pure]
        public static T ClearFiles<T>(this T toolSettings) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            toolSettings.FilesInternal.Clear();
            return toolSettings;
        }
        ///
        ///
Removes values from <see cref="SignToolSettings.Files"/>

        ///
Files to sign.

        ///
        [Pure]
        public static T RemoveFiles<T>(this T toolSettings, params string[] files) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            var hashSet = new HashSet<string>(files);
            toolSettings.FilesInternal.RemoveAll(x => hashSet.Contains(x));
            return toolSettings;
        }
        ///
        ///
Removes values from <see cref="SignToolSettings.Files"/>

        ///
Files to sign.

        ///
        [Pure]
        public static T RemoveFiles<T>(this T toolSettings, IEnumerable<string> files) where T : SignToolSettings
        {
            toolSettings = toolSettings.NewInstance();
            var hashSet = new HashSet<string>(files);
            toolSettings.FilesInternal.RemoveAll(x => hashSet.Contains(x));
            return toolSettings;
        }
        #endregion
    }
    #endregion
    #region SignToolContentMethod
    ///
    ///   Used within <see cref="SignToolTasks"/>.
    ///
    [PublicAPI]
    [Serializable]
    [ExcludeFromCodeCoverage]
    [TypeConverter(typeof(TypeConverter<SignToolContentMethod>))]
    public partial class SignToolContentMethod : Enumeration
    {
        public static SignToolContentMethod Embedded = (SignToolContentMethod) "Embedded";
        public static SignToolContentMethod DetachedSignedData = (SignToolContentMethod) "DetachedSignedData";
        public static implicit operator SignToolContentMethod(string value)
        {
            return new SignToolContentMethod { Value = value };
        }
    }
    #endregion
    #region SignToolDigestAlgorithm
    ///
    ///   Used within <see cref="SignToolTasks"/>.
    ///
    [PublicAPI]
    [Serializable]
    [ExcludeFromCodeCoverage]
    [TypeConverter(typeof(TypeConverter<SignToolDigestAlgorithm>))]
    public partial class SignToolDigestAlgorithm : Enumeration
    {
        public static SignToolDigestAlgorithm SHA1 = (SignToolDigestAlgorithm) "SHA1";
        public static SignToolDigestAlgorithm SHA256 = (SignToolDigestAlgorithm) "SHA256";
        public static implicit operator SignToolDigestAlgorithm(string value)
        {
            return new SignToolDigestAlgorithm { Value = value };
        }
    }
    #endregion
}