pkcs11 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryosuke Kutsuna
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2010-05-27 00:00:00 +02:00
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
  has_rdoc: true
87
118
  homepage: http://github.com/larskanis/pkcs11
88
119
  licenses: []
@@ -111,10 +142,12 @@ rubyforge_project: pkcs11
111
142
  rubygems_version: 1.3.5
112
143
  signing_key:
113
144
  specification_version: 3
114
- summary: ""
145
+ summary: PKCS#11 binding for Ruby
115
146
  test_files:
116
- - test/test_pkcs11.rb
147
+ - test/test_pkcs11_thread.rb
148
+ - test/test_pkcs11_structs.rb
117
149
  - test/test_pkcs11_session.rb
118
- - test/test_pkcs11_object.rb
119
- - test/test_pkcs11_crypt.rb
120
150
  - test/test_pkcs11_slot.rb
151
+ - test/test_pkcs11.rb
152
+ - test/test_pkcs11_crypt.rb
153
+ - test/test_pkcs11_object.rb