lib/hexapdf/encryption/security_handler.rb in hexapdf-0.32.0 vs lib/hexapdf/encryption/security_handler.rb in hexapdf-0.32.1
- old
+ new
@@ -356,10 +356,10 @@
5
else
raise(HexaPDF::UnsupportedEncryptionError,
"Invalid key length #{key_length} specified")
end
- dict[:Length] = key_length if dict[:V] == 2
+ dict[:Length] = key_length if dict[:V] == 4 || dict[:V] == 2
if ![:aes, :arc4].include?(algorithm)
raise(HexaPDF::UnsupportedEncryptionError,
"Unsupported encryption algorithm: #{algorithm}")
elsif key_length < 128 && algorithm == :aes