class PkiExpress::SignatureAlgorithmAndValue
Attributes
algorithm[RW]
value[RW]
Public Class Methods
new(model)
click to toggle source
# File lib/pki_express/signature_algorithm_and_value.rb, line 5 def initialize(model) @algorithm = nil @value = nil algorithm_identifier = nil unless model.nil? value = model.fetch(:value) if value.nil? raise 'The value was not set' end @value = Base64.decode64(value).bytes algorithm_identifier = model.fetch(:algorithmIdentifier) if algorithm_identifier.nil? algorithm = model.fetch(:algorithm) unless algorithm.nil? @algorithm = DigestAlgorithm.get_instance_by_api_model(algorithm) end end end end
Public Instance Methods
hex_value()
click to toggle source
# File lib/pki_express/signature_algorithm_and_value.rb, line 27 def hex_value @value.map { |b| b.to_s(16).rjust(2,'0') }.join.upcase end
hex_value=(value)
click to toggle source
# File lib/pki_express/signature_algorithm_and_value.rb, line 31 def hex_value=(value) @value = [value].pack('H*').unpack('C*') end