class

Beryl::TLS::CertificateVerifier

Inherits Reference < Object

Decides whether a peer's certificate chain is trusted, and checks the CertificateVerify signature made with its leaf key.

WebPkiVerifier is the default for clients. InsecureVerifier skips the chain (for tests and self-signed development servers) but still checks the signature, so the handshake keeps its integrity against anyone who does not hold the leaf's key.

Constants

LIST_OF_VERIFIED_SIGNATURE_SCHEMES = [SignatureScheme::EcdsaSecp256r1Sha256, SignatureScheme::RsaPssRsaeSha256, SignatureScheme::RsaPssRsaeSha384, SignatureScheme::RsaPssRsaeSha512, SignatureScheme::Ed25519, SignatureScheme::EcdsaSecp384r1Sha384]

The CertificateVerify schemes verify_with_key accepts, in the order a server lists them in its CertificateRequest.

Class methods

scheme_fits_key?(leaf : Certificates::Certificate, scheme : SignatureScheme) : Bool

Returns whether scheme signs with keys of leaf's type (and, for ECDSA, its curve: TLS 1.3 binds each ECDSA scheme to one curve).

Source
verify_with_key(key : Certificates::VerificationKey, scheme : SignatureScheme, content : Bytes, signature : Bytes) : Bool

Checks signature with key under one of the TLS 1.3 CertificateVerify schemes Beryl accepts (plan §2); every other scheme, or a key of the wrong type for it, does not verify. A SHA-1 scheme raises an Error with the illegal_parameter alert, naming SHA-1, before any signature check (RFC 9155 §2).

Source

Instance methods

verify_chain(chain : Array(Certificates::Certificate), hostname : String | Nil) : Nil

Raises CertificateRejected with the alert to send when chain (leaf first) is not trusted for hostname.

Source
verify_signature(leaf : Certificates::Certificate, scheme : SignatureScheme, content : Bytes, signature : Bytes) : Bool

Returns whether signature over content verifies under the leaf key of leaf with scheme.

Source