Class: GitBlur::KeyGen::KeyGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/git-blur/keygen.rb

Direct Known Subclasses

PasswordKeyGen, RandomKeyGen

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKeyGenerator

Returns a new instance of KeyGenerator.



29
30
31
32
33
# File 'lib/git-blur/keygen.rb', line 29

def initialize( )
  @cipher_list = GitBlur::Conf.ciphers
  raise 'No ciphers defined' if @cipher_list.nil?
  @cipher_keys = {}
end

Instance Attribute Details

#cipher_keysObject (readonly)

Returns the value of attribute cipher_keys.



27
28
29
# File 'lib/git-blur/keygen.rb', line 27

def cipher_keys
  @cipher_keys
end

#cipher_listObject (readonly)

Returns the value of attribute cipher_list.



27
28
29
# File 'lib/git-blur/keygen.rb', line 27

def cipher_list
  @cipher_list
end

Instance Method Details

#generate_keysObject



35
36
37
# File 'lib/git-blur/keygen.rb', line 35

def generate_keys
  raise "Please overwrite this method in your generator"
end

#hex_keysObject



43
44
45
# File 'lib/git-blur/keygen.rb', line 43

def hex_keys
  Hash[ @cipher_keys.keys.collect{ |k| [ k, Base64.strict_encode64( @cipher_keys[k] ) ] } ]
end

#keysObject



39
40
41
# File 'lib/git-blur/keygen.rb', line 39

def keys
  @cipher_keys
end