cert_munger 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.codeclimate.yml +8 -0
- data/.travis.yml +4 -2
- data/cert_munger.gemspec +3 -2
- data/certs/stevenhaddox.pem +15 -15
- data/checksum/cert_munger-0.2.1.gem.sha512 +1 -0
- data/checksum_generator.rb +7 -0
- data/lib/cert_munger/formatter.rb +10 -10
- data/lib/cert_munger/version.rb +1 -1
- data/spec/lib/cert_munger_spec.rb +5 -0
- data/spec/spec_helper.rb +2 -2
- metadata +41 -24
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e52e7430a05f18506ea7ecc99a192b0ec0f94e2a
|
4
|
+
data.tar.gz: 67981272e2623b4dec18f49e6bd9fb6194a6a753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7865f3c7e2cae6714851be14b6ae9375206accafb2f685d0c5c31b8e9092a8cbd440bb3a0a8efee694cb92b65ff2641649e1246360cd44a1e984e05a314cf602
|
7
|
+
data.tar.gz: ad411501f764f93162277b5a4e7de23eb38728bce3f101e088e9387b0058cf0063582d8ff0636491e16d7e480b93cf1686c0933cdc7b05a67eeaf10016d1a663
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.codeclimate.yml
ADDED
data/.travis.yml
CHANGED
data/cert_munger.gemspec
CHANGED
@@ -19,15 +19,16 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.required_ruby_version = '>= 1.9.3'
|
22
|
-
spec.add_dependency 'logging', '~> 1
|
22
|
+
spec.add_dependency 'logging', '~> 2.1'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
26
26
|
spec.add_development_dependency 'codeclimate-test-reporter'
|
27
|
+
spec.add_development_dependency 'simplecov'
|
27
28
|
spec.add_development_dependency 'rack', '~> 1.5'
|
28
29
|
spec.add_development_dependency 'rack-test', '~> 0.6'
|
29
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
|
-
spec.add_development_dependency 'rubocop', '
|
31
|
+
spec.add_development_dependency 'rubocop', '=0.41.1'
|
31
32
|
spec.add_development_dependency 'rspec', '~> 3.1'
|
32
33
|
spec.add_development_dependency 'yard', '~> 0.8'
|
33
34
|
|
data/certs/stevenhaddox.pem
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1zdGV2
|
3
3
|
ZW4uaGFkZG94MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
|
4
|
-
|
4
|
+
FgNjb20wHhcNMTcwNDA1MTQ0MDQ5WhcNMTgwNDA1MTQ0MDQ5WjBEMRYwFAYDVQQD
|
5
5
|
DA1zdGV2ZW4uaGFkZG94MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
|
6
|
-
k/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDV2Ycu
|
7
|
+
HeFUaXB6M6Y5/MIdrD8/yF6nDRnxVxuK2AQzDwtQNcRQoBvF2KkCCHZrRMKc1PEz
|
8
|
+
wE8X786jAhh5zcPpaJy37sRXW0hf/4tm8WkvGGdQIAD+EMgGnBG41CHw9Eo70xdY
|
9
|
+
TVGn3zBNH3x+b463ThyYSXz78G5tu3w1E6ba3OgW7R3wzk7gaQ0ggyifTQ7aIdgC
|
10
|
+
uEftGv9gdlj6NfPt0l5ZXGMEAVVVOz4dZO9Wye55qk+aVbLH389cExhok39spVN3
|
11
|
+
ptRfs0wayQNO/eVORrGEwa0A0U2NaDB0LUo32gWvi2adgqcGl7WHNSVTT4EdYft9
|
12
|
+
Mji1ifKuHEupywUFAgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAd
|
13
|
+
BgNVHQ4EFgQU91XgJKOjRb6SO47BbMWMKU5q+u8wIgYDVR0RBBswGYEXc3RldmVu
|
14
14
|
LmhhZGRveEBnbWFpbC5jb20wIgYDVR0SBBswGYEXc3RldmVuLmhhZGRveEBnbWFp
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
bC5jb20wDQYJKoZIhvcNAQEFBQADggEBANSDl5eTldDIUJKHMB8q7IK8fBt1DGEo
|
16
|
+
Y0dyf78b0BVujt945UGKRiPWb9vMeuiTaohtIjqfoI4lvBHe2cEkTIcroB25f+VY
|
17
|
+
iPep5M8ormpsruWCekrKlwHpmvtCj8EC7od3JiJIKJaiBRGaRz70D/DOs9sXyUdG
|
18
|
+
lrvCjJTLuLtj0HI7/cs+0OFdVA9P7YBH/6GgYIJWgCA9ppAotJrCYGPISYiFNCkc
|
19
|
+
NwdGc+LFuu/Xv5FBDYMFyfLSPhncqwXHSzF4OKSqEckawuqN+5eA/C0MsGDplVF4
|
20
|
+
eksh9s9/x2f0t0J05xQBWzmmSR6dJRi21G6VUquyVOWHggfRqs3UAZg=
|
21
21
|
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
4ca1cb691b0021b81d3ed527792a63e783834173867067c6233c6fae1ac88b5bcee35792ff888b636e42237234630cc9c5c1a6e5dc950772180dab2b1004afdd
|
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'digest/sha2'
|
4
|
+
built_gem_path = "pkg/cert_munger-#{ENV['VERSION']}.gem"
|
5
|
+
checksum = Digest::SHA512.new.hexdigest(File.read(built_gem_path))
|
6
|
+
checksum_path = "checksum/cert_munger-#{ENV['VERSION']}.gem.sha512"
|
7
|
+
File.open(checksum_path, 'w' ) {|f| f.write(checksum) }
|
@@ -48,11 +48,11 @@ module CertMunger
|
|
48
48
|
# @return [String] reformatted and (hopefully) parseable certificate string
|
49
49
|
def build_cert(raw_cert)
|
50
50
|
tmp_cert = ['-----BEGIN CERTIFICATE-----']
|
51
|
-
if raw_cert.lines.count == 1
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
51
|
+
cert_contents = if raw_cert.lines.count == 1
|
52
|
+
one_line_contents(raw_cert)
|
53
|
+
else
|
54
|
+
multi_line_contents(raw_cert)
|
55
|
+
end
|
56
56
|
tmp_cert << cert_contents.flatten # put mixed space lines as own elements
|
57
57
|
tmp_cert << '-----END CERTIFICATE-----'
|
58
58
|
tmp_cert.join("\n").rstrip
|
@@ -64,11 +64,11 @@ module CertMunger
|
|
64
64
|
# @return [String] reformatted certificate body
|
65
65
|
def one_line_contents(raw_cert)
|
66
66
|
# Detect if we have newlines, if not, split on spaces
|
67
|
-
if raw_cert.include?('\n')
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
cert_contents = if raw_cert.include?('\n')
|
68
|
+
raw_cert.split('\n')
|
69
|
+
else
|
70
|
+
parse_space_delimited_cert(raw_cert)
|
71
|
+
end
|
72
72
|
cert_contents.pop # Remove -----BEGIN CERTIFICATE-----
|
73
73
|
cert_contents.shift # Remove -----END CERTIFICATE-----
|
74
74
|
|
data/lib/cert_munger/version.rb
CHANGED
@@ -59,5 +59,10 @@ describe CertMunger do
|
|
59
59
|
new_cert = subject.class.send(:to_cert, one_line_cert)
|
60
60
|
expect(new_cert.to_s).to eq(certificate.to_s)
|
61
61
|
end
|
62
|
+
|
63
|
+
it "should parse a certificate with all content in one line, space delimited" do
|
64
|
+
new_cert = subject.class.send(:to_cert, one_line_spaces_cert)
|
65
|
+
expect(new_cert.to_s).to eq(certificate.to_s)
|
66
|
+
end
|
62
67
|
end
|
63
68
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cert_munger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Haddox
|
@@ -12,25 +12,25 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDhTCCAm2gAwIBAgIBATANBgkqhkiG9w0BAQUFADBEMRYwFAYDVQQDDA1zdGV2
|
14
14
|
ZW4uaGFkZG94MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
|
15
|
-
|
15
|
+
FgNjb20wHhcNMTcwNDA1MTQ0MDQ5WhcNMTgwNDA1MTQ0MDQ5WjBEMRYwFAYDVQQD
|
16
16
|
DA1zdGV2ZW4uaGFkZG94MRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJ
|
17
|
-
k/
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
k/IsZAEZFgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDV2Ycu
|
18
|
+
HeFUaXB6M6Y5/MIdrD8/yF6nDRnxVxuK2AQzDwtQNcRQoBvF2KkCCHZrRMKc1PEz
|
19
|
+
wE8X786jAhh5zcPpaJy37sRXW0hf/4tm8WkvGGdQIAD+EMgGnBG41CHw9Eo70xdY
|
20
|
+
TVGn3zBNH3x+b463ThyYSXz78G5tu3w1E6ba3OgW7R3wzk7gaQ0ggyifTQ7aIdgC
|
21
|
+
uEftGv9gdlj6NfPt0l5ZXGMEAVVVOz4dZO9Wye55qk+aVbLH389cExhok39spVN3
|
22
|
+
ptRfs0wayQNO/eVORrGEwa0A0U2NaDB0LUo32gWvi2adgqcGl7WHNSVTT4EdYft9
|
23
|
+
Mji1ifKuHEupywUFAgMBAAGjgYEwfzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAd
|
24
|
+
BgNVHQ4EFgQU91XgJKOjRb6SO47BbMWMKU5q+u8wIgYDVR0RBBswGYEXc3RldmVu
|
25
25
|
LmhhZGRveEBnbWFpbC5jb20wIgYDVR0SBBswGYEXc3RldmVuLmhhZGRveEBnbWFp
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
bC5jb20wDQYJKoZIhvcNAQEFBQADggEBANSDl5eTldDIUJKHMB8q7IK8fBt1DGEo
|
27
|
+
Y0dyf78b0BVujt945UGKRiPWb9vMeuiTaohtIjqfoI4lvBHe2cEkTIcroB25f+VY
|
28
|
+
iPep5M8ormpsruWCekrKlwHpmvtCj8EC7od3JiJIKJaiBRGaRz70D/DOs9sXyUdG
|
29
|
+
lrvCjJTLuLtj0HI7/cs+0OFdVA9P7YBH/6GgYIJWgCA9ppAotJrCYGPISYiFNCkc
|
30
|
+
NwdGc+LFuu/Xv5FBDYMFyfLSPhncqwXHSzF4OKSqEckawuqN+5eA/C0MsGDplVF4
|
31
|
+
eksh9s9/x2f0t0J05xQBWzmmSR6dJRi21G6VUquyVOWHggfRqs3UAZg=
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
33
|
+
date: 2017-04-05 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: logging
|
@@ -38,14 +38,14 @@ dependencies:
|
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '1
|
41
|
+
version: '2.1'
|
42
42
|
type: :runtime
|
43
43
|
prerelease: false
|
44
44
|
version_requirements: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '1
|
48
|
+
version: '2.1'
|
49
49
|
- !ruby/object:Gem::Dependency
|
50
50
|
name: awesome_print
|
51
51
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +88,20 @@ dependencies:
|
|
88
88
|
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: '0'
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: simplecov
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
type: :development
|
99
|
+
prerelease: false
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
91
105
|
- !ruby/object:Gem::Dependency
|
92
106
|
name: rack
|
93
107
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,16 +148,16 @@ dependencies:
|
|
134
148
|
name: rubocop
|
135
149
|
requirement: !ruby/object:Gem::Requirement
|
136
150
|
requirements:
|
137
|
-
- -
|
151
|
+
- - '='
|
138
152
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
153
|
+
version: 0.41.1
|
140
154
|
type: :development
|
141
155
|
prerelease: false
|
142
156
|
version_requirements: !ruby/object:Gem::Requirement
|
143
157
|
requirements:
|
144
|
-
- -
|
158
|
+
- - '='
|
145
159
|
- !ruby/object:Gem::Version
|
146
|
-
version:
|
160
|
+
version: 0.41.1
|
147
161
|
- !ruby/object:Gem::Dependency
|
148
162
|
name: rspec
|
149
163
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,6 +194,7 @@ executables: []
|
|
180
194
|
extensions: []
|
181
195
|
extra_rdoc_files: []
|
182
196
|
files:
|
197
|
+
- ".codeclimate.yml"
|
183
198
|
- ".gitignore"
|
184
199
|
- ".rubocop.yml"
|
185
200
|
- ".travis.yml"
|
@@ -190,6 +205,8 @@ files:
|
|
190
205
|
- Rakefile
|
191
206
|
- cert_munger.gemspec
|
192
207
|
- certs/stevenhaddox.pem
|
208
|
+
- checksum/cert_munger-0.2.1.gem.sha512
|
209
|
+
- checksum_generator.rb
|
193
210
|
- lib/cert_munger.rb
|
194
211
|
- lib/cert_munger/formatter.rb
|
195
212
|
- lib/cert_munger/string.rb
|
@@ -224,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
241
|
version: '0'
|
225
242
|
requirements: []
|
226
243
|
rubyforge_project:
|
227
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.5.2
|
228
245
|
signing_key:
|
229
246
|
specification_version: 4
|
230
247
|
summary: Reformat commonly malformatted X509 strings.
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�����v�0�
|
2
|
+
)Y��uh� �sFf�+�ë�M�ߔ�K�=R
|