Module: CcipherFactory::AsymKeySigner::ECCAttVerifier

Includes:
Common, Compression::CompressionHelper
Defined in:
lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_verifier.rb

Instance Method Summary collapse

Methods included from Compression::CompressionHelper

#compress_data_if_active, #compression_off, #compression_on, #compressor, #decompress_data_if_active, #decompressor, #decompressor_from_encoded, #encode_null_compressor, #is_compression_on?

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 Method Details

#att_verify_finalObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_verifier.rb', line 74

def att_verify_final

  res = @ver.verify_final

  if is_output_given?
    intOutputFile.rewind
    while not intOutputFile.eof?
      write_to_output(intOutputFile.read)
    end
  end

  disposeOutput(intOutputFile)
  res

end

#att_verify_init(*args, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_verifier.rb', line 19

def att_verify_init(*args, &block)

  @params = args

  if block
    instance_eval(&block)
    att_verify_final
  else
    self
  end

end

#att_verify_update(val) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_verifier.rb', line 32

def att_verify_update(val)

  if @ver.nil?

    intOutputBuf.write(val)
    begin
      Encoding.extract_meta(intOutputBuf) do |meta, bal|

        ts = BinStruct.instance.struct_from_bin(meta)
        smeta = ts.ecc_signature
        compression = ts.compression

        decompressor_from_encoded(compression)
        if is_compression_on?
          logger.tdebug :ecc_att_ver, "Compression on"
        else
          logger.tdebug :ecc_att_ver, "No compression"
        end

        @ver = AsymKeySigner.verifier
        @ver.output(@output) if is_output_given?

        @ver.verify_init(*@params)
        @ver.verify_update_meta(smeta)

        att_verify_update(bal) if bal.length > 0

        disposeOutput(intOutputBuf)

      end
    rescue Encoding::InsufficientData
    end

  else
    logger.tdebug :ecc_att_ver, "Compressed size : #{val.length}" if is_compression_on?
    res = decompress_data_if_active(val) 
    @ver.verify_update_data(res)
    intOutputFile.write(res)
  end

end

#embedded_signerObject



11
12
13
14
15
16
17
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_verifier.rb', line 11

def embedded_signer
  if not_empty?(@ver)
    @ver.embedded_signer
  else
    nil
  end
end

#loggerObject



90
91
92
93
94
95
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_verifier.rb', line 90

def logger
  if @logger.nil?
    @logger = Tlogger.new
  end
  @logger
end