class RestPki::SignatureStarter

Attributes

callback_argument[RW]
ignore_revocation_status_unknown[RW]
security_context_id[RW]
signature_policy_id[RW]

Public Class Methods

new(restpki_client) click to toggle source
# File lib/rest_pki/signature_starter.rb, line 7
def initialize(restpki_client)
    @restpki_client = restpki_client
    @signer_certificate_base64 = nil
    @signature_policy_id = nil
    @security_context_id = nil
    @callback_argument = nil
    @done = false
    @certificate = nil
    @ignore_revocation_status_unknown = false
end

Public Instance Methods

certificate() click to toggle source
# File lib/rest_pki/signature_starter.rb, line 18
def certificate
    unless @done
        raise 'The field "certificate_info" can only be accessed after calling one of the start methods'
    end
    @certificate
end
signer_certificate=(content_raw) click to toggle source
# File lib/rest_pki/signature_starter.rb, line 29
def signer_certificate=(content_raw)
    @signer_certificate_base64 = Base64.encode64(content_raw)
end
signer_certificate_base64=(content_base64) click to toggle source
# File lib/rest_pki/signature_starter.rb, line 25
def signer_certificate_base64=(content_base64)
    @signer_certificate_base64 = content_base64
end
start() click to toggle source
# File lib/rest_pki/signature_starter.rb, line 37
def start
    raise "#{self.class.name}#start is an abstract method."
end
start_with_webpki() click to toggle source
# File lib/rest_pki/signature_starter.rb, line 33
def start_with_webpki
    raise "#{self.class.name}#start_with_webpki is an abstract method."
end

Protected Instance Methods

get_signature_algorithm(oid) click to toggle source
# File lib/rest_pki/signature_starter.rb, line 42
def get_signature_algorithm(oid)
    case oid
        when '1.2.840.113549.2.5'
            return OpenSSL::Digest::MD5.new
        when '1.3.14.3.2.26'
            return OpenSSL::Digest::SHA1.new
        when '2.16.840.1.101.3.4.2.1'
            return OpenSSL::Digest::SHA256.new
        when '2.16.840.1.101.3.4.2.2'
            return OpenSSL::Digest::SHA384.new
        when '2.16.840.1.101.3.4.2.3'
            return OpenSSL::Digest::SHA512.new
        else
            return nil
    end
end