lib/hexapdf/encryption/fast_aes.rb in hexapdf-0.32.2 vs lib/hexapdf/encryption/fast_aes.rb in hexapdf-0.33.0
- old
+ new
@@ -46,11 +46,11 @@
# Since OpenSSL is a native Ruby extension (that comes bundled with Ruby) it is much faster
# than the pure Ruby version and it can use the AES-NI instruction set on CPUs when available.
#
# This implementation is using AES in Cipher Block Chaining (CBC) mode.
#
- # See: PDF1.7 s7.6.2
+ # See: PDF2.0 s7.6.3
class FastAES
prepend AES
# Uses OpenSSL to generate the requested random bytes.
@@ -66,10 +66,10 @@
def initialize(key, iv, mode)
@cipher = OpenSSL::Cipher.new("AES-#{key.length << 3}-CBC")
@cipher.send(mode)
@cipher.key = key
@cipher.iv = iv
- @cipher.padding = 0
+ @cipher.padding = 0 # Padding handled by HexaPDF, also no @cipher.final call needed
end
# Encrypts or decrypts the given data whose length must be a multiple of 16.
def process(data)
@cipher.update(data)