Method: PDF::Reader::SecurityHandlerFactory.standard?

Defined in:
lib/pdf/reader/security_handler_factory.rb

.standard?(encrypt) ⇒ Boolean

This handler supports all encryption that follows upto PDF 1.5 spec (revision 4)

Returns:

  • (Boolean)


55
56
57
58
59
60
61
62
63
# File 'lib/pdf/reader/security_handler_factory.rb', line 55

def self.standard?(encrypt)
  return false if encrypt.nil?

  filter = encrypt.fetch(:Filter, :Standard)
  version = encrypt.fetch(:V, 0)
  algorithm = encrypt.fetch(:CF, {}).fetch(encrypt[:StmF], {}).fetch(:CFM, nil)
  (filter == :Standard) && (encrypt[:StmF] == encrypt[:StrF]) &&
    (version <= 3 || (version == 4 && ((algorithm == :V2) || (algorithm == :AESV2))))
end