Module: Linzer::Verifier
- Extended by:
- Common
- Defined in:
- lib/linzer/verifier.rb
Overview
Handles HTTP message signature verification according to RFC 9421.
This module verifies that a signature on an HTTP message is valid by:
- Reconstructing the signature base from the message and signature parameters
- Verifying the signature using the provided public key
Class Method Summary collapse
-
.verify(key, message, signature, no_older_than: nil) ⇒ true
Verifies an HTTP message signature.
Methods included from Common
signature_base, signature_base_line, signature_params_line
Class Method Details
.verify(key, message, signature, no_older_than: nil) ⇒ true
Verifies an HTTP message signature.
Verification succeeds if:
- All covered components exist in the message
- The signature base matches what was signed
- The cryptographic signature is valid for the public key
- The signature has not expired (if
expiresparameter is present) - The signature is not older than
no_older_than(if specified)
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/linzer/verifier.rb', line 56 def verify(key, , signature, no_older_than: nil) validate , key, signature, no_older_than: no_older_than parameters = signature.parameters serialized_components = signature.serialized_components # Build fresh field_ids for signature_base (validate already # consumed its own set, which may have been mutated by adapters). field_ids = signature.field_ids signature_base = signature_base(, serialized_components, parameters, field_ids: field_ids) verify_or_fail key, signature.value, signature_base end |