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

- old
+ new

@@ -239,18 +239,22 @@ result << sym if dict[:P] & perm == perm end end def decrypt(obj) #:nodoc: - if obj.type == :Metadata && obj == document.catalog.value[:Metadata] && !dict[:EncryptMetadata] + if dict[:V] >= 4 && obj.type == :Metadata && obj[:Subtype] == :XML && !dict[:EncryptMetadata] obj else super end end def encrypt_stream(obj) #:nodoc - obj == document.catalog.value[:Metadata] && !dict[:EncryptMetadata] ? obj.stream_encoder : super + if dict[:V] >= 4 && obj.type == :Metadata && obj[:Subtype] == :XML && !dict[:EncryptMetadata] + obj.stream_encoder + else + super + end end private # Prepares the security handler for use in encrypting the document.