Sha256: 35c8c6d5153335b36a7e52fa4e23a0e64cd1c0434f8ad562b2a5e1c8594eb8f3

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents


module CcipherFactory
  module AsymKeyCipher
    module ECCAttDecrypt
      include Common

      attr_accessor :decryption_key 
      def att_decrypt_init(opts = { }, &block)

        if block
          instance_eval(&block)
          att_decrypt_final
        else
          self
        end

      end

      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

      def att_decrypt_final
        @dec.decrypt_final 
      end

    end
  end
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ccipher_factory-0.1.2 lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb
ccipher_factory-0.1.1 lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb
ccipher_factory-0.1.0 lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_decrypt.rb