pwl 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,61 @@
1
+ require 'helper'
2
+
3
+ class TestStorePasswordPolicy < Test::Pwl::TestCase
4
+ def setup
5
+ @store_file = temp_file_name
6
+ end
7
+
8
+ def teardown
9
+ File.unlink(@store_file) if File.exist?(@store_file)
10
+ end
11
+
12
+ def test_validations_ok_0
13
+ assert_valid('abcd3fgh')
14
+ end
15
+
16
+ def test_validations_ok_1
17
+ assert_valid('123A5678')
18
+ end
19
+
20
+ def test_validations_too_short_0
21
+ assert_invalid(nil)
22
+ end
23
+
24
+ def test_validations_too_short_1
25
+ assert_invalid('')
26
+ end
27
+
28
+ def test_validations_too_short_2
29
+ assert_invalid('a')
30
+ end
31
+
32
+ def test_validations_too_short_3
33
+ assert_invalid('abcdefg')
34
+ end
35
+
36
+ def test_validations_too_simple_0
37
+ assert_invalid(' ')
38
+ end
39
+
40
+ def test_validations_too_simple_1
41
+ assert_invalid('12345678')
42
+ end
43
+
44
+ def test_validations_too_simple_2
45
+ assert_invalid('abcdefgh')
46
+ end
47
+
48
+ private
49
+
50
+ def assert_valid(password)
51
+ store = ::Pwl::Store.new(@store_file, password)
52
+ store.put('foo', 'bar')
53
+ assert_equal('bar', store.get('foo'))
54
+ end
55
+
56
+ def assert_invalid(password)
57
+ assert_raise Pwl::InvalidMasterPasswordError do
58
+ assert_valid(password)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,34 @@
1
+ require 'helper'
2
+
3
+ class TestStoreSecurity < Test::Pwl::TestCase
4
+
5
+ # Read back raw PStore and ensure what we get is not clear text, even though we know the structure of the store
6
+ def test_encryption
7
+ assert(!store.nil?, "Store expected, but it is nil")
8
+ store.put('foo', 'bar')
9
+ raw = PStore.new(store_file)
10
+ assert_not_equal('bar', raw.transaction{raw[:user]['foo']})
11
+ assert_nil(raw.transaction{raw[:user]['foo']}) # must not find cleartext entry
12
+ end
13
+
14
+ def test_wrong_password
15
+ assert_raise Pwl::Store::WrongMasterPasswordError do
16
+ Pwl::Store.open(store_file, store_password.reverse)
17
+ end
18
+ end
19
+
20
+ def test_change_password
21
+ assert(!store.nil?, "Store expected, but it is nil")
22
+ store.put('Homer', 'Simpson')
23
+ store.change_password!(store_password.reverse)
24
+
25
+ # the old password must not work anymore
26
+ assert_raise Pwl::Store::WrongMasterPasswordError do
27
+ Pwl::Store.open(store_file, store_password)
28
+ end
29
+
30
+ # Read back with the changed password
31
+ reopened = Pwl::Store.open(store_file, store_password.reverse)
32
+ assert_equal('Simpson', reopened.get('Homer'))
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,156 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pwl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Nicholas E. Rabenau
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: encryptor
16
+ requirement: &2153967580 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2153967580
25
+ - !ruby/object:Gem::Dependency
26
+ name: commander
27
+ requirement: &2153964800 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2153964800
36
+ - !ruby/object:Gem::Dependency
37
+ name: activesupport
38
+ requirement: &2153963440 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *2153963440
47
+ - !ruby/object:Gem::Dependency
48
+ name: rdoc
49
+ requirement: &2153962400 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2153962400
58
+ - !ruby/object:Gem::Dependency
59
+ name: bundler
60
+ requirement: &2153960100 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.0.0
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2153960100
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ requirement: &2153959260 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.8.3
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2153959260
80
+ description: pwl is a secure password locker for the commandline
81
+ email: nerab@gmx.net
82
+ executables:
83
+ - pwl
84
+ extensions: []
85
+ extra_rdoc_files:
86
+ - LICENSE.txt
87
+ - README.md
88
+ files:
89
+ - .document
90
+ - .travis.yml
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - LICENSE.txt
94
+ - README.md
95
+ - Rakefile
96
+ - VERSION
97
+ - bin/pwl
98
+ - lib/pwl.rb
99
+ - lib/pwl/dialog.rb
100
+ - lib/pwl/dialog/base.rb
101
+ - lib/pwl/dialog/cocoa.rb
102
+ - lib/pwl/dialog/console.rb
103
+ - lib/pwl/dialog/gnome.rb
104
+ - lib/pwl/message.rb
105
+ - lib/pwl/password_policy.rb
106
+ - lib/pwl/store.rb
107
+ - pwl.gemspec
108
+ - templates/export.html.erb
109
+ - test/acceptance/test_basics.rb
110
+ - test/acceptance/test_delete.rb
111
+ - test/acceptance/test_dialogs.rb
112
+ - test/acceptance/test_export.rb
113
+ - test/acceptance/test_get.rb
114
+ - test/acceptance/test_init.rb
115
+ - test/acceptance/test_list.rb
116
+ - test/acceptance/test_passwd.rb
117
+ - test/acceptance/test_put.rb
118
+ - test/fixtures/test_all.html
119
+ - test/fixtures/test_empty.html
120
+ - test/helper.rb
121
+ - test/unit/test_error.rb
122
+ - test/unit/test_message.rb
123
+ - test/unit/test_store_construction.rb
124
+ - test/unit/test_store_crud.rb
125
+ - test/unit/test_store_metadata.rb
126
+ - test/unit/test_store_password_policy.rb
127
+ - test/unit/test_store_security.rb
128
+ homepage: http://github.com/nerab/pwl
129
+ licenses:
130
+ - MIT
131
+ post_install_message:
132
+ rdoc_options: []
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ! '>='
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ segments:
142
+ - 0
143
+ hash: -4225901376314280444
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 1.8.15
153
+ signing_key:
154
+ specification_version: 3
155
+ summary: Command-line password locker
156
+ test_files: []