Class: Facturae::Xades::KeyInfo
- Inherits:
-
Object
- Object
- Facturae::Xades::KeyInfo
- Includes:
- Utils
- Defined in:
- lib/facturae/xades/key_info.rb
Overview
Builds the KeyInfo element in XML signatures.
Constant Summary collapse
- NAMESPACES =
{ "ds" => "http://www.w3.org/2000/09/xmldsig#", "xades" => "http://uri.etsi.org/01903/v1.3.2#" }.freeze
Instance Method Summary collapse
-
#build ⇒ Object
-
#initialize(doc, certificate, signing_ids) ⇒ KeyInfo
constructor
A new instance of KeyInfo.
Methods included from Utils
#base64_encode, #base64_encode_raw, #calculate_sha512_digest, #create_xml_element, #create_xml_node_with_algorithm, #rand_id
Constructor Details
#initialize(doc, certificate, signing_ids) ⇒ KeyInfo
Returns a new instance of KeyInfo.
14 15 16 17 18 |
# File 'lib/facturae/xades/key_info.rb', line 14 def initialize(doc, certificate, signing_ids) @doc = doc @certificate = certificate @certificate_id = signing_ids[:certificate_id] || "Certificate#{rand_id}" end |
Instance Method Details
#build ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/facturae/xades/key_info.rb', line 20 def build key_info = create_xml_element(@doc, "ds:KeyInfo", nil, { "Id" => @certificate_id }) key_info.add_child(build_x509_data) key_info.add_child(build_key_value) key_info end |