Module: Rubrik::Sign

Extended by:
T::Sig
Defined in:
lib/rubrik/sign.rb

Class Method Summary collapse

Class Method Details

.call(input, output, private_key:, certificate:, certificate_chain: []) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rubrik/sign.rb', line 15

def self.call(input, output, private_key:, certificate:, certificate_chain: [])
  input.binmode
  output.reopen(T.unsafe(output), "wb+") if !output.is_a?(StringIO)

  document = Rubrik::Document.new(input)

  signature_value_ref = document.add_signature_field

  Document::Increment.call(document, io: output)

  FillSignature.call(output, signature_value_ref:, private_key:, certificate:, certificate_chain:)
end