certificate-transparency-client 0.3.0 → 0.4.0
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/certificate-transparency/client.rb +25 -0
- 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: 47509ede5ad48f3acedd9638c2baa2891fbab92b
|
4
|
+
data.tar.gz: bb6338c19b82864119ed264e36528eb16fa994c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d7c45b6d58f33ac7815dd530d73d4fc6c36052fe2059bda16352c707e8f4ea0a487fd864fb0159e0e00d744cb62e4ac384d3dafee4049a920e8b47401dd5c94
|
7
|
+
data.tar.gz: f6991c57c1b2681f25fcf68e65b0bc473579cb5cbf8eafe53190b62873db40e3ed7cd34ff89ae1cb447d8ee9e0542d5601836b573e009fda4f7878549a61d6aa
|
@@ -13,6 +13,10 @@ class CertificateTransparency::Client
|
|
13
13
|
#
|
14
14
|
class HTTPError < Error; end
|
15
15
|
|
16
|
+
# Indicates an error in parsing a response from the server.
|
17
|
+
#
|
18
|
+
class DataError < Error; end
|
19
|
+
|
16
20
|
# The public key of the log, as specified in the constructor.
|
17
21
|
#
|
18
22
|
# @return [OpenSSL::PKey]
|
@@ -91,6 +95,27 @@ class CertificateTransparency::Client
|
|
91
95
|
end
|
92
96
|
end
|
93
97
|
|
98
|
+
# Retrieve the full set of roots publicised as being supported by this log.
|
99
|
+
#
|
100
|
+
# @return [Array<OpenSSL::X509::Certificate>]
|
101
|
+
#
|
102
|
+
# @raise [CT::Client::HTTPError] if something went wrong with the HTTP request.
|
103
|
+
#
|
104
|
+
# @raise [CT::Client::DataError] if the data returned didn't meet our expectations.
|
105
|
+
#
|
106
|
+
def get_roots
|
107
|
+
json = make_request("get-roots")
|
108
|
+
|
109
|
+
begin
|
110
|
+
JSON.parse(json)["certificates"].map do |c|
|
111
|
+
OpenSSL::X509::Certificate.new(c.unpack("m").first)
|
112
|
+
end
|
113
|
+
rescue StandardError => ex
|
114
|
+
raise CT::Client::DataError,
|
115
|
+
"Failed to parse get-roots response: #{ex.message} (#{ex.class})"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
94
119
|
private
|
95
120
|
|
96
121
|
# Make a request to the log server.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: certificate-transparency-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: certificate-transparency
|