lib/hexapdf/encryption/standard_security_handler.rb in hexapdf-0.15.1 vs lib/hexapdf/encryption/standard_security_handler.rb in hexapdf-0.15.2

- old
+ new

@@ -238,9 +238,21 @@ Permissions::PERMISSION_TO_SYMBOL.each_with_object([]) do |(perm, sym), result| result << sym if dict[:P] & perm == perm end end + def decrypt(obj) #:nodoc: + if obj.type == :Metadata && obj == document.catalog.value[:Metadata] && !dict[:EncryptMetadata] + obj + else + super + end + end + + def encrypt_stream(obj) #:nodoc + obj == document.catalog.value[:Metadata] && !dict[:EncryptMetadata] ? obj.stream_encoder : super + end + private # Prepares the security handler for use in encrypting the document. # # See the attributes of the EncryptionOptions class for all possible arguments.