Module: CcipherFactory::AsymKeySigner::ECCAttSigner
Instance Attribute Summary collapse
Instance Method Summary
collapse
#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 Attribute Details
#signing_key ⇒ Object
Returns the value of attribute signing_key.
12
13
14
|
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_signer.rb', line 12
def signing_key
@signing_key
end
|
Instance Method Details
#att_sign_final ⇒ Object
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
73
74
75
76
|
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_signer.rb', line 46
def att_sign_final
meta = @signer.sign_final
ts = BinStruct.instance.struct(:ecc_att_sign)
ts.ecc_signature = meta
if is_compression_on?
ts.compression = compressor.compress_final
else
ts.compression = encode_null_compressor
end
smeta = ts.encoded
write_to_output(smeta)
intOutputFile.rewind
while not intOutputFile.eof?
write_to_output(intOutputFile.read)
end
disposeOutput(intOutputFile)
logger.tdebug :ecc_att_sign, "Total Plain : #{@totalPlain} / Total Compressed : #{@totalCompressed} = #{(@totalCompressed*1.0)/@totalPlain*100} %" if is_compression_on?
smeta
end
|
#att_sign_init(*args, &block) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_signer.rb', line 13
def att_sign_init(*args, &block)
@signer = AsymKeySigner.signer
@signer.signing_key = @signing_key
@signer.sign_init(*args)
@totalPlain = 0
@totalCompressed = 0
if block
instance_eval(&block)
att_sign_final
else
self
end
end
|
#att_sign_update(val) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_signer.rb', line 32
def att_sign_update(val)
raise ECCSignerError, "Output is required for attached sign with ECC" if not is_output_given?
@totalPlain += val.length
@signer.sign_update(val)
res = compress_data_if_active(val)
intOutputFile.write(res)
@totalCompressed += res.length
res
end
|
#logger ⇒ Object
78
79
80
81
82
83
|
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_att_signer.rb', line 78
def logger
if @logger.nil?
@logger = Tlogger.new
end
@logger
end
|