passw3rd 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/EXAMPLES.md CHANGED
@@ -24,6 +24,11 @@ Command line use
24
24
  The password is: asdf
25
25
  $ passw3rd -d foobar_app -p ~/Desktop/
26
26
  The password is: asdf
27
+ ------------------------------------------------------------------------------
28
+
29
+ Key rotation: simple
30
+
31
+ [passw3rd (gh-10-key_rotation *$)]$ rake rotate_keys[~/passwords,~/passwords,aes-256-cbc]
27
32
 
28
33
 
29
34
  ------------------------------------------------------------------------------
@@ -54,7 +59,7 @@ Java properties file
54
59
  Ruby on Rails config/database.yml
55
60
 
56
61
  initializer:
57
- Passw3rd::PasswordService.password_file_dir = "passwords"
62
+ ::Passw3rd::PasswordService.password_file_dir = "passwords"
58
63
 
59
64
  Before:
60
65
 
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.2 / 2011-11-4
2
+
3
+ Added key rotation script
4
+ [passw3rd (gh-10-key_rotation *$)]$ rake rotate_keys[~/passwords,~/passwords,aes-256-cbc]
5
+
1
6
  === 0.1.0 / 2011-10-31
2
7
 
3
8
  Finally some real life support
@@ -25,8 +25,8 @@ module Passw3rd
25
25
  end
26
26
 
27
27
  def self.create_key_iv_file(path=nil)
28
- if path.nil?
29
- path = ENV['HOME']
28
+ unless path
29
+ path = ::Passw3rd::PasswordService.key_file_dir || ENV['HOME']
30
30
  end
31
31
 
32
32
  # d'oh!
@@ -41,7 +41,7 @@ module Passw3rd
41
41
  puts "Couldn't write key/IV to #{path}\n"
42
42
  raise $!
43
43
  end
44
-
44
+ path
45
45
  end
46
46
  end
47
47
 
@@ -32,7 +32,7 @@ module Passw3rd
32
32
 
33
33
  opts.on('-p', '--password-dir PATH', 'Read and write password files to this directory (default is ~/)') do |opt|
34
34
  password_dir = opt
35
- Passw3rd::PasswordService.password_file_dir = password_dir
35
+ ::Passw3rd::PasswordService.password_file_dir = password_dir
36
36
  if !File.directory?(File.expand_path(password_dir))
37
37
  raise "#{password_dir} must be a directory"
38
38
  end
@@ -57,13 +57,13 @@ module Passw3rd
57
57
 
58
58
  # generate key/IV
59
59
  if gen_key_path
60
- Passw3rd::KeyLoader.create_key_iv_file(gen_key_path)
60
+ ::Passw3rd::KeyLoader.create_key_iv_file(gen_key_path)
61
61
  puts "generated keys in #{gen_key_path}"
62
62
  end
63
63
 
64
64
  # decrypt password_file using the key/IV in key_path
65
65
  if mode == "decrypt"
66
- decrypted = Passw3rd::PasswordService.get_password(password_file, key_path)
66
+ decrypted =::Passw3rd::PasswordService.get_password(password_file, key_path)
67
67
  puts "The password is: #{decrypted}"
68
68
  end
69
69
 
@@ -77,7 +77,7 @@ module Passw3rd
77
77
  system 'stty echo; echo ""'
78
78
  end
79
79
 
80
- file = Passw3rd::PasswordService.write_password_file(password, password_file, key_path)
80
+ file =::Passw3rd::PasswordService.write_password_file(password, password_file, key_path)
81
81
  puts "Wrote password to #{file}"
82
82
  end
83
83
  end
@@ -56,7 +56,7 @@ module Passw3rd
56
56
  d = cipher.update(cipher_text)
57
57
  d << cipher.final
58
58
  rescue OpenSSL::Cipher::CipherError => err
59
- puts "Couldn't decrypt password. Are you using the right keys?"
59
+ puts "Couldn't decrypt password. Are you using the right keys (#{key_path})?"
60
60
  raise err
61
61
  end
62
62
  end
@@ -1,3 +1,3 @@
1
1
  module Passw3rd
2
- Version = VERSION = '0.1.1'
2
+ Version = VERSION = '0.1.2'
3
3
  end
@@ -31,7 +31,7 @@ class PasswordServiceTest < Test::Unit::TestCase
31
31
 
32
32
  def test_set_and_get_password
33
33
  password_file = ::Passw3rd::PasswordService.write_password_file(@random_string, "test")
34
- decrypted = Passw3rd::PasswordService.get_password("test")
34
+ decrypted = ::Passw3rd::PasswordService.get_password("test")
35
35
  assert_equal(@random_string, decrypted)
36
36
  end
37
37
 
@@ -39,17 +39,17 @@ class PasswordServiceTest < Test::Unit::TestCase
39
39
  ::Passw3rd::PasswordService.password_file_dir = Dir.tmpdir
40
40
 
41
41
  password_file = ::Passw3rd::PasswordService.write_password_file(@random_string, "test2")
42
- decrypted = Passw3rd::PasswordService.get_password("test2")
42
+ decrypted = ::Passw3rd::PasswordService.get_password("test2")
43
43
  assert_equal(@random_string, decrypted)
44
44
  end
45
45
 
46
46
  def test_configure_with_block
47
- Passw3rd::PasswordService.configure do |c|
47
+ ::Passw3rd::PasswordService.configure do |c|
48
48
  c.password_file_dir = "/tmp/"
49
49
  c.cipher_name = "aes-256-cbc"
50
50
  end
51
- assert_equal(Passw3rd::PasswordService.password_file_dir, "/tmp/")
52
- assert_equal(Passw3rd::PasswordService.cipher_name, "aes-256-cbc")
51
+ assert_equal(::Passw3rd::PasswordService.password_file_dir, "/tmp/")
52
+ assert_equal(::Passw3rd::PasswordService.cipher_name, "aes-256-cbc")
53
53
  end
54
54
 
55
55
  def test_gen_key
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passw3rd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-03 00:00:00.000000000Z
12
+ date: 2011-11-04 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: Generate a key/iv file, generate passwords, and store encrypted files
15
15
  in source control, keep the key/iv safe!