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
identity
UserIdentityadmission
AdmissionManager
StoreCertificateManager(string, string, AdmissionManager)
public StoreCertificateManager(string name, string email, AdmissionManager admission)
Parameters
name
stringemail
stringadmission
AdmissionManager
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
disposing
bool
GetIdentities(string)
Enumerates the identities in the store.
public static IEnumerable<UserIdentity> GetIdentities(string filter = "")
Parameters
filter
stringAn 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
identity
UserIdentityThe 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
identity
UserIdentityThe identity of the user to be admitted.
endorsements
IEnumerable<Endorsement>Endorsements that support the identity provided by
identity
.timestamp
DateTimeThe 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
cert
X509CertificateThe user's certificate.
endorsements
IEnumerable<Endorsement>Endorsements that support the identity provided by
cert
.timestamp
DateTimeThe 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
name
stringThe unique name of the identity.
email
stringAn email to associate with the identity.
identity
UserIdentityIf 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
name
stringThe unique name of the identity.
email
stringAn email to associate with the identity.
identity
UserIdentityIf 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
data
ReadOnlySpan<byte>The data to sign.
signature
ReadOnlyMemory<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
publicKey
ReadOnlySpan<byte>The public key whose private key was used to sign the data.
data
ReadOnlySpan<byte>The data that was signed.
signature
ReadOnlySpan<byte>The signature to validate.
Returns
- bool
True if successful, false otherwise.