SAPTeam.EasySign.CommandLine 0.6.7

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package SAPTeam.EasySign.CommandLine --version 0.6.7
                    
NuGet\Install-Package SAPTeam.EasySign.CommandLine -Version 0.6.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SAPTeam.EasySign.CommandLine" Version="0.6.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SAPTeam.EasySign.CommandLine" Version="0.6.7" />
                    
Directory.Packages.props
<PackageReference Include="SAPTeam.EasySign.CommandLine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SAPTeam.EasySign.CommandLine --version 0.6.7
                    
#r "nuget: SAPTeam.EasySign.CommandLine, 0.6.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SAPTeam.EasySign.CommandLine&version=0.6.7
                    
Install SAPTeam.EasySign.CommandLine as a Cake Addin
#tool nuget:?package=SAPTeam.EasySign.CommandLine&version=0.6.7
                    
Install SAPTeam.EasySign.CommandLine as a Cake Tool

EasySign Command Line Helper

Gawe CI CodeQL NuGet Package Version NuGet Total Downloads

Easy Sign Command Line Helper is a library that provides an API for creating console applications using the EasySign library. It supports multiple .NET targets, including .NET 6, .NET 8, and .NET 9.

Features

  • File Signing: Digitally sign files using X.509 certificates without modifying the original files by storing signatures in a bundle.
  • File Verification: Verify the integrity and signatures of files using a bundle.
  • Easy Certificate Usage: Retrieve and use certificates from PFX files or the current user's certificate store.
  • Argument Parsing: Uses System.CommandLine for parsing command line arguments.
  • Command Line Interface: Provides standard commands for adding files to a bundle, signing and verifying bundles.
  • Customizable: Easily extendable to add custom commands or modify existing ones.
  • AOT Support: Compatible with Ahead-of-Time (AOT) compilation for better performance.
  • Cross-Platform: Compatible with Windows, Linux, and macOS.
  • Logging: Integrated logging support for better debugging and monitoring.

Installation

To install the EasySign Command Line Helper library, run the following command:

dotnet add package SAPTeam.EasySign.CommandLine


Getting Started

Implementing a Command Provider

The ExampleCommandProvider class demonstrates how to implement a command provider for the EasySign Bundle. It initializes the bundle and provides the root command for the console application.

The CommandProvider is Designed to be flexible and extensible, allowing you to use custom Bundle implementations or add additional commands as needed.

public class ExampleCommandProvider : CommandProvider<Bundle>
{
    public ExampleCommandProvider(ILogger logger)
    {
        Logger = logger;
    }

    public override void InitializeBundle(string bundlePath)
    {
        Logger.LogInformation("Initializing bundle at {bundlePath}", bundlePath);
        Bundle = new Bundle(bundlePath, Logger);
    }

    public override RootCommand GetRootCommand()
    {
        RootCommand root = new RootCommand("Easy Digital Signing Tool")
        {
            Add,
            Sign,
            Verify
        };

        return root;
    }
}

Creating the Console Application

The Program class demonstrates how to create a console application using the ExampleCommandProvider. It sets up the command line parser, initializes the bundle, and executes the commands automatically.

public class Program
{
    public static int Main(string[] args)
    {
        // Create a logger, if you don't want to use logger, pass NullLogger.Instance to the command provider.
        var loggerFactory = LoggerFactory.Create(builder =>
        {
            builder.AddConsole();
            builder.SetMinimumLevel(LogLevel.Information);
        });
        var logger = loggerFactory.CreateLogger<Program>();

        // Create a command provider
        var commandProvider = new ExampleCommandProvider(logger);
        var rootCommand = commandProvider.GetRootCommand();

        // Parse the incoming args and invoke the handler
        return rootCommand.Invoke(args);
    }
}

Commands

Currently, the following commands are available:

add

Creates a new bundle or updates an existing one by adding files from the specified directory.

esign add <bundle> [--replace] [--continue]
  • bundle: The path or directory containing the bundle. If the bundle name is not specified, a default name will be used.
  • --replace or -r: (Optional) Replace existing entries.
  • --continue or -c: (Optional) Continue adding files if an error occurs.

sign

Signs the bundle with a specified certificate.

esign sign <bundle> [--pfx <pfxFilePath>] [--pfx-password <pfxFilePassword>] [--no-password]
  • bundle: The path or directory containing the bundle to be signed. If the bundle name is not specified, a default name will be used.
  • --pfx: (Optional) The path to the PFX file containing the certificate and private key.
  • --pfx-password: (Optional) The password for the PFX file.
  • --no-password: (Optional) Ignore the PFX file password prompt.

verify

Verifies the file integrity and signatures of the bundle.

esign verify <bundle>
  • bundle: The path or directory containing the bundle to be verified. If the bundle name is not specified, a default name will be used.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.11 133 4/13/2025
0.6.7 136 4/13/2025
0.6.0 87 4/13/2025
0.5.0 85 4/12/2025
0.4.7 70 4/11/2025
0.4.5 84 4/11/2025
0.4.0 76 4/11/2025
0.2.24 81 4/4/2025
0.2.22 89 4/4/2025
0.2.20 123 4/3/2025
0.2.13 436 3/25/2025
0.2.8 435 3/25/2025
0.1.3 430 3/24/2025