openssl-win-root 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebed7ff514374969535e034a2360f8e953de49b3
4
- data.tar.gz: 20dab383ad84c77b9bf2da2e8e7b1efab21f3289
3
+ metadata.gz: ac483ad299cd7d80407dadd741f0d5b4dc1da182
4
+ data.tar.gz: 14f0180c0db3bacab9edd2b29ddc8523e3a06e71
5
5
  SHA512:
6
- metadata.gz: 47756db99b64c8c85fd22e59af5d8c783c393bcac3391c0d0ba7ce58238bd0ceab50122cb8ae0a56d5dbea1cf0b6b72738a8fbb957b5b05818b7394290b09afb
7
- data.tar.gz: feed5fe246c0e79df000c24abc2bca559a213ef6d954d5a5c37a45bc412345ddb064055ee4d0e671fcd2b481a309aa280bfb30ced761e0c62d2d053441a77fe4
6
+ metadata.gz: 32b64d4bf2deb9f397f502df473cd3bbb0a1a39eaa9860e7ae97e5029bf9a1bb896226391e03b353ca80985d24c4870cae2437dde2b7af2d1c5264334e264582
7
+ data.tar.gz: 9a7470233dc75824c757ed32b501879d1821ea957dcf1ba45536d102bdce669838a82c719472d5ebdf50ebc33bbd1fc47f00b76af2b90d5d116e6878415a77bd
@@ -50,17 +50,35 @@ module OpenSSL::Win::Root
50
50
  @path = x
51
51
  end
52
52
 
53
+ # Implement c_rehash naming
54
+ class CRehash
55
+ def unique id
56
+ @seen ||= {}
57
+ return if @seen[id]
58
+ @seen[id] = true
59
+ end
60
+
61
+ def name hash
62
+ hash = "%08x" % hash
63
+ @hashes ||= {}
64
+ names[name = "#{hash}.#{@hashes[hash] ||= 0}"] = 1
65
+ @hashes[hash] += 1
66
+ name
67
+ end
68
+
69
+ def names
70
+ @names ||= {}
71
+ end
72
+ end
73
+
53
74
  # Almost c_rehash
54
75
  def self.save(path=self.path)
55
- names={}
56
- hashes={}
76
+ cr = CRehash.new
57
77
  Crypt.each do |crt|
58
- peers=hashes[hash=crt.subject.hash]||={}
59
- id=OpenSSL::Digest::SHA1.new.digest crt.to_der
60
- next if peers[id]
61
- names[name='%08x.%i' % [hash, peers.length]]=1
62
- peers[id]=1
63
- File.open File.join(path, name), 'w' do |f|
78
+ next unless cr.unique OpenSSL::Digest::SHA1.new.digest crt.to_der
79
+
80
+ name = File.join path, cr.name(crt.subject.hash)
81
+ File.open name, 'w' do |f|
64
82
  f.puts <<-EOT
65
83
  Subject: #{crt.subject}
66
84
  Valid: #{crt.not_before} - #{crt.not_after}
@@ -68,9 +86,11 @@ Saved: #{Time.now} by #{self} v#{VERSION}
68
86
  #{crt.to_pem}
69
87
  EOT
70
88
  end
89
+ link = File.join path, cr.name(crt.subject.hash_old)
90
+ FileUtils.ln name, link, force: true
71
91
  end
72
92
  Dir.glob File.join path, '*' do |f|
73
- File.unlink f rescue nil unless names[File.basename f]
93
+ File.unlink f rescue nil unless cr.names[File.basename f]
74
94
  end
75
95
  end
76
96
 
@@ -1,7 +1,7 @@
1
1
  module OpenSSL
2
2
  module Win
3
3
  module Root
4
- VERSION = "1.1.0"
4
+ VERSION = "1.1.1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openssl-win-root
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stas Ukolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-07 00:00:00.000000000 Z
11
+ date: 2017-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.2.3
102
+ rubygems_version: 2.6.7
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: ''