Table of Contents

StrongNamePluginTrustPolicy Class

Definition

Namespace
Bodu.Globalization.Calendar.Plugins
Assembly
Bodu.Globalization.Calendar.Plugins.dll
Package
Bodu.Globalization.Calendar.Plugins 1.0.0
Source
StrongNamePluginTrustPolicy.cs

A trust policy that admits plugin assemblies whose strong-name public-key token appears in a consumer-supplied allowlist.

public sealed class StrongNamePluginTrustPolicy : IPluginTrustPolicy
Inheritance
StrongNamePluginTrustPolicy
Implements
Inherited Members
Extension Methods

Remarks

The policy reads PublicKeyToken - the lowercase-hexadecimal token the loader extracts from the assembly manifest - and compares it case-insensitively against the allowlist. An assembly that is not strong-named (no token) is always rejected.

This verifies the token value declared in the manifest; it does not cryptographically verify the strong-name signature. For byte-level tamper resistance, compose it with a FileHashPluginTrustPolicy through a CompositePluginTrustPolicy.

Constructors

StrongNamePluginTrustPolicy(IEnumerable<string>)

Initializes a new instance of the StrongNamePluginTrustPolicy class.

public StrongNamePluginTrustPolicy(IEnumerable<string> allowedPublicKeyTokens)

Parameters

allowedPublicKeyTokens IEnumerable<string>

The public-key tokens to admit, as hexadecimal strings.

Remarks

Tokens are normalized to trimmed lowercase. Blank entries are ignored; an empty allowlist rejects every assembly.

Exceptions

ArgumentNullException

allowedPublicKeyTokens is null.

Methods

Evaluate(PluginTrustContext)

Evaluates the trust of a candidate plugin assembly.

public PluginTrustResult Evaluate(PluginTrustContext context)

Parameters

context PluginTrustContext

The metadata describing the candidate assembly.

Returns

PluginTrustResult

The trust result.

Exceptions

ArgumentNullException

context is null.

Applies to

ProductVersions
.NET8, 10