class

Beryl::TLS::CertifiedKey

Inherits Reference < Object

A certificate chain and the private key of its leaf: what a server presents and signs its CertificateVerify with.

certified_key = Beryl::TLS::CertifiedKey.from_pem(File.read("chain.pem"), File.read("server.key"))

Keys: P-256 (signs ecdsa_secp256r1_sha256), RSA 2,048 to 4,096 bits (rsa_pss_rsae_sha256/384/512), Ed25519 (ed25519).

Constructors

from_pem(chain_pem : String, private_key_pem : String) : CertifiedKey

Reads the chain (leaf first) and the key from PEM text.

Source
new(list_of_certificates : Array(Certificates::Certificate), private_key : Certificates::SigningKey)
Source

Instance methods

list_of_certificates
Source
list_of_signature_schemes

The signature schemes this key signs, in Beryl's order of preference.

Source
private_key
Source
sign(scheme : SignatureScheme, content : Bytes, randomness : HandshakeRandomness) : Bytes

Signs content (the CertificateVerify input) with scheme, which must be one of list_of_signature_schemes. RSA-PSS draws its salt (one hash long, RFC 9846 ยง4.2.3) from randomness.

Source
signature_scheme_for(list_of_offered_values : Array(UInt16)) : SignatureScheme | Nil

Returns the first scheme of this key that the peer offered, or nil.

Source