class Rnp::Verify
Verification operation
Attributes
ptr[R]
@api private
Public Class Methods
destroy(ptr)
click to toggle source
@api private
# File lib/rnp/op/verify.rb, line 25 def self.destroy(ptr) LibRnp.rnp_op_verify_destroy(ptr) end
new(ptr)
click to toggle source
@api private
# File lib/rnp/op/verify.rb, line 18 def initialize(ptr) raise Rnp::Error, 'NULL pointer' if ptr.null? @ptr = FFI::AutoPointer.new(ptr, self.class.method(:destroy)) @signatures = nil end
Public Instance Methods
execute()
click to toggle source
Execute the operation.
This should only be called once.
@return [void] @raise [InvalidSignatureError, BadFormatError
, …] if the signature is
expired, not correctly formed, invalid, etc.
# File lib/rnp/op/verify.rb, line 40 def execute Rnp.call_ffi(:rnp_op_verify_execute, @ptr) end
good?()
click to toggle source
Check if all signatures are good.
@return [Boolean] true if all signatures are valid and not expired.
# File lib/rnp/op/verify.rb, line 47 def good? sigs = signatures sigs.size && sigs.all?(&:good?) end
inspect()
click to toggle source
# File lib/rnp/op/verify.rb, line 29 def inspect Rnp.inspect_ptr(self) end
signatures()
click to toggle source
Get a list of the checked signatures.
@return [Array<Signature>]
# File lib/rnp/op/verify.rb, line 55 def signatures return @signatures unless @signatures.nil? @signatures = [] pptr = FFI::MemoryPointer.new(:pointer) (0...signature_count).each do |i| Rnp.call_ffi(:rnp_op_verify_get_signature_at, @ptr, i, pptr) psig = pptr.read_pointer @signatures << Signature.new(psig) end @signatures end
Private Instance Methods
signature_count()
click to toggle source
# File lib/rnp/op/verify.rb, line 140 def signature_count pcount = FFI::MemoryPointer.new(:size_t) Rnp.call_ffi(:rnp_op_verify_get_signature_count, @ptr, pcount) pcount.read(:size_t) end