Beryl::Certificates::ServiceIdentity
The name a client expects the server to prove: a DNS name or an IP address (RFC 9525's DNS-ID and IP-ID).
identity = Beryl::Certificates::ServiceIdentity.new("www.example.com")
identity.matches?(certificate) # => true when a SAN dNSName matches
Matching follows RFC 9525 §6:
- a DNS name is compared with the certificate's subject alternative dNSName entries only; the common name is never used (§6.2.1);
- comparison is case-insensitive over ASCII (§6.3), on A-labels: a name with characters outside ASCII is refused, and the caller converts an internationalized name to its A-label form first;
- a presented name may start with one wildcard label
*, which matches exactly one non-empty label of the reference name (§6.3); a wildcard anywhere else, a partial wildcard such asf*.example.com, and a wildcard covering a whole public suffix (*.com,*.co.uk) do not match; - an IP address is compared with the subject alternative iPAddress entries only, byte for byte (§6.2.2).
Constructors
Instance methods
Returns whether a subject alternative name of certificate matches.