Class: Moxml::Signature::Algorithms::TransformBase

Inherits:
Object
  • Object
show all
Defined in:
lib/moxml/signature/algorithms/transform_base.rb

Overview

Base class for XML Signature transforms.

Each transform declares input and output types (:octets or :nodeset) plus an identifier URI. The reference resolver chains them with default type conversion when types mismatch (octets → nodeset via XML parse; nodeset → octets via inclusive C14N 1.0).

Direct Known Subclasses

Base64Transform, EnvelopedSignatureTransform

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parameters: nil, context: nil, signature_element: nil) ⇒ TransformBase

parameters: optional hash parsed from the ds:Transform element (e.g. { xpaths: [...] } for the XPath Filter transform).



27
28
29
30
31
# File 'lib/moxml/signature/algorithms/transform_base.rb', line 27

def initialize(parameters: nil, context: nil, signature_element: nil)
  @parameters = parameters || {}
  @context = context
  @signature_element = signature_element
end

Class Attribute Details

.identifier_uriObject (readonly)

Returns the value of attribute identifier_uri.



14
15
16
# File 'lib/moxml/signature/algorithms/transform_base.rb', line 14

def identifier_uri
  @identifier_uri
end

Class Method Details

.identifier(uri) ⇒ Object



16
17
18
19
# File 'lib/moxml/signature/algorithms/transform_base.rb', line 16

def identifier(uri)
  @identifier_uri = uri
  Algorithms.register(:transform, uri, self)
end

.input_typeObject



21
# File 'lib/moxml/signature/algorithms/transform_base.rb', line 21

def input_type; :octets; end

.output_typeObject



22
# File 'lib/moxml/signature/algorithms/transform_base.rb', line 22

def output_type; :octets; end

Instance Method Details

#transform(_input) ⇒ Object



33
34
35
36
# File 'lib/moxml/signature/algorithms/transform_base.rb', line 33

def transform(_input)
  raise NotImplementedError,
        "#{self.class} must implement #transform"
end