Class: Nis::Keypair
- Inherits:
-
Object
- Object
- Nis::Keypair
- Defined in:
- lib/nis/keypair.rb
Instance Attribute Summary collapse
-
#private ⇒ Object
readonly
Returns the value of attribute private.
-
#public ⇒ Object
readonly
Returns the value of attribute public.
Instance Method Summary collapse
- #calc_pubkey ⇒ Object
- #fix_private_key(key) ⇒ Object
-
#initialize(private_key, public_key: nil) ⇒ Keypair
constructor
A new instance of Keypair.
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
#private ⇒ Object (readonly)
Returns the value of attribute private.
3 4 5 |
# File 'lib/nis/keypair.rb', line 3 def private @private end |
#public ⇒ Object (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_pubkey ⇒ Object
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 |