class RestPki::CadesSignatureFinisher
Public Class Methods
new(restpki_client)
click to toggle source
Calls superclass method
# File lib/rest_pki/cades_signature_finisher.rb, line 5 def initialize(restpki_client) super(restpki_client) @cms = nil end
Public Instance Methods
cms()
click to toggle source
# File lib/rest_pki/cades_signature_finisher.rb, line 30 def cms unless @done raise 'The field "cms" can only be accessed after calling the finish method' end @cms end
finish()
click to toggle source
# File lib/rest_pki/cades_signature_finisher.rb, line 10 def finish if @token.to_s.blank? raise 'The token was not set' end if @signature.to_s.blank? response = @restpki_client.post("Api/CadesSignatures/#{@token}/Finalize", nil, 'cades_model') else request = { signature: @signature } response = @restpki_client.post("Api/CadesSignatures/#{@token}/SignedBytes", request, 'cades_model') end @cms = Base64.decode64(response['cms']) @callback_argument = response['callbackArgument'] @certificate_info = response['certificate'] @done = true @cms end
write_cms_to_path(path)
click to toggle source
# File lib/rest_pki/cades_signature_finisher.rb, line 38 def write_cms_to_path(path) unless @done raise 'The method write_cms_to_path can only be called after calling the finish method' end file = File.open(path, 'wb') file.write(@cms) file.close end