Module: CcipherFactory::AsymKeyCipher::ECCAttDecrypt

Includes:
Common
Defined in:
lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Common

#attach_mode, #cleanup_intOutputBuf, #cleanup_intOutputFile, #detach_mode, #disposeOutput, #intOutputBuf, #intOutputFile, #is_attach_mode?, #is_output_given?, #output, #output_obj, #sanitize_symbol, #write_to_output

Instance Attribute Details

#decryption_keyObject

Returns the value of attribute decryption_key.



8
9
10
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb', line 8

def decryption_key
  @decryption_key
end

Instance Method Details

#att_decrypt_finalObject



47
48
49
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb', line 47

def att_decrypt_final
  @dec.decrypt_final 
end

#att_decrypt_init(opts = { }, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb', line 9

def att_decrypt_init(opts = { }, &block)

  if block
    instance_eval(&block)
    att_decrypt_final
  else
    self
  end

end

#att_decrypt_update(val) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb', line 20

def att_decrypt_update(val)

  if @dec.nil?
    intOutputBuf.write(val)
    begin
      Encoding.extract_meta(intOutputBuf) do |meta, bal|

        @dec = AsymKeyCipher.decryptor(:ecc)
        @dec.output(@output)
        @dec.decryption_key = @decryption_key
        @dec.decrypt_init
        @dec.decrypt_update_meta(meta)

        att_decrypt_update(bal) if bal.length > 0

        intOutputBuf.rewind
        intOutputBuf = nil

      end
    rescue Encoding::InsufficientData => e
    end

  else
    @dec.decrypt_update_cipher(val)
  end
end