Class: HexaPDF::Type::Signature::Handler
- Inherits:
-
Object
- Object
- HexaPDF::Type::Signature::Handler
- Defined in:
- lib/hexapdf/type/signature/handler.rb
Overview
The base signature handler providing common functionality.
Specific signature handler need to override methods if necessary and implement the needed ones that don't have a default implementation.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#signature_dict ⇒ Object
readonly
The signature dictionary used by the handler.
Instance Method Summary collapse
-
#certificate_chain ⇒ Object
Returns the certificate chain.
-
#initialize(signature_dict) ⇒ Handler
constructor
Creates a new signature handler for the given signature dictionary.
-
#signer_certificate ⇒ Object
Returns the certificate used for signing.
-
#signer_name ⇒ Object
Returns the common name of the signer (/Name field of the signature dictionary).
-
#signing_time ⇒ Object
Returns the time of signing (/M field of the signature dictionary).
-
#verify(store, allow_self_signed: false) ⇒ Object
Verifies general signature properties and prepares the provided OpenSSL::X509::Store object for use by concrete implementations.
Constructor Details
#initialize(signature_dict) ⇒ Handler
Creates a new signature handler for the given signature dictionary.
53 54 55 |
# File 'lib/hexapdf/type/signature/handler.rb', line 53 def initialize(signature_dict) @signature_dict = signature_dict end |
Instance Attribute Details
#signature_dict ⇒ Object (readonly)
The signature dictionary used by the handler.
50 51 52 |
# File 'lib/hexapdf/type/signature/handler.rb', line 50 def signature_dict @signature_dict end |
Instance Method Details
#certificate_chain ⇒ Object
Returns the certificate chain.
Needs to be implemented by specific handlers.
70 71 72 |
# File 'lib/hexapdf/type/signature/handler.rb', line 70 def certificate_chain raise "Needs to be implemented by specific handlers" end |
#signer_certificate ⇒ Object
Returns the certificate used for signing.
Needs to be implemented by specific handlers.
77 78 79 |
# File 'lib/hexapdf/type/signature/handler.rb', line 77 def signer_certificate raise "Needs to be implemented by specific handlers" end |
#signer_name ⇒ Object
Returns the common name of the signer (/Name field of the signature dictionary).
58 59 60 |
# File 'lib/hexapdf/type/signature/handler.rb', line 58 def signer_name @signature_dict[:Name] end |
#signing_time ⇒ Object
Returns the time of signing (/M field of the signature dictionary).
63 64 65 |
# File 'lib/hexapdf/type/signature/handler.rb', line 63 def signing_time @signature_dict[:M] end |
#verify(store, allow_self_signed: false) ⇒ Object
Verifies general signature properties and prepares the provided OpenSSL::X509::Store object for use by concrete implementations.
Needs to be called by specific handlers.
85 86 87 88 89 90 91 92 |
# File 'lib/hexapdf/type/signature/handler.rb', line 85 def verify(store, allow_self_signed: false) result = VerificationResult.new check_certified_signature(result) verify_signing_time(result) store.verify_callback = store_verification_callback(result, allow_self_signed: allow_self_signed) result end |