ssltool 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
data/bin/ssltool-complete-chain
CHANGED
@@ -13,7 +13,7 @@ end
|
|
13
13
|
|
14
14
|
begin
|
15
15
|
store = SSLTool::CertificateStore.new("file://#{File.dirname(__FILE__)}/../var/pools")
|
16
|
-
chain = store.
|
16
|
+
chain = store.resolve_chain(ARGF.read)
|
17
17
|
rescue SSLTool::ChainResolution::ZeroCertsChainResolutionError ; die("No certificate given.", 1)
|
18
18
|
rescue SSLTool::ChainResolution::ZeroHeadsChainResolutionError ; die("No certificate given covers a domain name.", 2)
|
19
19
|
rescue SSLTool::ChainResolution::TooManyHeadsChainResolutionError; die("More than one domain name certificate given.", 3)
|
data/bin/ssltool-filter-certs
CHANGED
data/lib/ssltool/certificate.rb
CHANGED
@@ -79,13 +79,10 @@ module SSLTool
|
|
79
79
|
### chains
|
80
80
|
|
81
81
|
def resolve_chain(certs)
|
82
|
+
certs = Certificate.scan(certs) if certs.is_a?(String)
|
82
83
|
detect_and_merge_intermediates!(certs)
|
83
84
|
ChainResolution.new(certs, self)
|
84
85
|
end
|
85
86
|
|
86
|
-
def resolve_chain_from_pem_string(s)
|
87
|
-
resolve_chain(Certificate.scan(s))
|
88
|
-
end
|
89
|
-
|
90
87
|
end
|
91
88
|
end
|
data/lib/ssltool/key_helper.rb
CHANGED
data/lib/ssltool/pem_scanner.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
require_relative 'certificate'
|
2
3
|
|
3
4
|
module SSLTool
|
4
5
|
class PEMScanner
|
5
|
-
attr_reader :
|
6
|
+
attr_reader :pem_strings, :cert_strings, :key_strings, :garbage_strings
|
6
7
|
RX_PEM_BLOCK = /(-----BEGIN.*?-----\n
|
7
8
|
(?:[A-Za-z0-9\+\/]+\n)*
|
8
9
|
[A-Za-z0-9\+\/]*={0,2}\n
|
@@ -10,11 +11,20 @@ module SSLTool
|
|
10
11
|
)/x
|
11
12
|
|
12
13
|
def initialize(s)
|
13
|
-
s
|
14
|
-
@
|
15
|
-
@
|
16
|
-
@
|
17
|
-
@
|
14
|
+
s = s.dup.force_encoding('BINARY').gsub(/\r\n?/, "\n").gsub(/\s+\n/, "\n")
|
15
|
+
@pem_strings, @garbage_strings = s.split(RX_PEM_BLOCK).map(&:strip).reject(&:empty?).partition { |s| s =~ RX_PEM_BLOCK }
|
16
|
+
@cert_strings = @pem_strings.select { |s| s =~ /-----BEGIN CERTIFICATE-----/ }
|
17
|
+
@key_strings = @pem_strings.select { |s| s =~ /-----BEGIN (RSA )?PRIVATE KEY-----/ }
|
18
|
+
@garbage_strings += @pem_strings - @cert_strings - @key_strings
|
19
|
+
end
|
20
|
+
|
21
|
+
def certificates
|
22
|
+
cert_strings.map { |s| Certificate.new(s) }
|
23
|
+
end
|
24
|
+
alias_method :certs, :certificates
|
25
|
+
|
26
|
+
def keys
|
27
|
+
key_strings.map { |s| OpenSSL::PKey::RSA.new(s, '') }
|
18
28
|
end
|
19
29
|
|
20
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssltool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-09-
|
12
|
+
date: 2012-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Orders and completes SSL certificate trust chains, maintains an up-to-date
|
15
15
|
pool of viable intermediates and trusted roots, and provides other tooling for dealing
|