Class: WSDL::Security::Verifier::CertificateValidator
- Defined in:
- lib/wsdl/security/verifier/certificate_validator.rb
Overview
Validates X.509 certificates for trust and validity.
This class performs two types of validation:
- Validity period — Checks the certificate is not expired and not yet valid
- Chain validation — Verifies the certificate chain against a trust store
Validity period checking is enabled by default and runs first (fast, no I/O). Chain validation only runs if a trust store is provided.
Constant Summary
Constants inherited from Base
Base::SOAPNS, Base::SOAP_NAMESPACES, Base::SecurityNS, Base::SignatureNS, Base::VALID_ID_PATTERN
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(certificate, trust_store: nil, check_validity: true, at_time: nil) ⇒ CertificateValidator
constructor
Creates a new certificate validator.
-
#valid? ⇒ Boolean
Validates the certificate.
Constructor Details
#initialize(certificate, trust_store: nil, check_validity: true, at_time: nil) ⇒ CertificateValidator
Creates a new certificate validator.
55 56 57 58 59 60 61 |
# File 'lib/wsdl/security/verifier/certificate_validator.rb', line 55 def initialize(certificate, trust_store: nil, check_validity: true, at_time: nil) super() @certificate = certificate @trust_store = trust_store @check_validity = check_validity @at_time = at_time || Time.now end |
Instance Method Details
#valid? ⇒ Boolean
Validates the certificate.
Runs validity period checking first (if enabled), then chain validation (if a trust store is configured). Returns false on the first failure.
69 70 71 72 73 74 75 76 77 |
# File 'lib/wsdl/security/verifier/certificate_validator.rb', line 69 def valid? # Validity period first (fast, no I/O) return false if @check_validity && !validate_validity_period # Chain validation (if trust store configured) return false if @trust_store && !validate_chain true end |