Class CertificateManager
- Namespace
- MarymoorStudios.Core.Rpc.Identity
- Assembly
- MarymoorStudios.Core.Rpc.Identity.dll
Manages the certificates that provide identity to others.
public abstract class CertificateManager : IDisposable, IAsyncDisposable
- Inheritance
-
CertificateManager
- Implements
- Derived
- Inherited Members
Constructors
CertificateManager()
protected CertificateManager()
Properties
ClientOptions
The TLS client options used to negotiate authentication parameters.
public abstract SslClientAuthenticationOptions ClientOptions { get; }
Property Value
Endorsements
Endorsements to support Identity.
public abstract EndorsementCollection Endorsements { get; }
Property Value
Identity
The identity.
public abstract UserIdentity Identity { get; }
Property Value
ServerOptions
The TLS server options used to negotiate authentication parameters.
public abstract SslServerAuthenticationOptions ServerOptions { get; }
Property Value
Methods
Dispose()
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
DisposeAsync()
public ValueTask DisposeAsync()
Returns
DisposeAsyncCore()
protected virtual ValueTask DisposeAsyncCore()
Returns
TryAdmit(UserIdentity, IEnumerable<Endorsement>, DateTime)
Checks if the user can be admitted.
public abstract 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 abstract 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.
TrySignData(ReadOnlySpan<byte>, out ReadOnlyMemory<byte>)
Signs data with the Identity private key.
public abstract 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 abstract 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.