Module: CcipherFactory::AsymKeySigner::ECCVerifier

Includes:
Common
Defined in:
lib/ccipher_factory/asymkey_cipher/ecc/ecc_verifier.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

#embedded_signerObject (readonly)

Returns the value of attribute embedded_signer.



10
11
12
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_verifier.rb', line 10

def embedded_signer
  @embedded_signer
end

#verification_keyObject

Returns the value of attribute verification_key.



9
10
11
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_verifier.rb', line 9

def verification_key
  @verification_key
end

Instance Method Details

#verify_finalObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_verifier.rb', line 41

def verify_final

  @digest.digest_final
  
  res = Ccrypto::AlgoFactory.engine(Ccrypto::ECCConfig).verify(@signer, intOutputBuf.bytes, @sign)
  
  #res = @signer.dsa_verify_asn1(intOutputBuf.string, @sign)

  res

end

#verify_init(*args, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_verifier.rb', line 11

def verify_init(*args, &block)

  if block
    instance_eval(&block)
    verify_final
  else
    self
  end

end

#verify_update_data(data) ⇒ Object



37
38
39
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_verifier.rb', line 37

def verify_update_data(data)
  @digest.digest_update(data) 
end

#verify_update_meta(meta) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ccipher_factory/asymkey_cipher/ecc/ecc_verifier.rb', line 22

def verify_update_meta(meta)

  ts = BinStruct.instance.struct_from_bin(meta)
  digInfo = ts.digest_info
  sigInfo = ts.signer_info
  @sign = ts.signature

  @digest = Digest.from_encoded(digInfo)
  @digest.output(intOutputBuf)

  @signer = KeyPair::ECCKeyPair.from_signer_info(sigInfo)
  @embedded_signer = @signer

end