Beryl::Certificates
X.509 certificates and certificate path validation, written in Crystal.
The calls on this module use the choices Beryl recommends: the pinned
Mozilla root set, the current time and the serverAuth purpose.
chain = Beryl::Certificates.read_pem_chain(File.read("chain.pem"))
Beryl::Certificates.verify_server_chain(chain, hostname: "example.com") # => the verified path, or raises
key = Beryl::Certificates.read_private_key(File.read("server.key"))
ChainVerification takes another trust store (TrustStore.system,
TrustStore.from_pem), a validation time, a client purpose, CRLs and
limits. See docs/certificates.md for the profile it enforces and the
test suites behind it.
Constants
Class methods
Reads every certificate of the PEM text, in order (the leaf first, as
TLS servers and chain.pem files hold them).
Reads the first private key in the PEM text (PKCS #8, SEC 1 or PKCS #1).
Verifies chain (the leaf first, then the intermediates in any order)
for a TLS server named hostname (a DNS name or an IP address), against
the Mozilla root set at the current time. Returns the verified path,
leaf first, or raises VerificationFailed.
Nested types
- Beryl::Certificates::AuthorityKeyIdentifier
- Beryl::Certificates::BasicConstraints
- Beryl::Certificates::Certificate
- Beryl::Certificates::CertificateRevocationList
- Beryl::Certificates::ChainVerification
- Beryl::Certificates::DistinguishedName
- Beryl::Certificates::Error
- Beryl::Certificates::Extension
- Beryl::Certificates::FailureReason
- Beryl::Certificates::GeneralName
- Beryl::Certificates::KeyUsage
- Beryl::Certificates::MalformedCertificate
- Beryl::Certificates::NameConstraintCheck
- Beryl::Certificates::NameConstraints
- Beryl::Certificates::ObjectIdentifiers
- Beryl::Certificates::PolicyConstraints
- Beryl::Certificates::PrivateKeyFile
- Beryl::Certificates::PublicSuffixList
- Beryl::Certificates::Purpose
- Beryl::Certificates::ServiceIdentity
- Beryl::Certificates::SignatureAlgorithm
- Beryl::Certificates::SigningKey
- Beryl::Certificates::SubjectPublicKeyInfo
- Beryl::Certificates::TrustStore
- Beryl::Certificates::UnsupportedKey
- Beryl::Certificates::VerificationFailed
- Beryl::Certificates::VerificationKey