Class SecomClientIdentity
- Namespace
- EncDotNet.S100.Collections.Secom
- Assembly
- EncDotNet.S100.Collections.dll
An MCP identity for SECOM requests (issue #832): a client certificate with its private key, presented by SecomServerTrust's handlers when a SECOM service asks for one (mutual TLS).
public sealed class SecomClientIdentity : IDisposable
- Inheritance
-
SecomClientIdentity
- Implements
- Inherited Members
Remarks
Identities are issued by an MCP Identity Registry to an organisation's
devices and services; their subject carries the MRN (as UID). This
library only holds an identity in memory: loading it from a key store and
persisting it is the host's concern.
Properties
Anchor
The trust anchor the certificate chains to (e.g. "MCP MCC"), or null for none.
public string? Anchor { get; }
Property Value
CallSign
The vessel's call sign, when the certificate carries the MCP attribute.
public string? CallSign { get; }
Property Value
Certificate
The certificate, with its private key.
public X509Certificate2 Certificate { get; }
Property Value
DisplayName
The MRN when there is one, otherwise the subject: how the identity is named in messages.
public string DisplayName { get; }
Property Value
FlagState
The vessel's flag state, when the certificate carries the MCP attribute.
public string? FlagState { get; }
Property Value
ImoNumber
The vessel's IMO number, when the certificate carries the MCP attribute.
public string? ImoNumber { get; }
Property Value
Issuer
The issuer's common name, e.g. "MCP Identity Registry".
public string Issuer { get; }
Property Value
Mmsi
The vessel's MMSI, when the certificate carries the MCP attribute.
public string? Mmsi { get; }
Property Value
Mrn
The MRN the certificate was issued to (its subject UID), when it has one.
public string? Mrn { get; }
Property Value
NotAfter
When the certificate expires.
public DateTimeOffset NotAfter { get; }
Property Value
NotBefore
When the certificate becomes valid.
public DateTimeOffset NotBefore { get; }
Property Value
Subject
The certificate's subject common name.
public string Subject { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FromCertificate(X509Certificate2, SecomTrustAnchors?)
Wraps a certificate that already holds its private key.
public static SecomClientIdentity FromCertificate(X509Certificate2 certificate, SecomTrustAnchors? anchors = null)
Parameters
certificateX509Certificate2The certificate; the identity takes ownership of it.
anchorsSecomTrustAnchors
Returns
Exceptions
- InvalidDataException
The certificate has no private key.
IsValidAt(DateTimeOffset)
True when at lies within the certificate's validity period.
public bool IsValidAt(DateTimeOffset at)
Parameters
Returns
Load(string, string?, SecomTrustAnchors?, X509KeyStorageFlags)
Loads an identity from a PKCS#12 file (.p12, .pfx) or a
PEM file holding the certificate and its private key (optionally
encrypted), as the MCP Management Portal issues them.
public static SecomClientIdentity Load(string path, string? password = null, SecomTrustAnchors? anchors = null, X509KeyStorageFlags keyStorageFlags = X509KeyStorageFlags.DefaultKeySet)
Parameters
pathstringThe file.
passwordstringThe PKCS#12 or encrypted-key password, if any.
anchorsSecomTrustAnchorskeyStorageFlagsX509KeyStorageFlagsHow the private key is held, e.g. Exportable or PersistKeySet for a host that adds the identity to a platform key store; by default the platform's default.
Returns
Exceptions
- FileNotFoundException
The file does not exist.
- InvalidDataException
The file holds no certificate with a private key, or the password is wrong.