Class: XmlSig::SignatureMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/xml_sig/signature_method.rb

Overview

SignatureMethod is a required element that specifies the algorithm used for signature generation and validation. This algorithm identifies all cryptographic functions involved in the signature operation (e.g. hashing, public key algorithms, MACs, padding, etc.).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#algorithmObject

Returns the value of attribute algorithm.



7
8
9
# File 'lib/xml_sig/signature_method.rb', line 7

def algorithm
  @algorithm
end

Instance Method Details

#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object



13
14
15
16
17
18
# File 'lib/xml_sig/signature_method.rb', line 13

def to_xml(xml=Builder::XmlMarkup.new)
  attributes = {'Algorightm' => algorithm}
  xml.tag!('ds:SignatureMethod', attributes) {
    xml.tag!('ds:HMACOutputLength', hmac_output_length) unless hmac_output_length.nil?
  }
end

#validateObject

Raises:

  • (ValidationError)


9
10
11
# File 'lib/xml_sig/signature_method.rb', line 9

def validate
  raise ValidationError, "Algorithm is required" if algorithm.nil?
end