lib/combine_pdf/decrypt.rb in combine_pdf-1.0.26 vs lib/combine_pdf/decrypt.rb in combine_pdf-1.0.27
- old
+ new
@@ -1,6 +1,7 @@
# -*- encoding : utf-8 -*-
+# frozen_string_literal: true
########################################################
## Thoughts from reading the ISO 32000-1:2008
## this file is part of the CombinePDF library and the code
## is subject to the same license.
########################################################
@@ -135,10 +136,10 @@
def decrypt_AES(encrypted, encrypted_id, encrypted_generation, _encrypted_filter)
## start decryption using padding strings
object_key = @key.dup
object_key << [encrypted_id].pack('i')[0..2]
object_key << [encrypted_generation].pack('i')[0..1]
- object_key << 'sAlT'.force_encoding(Encoding::ASCII_8BIT)
+ object_key << 'sAlT'.b
key_length = object_key.length < 16 ? object_key.length : 16
begin
cipher = OpenSSL::Cipher.new("aes-#{key_length << 3}-cbc")
cipher.decrypt