Class: Ed25519Key
Instance Attribute Summary collapse
Instance Method Summary
collapse
account_hash_from_byte_to_hex, byte_hash
#account_hash, #get_public_key_hex, #get_signature_algorithm
Constructor Details
#initialize(public_key, private_key) ⇒ Ed25519Key
Returns a new instance of Ed25519Key.
9
10
11
|
# File 'lib/crypto/01_ed25519.rb', line 9
def initialize(public_key, private_key)
super(public_key, private_key, SignatureAlgorithm[:Ed25519])
end
|
Instance Attribute Details
#private_key_hex ⇒ Object
attr_reader :public_key, :private_key, :signature_algorithm
16
17
18
|
# File 'lib/crypto/ed25519_key.rb', line 16
def private_key_hex
@private_key_hex
end
|
#privKey ⇒ Object
attr_reader :public_key, :private_key, :signature_algorithm
16
17
18
|
# File 'lib/crypto/ed25519_key.rb', line 16
def privKey
@privKey
end
|
#public_key_hex ⇒ Object
attr_reader :public_key, :private_key, :signature_algorithm
16
17
18
|
# File 'lib/crypto/ed25519_key.rb', line 16
def public_key_hex
@public_key_hex
end
|
#signature_algorithm ⇒ Object
attr_reader :public_key, :private_key, :signature_algorithm
16
17
18
|
# File 'lib/crypto/ed25519_key.rb', line 16
def signature_algorithm
@signature_algorithm
end
|
Instance Method Details
#account_hex(public_key) ⇒ String
Generate the account_hex for the Ed25519 public key
35
36
37
|
# File 'lib/crypto/test_ed25519_key.rb', line 35
def account_hex(public_key)
'01' + Utils::Base16.encode16(public_key)
end
|
#create_from_private_key_file(private_key_path) ⇒ Object
115
116
117
|
# File 'lib/crypto/ed25519_key.rb', line 115
def create_from_private_key_file(path_to_private_key)
end
|
#export_private_key_in_pem ⇒ Object
48
49
|
# File 'lib/crypto/01_ed25519.rb', line 48
def export_private_key_in_pem
end
|
#export_public_key_in_pem ⇒ Object
51
52
|
# File 'lib/crypto/01_ed25519.rb', line 51
def export_public_key_in_pem
end
|
#get_public_key ⇒ Object
51
52
53
54
|
# File 'lib/crypto/ed25519_key.rb', line 51
def get_public_key
raise ArgumentError, "Expected a 64 character hex String" unless @public_key_hex.length == 64
return "01" + @public_key_hex
end
|
#load_keypair_from_private_file(private_key_path) ⇒ Object
63
64
|
# File 'lib/crypto/01_ed25519.rb', line 63
def load_keypair_from_private_file(private_key_path)
end
|
#parse_key(bytes, from, to) ⇒ Object
45
46
|
# File 'lib/crypto/01_ed25519.rb', line 45
def parse_key(bytes, from, to)
end
|
#parse_private_key(private_key) ⇒ Object
31
32
|
# File 'lib/crypto/01_ed25519.rb', line 31
def parse_private_key(bytes)
end
|
#parse_private_key_file(path) ⇒ Object
25
26
|
# File 'lib/crypto/01_ed25519.rb', line 25
def parse_private_key_file(path)
end
|
#parse_public_key(bytes) ⇒ Object
34
35
|
# File 'lib/crypto/01_ed25519.rb', line 34
def parse_public_key(bytes)
end
|
#parse_public_key_file(path) ⇒ Object
28
29
|
# File 'lib/crypto/01_ed25519.rb', line 28
def parse_public_key_file(path)
end
|
#private_to_public(private_key) ⇒ Object
60
61
|
# File 'lib/crypto/01_ed25519.rb', line 60
def private_to_public(private_key)
end
|
#private_to_public_key(private_key) ⇒ Object
126
127
|
# File 'lib/crypto/ed25519_key.rb', line 126
def private_to_public_key(private_key)
end
|
#public_key ⇒ Object
101
102
103
104
105
106
|
# File 'lib/crypto/ed25519_key.rb', line 101
def public_key
if @signature_algorithm == "ed25519" && @private_key_hex.length == 64
prefix = "01"
@public_key = prefix + @public_key_hex
end
end
|
#read_base_64_file(path) ⇒ Object
41
42
|
# File 'lib/crypto/01_ed25519.rb', line 41
def read_base_64_file(path)
end
|
#read_base_64_with_pem(content) ⇒ Object
37
38
|
# File 'lib/crypto/01_ed25519.rb', line 37
def read_base_64_with_pem(content)
end
|
#sign(message) ⇒ Object
54
55
|
# File 'lib/crypto/01_ed25519.rb', line 54
def sign(msg)
end
|
#verify(signature, message) ⇒ Object
82
83
|
# File 'lib/crypto/ed25519_key.rb', line 82
def verify(signature, msg)
end
|