Class StoreCertificateManager
- Namespace
- MarymoorStudios.Core.Rpc.Identity
- Assembly
- MarymoorStudios.Core.Rpc.Identity.dll
An implementation of CertificateManager that stores its certificates in an X509Store.
public sealed class StoreCertificateManager : CertificateManager, IDisposable, IAsyncDisposable
- Inheritance
-
StoreCertificateManager
- Implements
- Inherited Members
Constructors
StoreCertificateManager(UserIdentity, AdmissionManager)
public StoreCertificateManager(UserIdentity identity, AdmissionManager admission)
Parameters
identityUserIdentityadmissionAdmissionManager
StoreCertificateManager(string, string, Claim[], AdmissionManager)
public StoreCertificateManager(string name, string email, Claim[] claims, AdmissionManager admission)
Parameters
namestringemailstringclaimsClaim[]admissionAdmissionManager
Properties
ClientOptions
The TLS client options used to negotiate authentication parameters.
public override SslClientAuthenticationOptions ClientOptions { get; }
Property Value
Endorsements
Endorsements to support Identity.
public override EndorsementCollection Endorsements { get; }
Property Value
Identity
The identity.
public override UserIdentity Identity { get; }
Property Value
ServerOptions
The TLS server options used to negotiate authentication parameters.
public override SslServerAuthenticationOptions ServerOptions { get; }
Property Value
Methods
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposingbool
GetIdentities(string)
Enumerates the identities in the store.
public static IEnumerable<UserIdentity> GetIdentities(string filter = "")
Parameters
filterstringAn optional filter that can match either name or email.
Returns
RemoveIdentity(UserIdentity)
Removes the identity from the store.
public static bool RemoveIdentity(UserIdentity identity)
Parameters
identityUserIdentityThe identity to remove.
Returns
- bool
True if successful, false otherwise.
TryAdmit(UserIdentity, IEnumerable<Endorsement>, DateTime)
Checks if the user can be admitted.
public override ValueTask<bool> TryAdmit(UserIdentity identity, IEnumerable<Endorsement> endorsements, DateTime timestamp)
Parameters
identityUserIdentityThe identity of the user to be admitted.
endorsementsIEnumerable<Endorsement>Endorsements that support
identity.timestampDateTimeThe timestamp.
Returns
TryAdmit(X509Certificate, IEnumerable<Endorsement>, DateTime)
Checks if the user can be admitted.
public override ValueTask<(bool IsAdmitted, UserIdentity Identity)> TryAdmit(X509Certificate cert, IEnumerable<Endorsement> endorsements, DateTime timestamp)
Parameters
certX509CertificateThe user's certificate.
endorsementsIEnumerable<Endorsement>Endorsements that support
cert.timestampDateTimeThe timestamp.
Returns
- ValueTask<(bool IsAdmitted, UserIdentity Identity)>
(True, the admitted identity) if the user should be admitted, (false, undefined) otherwise.
TryCreateIdentity(string, string, out UserIdentity)
Creates a new identity.
public static bool TryCreateIdentity(string name, string email, out UserIdentity identity)
Parameters
namestringThe unique name of the identity.
emailstringAn email to associate with the identity.
identityUserIdentityIf successful, the identity,
otherwise.
Returns
- bool
True if successful, false an identity with the same name already exists.
TryGetIdentity(string, string, out UserIdentity)
Loads an existing identity.
public static bool TryGetIdentity(string name, string email, out UserIdentity identity)
Parameters
namestringThe unique name of the identity.
emailstringAn email to associate with the identity.
identityUserIdentityIf successful, the identity,
otherwise.
Returns
- bool
True if successful, false an identity with the same name already exists.
TrySignData(ReadOnlySpan<byte>, out ReadOnlyMemory<byte>)
Signs data with the Identity private key.
public override bool TrySignData(ReadOnlySpan<byte> data, out ReadOnlyMemory<byte> signature)
Parameters
dataReadOnlySpan<byte>The data to sign.
signatureReadOnlyMemory<byte>The signature, if successful, undefined otherwise.
Returns
- bool
True if successful, false otherwise.
ValidateData(ReadOnlySpan<byte>, ReadOnlySpan<byte>, ReadOnlySpan<byte>)
Validates a signature over the data.
public override bool ValidateData(ReadOnlySpan<byte> publicKey, ReadOnlySpan<byte> data, ReadOnlySpan<byte> signature)
Parameters
publicKeyReadOnlySpan<byte>The public key whose private key was used to sign the data.
dataReadOnlySpan<byte>The data that was signed.
signatureReadOnlySpan<byte>The signature to validate.
Returns
- bool
True if successful, false otherwise.