Table of Contents

Class SecretDecryptorConfiguratorExtensions

Namespace
Arc4u.Configuration.Decryptor
Assembly
Arc4u.Configuration.Decryptor.dll

Extension methods on IConfigurationBuilder that add a provider decrypting the values of the previously added providers. A value is decrypted when it starts with the prefix (Decrypt: by default); the decrypted values are exposed by the added provider under the same keys. The decryption provider must therefore be added after the providers holding the encrypted values and the key material.

public static class SecretDecryptorConfiguratorExtensions
Inheritance
SecretDecryptorConfiguratorExtensions
Inherited Members

Examples

var builder = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json")
    .AddCertificateDecryptorConfiguration();

// appsettings.json contains the certificate description and the encrypted value:
// "EncryptionCertificate": { "Store": { "Name": "MyCertificate", "Location": "LocalMachine" } },
// "ConnectionStrings": { "Db": "Decrypt:AbC..." }
var configuration = builder.Build();

Methods

AddCertificateDecryptorConfiguration(IConfigurationBuilder)

Adds a provider that decrypts, with a certificate, the values starting with the default prefix. The certificate is described by the default EncryptionCertificate section found in the previously added providers.

public static IConfigurationBuilder AddCertificateDecryptorConfiguration(this IConfigurationBuilder configurationBuilder)

Parameters

configurationBuilder IConfigurationBuilder

The IConfigurationBuilder to add to.

Returns

IConfigurationBuilder

The IConfigurationBuilder.

AddCertificateDecryptorConfiguration(IConfigurationBuilder, Action<SecretCertificateOptions>)

Adds a provider that decrypts, with a certificate, the values starting with the configured prefix.

public static IConfigurationBuilder AddCertificateDecryptorConfiguration(this IConfigurationBuilder configurationBuilder, Action<SecretCertificateOptions> options)

Parameters

configurationBuilder IConfigurationBuilder

The IConfigurationBuilder to add to.

options Action<SecretCertificateOptions>

An action that configures the SecretCertificateOptions.

Returns

IConfigurationBuilder

The IConfigurationBuilder.

AddRijndaelDecryptorConfiguration(IConfigurationBuilder)

Adds an IConfigurationProvider that reads configuration values based on the default values defined in the SecretRijndaelOptions.

public static IConfigurationBuilder AddRijndaelDecryptorConfiguration(this IConfigurationBuilder configurationBuilder)

Parameters

configurationBuilder IConfigurationBuilder

The IConfigurationBuilder to add to.

Returns

IConfigurationBuilder

The IConfigurationBuilder.

AddRijndaelDecryptorConfiguration(IConfigurationBuilder, Action<SecretRijndaelOptions>)

Adds an IConfigurationProvider that reads configuration values based on the values defined in the SecretRijndaelOptions.

public static IConfigurationBuilder AddRijndaelDecryptorConfiguration(this IConfigurationBuilder configurationBuilder, Action<SecretRijndaelOptions> options)

Parameters

configurationBuilder IConfigurationBuilder

The IConfigurationBuilder to add to.

options Action<SecretRijndaelOptions>

The SecretRijndaelOptions parameters.

Returns

IConfigurationBuilder

The IConfigurationBuilder.