License
BSD-3-Clause
X.509 Certificate Chain Validation (RFC 5280).
Provides functions for building and validating certificate chains, including signature verification, validity period checks, and extension validation.
Result of certificate chain validation.
Options for certificate chain validation.
long validationTimeThe time to use for validity checks (Unix timestamp). If 0, validation is skipped.bool verifySignaturesWhether to verify signatures in the chain.bool checkKeyUsageWhether to check key usage extensions.bool checkBasicConstraintsWhether to check basic constraints.bool checkCriticalExtensionsWhether to check for unrecognized critical extensions.string requiredPurposePurpose OID to check in Extended Key Usage (null to skip).Detailed result of certificate chain validation.
ValidationResult resultThe overall validation resultstring errorMessageHuman-readable error message (if validation failed)int failingCertIndexIndex of the certificate that caused the failure (-1 if N/A)X509Certificate[] chainThe validated certificate chain (from end-entity to root)A collection of trusted root certificates.
The trust store is used during chain validation to determine whether a certificate chain terminates at a trusted root.
void addTrustedRoot(X509Certificate cert)Adds a trusted root certificate.void addTrustedRoots(X509Certificate[] certs)Adds multiple trusted root certificates.void loadFromPem(string pem)Loads trusted roots from PEM data containing multiple certificates.X509Certificate findIssuer(X509Certificate cert)Finds a trusted root that issued the given certificate.X509Certificate findTrustedRoot(X509Certificate cert)Finds the stored trusted root matching a presented certificate.bool isTrusted(X509Certificate cert)Checks if a certificate is in the trust store.this()Creates an empty trust store.ValidationReport validateChain(X509Certificate[] chain, TrustStore trustStore,
ValidationOptions options = ValidationOptions.init)Validates a certificate chain against a trust store.bool verifySignature(X509Certificate cert, X509Certificate issuer)Verifies that a certificate was signed by the given issuer.bool verifySignatureWithKey(X509Certificate cert, PublicKey publicKey)Verifies a certificate's signature using a public key.bool verifyHostname(X509Certificate cert, string hostname) @safeVerifies that a certificate is valid for the given hostname.