Class: GitBlur::KeyGen::PasswordKeyGen
- Inherits:
-
KeyGenerator
- Object
- KeyGenerator
- GitBlur::KeyGen::PasswordKeyGen
- Defined in:
- lib/git-blur/keygen.rb
Constant Summary collapse
- @@iter =
100000
Instance Attribute Summary
Attributes inherited from KeyGenerator
Instance Method Summary collapse
Methods inherited from KeyGenerator
Constructor Details
This class inherits a constructor from GitBlur::KeyGen::KeyGenerator
Instance Method Details
#generate_keys(password = nil) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/git-blur/keygen.rb', line 66 def generate_keys( password = nil ) if not password puts "Enter your password:" begin pass1 = $stdin.noecho(&:gets) rescue Errno::ENOTTY, Errno::EINVAL pass1 = $stdin.gets end puts "Enter it again:" begin pass2 = $stdin.noecho(&:gets) rescue Errno::ENOTTY, Errno::EINVAL pass2 = $stdin.gets end raise "Passwords do not match" if pass1 != pass2 pass1.gsub!( /\n/, '' ) raise "Password is empty. Why do you want to crypt then?" if pass1 == "" @pass = pass1 else @pass = password end @cipher_list.each do |cname| c = OpenSSL::Cipher.new( cname ) @cipher_keys[ cname ] = generate_cipher_key( cname, c.key_len ) end @cipher_key end |