tss 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glenn Rempe
@@ -30,22 +30,36 @@ cert_chain:
30
30
  zieXiXZSAojfFx9g91fKdIrlPbInHU/BaCxXSLBwvOM0drE+c2ue9X8gB55XAhzX
31
31
  37oBiw==
32
32
  -----END CERTIFICATE-----
33
- date: 2016-04-14 00:00:00.000000000 Z
33
+ date: 2016-09-23 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
- name: dry-types
36
+ name: sysrandom
37
37
  requirement: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.7'
41
+ version: '1.0'
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: '0.7'
48
+ version: '1.0'
49
+ - !ruby/object:Gem::Dependency
50
+ name: contracts
51
+ requirement: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '0.14'
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.14'
49
63
  - !ruby/object:Gem::Dependency
50
64
  name: binary_struct
51
65
  requirement: !ruby/object:Gem::Requirement
@@ -80,14 +94,14 @@ dependencies:
80
94
  requirements:
81
95
  - - "~>"
82
96
  - !ruby/object:Gem::Version
83
- version: '1.11'
97
+ version: '1.12'
84
98
  type: :development
85
99
  prerelease: false
86
100
  version_requirements: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - "~>"
89
103
  - !ruby/object:Gem::Version
90
- version: '1.11'
104
+ version: '1.12'
91
105
  - !ruby/object:Gem::Dependency
92
106
  name: rake
93
107
  requirement: !ruby/object:Gem::Requirement
@@ -134,16 +148,44 @@ dependencies:
134
148
  name: coveralls
135
149
  requirement: !ruby/object:Gem::Requirement
136
150
  requirements:
137
- - - ">="
151
+ - - "~>"
138
152
  - !ruby/object:Gem::Version
139
- version: '0'
153
+ version: '0.8'
140
154
  type: :development
141
155
  prerelease: false
142
156
  version_requirements: !ruby/object:Gem::Requirement
143
157
  requirements:
144
- - - ">="
158
+ - - "~>"
159
+ - !ruby/object:Gem::Version
160
+ version: '0.8'
161
+ - !ruby/object:Gem::Dependency
162
+ name: coco
163
+ requirement: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - "~>"
166
+ - !ruby/object:Gem::Version
167
+ version: '0.14'
168
+ type: :development
169
+ prerelease: false
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - "~>"
173
+ - !ruby/object:Gem::Version
174
+ version: '0.14'
175
+ - !ruby/object:Gem::Dependency
176
+ name: wwtd
177
+ requirement: !ruby/object:Gem::Requirement
178
+ requirements:
179
+ - - "~>"
180
+ - !ruby/object:Gem::Version
181
+ version: '1.3'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - "~>"
145
187
  - !ruby/object:Gem::Version
146
- version: '0'
188
+ version: '1.3'
147
189
  description: |2
148
190
  Threshold Secret Sharing (TSS) provides a way to generate N shares
149
191
  from a value, so that any M of those shares can be used to
@@ -166,16 +208,22 @@ executables:
166
208
  extensions: []
167
209
  extra_rdoc_files: []
168
210
  files:
211
+ - ".coco.yml"
169
212
  - ".codeclimate.yml"
213
+ - ".editorconfig"
170
214
  - ".gitignore"
215
+ - ".hound.yml"
216
+ - ".inch.yml"
171
217
  - ".rubocop.yml"
172
218
  - ".ruby-version"
173
219
  - ".travis.yml"
174
220
  - ".yardopts"
221
+ - CHANGELOG.md
175
222
  - CODE_OF_CONDUCT.md
176
223
  - Gemfile
177
224
  - LICENSE.txt
178
225
  - README.md
226
+ - RELEASE.md
179
227
  - Rakefile
180
228
  - bin/console
181
229
  - bin/setup
@@ -185,12 +233,14 @@ files:
185
233
  - docs/tss-ietf-draft/draft-mcgrew-tss-03.txt
186
234
  - lib/tss.rb
187
235
  - lib/tss/blank.rb
188
- - lib/tss/cli.rb
236
+ - lib/tss/cli_combine.rb
237
+ - lib/tss/cli_common.rb
238
+ - lib/tss/cli_split.rb
239
+ - lib/tss/cli_version.rb
189
240
  - lib/tss/combiner.rb
190
241
  - lib/tss/hasher.rb
191
242
  - lib/tss/splitter.rb
192
243
  - lib/tss/tss.rb
193
- - lib/tss/types.rb
194
244
  - lib/tss/util.rb
195
245
  - lib/tss/version.rb
196
246
  - tss.gemspec
@@ -214,7 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
264
  version: '0'
215
265
  requirements: []
216
266
  rubyforge_project:
217
- rubygems_version: 2.4.5.1
267
+ rubygems_version: 2.5.1
218
268
  signing_key:
219
269
  specification_version: 4
220
270
  summary: A Ruby gem implementing Threshold Secret Sharing. This code can be used in
