class

Beryl::Certificates::TrustStore

Inherits Reference < Object

The certificates a verifier trusts as the ends of paths (trust anchors).

Beryl::Certificates::TrustStore.mozilla                       # the pinned Mozilla root set
Beryl::Certificates::TrustStore.system                        # the operating system's bundle
Beryl::Certificates::TrustStore.from_pem(File.read("ca.pem")) # an application's own CA

mozilla is the Mozilla root set with the Websites trust bit, from the CCADB report IncludedRootsPEMTxt?TrustBitsInclude=Websites, compiled into Beryl and pinned by sha256 (MOZILLA_ROOTS_SHA256), so verdicts are the same on every machine and change only with a Beryl release. Mozilla's per-root "distrust for TLS after" dates are not applied.

Constants

LIST_OF_SYSTEM_BUNDLE_PATHS = ["/etc/ssl/certs/ca-certificates.crt", "/etc/pki/tls/certs/ca-bundle.crt", "/etc/ssl/ca-bundle.pem", "/etc/ssl/cert.pem"]

The bundles system reads, first one found wins: Debian and Ubuntu, Fedora and RHEL, openSUSE, then Alpine and macOS (where the file trails the keychain; see system).

MOZILLA_ROOTS_PEM = {{ read_file("/tmp/tmp.JBPNOM/src/src/beryl/certificates/data/mozilla_root_certificates.pem") }}
MOZILLA_ROOTS_RETRIEVED = "2026-11-23"

When the root set was taken from the CCADB.

MOZILLA_ROOTS_SHA256 = "4d5d68b49a30f7a28efb573a9dce4fbe54a91dd99cf53419fbf783638e39b852"

The sha256 of data/mozilla_root_certificates.pem, checked by a spec.

SYSTEM_BUNDLE_OVERRIDE_VARIABLE = "SSL_CERT_FILE"

The environment variable that names a PEM bundle to use in place of the operating system's, as OpenSSL and Go read it.

Constructors

from_pem(text : String) : TrustStore

The certificates in the PEM text. A block that is not a certificate Beryl can read is skipped (system bundles hold a few with old encodings), and logged at debug level.

Source
mozilla
Source
new(list_of_certificates : Enumerable(Certificate))
Source
system

The trust anchors in the operating system's bundle (see LIST_OF_SYSTEM_BUNDLE_PATHS), or in the file SSL_CERT_FILE names when it is set, as OpenSSL's default paths and Go's crypto/x509 honor it. Raises Error when no bundle is found.

On macOS the keychain, not /etc/ssl/cert.pem, holds the roots the system trusts, and the file falls behind it: on macOS 27.2.1 it lacks SSL.com TLS ECC Root CA 2022 and AAA Certificate Services, so a server whose chain ends there (www.example.com in November 2026) would be refused. So on macOS, unless SSL_CERT_FILE is set, system is that file joined with the pinned Mozilla set (mozilla).

Source

Class methods

joins_mozilla_roots_to_the_system_bundle?

Whether system adds the pinned Mozilla set to the bundle it reads: on macOS when SSL_CERT_FILE is not set.

Source
system_bundle_path

The bundle system reads: the file SSL_CERT_FILE names when it is set and not empty, else the first of LIST_OF_SYSTEM_BUNDLE_PATHS that exists.

Source

Instance methods

includes?(certificate : Certificate) : Bool
Source
list_of_anchors_named(name : DistinguishedName) : Array(Certificate)

The anchors whose subject is name.

Source
list_of_certificates
Source
size
Source