EasySign BETA
Digital Signing Tool
Loading...
Searching...
No Matches
SAPTeam.EasySign.CommandLine.CommandProviderConfiguration Class Reference

Represents the configuration for the EasySign command provider. More...

Public Member Functions

 CommandProviderConfiguration ()
 Initializes a new instance of the CommandProviderConfiguration class.
 
 CommandProviderConfiguration (string[] protectedPrefixes)
 Initializes a new instance of the CommandProviderConfiguration class with the specified protected prefixes.
 
bool IsProtected (string id)
 Checks if the given ID starts with any of the protected prefixes.
 
void AddProtectedPrefix (params string[] prefixes)
 Adds given prefixes to the list of Protected ID Prefixes.
 
void AddSAPTeamCertificates ()
 Adds the SAP Team certificates to the trusted root CA and intermediate CA stores and Locks the sapteam: prefix.
 
string AddCertificate (CertificateStore certificateStore, X509Certificate2 certificate, string? id=null)
 Adds a certificate to the specified certificate store.
 
X509Certificate2Collection LoadCertificates (CertificateStore certificateStore)
 Loads all certificates from the specified certificate store.
 
X509Certificate2 LoadCertificate (CertificateStore certificateStore, string id)
 Loads a certificate from the specified certificate store using the given ID.
 
bool RemoveCertificate (CertificateStore certificateStore, string id)
 Removes a certificate from the specified certificate store using the given ID.
 

Protected Member Functions

void CheckProtectedPrefix (string id)
 Checks if the given ID starts with any of the protected prefixes.
 

Properties

Dictionary< string, bool > Settings [get, set]
 Gets or sets the settings for the command provider.
 
string[] ProtectedPrefixes = [] [get, set]
 Gets or sets the list of prefixes that should be protected from modification.
 
Dictionary< string, byte[]> TrustedRootCA = [] [get, set]
 Gets or sets the list of trusted root CA certificates.
 
Dictionary< string, byte[]> IntermediateCA = [] [get, set]
 Gets or sets the list of intermediate CA certificates.
 
Dictionary< string, byte[]> IssuedCertificates = [] [get, set]
 Gets or sets the list of issued certificates by the self signing root CA.
 
byte?[] SelfSignedRootCA = null [get, set]
 Gets or sets the self-signed root CA certificate.
 

Detailed Description

Represents the configuration for the EasySign command provider.

Definition at line 14 of file CommandProviderConfiguration.cs.

Constructor & Destructor Documentation

◆ CommandProviderConfiguration() [1/2]

SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.CommandProviderConfiguration ( )

Initializes a new instance of the CommandProviderConfiguration class.

Definition at line 53 of file CommandProviderConfiguration.cs.

◆ CommandProviderConfiguration() [2/2]

SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.CommandProviderConfiguration ( string[] protectedPrefixes)

Initializes a new instance of the CommandProviderConfiguration class with the specified protected prefixes.

IDs with these prefixes cannot be modified in the trusted root CA and intermediate CA stores with the AddCertificate(CertificateStore, X509Certificate2, string?) and RemoveCertificate(CertificateStore, string) methods.

Parameters
protectedPrefixesThe prefixes that should be protected from modification.

Definition at line 67 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.AddProtectedPrefix().

Member Function Documentation

◆ AddCertificate()

string SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.AddCertificate ( CertificateStore certificateStore,
X509Certificate2 certificate,
string? id = null )

Adds a certificate to the specified certificate store.

Parameters
certificateStoreThe certificate store to which the certificate will be added.
certificateThe certificate to add.
idThe ID of the certificate. If not provided, the last 6 characters of the certificate's thumbprint will be used.
Exceptions
ArgumentOutOfRangeException
Returns
The ID of the added certificate.

Definition at line 145 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.CheckProtectedPrefix(), SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IntermediateCA, SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IssuedCertificates, and SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.TrustedRootCA.

◆ AddProtectedPrefix()

void SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.AddProtectedPrefix ( params string[] prefixes)

Adds given prefixes to the list of Protected ID Prefixes.

Parameters
prefixesThe prefixes to add.
Exceptions
ArgumentNullException

Definition at line 108 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.ProtectedPrefixes.

Referenced by SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.AddSAPTeamCertificates(), and SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.CommandProviderConfiguration().

◆ AddSAPTeamCertificates()

void SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.AddSAPTeamCertificates ( )

◆ CheckProtectedPrefix()

void SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.CheckProtectedPrefix ( string id)
protected

Checks if the given ID starts with any of the protected prefixes.

Parameters
idThe ID to check.
Exceptions
InvalidOperationException

Definition at line 79 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IsProtected().

Referenced by SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.AddCertificate(), and SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.RemoveCertificate().

◆ IsProtected()

bool SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IsProtected ( string id)

Checks if the given ID starts with any of the protected prefixes.

Parameters
idThe ID to check.
Returns
true if the ID is protected; otherwise, false.

Definition at line 96 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.ProtectedPrefixes.

Referenced by SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.CheckProtectedPrefix().

◆ LoadCertificate()

X509Certificate2 SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.LoadCertificate ( CertificateStore certificateStore,
string id )

Loads a certificate from the specified certificate store using the given ID.

Parameters
certificateStoreThe certificate store from which to load the certificate.
idThe ID of the certificate to load.
Returns
Exceptions
ArgumentOutOfRangeException

Definition at line 225 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IntermediateCA, SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IssuedCertificates, and SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.TrustedRootCA.

Referenced by SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.LoadCertificates().

◆ LoadCertificates()

X509Certificate2Collection SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.LoadCertificates ( CertificateStore certificateStore)

Loads all certificates from the specified certificate store.

Parameters
certificateStoreThe certificate store from which to load the certificates.
Returns
A collection of certificates from the specified store.
Exceptions
ArgumentOutOfRangeException

Definition at line 183 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IntermediateCA, SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IssuedCertificates, SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.LoadCertificate(), and SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.TrustedRootCA.

◆ RemoveCertificate()

bool SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.RemoveCertificate ( CertificateStore certificateStore,
string id )

Removes a certificate from the specified certificate store using the given ID.

Parameters
certificateStoreThe certificate store from which to remove the certificate.
idThe ID of the certificate to remove.
Returns
true if the certificate was removed successfully; otherwise, false.
Exceptions
ArgumentOutOfRangeException

Definition at line 262 of file CommandProviderConfiguration.cs.

References SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.CheckProtectedPrefix(), SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IntermediateCA, SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IssuedCertificates, and SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.TrustedRootCA.

Property Documentation

◆ IntermediateCA

◆ IssuedCertificates

Dictionary<string, byte[]> SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IssuedCertificates = []
getset

◆ ProtectedPrefixes

string [] SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.ProtectedPrefixes = []
getsetprotected

Gets or sets the list of prefixes that should be protected from modification.

Definition at line 28 of file CommandProviderConfiguration.cs.

Referenced by SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.AddProtectedPrefix(), and SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.IsProtected().

◆ SelfSignedRootCA

byte? [] SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.SelfSignedRootCA = null
getset

Gets or sets the self-signed root CA certificate.

Definition at line 48 of file CommandProviderConfiguration.cs.

◆ Settings

Dictionary<string, bool> SAPTeam.EasySign.CommandLine.CommandProviderConfiguration.Settings
getset
Initial value:
= new Dictionary<string, bool>
{
["trust.enable"] = true,
["selfsign.enable"] = true,
}

Gets or sets the settings for the command provider.

Definition at line 19 of file CommandProviderConfiguration.cs.

◆ TrustedRootCA


The documentation for this class was generated from the following file: