Class: Moxml::Signature::KeyExtractor
- Inherits:
-
Object
- Object
- Moxml::Signature::KeyExtractor
- Defined in:
- lib/moxml/signature/key_extractor.rb
Overview
Extracts an OpenSSL verification key from a Model::KeyInfo.
Strategy (per spec ยง4.5): X509Certificate is preferred for key reconstruction because it carries the certified binding. Falls back to RSAKeyValue / DSAKeyValue / ECKeyValue if no certificate is present. KeyName is resolved via an application-supplied key map.
Instance Attribute Summary collapse
-
#cert_store ⇒ Object
readonly
Returns the value of attribute cert_store.
-
#key_map ⇒ Object
readonly
Returns the value of attribute key_map.
Instance Method Summary collapse
- #extract(key_info) ⇒ Object
-
#initialize(key_map: {}, cert_store: nil) ⇒ KeyExtractor
constructor
A new instance of KeyExtractor.
Constructor Details
#initialize(key_map: {}, cert_store: nil) ⇒ KeyExtractor
Returns a new instance of KeyExtractor.
17 18 19 20 |
# File 'lib/moxml/signature/key_extractor.rb', line 17 def initialize(key_map: {}, cert_store: nil) @key_map = key_map || {} @cert_store = cert_store end |
Instance Attribute Details
#cert_store ⇒ Object (readonly)
Returns the value of attribute cert_store.
15 16 17 |
# File 'lib/moxml/signature/key_extractor.rb', line 15 def cert_store @cert_store end |
#key_map ⇒ Object (readonly)
Returns the value of attribute key_map.
15 16 17 |
# File 'lib/moxml/signature/key_extractor.rb', line 15 def key_map @key_map end |
Instance Method Details
#extract(key_info) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/moxml/signature/key_extractor.rb', line 22 def extract(key_info) return nil if key_info.nil? from_x509_data(key_info.x509_data) || from_key_value(key_info.key_value) || from_key_name(key_info.key_name) end |