Skip to content

TLS & certificates ​

Network-side TLS helpers inspect what a host presents — complementary to JASE.Crypto certificate generation.

Check a host certificate ​

csharp
using JASE.Network;

CertificateCheck check = await CertificateCheck.CheckAsync(
    host: "www.example.com",
    protocols: SslProtocols.Tls13,
    port: 443,
    connectionTimeout: 10);

if (check.Result != CertificateCheckResult.Success)
{
    // TcpConnectionFailed / SslNegotiationFailed / Timeout / …
}

bool chainOk = check.TrustedCertificateChain;
bool expired = check.Expired;
CertificateInfo? info = check.Certificate;
bool nameOk = info?.IsValidForHost("www.example.com") ?? false;

SslProtocols here is the JASE.Network enum (wrapper around the BCL flags), not System.Security.Authentication.SslProtocols.

Guidance ​

  • Treat chain validation failures as hard errors in production clients unless you have an explicit insecure mode for labs
  • Do not disable validation globally to “make it work”
  • For creating certs/CSRs, prefer Crypto helpers; for observing peer certs on the wire, prefer Network
  • Multi-port CertificateCheck.Scan / ScanAsync are diagnostic tools — respect legal and ops constraints before scanning third-party hosts