Module: Pdfrb::Encryption

Defined in:
lib/pdfrb/encryption.rb,
lib/pdfrb/encryption/aes.rb,
lib/pdfrb/encryption/rc4.rb,
lib/pdfrb/encryption/identity.rb,
lib/pdfrb/encryption/security_handler.rb,
lib/pdfrb/encryption/password_verification.rb,
lib/pdfrb/encryption/standard_security_handler.rb

Overview

Encryption layer (s7.6). Security handlers own per-document key derivation and per-object (de)cryption. The Standard handler covers V1..V6 / R2..R6 (RC4 40-bit through AES-256).

The Crypt stream filter routes through the active handler; the Serializer accepts an encrypter slot set by the handler.

Defined Under Namespace

Modules: Identity, PasswordVerification Classes: AES, RC4, RC4Impl, SecurityHandler, StandardSecurityHandler

Class Method Summary collapse

Class Method Details

.handler_for(filter_name) ⇒ Object

Look up a registered security-handler subclass by /Filter name.



24
25
26
# File 'lib/pdfrb/encryption.rb', line 24

def handler_for(filter_name)
  SecurityHandler.lookup(filter_name)
end

.handler_for_document(document, **opts) ⇒ Object

Build a security handler for document by inspecting its /Encrypt. Returns nil if the document is not encrypted.



30
31
32
# File 'lib/pdfrb/encryption.rb', line 30

def handler_for_document(document, **opts)
  SecurityHandler.for(document, decryption_opts: opts)
end