Class: TencentTrustsql::IOFormatter::Output

Inherits:
Object
  • Object
show all
Defined in:
lib/tencent_trustsql/i_o_formatter/output.rb

Instance Method Summary collapse

Instance Method Details

#out_private_key(private_key) ⇒ Object



10
11
12
13
14
# File 'lib/tencent_trustsql/i_o_formatter/output.rb', line 10

def out_private_key private_key
  hex = private_key.to_s(16)
  hex_string = [].push(hex).pack('H*')
  Base64.encode64(hex_string).gsub(/[\n]/, '')
end

#out_public_key(public_key) ⇒ Object



5
6
7
8
# File 'lib/tencent_trustsql/i_o_formatter/output.rb', line 5

def out_public_key public_key
  public_key_string = ECDSA::Format::PointOctetString.encode(public_key, compression: true)
  Base64.encode64(public_key_string).gsub(/[\n]/, '')
end

#out_sign(signature) ⇒ Object



16
17
18
19
# File 'lib/tencent_trustsql/i_o_formatter/output.rb', line 16

def out_sign signature
  signature_der_string = ECDSA::Format::SignatureDerString.encode(signature)
  Base64.encode64(signature_der_string).gsub(/[\n]/, '')
end