wikk_password 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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +12 -0
  3. data/lib/wikk_password.rb +14 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19ad1b3c011f21c528f0768d52ca3506888a6233
4
- data.tar.gz: e4da4cdd96b35f04d50d485f41ffc34960710581
3
+ metadata.gz: 2fffbdd9a85babdcd1d772562115dd37a0c37d02
4
+ data.tar.gz: c27e7637480d190624a963ecf670eedaed492e03
5
5
  SHA512:
6
- metadata.gz: b5c4e05d87e354db09cbe4d95c100752609318da46ea6872046f7155f4184650047e32e2dbb1810da6390d390b5f607a3ed7dab2b47bbf4cd83eef1866863270
7
- data.tar.gz: bb321619963fe5f17bf2200a95b5f5529490e9a3b605bd1ceeb8c2c6fe96cea0af85537bce6b0977eaf6b66b72cf80363ddb1876ce996e06ba076e6bb6d3ab78
6
+ metadata.gz: f6dd9964dd64a155a9fc9c537bd179831a7b4b32b735d13cb96383abea0732c792e636f98322a73c7a7a437d20487245d915202db66e2c639117f2caf9787907
7
+ data.tar.gz: 47d8c78a9b077cfb0f4cce88ca2a6bc253a5d83e6cbda979c6912ac2cb520cc84b046c37f87a4806e48a2afa5a2239c7e5cebd3498ac0a0c26ba61177186e4f5
data/History.txt CHANGED
@@ -1,2 +1,14 @@
1
+ robertburrowes Wed Jun 22 22:53:58 2016 +1200
2
+ Wrong spelling of unix-crypt
3
+ robertburrowes Wed Jun 22 22:50:55 2016 +1200
4
+ Dropping this from tracking as auto generated
5
+ robertburrowes Wed Jun 22 22:49:47 2016 +1200
6
+ added MD5 and SHA512 test case to test password file
7
+ robertburrowes Wed Jun 22 22:49:03 2016 +1200
8
+ Noted lack of locking
9
+ robertburrowes Wed Jun 22 22:48:50 2016 +1200
10
+ Added dependencies, though hoe grumbles.
11
+ robertburrowes Wed Jun 22 22:48:32 2016 +1200
12
+ Tidy up, adding yard comments, bug fixes from library transition
1
13
  robertburrowes Wed Jun 22 21:16:24 2016 +1200
2
14
  first commit
data/lib/wikk_password.rb CHANGED
@@ -8,7 +8,7 @@ module WIKK
8
8
  # @attr_reader [String] user the decrypted text
9
9
  # @attr_reader [String] password the encrypted password, in form $type$initial_vector$encrypted_text
10
10
  class Password
11
- VERSION = '0.1.1'
11
+ VERSION = '0.1.2'
12
12
 
13
13
  attr_reader :user, :password
14
14
 
@@ -44,6 +44,18 @@ module WIKK
44
44
  def valid_sha256_response?(challenge, response)
45
45
  return response == Digest::SHA256.digest(decrypt + challenge).unpack('H*')[0]
46
46
  end
47
+
48
+ #Compare an SHA256 hashed password + challenge with this users password
49
+ # @param user [String] User name to fetch from password file, or to create, if new_user == true
50
+ # @param config [WIKK:Configuration] or hash or class with attr_readers :passwordFile, :encryption, :key
51
+ # @param challenge [String] a random string, sent to the remote client, added to the password, and SHA256 hashed
52
+ # @param response [String] the remote clients hex_SHA256(password + challenge)
53
+ # @return [Boolean] True if the users password matches the one that created the response.
54
+ # @note The password entry must be decryptable, not a UNIX style hash.
55
+ # @raise [ArgumentError] if the encryption method is unknown.
56
+ def self.valid_sha256_response?(user, config, challenge, response)
57
+ self.new(user, config).valid_sha256_response?(challenge, response)
58
+ end
47
59
 
48
60
  #Compares the password with the user's password by encrypting the password passed in
49
61
  # @param password [String] The clear text password
@@ -51,7 +63,7 @@ module WIKK
51
63
  # @raise [ArgumentError] if the encryption method is unknown.
52
64
  def valid?(ct_password)
53
65
  ignore,encryption,iv,password = @password.split('$')
54
- encryption = DES if ignore != '' #No $'s in DES password, so ignore has text.
66
+ encryption = 'DES' if ignore != '' #No $'s in DES password, so ignore has text.
55
67
  case encryption
56
68
  when 'ct'; return ct_password == @password
57
69
  when 'aes256'; return encrypt(ct_password, encryption, iv) == @password
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikk_password
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Burrowes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unix-crypt