Class: WSDL::Security::Verifier::SignatureValidator
- Defined in:
- lib/wsdl/security/verifier/signature_validator.rb
Overview
Validates the cryptographic signature over the SignedInfo element.
This validator performs the final cryptographic verification step:
- Canonicalizes the ds:SignedInfo element using the specified algorithm
- Decodes the ds:SignatureValue
- Verifies the signature using the certificate's public key
This should be called after all reference digests have been verified, as the SignedInfo contains the digest values being authenticated.
Constant Summary
Constants inherited from Base
Base::SOAPNS, Base::SOAP_NAMESPACES, Base::SecurityNS, Base::SignatureNS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#canonicalization_algorithm ⇒ String?
Returns the canonicalization algorithm URI.
-
#initialize(signature_node, certificate) ⇒ SignatureValidator
constructor
Creates a new signature validator.
-
#signature_algorithm ⇒ String?
Returns the signature algorithm URI.
-
#valid? ⇒ Boolean
Validates the cryptographic signature.
Constructor Details
#initialize(signature_node, certificate) ⇒ SignatureValidator
Creates a new signature validator.
37 38 39 40 41 |
# File 'lib/wsdl/security/verifier/signature_validator.rb', line 37 def initialize(signature_node, certificate) super() @signature_node = signature_node @certificate = certificate end |
Instance Method Details
#canonicalization_algorithm ⇒ String?
Returns the canonicalization algorithm URI.
63 64 65 |
# File 'lib/wsdl/security/verifier/signature_validator.rb', line 63 def canonicalization_algorithm signed_info_node&.at_xpath('ds:CanonicalizationMethod/@Algorithm', ns)&.value end |
#signature_algorithm ⇒ String?
Returns the signature algorithm URI.
56 57 58 |
# File 'lib/wsdl/security/verifier/signature_validator.rb', line 56 def signature_algorithm signed_info_node&.at_xpath('ds:SignatureMethod/@Algorithm', ns)&.value end |
#valid? ⇒ Boolean
Validates the cryptographic signature.
46 47 48 49 50 51 |
# File 'lib/wsdl/security/verifier/signature_validator.rb', line 46 def valid? return add_failure('SignedInfo not found') unless signed_info_node return add_failure('SignatureValue not found') unless signature_value_node verify_signature end |