ssltool 0.0.20 → 0.0.21
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/bin/ssltool-print-certs-info +24 -2
- data/lib/ssltool/key_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c0dd22868569aad7c1549644b9856fec8eed476d
|
|
4
|
+
data.tar.gz: 0559e7135d9e37c86096a0580e1b41dadb443031
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32eb0d9d73a97ddb6b594bbf8974c29379d8708736d0f65e4162e75ce9786b69d1fef8f3d3b8cab5326b3eeaf3c9242cf46de23ca9e4ee3a4e3297018f26e6eb
|
|
7
|
+
data.tar.gz: e6b9228a42b46c69cb04b7b1685b70e5c3bcf05d91a2469e3aca29d2fce4fbf7a568737854b2717b26a460dd647bb056b0958bc8fb07ce9b5b40b192eeeb6df9
|
|
@@ -4,6 +4,27 @@
|
|
|
4
4
|
# input..: multiple certificate PEM string + garbage
|
|
5
5
|
# output.: cert information
|
|
6
6
|
|
|
7
|
+
|
|
8
|
+
class String
|
|
9
|
+
def color(n)
|
|
10
|
+
return "" if empty?
|
|
11
|
+
color = `tput setaf #{n}` # set ansi foreground color
|
|
12
|
+
reset = `tput sgr0` # reset terminal colors to normal
|
|
13
|
+
(m = match(/\\\[\e.*?m.*\e.*?m\\\]/)) \
|
|
14
|
+
? [m.pre_match.color(n), m.to_s, m.post_match.color(n)].join
|
|
15
|
+
: [color, self, reset].join
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
# 255.times { |n| puts if n % 16 == 0; print ("X%02x-" % n).color(n); }
|
|
19
|
+
|
|
20
|
+
def calc_color s
|
|
21
|
+
c = s.each_byte.inject(0, &:^)
|
|
22
|
+
c = (~c).abs if c == 0 || c == 0x10 || (c >= 0xE8 && c <= 0xEE)
|
|
23
|
+
c
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
7
28
|
require_relative "../lib/ssltool/certificate_store"
|
|
8
29
|
require_relative "../lib/ssltool/adapters/filesystem"
|
|
9
30
|
|
|
@@ -12,8 +33,9 @@ certs = SSLTool::Certificate.scan(ARGF.read)
|
|
|
12
33
|
|
|
13
34
|
certs.each do |cert|
|
|
14
35
|
trusted = store.trust?(cert)
|
|
15
|
-
|
|
16
|
-
puts cert.to_s.split(/\n/)[1, 2]
|
|
36
|
+
color = calc_color cert.to_s
|
|
37
|
+
# puts cert.to_s.split(/\n/)[1, 2].join("\n").color(color)
|
|
38
|
+
puts "--- #{cert.fingerprint.color(color)}"
|
|
17
39
|
puts "Domains.....: #{cert.domain_names.join(', ')}" if cert.for_domain_name?
|
|
18
40
|
puts "Subject.....: #{cert.subject}"
|
|
19
41
|
puts "Issuer......: #{cert.issuer}"
|
data/lib/ssltool/key_helper.rb
CHANGED
|
@@ -29,7 +29,7 @@ module SSLTool
|
|
|
29
29
|
def key(s)
|
|
30
30
|
error = -> { raise KeyMalformedError, "Key appears to be malformed, or is passphrase-protected." }
|
|
31
31
|
case s
|
|
32
|
-
when /\A-----BEGIN EC PRIVATE KEY/ then OpenSSL::PKey::EC.new(s, '')
|
|
32
|
+
when /\A-----BEGIN EC PRIVATE KEY/ then OpenSSL::PKey::EC.new(s, '').tap{|k| k.singleton_class.class_eval{ alias_method :private?, :private_key? }}
|
|
33
33
|
when /\A-----BEGIN (RSA )?PRIVATE KEY/ then OpenSSL::PKey::RSA.new(s, '')
|
|
34
34
|
else error[]
|
|
35
35
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.21
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Caio Chassot
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Orders and completes SSL certificate trust chains, maintains an up-to-date
|
|
14
14
|
pool of viable intermediates and trusted roots, and provides other tooling for dealing
|