Class SecomSignatureVerifier
- Namespace
- EncDotNet.S100.Collections.Secom
- Assembly
- EncDotNet.S100.Collections.dll
Checks the data signature of a SECOM data object
(exchangeMetadata.digitalSignatureValue): a hex-encoded signature
over the decoded data, made with the key of the first certificate in
publicCertificate.
public static class SecomSignatureVerifier
- Inheritance
-
SecomSignatureVerifier
- Inherited Members
Remarks
Signer trust is checked against SecomTrustAnchors: SECOM signers hold Maritime Connectivity Platform (MCP) certificates, whose roots are not in operating-system trust stores. Without anchors the result says only whether the data matches the stated certificate (SignerTrusted is null). Revocation is checked for a trusted signer when a SecomRevocation is given (SignerRevocation).
Methods
LoadCertificate(string)
Loads a certificate sent as base64 DER or as (possibly single-line) PEM, the "minified" form SECOM services use.
public static X509Certificate2 LoadCertificate(string text)
Parameters
textstring
Returns
Exceptions
- FormatException
The text is not base64.
- CryptographicException
The bytes are not a certificate.
Recheck(SecomSignatureCheck, IReadOnlyList<string>, string?, SecomTrustAnchors?, DateTimeOffset?, SecomRevocation?)
Judges the signer of an earlier check again: its expiry now and, for a
valid signature, its trust against trust and its
revocation with revocation. A recorded
download is re-judged this way each time it is read, so trust follows
the current anchors without re-downloading.
public static SecomSignatureCheck Recheck(SecomSignatureCheck check, IReadOnlyList<string> publicCertificates, string? statedThumbprint, SecomTrustAnchors? trust, DateTimeOffset? now = null, SecomRevocation? revocation = null)
Parameters
checkSecomSignatureCheckThe earlier check.
publicCertificatesIReadOnlyList<string>The certificates the object carried, signer first (base64 DER or PEM).
statedThumbprintstringThe object's
publicRootCertificateThumbprint, if any.trustSecomTrustAnchorsThe anchors to judge trust against, or null to skip the trust check.
nowDateTimeOffset?The time expiry is judged at; defaults to now.
revocationSecomRevocationChecks a trusted signer's chain for revocation, or null to skip the check. On read paths pass CacheOnly.
Returns
- SecomSignatureCheck
The check with its trust, revocation and expiry updated, or unchanged when the certificates cannot be read.
Verify(byte[], SecomExchangeMetadata?, SecomTrustAnchors?, DateTimeOffset?, SecomRevocation?)
Checks the signature of data.
public static SecomSignatureCheck Verify(byte[] data, SecomExchangeMetadata? metadata, SecomTrustAnchors? trust = null, DateTimeOffset? now = null, SecomRevocation? revocation = null)
Parameters
databyte[]The decoded data the signature covers.
metadataSecomExchangeMetadataThe object's exchange metadata; null means unsigned.
trustSecomTrustAnchorsThe anchors the signer must chain to (e.g. BuiltIn), or null to skip the trust check.
nowDateTimeOffset?The time expiry is judged at; defaults to now.
revocationSecomRevocationChecks a trusted signer's chain for revocation, or null to skip the check.