json-jwt 0.3.1 → 0.3.2

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.

Potentially problematic release.


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

data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- json-jwt (0.3.0)
4
+ json-jwt (0.3.1)
5
5
  activesupport (>= 2.3)
6
6
  i18n
7
7
  json (>= 1.4.3)
@@ -22,6 +22,7 @@ GEM
22
22
  hashie (1.2.0)
23
23
  i18n (0.6.1)
24
24
  json (1.7.5)
25
+ json (1.7.5-java)
25
26
  multi_json (1.3.6)
26
27
  rake (0.9.2.2)
27
28
  rspec (2.11.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.1
1
+ 0.3.2
data/lib/json/jwk.rb CHANGED
@@ -42,6 +42,7 @@ module JSON
42
42
  {
43
43
  alg: :RSA,
44
44
  xpo: UrlSafeBase64.encode64(public_key.e.to_s(2)),
45
+ exp: UrlSafeBase64.encode64(public_key.e.to_s(2)),
45
46
  mod: UrlSafeBase64.encode64(public_key.n.to_s(2))
46
47
  }
47
48
  when OpenSSL::PKey::EC
@@ -61,7 +62,7 @@ module JSON
61
62
  def decode(jwk)
62
63
  case jwk[:alg].to_s
63
64
  when 'RSA'
64
- exp = OpenSSL::BN.new UrlSafeBase64.decode64(jwk[:xpo]), 2
65
+ exp = OpenSSL::BN.new UrlSafeBase64.decode64(jwk[:xpo] || jwk[:exp]), 2
65
66
  mod = OpenSSL::BN.new UrlSafeBase64.decode64(jwk[:mod]), 2
66
67
  key = OpenSSL::PKey::RSA.new
67
68
  key.e = exp
@@ -3,9 +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, :mod }
6
+ it { jwk.should include :alg, :xpo, :exp, :mod }
7
7
  its(:alg) { jwk[:alg].should == :RSA }
8
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)) }
9
10
  its(:mod) { jwk[:mod].should == UrlSafeBase64.encode64(public_key.n.to_s(2)) }
10
11
 
11
12
  context 'when kid/use options given' do
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.1
4
+ version: 0.3.2
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-15 00:00:00.000000000 Z
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json