Table of Contents

Method Decode

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

Decode(string, ResolvedSecret, out DataEncryptionKeyMaterialFailure?)

Decodes configured material into a key.

public static DataEncryptionKey? Decode(string keyId, ResolvedSecret material, out DataEncryptionKeyMaterialFailure? failure)

Parameters

keyId string

The identifier the material is configured under.

material ResolvedSecret

The resolved material, which stays owned by the caller and is not disposed here.

failure DataEncryptionKeyMaterialFailure?

Why the material is unusable when it is; otherwise null.

Returns

DataEncryptionKey

The decoded key, which the caller owns and must dispose, or null when the material is unusable.

Remarks

The decode buffer holds one byte more than a key, so material that is base64 but too long fails to fit rather than being silently truncated to the right length. Startup calls this and disposes the result, which is what turns a mistyped key into a refusal to start rather than into a failure at the first stored read.

Exceptions

ArgumentNullException

Thrown when an argument is null.