Class: RestPki::FullXmlSignatureStarter

Inherits:
XmlSignatureStarter show all
Defined in:
lib/rest_pki/full_xml_signature_starter.rb

Instance Attribute Summary

Attributes inherited from SignatureStarter

#callback_argument, #ignore_revocation_status_unknown, #security_context_id, #signature_policy_id

Instance Method Summary collapse

Methods inherited from XmlSignatureStarter

#set_signature_element_location, #set_xml_content_tosign, #set_xml_file_tosign, #set_xml_tosign_from_base64, #set_xml_tosign_from_path, #set_xml_tosign_from_raw

Methods inherited from SignatureStarter

#certificate, #signer_certificate=, #signer_certificate_base64=

Constructor Details

#initialize(restpki_client) ⇒ FullXmlSignatureStarter

Returns a new instance of FullXmlSignatureStarter.



4
5
6
# File 'lib/rest_pki/full_xml_signature_starter.rb', line 4

def initialize(restpki_client)
    super(restpki_client)
end

Instance Method Details

#startObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rest_pki/full_xml_signature_starter.rb', line 26

def start
    verify_common_parameters(true)
    if @xml_content_base64.to_s.blank?
        raise 'The XML to sign was not set'
    end

    request = get_request

    response = @restpki_client.post('Api/XmlSignatures/FullXmlSignature', request, 'xml_model')

    unless response['certificate'].nil?
        @certificate = response['certificate']
    end
    @done = true

    {
        :token => response['token'],
        :to_sign_data => response['toSignData'],
        :to_sign_hash => response['toSignHash'],
        :digest_algorithm_oid => response['digestAlgorithmOid'],
        :signature_algorithm => get_signature_algorithm(response['digestAlgorithmOid'])
    }
end

#start_with_webpkiObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rest_pki/full_xml_signature_starter.rb', line 8

def start_with_webpki
    verify_common_parameters(true)
    if @xml_content_base64.to_s.blank?
        raise 'The XML to sign was not set'
    end

    request = get_request

    response = @restpki_client.post('Api/XmlSignatures/FullXmlSignature', request, 'xml_model')

    unless response['certificate'].nil?
        @certificate = response['certificate']
    end
    @done = true

    response['token']
end