Module: Pdfrb::DigitalSignature

Defined in:
lib/pdfrb/digital_signature.rb,
lib/pdfrb/digital_signature/handler.rb,
lib/pdfrb/digital_signature/signing.rb,
lib/pdfrb/digital_signature/cms_handler.rb,
lib/pdfrb/digital_signature/verification.rb,
lib/pdfrb/digital_signature/timestamp_client.rb,
lib/pdfrb/digital_signature/timestamp_handler.rb,
lib/pdfrb/digital_signature/verification_result.rb

Overview

Digital signatures (s12.8). PKCS#7 detached signing + verification against a cert + private key pair. CMS handler is the default adbe.pkcs7.detached subfilter.

Defined Under Namespace

Modules: CmsHandler, Handler, Signing, TimestampClient, TimestampHandler, Verification Classes: VerificationResult

Class Method Summary collapse

Class Method Details

.handler_for(sub_filter) ⇒ Object

Resolve the handler class for sub_filter. Constant references live inside the case so the autoloads above defer loading the handlers (and their OpenSSL surface) until an actual sign/verify call needs them.



22
23
24
25
26
27
# File 'lib/pdfrb/digital_signature.rb', line 22

def handler_for(sub_filter)
  case sub_filter.to_sym
  when :"adbe.pkcs7.detached", :"adbe.pkcs7.sha1" then CmsHandler
  when :"adbe.revision" then TimestampHandler
  end
end

.sign(document, cert:, key:) ⇒ Object



29
30
31
# File 'lib/pdfrb/digital_signature.rb', line 29

def sign(document, cert:, key:, **)
  Handler.sign(document, cert: cert, key: key, **)
end

.verify(document, trusted_certs: []) ⇒ Object



33
34
35
# File 'lib/pdfrb/digital_signature.rb', line 33

def verify(document, trusted_certs: [])
  Handler.verify(document, trusted_certs: trusted_certs)
end