json-jwt 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of json-jwt might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.4.0
@@ -41,9 +41,8 @@ module JSON
41
41
  when OpenSSL::PKey::RSA
42
42
  {
43
43
  alg: :RSA,
44
- xpo: UrlSafeBase64.encode64(public_key.e.to_s(2)),
45
- exp: UrlSafeBase64.encode64(public_key.e.to_s(2)),
46
- mod: UrlSafeBase64.encode64(public_key.n.to_s(2))
44
+ e: UrlSafeBase64.encode64(public_key.e.to_s(2)),
45
+ n: UrlSafeBase64.encode64(public_key.n.to_s(2))
47
46
  }
48
47
  when OpenSSL::PKey::EC
49
48
  {
@@ -62,11 +61,11 @@ module JSON
62
61
  def decode(jwk)
63
62
  case jwk[:alg].to_s
64
63
  when 'RSA'
65
- exp = OpenSSL::BN.new UrlSafeBase64.decode64(jwk[:xpo] || jwk[:exp]), 2
66
- mod = OpenSSL::BN.new UrlSafeBase64.decode64(jwk[:mod]), 2
64
+ e = OpenSSL::BN.new UrlSafeBase64.decode64(jwk[:e]), 2
65
+ n = OpenSSL::BN.new UrlSafeBase64.decode64(jwk[:n]), 2
67
66
  key = OpenSSL::PKey::RSA.new
68
- key.e = exp
69
- key.n = mod
67
+ key.e = e
68
+ key.n = n
70
69
  key
71
70
  when 'EC'
72
71
  raise NotImplementedError.new('Not Implemented Yet')
@@ -3,11 +3,10 @@ require 'spec_helper'
3
3
  describe JSON::JWK do
4
4
  context 'when RSA public key given' do
5
5
  let(:jwk) { JSON::JWK.new public_key }
6
- it { jwk.should include :alg, :xpo, :exp, :mod }
6
+ it { jwk.should include :alg, :e, :n }
7
7
  its(:alg) { jwk[:alg].should == :RSA }
8
- its(:xpo) { jwk[:xpo].should == UrlSafeBase64.encode64(public_key.e.to_s(2)) }
9
- its(:exp) { jwk[:exp].should == UrlSafeBase64.encode64(public_key.e.to_s(2)) }
10
- its(:mod) { jwk[:mod].should == UrlSafeBase64.encode64(public_key.n.to_s(2)) }
8
+ its(:e) { jwk[:e].should == UrlSafeBase64.encode64(public_key.e.to_s(2)) }
9
+ its(:n) { jwk[:n].should == UrlSafeBase64.encode64(public_key.n.to_s(2)) }
11
10
 
12
11
  context 'when kid/use options given' do
13
12
  let(:jwk) { JSON::JWK.new public_key, kid: '12345', use: :sig }
@@ -68,12 +67,12 @@ describe JSON::JWK do
68
67
  subject do
69
68
  JSON::JWK.decode(
70
69
  alg: :RSA,
71
- mod: mod,
72
- xpo: xpo
70
+ n: n,
71
+ e: e
73
72
  )
74
73
  end
75
- let(:xpo) { 'AQAB' }
76
- let(:mod) { 'AK8ppaAGn6N3jDic2DhDN5mI5mWzvhfL1AFZOS9q2EBM8L5sjZbYiaHeNoKillZGmEF9a9g6Z20bDnoHTuHPsx93HYkZqPumFZ8K9lLCbqKAMWw2Qgk10RgrZ-kblJotTBCeer9-tZSWO-OWFzP4gp8MpSuQOQbwTJwDgEkFIQLUK2YgzWbn1PoW8xcfbVyWhZD880ELGRW6GhRgYAl0DN_EQS8kyUa0CusYCzOOg2W3-7qjYeojyP6jiOEr-eyjC7hcUvTVoTfz84BiZv72KS3i5JS8ZNNuRp5Ce51wjoDDUoNxDLWv6Da6qMaGpKz6NTSNbvhE_KFhpp4wf5yRQD8=' }
74
+ let(:e) { 'AQAB' }
75
+ let(:n) { 'AK8ppaAGn6N3jDic2DhDN5mI5mWzvhfL1AFZOS9q2EBM8L5sjZbYiaHeNoKillZGmEF9a9g6Z20bDnoHTuHPsx93HYkZqPumFZ8K9lLCbqKAMWw2Qgk10RgrZ-kblJotTBCeer9-tZSWO-OWFzP4gp8MpSuQOQbwTJwDgEkFIQLUK2YgzWbn1PoW8xcfbVyWhZD880ELGRW6GhRgYAl0DN_EQS8kyUa0CusYCzOOg2W3-7qjYeojyP6jiOEr-eyjC7hcUvTVoTfz84BiZv72KS3i5JS8ZNNuRp5Ce51wjoDDUoNxDLWv6Da6qMaGpKz6NTSNbvhE_KFhpp4wf5yRQD8=' }
77
76
  let(:pem) do
78
77
  if RUBY_VERSION >= '1.9.3'
79
78
  <<-PEM
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-jwt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
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-10-18 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -172,18 +172,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  - - ! '>='
173
173
  - !ruby/object:Gem::Version
174
174
  version: '0'
175
- segments:
176
- - 0
177
- hash: -4331477712692770542
178
175
  required_rubygems_version: !ruby/object:Gem::Requirement
179
176
  none: false
180
177
  requirements:
181
178
  - - ! '>='
182
179
  - !ruby/object:Gem::Version
183
180
  version: '0'
184
- segments:
185
- - 0
186
- hash: -4331477712692770542
187
181
  requirements: []
188
182
  rubyforge_project:
189
183
  rubygems_version: 1.8.24