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 +2 -0
- data/lib/smartcard/iso/jcop_remote_server.rb +2 -2
- data/lib/smartcard/iso/jcop_remote_transport.rb +11 -3
- data/lib/smartcard/pcsc.so +0 -0
- data/smartcard.gemspec +1 -1
- data/test/iso/jcop_remote_test.rb +1 -0
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -43,8 +43,8 @@ module JcopRemoteServingStubs
|
|
43
43
|
[0x90, 0x00]
|
44
44
|
end
|
45
45
|
|
46
|
-
# The smartcard's
|
47
|
-
def
|
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
|
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
|
|
data/lib/smartcard/pcsc.so
CHANGED
Binary file
|
data/smartcard.gemspec
CHANGED
@@ -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
|