cert-to-cwt 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 599594ac004acd8a7fdf29c302d566bf6253f5d6
4
- data.tar.gz: 53de4844c860c9eb8f498f0dcc639631dec2b55f
3
+ metadata.gz: bb0d2612512bce82fd2fd95a7af7c9bbe517d980
4
+ data.tar.gz: 178dcde6fb0f0b18fdde5b7dd9c1c8acb94576e9
5
5
  SHA512:
6
- metadata.gz: 2f45ef0d8dafd166e4f6c9ed03605ce0f41aa0715684836124bc3b262cc23526c98adc16d7c95008b802476c76e1b1815c31f03b4b4ea6076a732ef63522bc9f
7
- data.tar.gz: 213f1f078d04f38865e663f6985b0510eabd3d9c43487dc358f4f0a8a2913f48cb03b7cf12d0508459041a0316182db8f519e91b9f0b06717e46d28ef9cfadc7
6
+ metadata.gz: 501472717dc2f0274d35050a9d8e60cf12e34f8a1b9cf1c44c91a63a9502ffd11c9f1c77cc9a9d8693b4c88048f7cd653afb5dc86c4cdab5a8844b1a604dbb92
7
+ data.tar.gz: 6d245d894362c6b926625c83680aeb5654e92adc43d1f44f0a9fa8a722bfc701511d0c629fd783a4778d7aef8e3633f56ff0ec63cacb3f3c2ad0b85dffbc22ab
@@ -30,7 +30,7 @@ if ARGV[0] == "-b"
30
30
  end
31
31
  f = ARGF.read.b
32
32
 
33
- def numbertobytes(n) # doesn't work for 0
33
+ def numbertobytes(n)
34
34
  if n == 0
35
35
  "".b
36
36
  else
@@ -130,6 +130,9 @@ y -3
130
130
  pk -100001
131
131
  ).each_slice(2).map{ |x, y| SYMLOOKUP[x.intern] = y.to_i}
132
132
 
133
+ StopDS = Struct.new(:value)
134
+ Bits = Struct.new(:bits)
135
+
133
136
  def desymbolicate(o)
134
137
  case o
135
138
  when Symbol
@@ -138,6 +141,8 @@ def desymbolicate(o)
138
141
  Hash[o.map {|k, v| [desymbolicate(k), desymbolicate(v)]}]
139
142
  when Array
140
143
  o.map {|x| desymbolicate(x)}
144
+ when StopDS
145
+ o.value
141
146
  else
142
147
  o
143
148
  end
@@ -217,7 +222,16 @@ exp3[0].fetch(:seq).each do |e3|
217
222
  crit = false
218
223
  end
219
224
  val = val.fetch(:b)
220
- # val = ASN1.decode(val)
225
+ val = ASN1.decode(val)
226
+ # warn "@@ #{val.inspect}"
227
+ if Hash === val && val.keys == [:bits]
228
+ s = val[:bits]
229
+ ignore_bits = s.getbyte(0)
230
+ bits = s[1..-1].bytes.map {|b| (b+0x100).to_s(2)[1..-1] }.join
231
+ bits[-1-ignore_bits+1..-1] = '' if ignore_bits > 0
232
+ val = {bits: bits}
233
+ end
234
+ val = StopDS.new(val)
221
235
  claimset[name] = val # er, ignoring crit right now
222
236
  end
223
237
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cert-to-cwt"
3
- s.version = "0.0.2"
3
+ s.version = "0.0.4"
4
4
  s.summary = "Convert an X.509 cert into a CWT claim set"
5
5
  s.description = %q{cert-to-cwt is a highly experimental converter for X.509 certificates into CWT claim sets.}
6
6
  s.author = "Carsten Bormann"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cert-to-cwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-22 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  version: '0'
83
83
  requirements: []
84
84
  rubyforge_project:
85
- rubygems_version: 2.6.11
85
+ rubygems_version: 2.6.14
86
86
  signing_key:
87
87
  specification_version: 4
88
88
  summary: Convert an X.509 cert into a CWT claim set