StrongNamePluginTrustPolicy Class
Definition
- Namespace
- Bodu.Globalization.Calendar.Plugins
- Assembly
- Bodu.Globalization.Calendar.Plugins.dll
- Package
- Bodu.Globalization.Calendar.Plugins 1.0.0
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
allowedPublicKeyTokensIEnumerable<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
allowedPublicKeyTokensis null.
Methods
Evaluate(PluginTrustContext)
Evaluates the trust of a candidate plugin assembly.
public PluginTrustResult Evaluate(PluginTrustContext context)
Parameters
contextPluginTrustContextThe metadata describing the candidate assembly.
Returns
- PluginTrustResult
The trust result.
Exceptions
- ArgumentNullException
contextis null.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |