smartcard 0.4.9-x86-mswin32-60 → 0.4.10-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.4.10. Removed hardcoded card manager AID.
2
+
1
3
  v0.4.9. Disabled Nagle's algorithm in the remote JCOP transport.
2
4
 
3
5
  v0.4.8. Gem dependencies.
@@ -35,9 +35,12 @@ module GpCardMixin
35
35
  app_data
36
36
  end
37
37
 
38
- # The default application ID of the GlobalPlatform card manager.
38
+ # The application ID of the GlobalPlatform card manager.
39
39
  def gp_card_manager_aid
40
- [0xA0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00]
40
+ unless instance_variable_defined? :@gp_card_manager_aid
41
+ @gp_card_manager_aid = select_application([])[:aid]
42
+ end
43
+ @gp_card_manager_aid
41
44
  end
42
45
 
43
46
  # Issues a GlobalPlatform INITIALIZE UPDATE command.
@@ -30,7 +30,7 @@ class ApduError < RuntimeError
30
30
  def initialize(response)
31
31
  @data = response[:data]
32
32
  @status = response[:status]
33
- super ApduError.message_for_apdu_response response
33
+ super ApduError.message_for_apdu_response(response)
34
34
  end
35
35
 
36
36
  # Computes the exception message for an APDU response.
Binary file
data/smartcard.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{smartcard}
5
- s.version = "0.4.9"
5
+ s.version = "0.4.10"
6
6
  s.platform = %q{x86-mswin32-60}
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
9
9
  s.authors = ["Victor Costan"]
10
- s.date = %q{2009-11-11}
10
+ s.date = %q{2009-11-12}
11
11
  s.description = %q{Interface with ISO 7816 smart cards.}
12
12
  s.email = %q{victor@costan.us}
13
13
  s.extra_rdoc_files = ["BUILD", "CHANGELOG", "LICENSE", "README", "ext/smartcard_pcsc/extconf.rb", "ext/smartcard_pcsc/pcsc.h", "ext/smartcard_pcsc/pcsc_card.c", "ext/smartcard_pcsc/pcsc_constants.c", "ext/smartcard_pcsc/pcsc_context.c", "ext/smartcard_pcsc/pcsc_exception.c", "ext/smartcard_pcsc/pcsc_io_request.c", "ext/smartcard_pcsc/pcsc_main.c", "ext/smartcard_pcsc/pcsc_multi_strings.c", "ext/smartcard_pcsc/pcsc_namespace.c", "ext/smartcard_pcsc/pcsc_reader_states.c", "ext/smartcard_pcsc/pcsc_surrogate_reader.h", "ext/smartcard_pcsc/pcsc_surrogate_wintypes.h", "lib/smartcard.rb", "lib/smartcard/gp/asn1_ber.rb", "lib/smartcard/gp/cap_loader.rb", "lib/smartcard/gp/des.rb", "lib/smartcard/gp/gp_card_mixin.rb", "lib/smartcard/iso/apdu_error.rb", "lib/smartcard/iso/auto_configurator.rb", "lib/smartcard/iso/iso_card_mixin.rb", "lib/smartcard/iso/jcop_remote_protocol.rb", "lib/smartcard/iso/jcop_remote_server.rb", "lib/smartcard/iso/jcop_remote_transport.rb", "lib/smartcard/iso/pcsc_transport.rb", "lib/smartcard/iso/transport.rb", "lib/smartcard/pcsc/pcsc_exception.rb"]
@@ -30,6 +30,20 @@ class GpCardMixinTest < Test::Unit::TestCase
30
30
  @max_apdu_length = 0x0F
31
31
  end
32
32
 
33
+ def mock_card_manager_query(channel_mock)
34
+ flexmock(channel_mock).should_receive(:exchange_apdu).
35
+ with([0x00, 0xA4, 0x04, 0x00, 0x00, 0x00]).
36
+ and_return([0x6F, 16, 0x84, 8, 0xA0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
37
+ 0x00, 0xA5, 4, 0x9F, 0x65, 1, 0x0F, 0x90, 0x00])
38
+ end
39
+
40
+ def test_gp_card_manager_aid
41
+ mock = MixinWrapper.new
42
+ mock_card_manager_query mock
43
+ golden = [0xA0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00]
44
+ assert_equal golden, mock.gp_card_manager_aid
45
+ end
46
+
33
47
  def mock_card_manager_select(channel_mock)
34
48
  flexmock(channel_mock).should_receive(:exchange_apdu).
35
49
  with([0x00, 0xA4, 0x04, 0x00, 0x08, 0xA0, 0x00, 0x00, 0x00, 0x03, 0x00,
@@ -40,13 +54,14 @@ class GpCardMixinTest < Test::Unit::TestCase
40
54
 
41
55
  def test_select_application
42
56
  mock = MixinWrapper.new
57
+ mock_card_manager_query mock
43
58
  mock_card_manager_select mock
44
59
  app_data = mock.select_application mock.gp_card_manager_aid
45
60
 
46
61
  golden = { :aid => mock.gp_card_manager_aid, :max_apdu_length => 0x0F }
47
62
  assert_equal golden, app_data
48
63
  end
49
-
64
+
50
65
  def mock_channel_setup(channel_mock)
51
66
  flexmock(channel_mock).should_receive(:exchange_apdu).
52
67
  with([0x80, 0x50, 0x00, 0x00, 0x08, 0x20, 0xBB, 0xE0, 0x4A, 0x1C, 0x6B,
@@ -129,6 +144,7 @@ class GpCardMixinTest < Test::Unit::TestCase
129
144
 
130
145
  def test_gp_applications
131
146
  mock = MixinWrapper.new
147
+ mock_card_manager_query mock
132
148
  mock_card_manager_select mock
133
149
  mock_channel_setup mock
134
150
  mock_channel_lock mock
@@ -156,6 +172,7 @@ class GpCardMixinTest < Test::Unit::TestCase
156
172
 
157
173
  def test_delete_application
158
174
  mock = MixinWrapper.new
175
+ mock_card_manager_query mock
159
176
  mock_card_manager_select mock
160
177
  mock_channel_setup mock
161
178
  mock_channel_lock mock
@@ -167,6 +184,7 @@ class GpCardMixinTest < Test::Unit::TestCase
167
184
 
168
185
  def test_gp_install_load
169
186
  mock = MixinWrapper.new
187
+ mock_card_manager_query mock
170
188
  flexmock(mock).should_receive(:exchange_apdu).
171
189
  with([0x80, 0xE6, 0x02, 0x00, 0x14, 0x07, 0x19, 0x83, 0x12, 0x29, 0x10,
172
190
  0xFA, 0xCE, 0x08, 0xA0, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartcard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.9
4
+ version: 0.4.10
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Victor Costan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-11 00:00:00 -05:00
12
+ date: 2009-11-12 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency