smartcard 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Manifest +13 -6
- data/Rakefile +3 -3
- data/lib/smartcard.rb +3 -0
- data/lib/smartcard/gp/asn1_ber.rb +199 -0
- data/lib/smartcard/gp/cap_loader.rb +88 -0
- data/lib/smartcard/gp/des.rb +68 -0
- data/lib/smartcard/gp/gp_card_mixin.rb +364 -5
- data/lib/smartcard/iso/iso_card_mixin.rb +13 -3
- data/lib/smartcard/iso/jcop_remote_server.rb +14 -5
- data/lib/smartcard/iso/pcsc_transport.rb +8 -1
- data/smartcard.gemspec +5 -5
- data/test/gp/asn1_ber_test.rb +116 -0
- data/test/gp/cap_loader_test.rb +24 -0
- data/test/gp/des_test.rb +39 -0
- data/test/gp/gp_card_mixin_test.rb +194 -5
- data/test/gp/hello.apdu +1 -0
- data/test/gp/hello.cap +0 -0
- data/test/iso/iso_card_mixin_test.rb +9 -8
- data/test/iso/jcop_remote_test.rb +4 -1
- metadata +25 -11
data/test/gp/hello.apdu
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
01 00 11 de ca ff ed 01 02 04 00 01 07 19 83 12 29 10 de ae 02 00 1f 00 11 00 1f 00 0b 00 0b 00 2a 00 0c 00 52 00 13 00 0e 00 00 00 63 00 02 00 01 00 06 01 01 00 04 00 0b 01 00 01 07 a0 00 00 00 62 01 01 03 00 0b 01 07 19 83 12 29 10 de ad 00 08 06 00 0c 00 80 03 00 ff 00 07 01 00 00 00 1c 07 00 52 00 01 10 18 8c 00 01 7a 05 30 8f 00 04 3d 8c 00 08 18 1d 04 41 18 1d 25 8b 00 05 7a 05 21 18 8b 00 03 60 03 7a 19 8b 00 09 2d 1a 04 25 73 00 1e 00 00 00 00 00 09 7b 00 00 03 1a 03 10 06 8d 00 07 3b 19 03 10 06 8b 00 06 70 08 11 6d 00 8d 00 02 7a 08 00 13 00 02 00 01 00 01 03 00 06 48 65 6c 6c 6f 21 00 00 00 00 05 00 2a 00 0a 05 00 00 00 06 80 03 00 06 80 07 01 03 80 03 03 01 00 00 00 03 80 03 02 03 80 0a 08 06 80 10 01 06 00 00 01 03 80 0a 01 09 00 0e 00 00 00 0a 05 06 04 0a 07 07 10 08 08 08
|
data/test/gp/hello.cap
ADDED
Binary file
|
@@ -24,20 +24,21 @@ class IsoCardMixinTest < Test::Unit::TestCase
|
|
24
24
|
def test_serialize_apdu
|
25
25
|
s = lambda { |apdu| IsoCardMixin.serialize_apdu apdu }
|
26
26
|
|
27
|
-
assert_equal [0x00, 0x05, 0x00, 0x00, 0x00], s[:ins => 0x05],
|
27
|
+
assert_equal [0x00, 0x05, 0x00, 0x00, 0x00, 0x00], s[:ins => 0x05],
|
28
28
|
'Specified INS'
|
29
|
-
assert_equal [0x00, 0x09, 0x00, 0x01, 0x00
|
29
|
+
assert_equal [0x00, 0x09, 0x00, 0x01, 0x00, 0x00],
|
30
|
+
s[:ins => 0x09, :p2 => 0x01],
|
30
31
|
'Specified INS and P2'
|
31
|
-
assert_equal [0x00, 0xF9, 0xAC, 0xEF, 0x00],
|
32
|
+
assert_equal [0x00, 0xF9, 0xAC, 0xEF, 0x00, 0x00],
|
32
33
|
s[:ins => 0xF9, :p1 => 0xAC, :p2 => 0xEF],
|
33
34
|
'Specified INS, P1, P2'
|
34
|
-
assert_equal [0x00, 0xFA, 0xAD, 0xEC, 0x00],
|
35
|
+
assert_equal [0x00, 0xFA, 0xAD, 0xEC, 0x00, 0x00],
|
35
36
|
s[:ins => 0xFA, :p12 => [0xAD, 0xEC]],
|
36
37
|
'Specified INS, P1+P2'
|
37
|
-
assert_equal [0x00, 0x0E, 0x00, 0x00, 0x04, 0x33, 0x95, 0x81, 0x63],
|
38
|
+
assert_equal [0x00, 0x0E, 0x00, 0x00, 0x04, 0x33, 0x95, 0x81, 0x63, 0x00],
|
38
39
|
s[:ins => 0x0E, :data => [0x33, 0x95, 0x81, 0x63]],
|
39
40
|
'Specified INS and DATA'
|
40
|
-
assert_equal [0x80, 0x0F, 0xBA, 0xBE, 0x03, 0x31, 0x41, 0x59],
|
41
|
+
assert_equal [0x80, 0x0F, 0xBA, 0xBE, 0x03, 0x31, 0x41, 0x59, 0x00],
|
41
42
|
s[:cla => 0x80, :ins => 0x0F, :p1 => 0xBA, :p2 => 0xBE,
|
42
43
|
:data => [0x31, 0x41, 0x59]],
|
43
44
|
'Specified everything'
|
@@ -60,7 +61,7 @@ class IsoCardMixinTest < Test::Unit::TestCase
|
|
60
61
|
def win_mock
|
61
62
|
mock = MixinWrapper.new
|
62
63
|
flexmock(mock).should_receive(:exchange_apdu).
|
63
|
-
with([0x00, 0xF9, 0xAC, 0x00, 0x02, 0x31, 0x41]).
|
64
|
+
with([0x00, 0xF9, 0xAC, 0x00, 0x02, 0x31, 0x41, 0x00]).
|
64
65
|
and_return([0x67, 0x31, 0x90, 0x00])
|
65
66
|
mock
|
66
67
|
end
|
@@ -71,7 +72,7 @@ class IsoCardMixinTest < Test::Unit::TestCase
|
|
71
72
|
def lose_mock
|
72
73
|
mock = MixinWrapper.new
|
73
74
|
flexmock(mock).should_receive(:exchange_apdu).
|
74
|
-
with([0x00, 0xF9, 0xAC, 0x00, 0x02, 0x31, 0x41]).
|
75
|
+
with([0x00, 0xF9, 0xAC, 0x00, 0x02, 0x31, 0x41, 0x00]).
|
75
76
|
and_return([0x86, 0x31])
|
76
77
|
mock
|
77
78
|
end
|
@@ -34,6 +34,9 @@ class JcopRemoteTest < Test::Unit::TestCase
|
|
34
34
|
@received << apdu
|
35
35
|
@responses.shift
|
36
36
|
end
|
37
|
+
def card_atr
|
38
|
+
[0x31, 0x41, 0x59].pack('C*')
|
39
|
+
end
|
37
40
|
end
|
38
41
|
|
39
42
|
def setup
|
@@ -88,7 +91,7 @@ class JcopRemoteTest < Test::Unit::TestCase
|
|
88
91
|
end
|
89
92
|
|
90
93
|
def test_iso_card_integration
|
91
|
-
apdu_request = [0x00, 0x31, 0x41, 0x59, 0x00]
|
94
|
+
apdu_request = [0x00, 0x31, 0x41, 0x59, 0x00, 0x00]
|
92
95
|
apdu_response = [0x27, 0x90, 0x00]
|
93
96
|
|
94
97
|
logic = Logic.new([apdu_response])
|
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.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
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-
|
12
|
+
date: 2009-11-01 01:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,6 +22,8 @@ extensions:
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- BUILD
|
24
24
|
- CHANGELOG
|
25
|
+
- LICENSE
|
26
|
+
- README
|
25
27
|
- ext/smartcard_pcsc/extconf.rb
|
26
28
|
- ext/smartcard_pcsc/pcsc.h
|
27
29
|
- ext/smartcard_pcsc/pcsc_card.c
|
@@ -35,6 +37,10 @@ extra_rdoc_files:
|
|
35
37
|
- ext/smartcard_pcsc/pcsc_reader_states.c
|
36
38
|
- ext/smartcard_pcsc/pcsc_surrogate_reader.h
|
37
39
|
- ext/smartcard_pcsc/pcsc_surrogate_wintypes.h
|
40
|
+
- lib/smartcard.rb
|
41
|
+
- lib/smartcard/gp/asn1_ber.rb
|
42
|
+
- lib/smartcard/gp/cap_loader.rb
|
43
|
+
- lib/smartcard/gp/des.rb
|
38
44
|
- lib/smartcard/gp/gp_card_mixin.rb
|
39
45
|
- lib/smartcard/iso/auto_configurator.rb
|
40
46
|
- lib/smartcard/iso/iso_card_mixin.rb
|
@@ -44,12 +50,13 @@ extra_rdoc_files:
|
|
44
50
|
- lib/smartcard/iso/pcsc_transport.rb
|
45
51
|
- lib/smartcard/iso/transport.rb
|
46
52
|
- lib/smartcard/pcsc/pcsc_exception.rb
|
47
|
-
- lib/smartcard.rb
|
48
|
-
- LICENSE
|
49
|
-
- README
|
50
53
|
files:
|
51
54
|
- BUILD
|
52
55
|
- CHANGELOG
|
56
|
+
- LICENSE
|
57
|
+
- Manifest
|
58
|
+
- README
|
59
|
+
- Rakefile
|
53
60
|
- ext/smartcard_pcsc/extconf.rb
|
54
61
|
- ext/smartcard_pcsc/pcsc.h
|
55
62
|
- ext/smartcard_pcsc/pcsc_card.c
|
@@ -63,6 +70,10 @@ files:
|
|
63
70
|
- ext/smartcard_pcsc/pcsc_reader_states.c
|
64
71
|
- ext/smartcard_pcsc/pcsc_surrogate_reader.h
|
65
72
|
- ext/smartcard_pcsc/pcsc_surrogate_wintypes.h
|
73
|
+
- lib/smartcard.rb
|
74
|
+
- lib/smartcard/gp/asn1_ber.rb
|
75
|
+
- lib/smartcard/gp/cap_loader.rb
|
76
|
+
- lib/smartcard/gp/des.rb
|
66
77
|
- lib/smartcard/gp/gp_card_mixin.rb
|
67
78
|
- lib/smartcard/iso/auto_configurator.rb
|
68
79
|
- lib/smartcard/iso/iso_card_mixin.rb
|
@@ -72,19 +83,19 @@ files:
|
|
72
83
|
- lib/smartcard/iso/pcsc_transport.rb
|
73
84
|
- lib/smartcard/iso/transport.rb
|
74
85
|
- lib/smartcard/pcsc/pcsc_exception.rb
|
75
|
-
-
|
76
|
-
-
|
77
|
-
-
|
78
|
-
- Rakefile
|
79
|
-
- README
|
80
|
-
- smartcard.gemspec
|
86
|
+
- test/gp/asn1_ber_test.rb
|
87
|
+
- test/gp/cap_loader_test.rb
|
88
|
+
- test/gp/des_test.rb
|
81
89
|
- test/gp/gp_card_mixin_test.rb
|
90
|
+
- test/gp/hello.apdu
|
91
|
+
- test/gp/hello.cap
|
82
92
|
- test/iso/auto_configurator_test.rb
|
83
93
|
- test/iso/iso_card_mixin_test.rb
|
84
94
|
- test/iso/jcop_remote_test.rb
|
85
95
|
- test/pcsc/containers_test.rb
|
86
96
|
- test/pcsc/smoke_test.rb
|
87
97
|
- tests/ts_pcsc_ext.rb
|
98
|
+
- smartcard.gemspec
|
88
99
|
has_rdoc: true
|
89
100
|
homepage: http://www.costan.us/smartcard
|
90
101
|
licenses: []
|
@@ -120,6 +131,9 @@ signing_key:
|
|
120
131
|
specification_version: 3
|
121
132
|
summary: Interface with ISO 7816 smart cards.
|
122
133
|
test_files:
|
134
|
+
- test/gp/asn1_ber_test.rb
|
135
|
+
- test/gp/cap_loader_test.rb
|
136
|
+
- test/gp/des_test.rb
|
123
137
|
- test/gp/gp_card_mixin_test.rb
|
124
138
|
- test/iso/auto_configurator_test.rb
|
125
139
|
- test/iso/iso_card_mixin_test.rb
|