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 is not older than
no_older_than(if specified)
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/linzer/verifier.rb', line 55 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 signature_base = signature_base(, serialized_components, parameters) verify_or_fail key, signature.value, signature_base end |