pkcs11 0.1.0-x86-mswin32 → 0.2.0-x86-mswin32
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.
- data/.yardopts +2 -0
- data/History.txt +23 -0
- data/Manifest.txt +6 -0
- data/README.rdoc +28 -15
- data/Rakefile +51 -2
- data/ext/extconf.rb +1 -0
- data/ext/generate_structs.rb +157 -0
- data/ext/generate_thread_funcs.rb +72 -0
- data/ext/pk11.c +482 -252
- data/ext/pk11.h +4 -1
- data/ext/pk11_const.c +25 -476
- data/ext/pk11_const_def.inc +452 -0
- data/ext/pk11_struct_def.inc +304 -0
- data/ext/pk11_struct_impl.inc +304 -0
- data/ext/pk11_thread_funcs.c +411 -0
- data/ext/pk11_thread_funcs.h +482 -0
- data/lib/1.8/pkcs11_ext.so +0 -0
- data/lib/1.9/pkcs11_ext.so +0 -0
- data/lib/pkcs11.rb +5 -8
- data/lib/pkcs11/extensions.rb +17 -109
- data/lib/pkcs11/helper.rb +151 -0
- data/lib/pkcs11/library.rb +44 -13
- data/lib/pkcs11/object.rb +73 -17
- data/lib/pkcs11/session.rb +318 -121
- data/lib/pkcs11/slot.rb +30 -9
- data/test/helper.rb +13 -6
- data/test/test_pkcs11.rb +13 -2
- data/test/test_pkcs11_crypt.rb +38 -3
- data/test/test_pkcs11_object.rb +18 -4
- data/test/test_pkcs11_session.rb +28 -2
- data/test/test_pkcs11_slot.rb +9 -6
- data/test/test_pkcs11_structs.rb +134 -0
- data/test/test_pkcs11_thread.rb +45 -0
- metadata +40 -7
@@ -0,0 +1,45 @@
|
|
1
|
+
require "test/unit"
|
2
|
+
require "pkcs11"
|
3
|
+
require "test/helper"
|
4
|
+
require "openssl"
|
5
|
+
|
6
|
+
class TestPkcs11Thread < Test::Unit::TestCase
|
7
|
+
include PKCS11
|
8
|
+
|
9
|
+
attr_reader :slots
|
10
|
+
attr_reader :slot
|
11
|
+
attr_reader :session
|
12
|
+
|
13
|
+
def setup
|
14
|
+
$pkcs11 ||= open_softokn
|
15
|
+
@slots = $pkcs11.active_slots
|
16
|
+
@slot = slots.last
|
17
|
+
@session = slot.open
|
18
|
+
# session.login(:USER, "")
|
19
|
+
end
|
20
|
+
|
21
|
+
def teardown
|
22
|
+
# @session.logout
|
23
|
+
@session.close
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_concurrency
|
27
|
+
return unless self.respond_to?(:skip)
|
28
|
+
skip "PKCS#11 calls will block on Ruby 1.8.x" if RUBY_VERSION<'1.9'
|
29
|
+
|
30
|
+
count = 0
|
31
|
+
th = Thread.new{
|
32
|
+
loop do
|
33
|
+
count += 1
|
34
|
+
sleep 0.01
|
35
|
+
end
|
36
|
+
}
|
37
|
+
# This should take some seconds:
|
38
|
+
pub_key, priv_key = session.generate_key_pair(:RSA_PKCS_KEY_PAIR_GEN,
|
39
|
+
{:MODULUS_BITS=>1408, :PUBLIC_EXPONENT=>[3].pack("N"), :TOKEN=>false},
|
40
|
+
{})
|
41
|
+
th.kill
|
42
|
+
assert_operator count, :>, 10, "The second thread should count further concurrent to the key generation"
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pkcs11
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: x86-mswin32
|
6
6
|
authors:
|
7
7
|
- Ryosuke Kutsuna
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date:
|
14
|
+
date: 2011-01-11 00:00:00 +01:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -24,6 +24,26 @@ dependencies:
|
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: 2.0.4
|
26
26
|
version:
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yard
|
29
|
+
type: :development
|
30
|
+
version_requirement:
|
31
|
+
version_requirements: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0.6"
|
36
|
+
version:
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rake-compiler
|
39
|
+
type: :development
|
40
|
+
version_requirement:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0.7"
|
46
|
+
version:
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: hoe
|
29
49
|
type: :development
|
@@ -34,7 +54,7 @@ dependencies:
|
|
34
54
|
- !ruby/object:Gem::Version
|
35
55
|
version: 2.6.0
|
36
56
|
version:
|
37
|
-
description: ""
|
57
|
+
description: "This module allows Ruby programs to interface with \"RSA Security Inc. PKCS #11 Cryptographic Token Interface (Cryptoki)\"."
|
38
58
|
email:
|
39
59
|
- ryosuke@deer-n-horse.jp
|
40
60
|
- gotoyuzo@notwork.org
|
@@ -50,12 +70,15 @@ extra_rdoc_files:
|
|
50
70
|
- ext/pk11.c
|
51
71
|
files:
|
52
72
|
- .autotest
|
73
|
+
- .yardopts
|
53
74
|
- History.txt
|
54
75
|
- MIT-LICENSE
|
55
76
|
- Manifest.txt
|
56
77
|
- README.rdoc
|
57
78
|
- Rakefile
|
58
79
|
- ext/extconf.rb
|
80
|
+
- ext/generate_structs.rb
|
81
|
+
- ext/generate_thread_funcs.rb
|
59
82
|
- ext/include/cryptoki.h
|
60
83
|
- ext/include/ct-kip.h
|
61
84
|
- ext/include/otp-pkcs11.h
|
@@ -68,6 +91,7 @@ files:
|
|
68
91
|
- ext/pk11_const.c
|
69
92
|
- lib/pkcs11.rb
|
70
93
|
- lib/pkcs11/extensions.rb
|
94
|
+
- lib/pkcs11/helper.rb
|
71
95
|
- lib/pkcs11/library.rb
|
72
96
|
- lib/pkcs11/object.rb
|
73
97
|
- lib/pkcs11/session.rb
|
@@ -83,6 +107,13 @@ files:
|
|
83
107
|
- test/test_pkcs11_object.rb
|
84
108
|
- test/test_pkcs11_session.rb
|
85
109
|
- test/test_pkcs11_slot.rb
|
110
|
+
- test/test_pkcs11_structs.rb
|
111
|
+
- test/test_pkcs11_thread.rb
|
112
|
+
- ext/pk11_struct_impl.inc
|
113
|
+
- ext/pk11_struct_def.inc
|
114
|
+
- ext/pk11_const_def.inc
|
115
|
+
- ext/pk11_thread_funcs.h
|
116
|
+
- ext/pk11_thread_funcs.c
|
86
117
|
- lib/1.8/pkcs11_ext.so
|
87
118
|
- lib/1.9/pkcs11_ext.so
|
88
119
|
has_rdoc: true
|
@@ -113,10 +144,12 @@ rubyforge_project: pkcs11
|
|
113
144
|
rubygems_version: 1.3.5
|
114
145
|
signing_key:
|
115
146
|
specification_version: 3
|
116
|
-
summary:
|
147
|
+
summary: PKCS#11 binding for Ruby
|
117
148
|
test_files:
|
118
|
-
- test/
|
149
|
+
- test/test_pkcs11_thread.rb
|
150
|
+
- test/test_pkcs11_structs.rb
|
119
151
|
- test/test_pkcs11_session.rb
|
120
|
-
- test/test_pkcs11_object.rb
|
121
|
-
- test/test_pkcs11_crypt.rb
|
122
152
|
- test/test_pkcs11_slot.rb
|
153
|
+
- test/test_pkcs11.rb
|
154
|
+
- test/test_pkcs11_crypt.rb
|
155
|
+
- test/test_pkcs11_object.rb
|