smartcard 0.4.3-x86-mswin32-60 → 0.4.4-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.4. Bugfixes in JcopRemoteTransport's ATR forwarding logic.
2
+
1
3
  v0.4.3. Fixed gem manifest to state dependency on rubyzip.
2
4
 
3
5
  v0.4.2. GlobalPlatform applet instalation.
@@ -43,8 +43,8 @@ module JcopRemoteServingStubs
43
43
  [0x90, 0x00]
44
44
  end
45
45
 
46
- # The smartcard's APDU.
47
- def card_apdu
46
+ # The smartcard's ATR.
47
+ def card_atr
48
48
  # ATR from the card simulator in JCOP 3.2.7.
49
49
  [0x3B, 0xF8, 0x13, 0x00, 0x00, 0x81, 0x31, 0xFE, 0x45, 0x4A, 0x43, 0x4F,
50
50
  0x50, 0x76, 0x32, 0x34, 0x31, 0xB7].pack('C*')
@@ -23,16 +23,22 @@ class JcopRemoteTransport
23
23
  def initialize(options)
24
24
  @host, @port = options[:host], options[:port]
25
25
  @socket = nil
26
+ @atr = nil
26
27
  end
27
28
 
28
- #
29
+ # :nodoc: standard transport method
29
30
  def exchange_apdu(apdu)
30
31
  send_message @socket, :type => 1, :node => 0, :data => apdu
31
32
  loop do
32
33
  message = recv_message @socket
33
34
  return message[:data] if message[:type] == 1
34
35
  end
35
- end
36
+ end
37
+
38
+ # :nodoc: standard transport method
39
+ def card_atr
40
+ @atr
41
+ end
36
42
 
37
43
  # Makes a transport-level connection to the TEM.
38
44
  def connect
@@ -51,7 +57,8 @@ class JcopRemoteTransport
51
57
 
52
58
  # Wait for the card to be inserted.
53
59
  send_message @socket, :type => 0, :node => 0, :data => [0, 1, 0, 0]
54
- recv_message @socket # ATR should come here, but who cares
60
+ message = recv_message @socket
61
+ @atr = message[:data]
55
62
  rescue Exception
56
63
  @socket = nil
57
64
  raise
@@ -63,6 +70,7 @@ class JcopRemoteTransport
63
70
  if @socket
64
71
  @socket.close
65
72
  @socket = nil
73
+ @atr = nil
66
74
  end
67
75
  end
68
76
 
Binary file
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{smartcard}
5
- s.version = "0.4.3"
5
+ s.version = "0.4.4"
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=
@@ -68,6 +68,7 @@ class JcopRemoteTest < Test::Unit::TestCase
68
68
  Kernel.sleep 0.05 # Wait for the server to start up.
69
69
  @client.connect
70
70
  assert_equal apdu_response, @client.exchange_apdu(apdu_request)
71
+ assert_equal [0x31, 0x41, 0x59], @client.card_atr
71
72
  @client.disconnect
72
73
  Kernel.sleep 0.05 # Wait for the server to process the disconnect.
73
74
  assert_equal [:start, apdu_request, :end], logic.received
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.3
4
+ version: 0.4.4
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Victor Costan