class HexaPDF::Encryption::EncryptionDictionary
Base class for all encryption dictionaries.
Contains entries common to all encryption dictionaries. If a specific security handler needs further fields it should derive a new subclass and add the new fields there.
See: PDF1.7 s7.6.1
Public Instance Methods
must_be_indirect?()
click to toggle source
Returns true
because some PDF readers stumble when encountering a non-indirect encryption dictionary.
# File lib/hexapdf/encryption/security_handler.rb, line 63 def must_be_indirect? true end
Private Instance Methods
perform_validation() { |"Value of /V is not one of 1, 2, 4 or 5", false| ... }
click to toggle source
Ensures that the encryption dictionary's content is valid.
Calls superclass method
HexaPDF::Dictionary#perform_validation
# File lib/hexapdf/encryption/security_handler.rb, line 70 def perform_validation super unless [1, 2, 4, 5].include?(value[:V]) yield("Value of /V is not one of 1, 2, 4 or 5", false) return end if value[:V] == 2 && (!key?(:Length) || value[:Length] < 40 || value[:Length] > 128 || value[:Length] % 8 != 0) yield("Invalid value for /Length field when /V is 2", false) end end