class Rnp::Verify::Signature
Class representing an individual signature.
Attributes
creation_time[R]
The creation time of the signature @return [Time]
expiration_time[R]
The expiration (as the number of seconds after {creation_time}) @return [Integer]
hash[R]
The hash algorithm used for the signature @return [String]
key[R]
The key that created the signature @return [Key]
status[R]
@api private
Public Class Methods
new(ptr)
click to toggle source
@api private
# File lib/rnp/op/verify.rb, line 85 def initialize(ptr) # status @status = LibRnp.rnp_op_verify_signature_get_status(ptr) pptr = FFI::MemoryPointer.new(:pointer) # creation and expiration pcreation_time = FFI::MemoryPointer.new(:uint32) pexpiration_time = FFI::MemoryPointer.new(:uint32) Rnp.call_ffi(:rnp_op_verify_signature_get_times, ptr, pcreation_time, pexpiration_time) @creation_time = Time.at(pcreation_time.read(:uint32)) @expiration_time = pexpiration_time.read(:uint32) # hash Rnp.call_ffi(:rnp_op_verify_signature_get_hash, ptr, pptr) begin phash = pptr.read_pointer @hash = phash.read_string unless phash.null? ensure LibRnp.rnp_buffer_destroy(phash) end # key Rnp.call_ffi(:rnp_op_verify_signature_get_key, ptr, pptr) pkey = pptr.read_pointer @key = Key.new(pkey) unless pkey.null? end
Public Instance Methods
expired?()
click to toggle source
Check if this signature is expired.
@return [Boolean] true if the signature is expired
# File lib/rnp/op/verify.rb, line 133 def expired? @status == LibRnp::RNP_ERROR_SIGNATURE_EXPIRED end
good?()
click to toggle source
Check if this signature is good.
@return [Boolean] true if the signature is valid and not expired
# File lib/rnp/op/verify.rb, line 116 def good? @status == LibRnp::RNP_SUCCESS end
valid?()
click to toggle source
Check if this signature is valid.
@note A valid signature may also be expired.
@return [Boolean] true if the signature is valid
# File lib/rnp/op/verify.rb, line 125 def valid? @status == LibRnp::RNP_SUCCESS || @status == LibRnp::RNP_ERROR_SIGNATURE_EXPIRED end