Class: Nis::Keypair

Inherits:
Object
  • Object
show all
Defined in:
lib/nis/keypair.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(private_key, public_key: nil) ⇒ Keypair

Returns a new instance of Keypair.



5
6
7
8
# File 'lib/nis/keypair.rb', line 5

def initialize(private_key, public_key: nil)
  @private = private_key
  @public  = public_key
end

Instance Attribute Details

#privateObject (readonly)

Returns the value of attribute private.



3
4
5
# File 'lib/nis/keypair.rb', line 3

def private
  @private
end

#publicObject (readonly)

Returns the value of attribute public.



3
4
5
# File 'lib/nis/keypair.rb', line 3

def public
  @public
end

Instance Method Details

#calc_pubkeyObject



14
15
16
# File 'lib/nis/keypair.rb', line 14

def calc_pubkey
  # TODO: calculate pubkey from privkey
end

#fix_private_key(key) ⇒ Object



10
11
12
# File 'lib/nis/keypair.rb', line 10

def fix_private_key(key)
  "#{'0' * 64}#{key.sub(/^00/i, '')}"[-64, 64]
end