Method: Ccrypto::Ruby::CipherEngine#final

Defined in:
lib/ccrypto/ruby/engines/cipher_engine.rb

#final(val = nil) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/ccrypto/ruby/engines/cipher_engine.rb', line 142

def final(val = nil)
  res = []

  begin

    if not_empty?(val)
      res << @cipher.update(val)
    end

    res << @cipher.final

  rescue Exception => ex
    raise CipherEngineException, ex
  end

  if @spec.is_mode?(:gcm) and @spec.is_encrypt_cipher_mode?
    @spec.auth_tag = @cipher.auth_tag 
  end

  res.join
end