metadata.gz.sig CHANGED
Binary file
data/lib/tss/cli.rb DELETED
@@ -1,107 +0,0 @@
1
- require 'thor'
2
-
3
- # Command Line Interface (CLI)
4
- # See also, `bin/tss` executable.
5
- module TSS
6
- class CLI < Thor
7
- include Thor::Actions
8
-
9
- method_option :threshold, :aliases => '-t', :banner => 'threshold', :type => :numeric, :desc => '# of shares, of total, required to reconstruct a secret'
10
- method_option :num_shares, :aliases => '-n', :banner => 'num_shares', :type => :numeric, :desc => '# of shares total that will be generated'
11
- method_option :identifier, :aliases => '-i', :banner => 'identifier', :type => :string, :desc => 'A unique identifier string, 0-16 Bytes, [a-zA-Z0-9.-_]'
12
- method_option :hash_alg, :aliases => '-h', :banner => 'hash_alg', :type => :string, :desc => 'A hash type for verification, NONE, SHA1, SHA256'
13
- method_option :format, :aliases => '-f', :banner => 'format', :type => :string, :default => 'human', :desc => 'Share output format, binary or human'
14
- method_option :pad_blocksize, :aliases => '-p', :banner => 'pad_blocksize', :type => :numeric, :desc => 'Block size # secrets will be left-padded to, 0-255'
15
- desc "split SECRET", "split a SECRET String into shares"
16
- long_desc <<-LONGDESC
17
- `tss split` will generate a set of Threshold Secret
18
- Sharing shares from the SECRET provided. To protect
19
- your secret from being saved in your shell history
20
- you will be prompted for the single-line secret.
21
-
22
- Optional Params:
23
-
24
- num_shares :
25
- The number of total shares that will be generated.
26
-
27
- threshold :
28
- The threshold is the number of shares required to
29
- recreate a secret. This is always a subset of the total
30
- shares.
31
-
32
- identifier :
33
- A unique identifier string that will be attached
34
- to each share. It can be 0-16 Bytes long and use the
35
- characters [a-zA-Z0-9.-_]
36
-
37
- hash_alg :
38
- One of NONE, SHA1, SHA256. The algorithm to use for a one-way hash of the secret that will be split along with the secret.
39
-
40
- pad_blocksize :
41
- An Integer, 0-255, that represents a multiple to which the secret will be padded. For example if pad_blocksize is set to 8, the secret 'abc' would be left-padded to '00000abc' (the padding char is not zero, that is just for illustration).
42
-
43
- format :
44
- Whether to output the shares as a binary octet string (RTSS), or the same encoded as more human friendly Base 64 text with some metadata prefixed.
45
-
46
- Example using all options:
47
-
48
- $ tss split -t 3 -n 6 -i abc123 -h SHA256 -p 8 -f human
49
-
50
- Enter your secret:
51
-
52
- secret > my secret
53
-
54
- tss~v1~abc123~3~YWJjMTIzAAAAAAAAAAAAAAIDADEBQ-AQG3PuU4oT4qHOh2oJmu-vQwGE6O5hsGRBNtdAYauTIi7VoIdi5imWSrswDdRy
55
- tss~v1~abc123~3~YWJjMTIzAAAAAAAAAAAAAAIDADECM0OK5TSamH3nubH3FJ2EGZ4Yux4eQC-mvcYY85oOe6ae3kpvVXjuRUDU1m6sX20X
56
- tss~v1~abc123~3~YWJjMTIzAAAAAAAAAAAAAAIDADEDb7yF4Vhr1JqNe2Nc8IXo98hmKAxsqC3c_Mn3r3t60NxQMC22ate51StDOM-BImch
57
- tss~v1~abc123~3~YWJjMTIzAAAAAAAAAAAAAAIDADEEIXU0FajldnRtEQMLK-ZYMO2MRa0NmkBFfNAOx7olbgXLkVbP9txXMDsdokblVwke
58
- tss~v1~abc123~3~YWJjMTIzAAAAAAAAAAAAAAIDADEFfYo7EcQUOpMH09Ggz_403rvy1r9_ckI_Pd_hm1tRxX8FfzEWyXMAoFCKTOfIKgMo
59
- tss~v1~abc123~3~YWJjMTIzAAAAAAAAAAAAAAIDADEGDSmh74Ng8WTziMGZXAm5XcpFLqDl2oP4MH24XhYf33IIg1WsPIyMAznI0DJUeLpN
60
- LONGDESC
61
- def split
62
- args = {}
63
-
64
- say('Enter your secret:')
65
- args[:secret] = ask('secret > ')
66
- args[:threshold] = options[:threshold] if options[:threshold]
67
- args[:num_shares] = options[:num_shares] if options[:num_shares]
68
- args[:identifier] = options[:identifier] if options[:identifier]
69
- args[:hash_alg] = options[:hash_alg] if options[:hash_alg]
70
- args[:pad_blocksize] = options[:pad_blocksize] if options[:pad_blocksize]
71
- args[:format] = options[:format] if options[:format]
72
-
73
- begin
74
- shares = TSS.split(args)
75
- shares.each {|s| say(s) }
76
- rescue => e
77
- say("TSS ERROR : " + e.message)
78
- end
79
- end
80
-
81
- desc "combine SHARES", "Enter min threshold # of SHARES, one at a time, to reconstruct a split secret"
82
- def combine
83
- shares = []
84
- last_ans = nil
85
-
86
- say('Enter shares, one per line, blank line or dot (.) to finish:')
87
- until last_ans == '.' || last_ans == ''
88
- last_ans = ask('share> ')
89
- shares << last_ans unless last_ans.blank? || last_ans == '.'
90
- end
91
-
92
- begin
93
- sec = TSS.combine(shares: shares)
94
-
95
- say('')
96
- say('Secret Recovered and Verified!')
97
- say('')
98
- say("identifier : " + sec[:identifier]) if sec[:identifier].present?
99
- say("threshold : " + sec[:threshold].to_s) if sec[:threshold].present?
100
- say("processing time (ms) : " + sec[:processing_time_ms].to_s) if sec[:processing_time_ms].present?
101
- say("secret :\n" + '*'*50 + "\n" + sec[:secret] + "\n" + '*'*50 + "\n") if sec[:secret].present?
102
- rescue => e
103
- say("TSS ERROR : " + e.message)
104
- end
105
- end
106
- end
107
- end
data/lib/tss/types.rb DELETED
@@ -1,4 +0,0 @@
1
- # dry-types
2
- module Types
3
- include Dry::Types.module
4
- end