Class: ZATCA::UBL::Signing::SignedProperties

Inherits:
BaseComponent show all
Defined in:
lib/zatca/ubl/signing/signed_properties.rb

Constant Summary

Constants inherited from BaseComponent

BaseComponent::ArrayOfBaseComponentOrNil

Instance Attribute Summary

Attributes inherited from BaseComponent

#index, #value

Instance Method Summary collapse

Methods inherited from BaseComponent

#[], build, #build_xml, #dig, #find_nested_element_by_path, #generate_xml, #schema, #to_h, #to_xml

Constructor Details

#initialize(signing_time:, cert_digest_value:, cert_issuer_name:, cert_serial_number:) ⇒ SignedProperties

Returns a new instance of SignedProperties.



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/zatca/ubl/signing/signed_properties.rb', line 2

def initialize(
  signing_time:,
  cert_digest_value:,
  cert_issuer_name:,
  cert_serial_number:
)
  super()

  @signing_time = signing_time
  @cert_digest_value = cert_digest_value
  @cert_issuer_name = cert_issuer_name
  @cert_serial_number = cert_serial_number
end

Instance Method Details

#attributesObject



20
21
22
23
24
# File 'lib/zatca/ubl/signing/signed_properties.rb', line 20

def attributes
  {
    "Id" => "xadesSignedProperties"
  }
end

#elementsObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/zatca/ubl/signing/signed_properties.rb', line 26

def elements
  [
    ZATCA::UBL::Signing::SignedSignatureProperties.new(
      signing_time: @signing_time,
      cert_digest_value: @cert_digest_value,
      cert_issuer_name: @cert_issuer_name,
      cert_serial_number: @cert_serial_number
    )
  ]
end

#generate_hashObject



37
38
39
# File 'lib/zatca/ubl/signing/signed_properties.rb', line 37

def generate_hash
  ZATCA::Hashing.generate_hashes(zatca_whitespaced_xml_for_hashing)[:hexdigest_base64]
end

#nameObject



16
17
18
# File 'lib/zatca/ubl/signing/signed_properties.rb', line 16

def name
  "xades:SignedProperties"
end