Class: Rnp::Verify
- Inherits:
-
Object
- Object
- Rnp::Verify
- Defined in:
- lib/rnp/op/verify.rb
Overview
Verification operation
Defined Under Namespace
Classes: Signature
Instance Attribute Summary collapse
- #ptr ⇒ Object readonly private
Class Method Summary collapse
- .destroy(ptr) ⇒ Object private
Instance Method Summary collapse
-
#execute ⇒ void
Execute the operation.
-
#good? ⇒ Boolean
Check if all signatures are good.
-
#initialize(ptr) ⇒ Verify
constructor
private
A new instance of Verify.
- #inspect ⇒ Object
-
#signatures ⇒ Array<Signature>
Get a list of the checked signatures.
Constructor Details
#initialize(ptr) ⇒ Verify
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Verify.
18 19 20 21 22 |
# 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 |
Instance Attribute Details
#ptr ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/rnp/op/verify.rb', line 15 def ptr @ptr end |
Class Method Details
.destroy(ptr) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/rnp/op/verify.rb', line 25 def self.destroy(ptr) LibRnp.rnp_op_verify_destroy(ptr) end |
Instance Method Details
#execute ⇒ void
This method returns an undefined value.
Execute the operation.
This should only be called once.
40 41 42 |
# File 'lib/rnp/op/verify.rb', line 40 def execute Rnp.call_ffi(:rnp_op_verify_execute, @ptr) end |
#good? ⇒ Boolean
Check if all signatures are good.
47 48 49 50 |
# File 'lib/rnp/op/verify.rb', line 47 def good? sigs = signatures sigs.size && sigs.all?(&:good?) end |
#inspect ⇒ Object
29 30 31 |
# File 'lib/rnp/op/verify.rb', line 29 def inspect Rnp.inspect_ptr(self) end |
#signatures ⇒ Array<Signature>
Get a list of the checked signatures.
55 56 57 58 59 60 61 62 63 64 65 |
# 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 |