Table of Contents

Method AddDataEncryption

Namespace
MailFathom.Infrastructure.DataEncryption
Assembly
MailFathom.Infrastructure.dll

AddDataEncryption(IServiceCollection, Func<IServiceProvider, DataEncryptionKeyRingSettings>)

Registers the key ring and the encryptor over it.

public static IServiceCollection AddDataEncryption(this IServiceCollection services, Func<IServiceProvider, DataEncryptionKeyRingSettings> readSettings)

Parameters

services IServiceCollection

The service collection.

readSettings Func<IServiceProvider, DataEncryptionKeyRingSettings>

Reads the currently published key ring settings for a resolved provider.

Returns

IServiceCollection

The same collection, for chaining.

Remarks

Both are singletons because neither holds anything a scope owns: the ring resolves a key per operation and erases it, and the encryptor holds only the ring. The settings arrive through a delegate rather than as a value so a reloaded snapshot reaches the next operation, which is what lets an operator add a key to a running deployment.

Exceptions

ArgumentNullException

Thrown when an argument is null.