acme-pki 0.1.4 → 0.1.5
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 +4 -4
- data/lib/acme/pki/information.rb +31 -19
- data/lib/acme/pki/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 199f39943a323bd98c3b300c6fb36cf1502755b9
|
4
|
+
data.tar.gz: 0d59e672b06a208dff74d20513b5a635ac722324
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 413f3dc9fdcea80c831287d2e12b7ac8addb7b854e0ba99d851e939ab59235f6ba64e8e8bfaca9a88f4a1961e8104ba864bbe7b733f736392a036d8cc5024d36
|
7
|
+
data.tar.gz: 301f8476f672f6d994589632755ca4ba4c871c22b44486ec34be5db852c1eaa812052cef582c127febf5b871699e18e2015248d9493be6235aed9715996be5b1
|
data/lib/acme/pki/information.rb
CHANGED
@@ -5,7 +5,19 @@ module Acme
|
|
5
5
|
module Information
|
6
6
|
def key_info(key, tab: 0)
|
7
7
|
key = open(key, 'r') { |f| OpenSSL::PKey.read f } unless key.is_a? OpenSSL::PKey::PKey
|
8
|
-
|
8
|
+
|
9
|
+
der = case key
|
10
|
+
when OpenSSL::PKey::EC
|
11
|
+
puts "\t" * (tab) + "#{'Key'.colorize :red} : ECC #{key.group.curve_name}"
|
12
|
+
|
13
|
+
point = key.public_key
|
14
|
+
pub = OpenSSL::PKey::EC.new point.group
|
15
|
+
pub.public_key = point
|
16
|
+
pub
|
17
|
+
when OpenSSL::PKey::RSA
|
18
|
+
puts "\t" * (tab) + "#{'Key'.colorize :red} : RSA #{key.n.num_bits} bits"
|
19
|
+
key.public_key
|
20
|
+
end.to_der
|
9
21
|
|
10
22
|
fingerprint der, tab: tab
|
11
23
|
|
@@ -61,25 +73,25 @@ module Acme
|
|
61
73
|
puts "Fetch certificate #{issuer} from #{uri}"
|
62
74
|
file = Digest::MD5.hexdigest uri
|
63
75
|
file = file File.join 'cache', file
|
64
|
-
dir
|
76
|
+
dir = File.dirname file
|
65
77
|
FileUtils.mkpath dir unless Dir.exist? dir
|
66
|
-
crt
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
78
|
+
crt = if File.exist? file
|
79
|
+
open(file, 'r') { |f| OpenSSL::X509::Certificate.new f }
|
80
|
+
else
|
81
|
+
crt = Faraday.get uri
|
82
|
+
break unless crt.success?
|
83
|
+
crt = crt.body
|
84
|
+
|
85
|
+
crt = begin
|
86
|
+
OpenSSL::X509::Certificate.new crt
|
87
|
+
rescue
|
88
|
+
pkcs7 = OpenSSL::PKCS7.new crt
|
89
|
+
pkcs7.certificates.first
|
90
|
+
end
|
91
|
+
|
92
|
+
File.write file, crt.to_pem
|
93
|
+
crt
|
94
|
+
end
|
83
95
|
|
84
96
|
subject = crt.subject
|
85
97
|
puts "Warning : expecting #{issuer}, get #{subject}".colorize :magenta unless subject == issuer
|
data/lib/acme/pki/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acme-pki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aeris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04
|
11
|
+
date: 2017-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
120
|
rubyforge_project:
|
121
|
-
rubygems_version: 2.6.
|
121
|
+
rubygems_version: 2.6.11
|
122
122
|
signing_key:
|
123
123
|
specification_version: 4
|
124
124
|
summary: Ruby client for Let's Encrypt
|