gcrypto_jce 0.1 → 0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ea980e568ff834fe048aec8765173363c7fef97
4
- data.tar.gz: c0e4dd9410fd14407084f3cc1c36706dfc2a9e2e
3
+ metadata.gz: a566f6242d7000f806c16bf39ffd354c8a6a259b
4
+ data.tar.gz: 0d2ee0c2683c8602703c22d0a6a86f0ed438f0d9
5
5
  SHA512:
6
- metadata.gz: dbbd80105e940387809faff363c7c03e02b506c3e89ee3371b94c3789c68ecddec4a59be991816ca22d72d59f96afded95cf20a68c08e118dca06bc310e3d998
7
- data.tar.gz: e7bf81bd606ec25dfcfdd8b940f10cf742742763fee88d4c3d26aa9c1dc4f643a977ad13064f758ba4d9e068fdeb2028d506b53ac9bf3b6c17d0d34708c81f31
6
+ metadata.gz: b24f53c8982a449c937ee22d4e3ecda5b996ade8ccf342b1a37fa643938161bd0736776a15e7fa9a85f709b10184a5ba0d8bf60a2b804ab682b3d6012210f641
7
+ data.tar.gz: '0496af1d168c75bb57dc7d2d53759b848a6ee8e7889cea2ba76d9075c6f1b6e1532a14af37cd3481ad5ce340f6058c330cc2ae6782bc2816710457c202efda3e'
@@ -28,24 +28,37 @@ module GcryptoJce
28
28
  end
29
29
 
30
30
  iter = opts[:iteration]
31
+ iter_lb = opts[:iter_lb] || 10000
32
+ iter_hb = opts[:iter_hb] || 30000
31
33
  if iter.nil? or iter.to_i == 0
32
- iter = rand(10000...20000)
34
+ iter = rand(iter_lb...iter_hb)
33
35
  end
34
36
 
37
+ hashSpec = opts[:hash_eng]
38
+ if not (hashSpec.nil? or hashSpec.empty?)
39
+ case hashSpec.downcase.to_sym
40
+ when :sha1
41
+ engSpec = "PBKDF2WithHMACSHA1"
42
+ when :sha2, :sha256
43
+ engSpec = "PBKDF2WithHMACSHA256"
44
+ when :sha512
45
+ engSpec = "PBKDF2WithHMACSHA512"
46
+ else
47
+ engSpec = "PBKDF2WithHMACSHA256"
48
+ GcryptoJce::Gconf.instance.glog.warn "User asking for hash engine '#{hashSpec}' but not in supported list. Using default PBKDF2WithHMACSHA256 instead."
49
+ end
50
+ end
51
+
35
52
  keyLen = opts[:outKeyLen]
36
53
  case keyLen
37
54
  when 128
38
55
  outKeyLen = 128
39
- engSpec = "PBKDF2WithHMACSHA1"
40
56
  when 256, 192
41
57
  outKeyLen = 256
42
- engSpec = "PBKDF2WithHMACSHA256"
43
58
  when 512
44
59
  outKeyLen = 512
45
- engSpec = "PBKDF2WithHMACSHA512"
46
60
  else
47
61
  outKeyLen = 256
48
- engSpec = "PBKDF2WithHMACSHA256"
49
62
  end
50
63
 
51
64
  prov = GcryptoJce::Provider.handle_options(opts, nil)
@@ -346,6 +346,7 @@ module GcryptoJce
346
346
  hmac = javax.crypto.Mac.getInstance(hmacHashEng)
347
347
  end
348
348
 
349
+ # seed the hmac engine with the given secret key...
349
350
  hmac.init(spec.key)
350
351
 
351
352
  begin
@@ -1,3 +1,3 @@
1
1
  module GcryptoJce
2
- VERSION = "0.1"
2
+ VERSION = "0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcrypto_jce
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Liaw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-30 00:00:00.000000000 Z
11
+ date: 2019-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement