pkcs11 0.2.7 → 0.3.0
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.appveyor.yml +40 -0
- data/.gitignore +17 -0
- data/.travis.yml +4 -4
- data/Gemfile +3 -3
- data/History.txt +10 -0
- data/README.rdoc +7 -10
- data/Rakefile +4 -5
- data/ext/extconf.rb +0 -2
- data/ext/generate_structs.rb +19 -8
- data/ext/generate_thread_funcs.rb +0 -6
- data/ext/pk11.c +16 -21
- data/ext/pk11.h +2 -17
- data/ext/pk11_struct.doc +90 -90
- data/ext/pk11_struct_impl.inc +90 -90
- data/ext/pk11_struct_macros.h +13 -13
- data/ext/pk11_thread_funcs.c +0 -2
- data/ext/pk11_thread_funcs.h +0 -2
- data/ext/pk11_version.h +1 -1
- data/lib/pkcs11/object.rb +1 -1
- data/lib/pkcs11/session.rb +13 -13
- data/pkcs11_luna/README_LUNA.rdoc +3 -3
- data/pkcs11_protect_server/README_PROTECT_SERVER.rdoc +3 -3
- data/test/helper.rb +1 -1
- data/test/test_pkcs11.rb +1 -1
- data/test/test_pkcs11_crypt.rb +28 -28
- data/test/test_pkcs11_object.rb +14 -11
- data/test/test_pkcs11_session.rb +22 -22
- data/test/test_pkcs11_slot.rb +1 -1
- data/test/test_pkcs11_structs.rb +35 -9
- data/test/test_pkcs11_thread.rb +2 -2
- metadata +29 -22
- metadata.gz.sig +0 -0
- data/appveyor.yml +0 -42
data/test/test_pkcs11_structs.rb
CHANGED
@@ -11,9 +11,10 @@ class TestPkcs11Structs < Minitest::Test
|
|
11
11
|
def teardown
|
12
12
|
end
|
13
13
|
|
14
|
-
def
|
14
|
+
def test_STRING_ACCESSOR_ASCII
|
15
15
|
s = CK_DATE.new
|
16
16
|
assert_equal "\0\0", s.day
|
17
|
+
assert_equal Encoding::ASCII, s.day.encoding
|
17
18
|
assert_equal "\0\0\0\0", s.year
|
18
19
|
s.day = "12345"
|
19
20
|
assert_equal "12", s.day
|
@@ -22,6 +23,20 @@ class TestPkcs11Structs < Minitest::Test
|
|
22
23
|
assert_raises(TypeError){ s.day = nil }
|
23
24
|
end
|
24
25
|
|
26
|
+
def test_STRING_ACCESSOR_UTF8
|
27
|
+
s = CK_INFO.new
|
28
|
+
s.manufacturerID = 'Müller'
|
29
|
+
assert_equal "Müller", s.manufacturerID.split("\0",2).first
|
30
|
+
assert_equal Encoding::UTF_8, s.manufacturerID.encoding
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_STRING_ACCESSOR_BINARY
|
34
|
+
s = CK_DES_CBC_ENCRYPT_DATA_PARAMS.new
|
35
|
+
s.iv = "somedata"
|
36
|
+
assert_equal "somedata", s.iv
|
37
|
+
assert_equal Encoding::BINARY, s.iv.encoding
|
38
|
+
end
|
39
|
+
|
25
40
|
def test_ULONG_ACCESSOR
|
26
41
|
s = CK_SSL3_KEY_MAT_PARAMS.new
|
27
42
|
assert_equal 0, s.ulIVSizeInBits
|
@@ -42,13 +57,24 @@ class TestPkcs11Structs < Minitest::Test
|
|
42
57
|
assert_raises(ArgumentError){ s.bIsExport = nil }
|
43
58
|
end
|
44
59
|
|
45
|
-
def
|
46
|
-
s =
|
47
|
-
assert_nil s.
|
48
|
-
s.
|
49
|
-
assert_equal "
|
50
|
-
s.
|
51
|
-
|
60
|
+
def test_STRING_PTR_ACCESSOR_UTF8
|
61
|
+
s = CK_PBE_PARAMS.new
|
62
|
+
assert_nil s.pPassword
|
63
|
+
s.pPassword = "secret"
|
64
|
+
assert_equal "secret", s.pPassword
|
65
|
+
assert_equal Encoding::UTF_8, s.pPassword.encoding
|
66
|
+
s.pPassword = nil
|
67
|
+
assert_nil s.pPassword
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_STRING_PTR_ACCESSOR_BINARY
|
71
|
+
s = CK_DES_CBC_ENCRYPT_DATA_PARAMS.new
|
72
|
+
assert_nil s.pData
|
73
|
+
s.pData = "some data"
|
74
|
+
assert_equal "some data", s.pData
|
75
|
+
assert_equal Encoding::BINARY, s.pData.encoding
|
76
|
+
s.pData = nil
|
77
|
+
assert_nil s.pData
|
52
78
|
end
|
53
79
|
|
54
80
|
def test_STRUCT_ACCESSOR
|
@@ -148,7 +174,7 @@ class TestPkcs11Structs < Minitest::Test
|
|
148
174
|
assert s.inspect =~ /year="2010"/, 'There should be a year in CK_DATE'
|
149
175
|
assert_equal ["year", "month", "day"], s.members, 'CK_DATE should contain some attributes'
|
150
176
|
assert_equal ["2010", "12", "31"], s.values, 'values of CK_DATE'
|
151
|
-
assert_equal( {:
|
177
|
+
assert_equal( {day: "31", month: "12", year: "2010"}, s.to_hash, 'CK_DATE as hash' )
|
152
178
|
end
|
153
179
|
|
154
180
|
def test_bignum_attribute
|
data/test/test_pkcs11_thread.rb
CHANGED
@@ -33,8 +33,8 @@ class TestPkcs11Thread < Minitest::Test
|
|
33
33
|
end
|
34
34
|
}
|
35
35
|
# This should take some seconds:
|
36
|
-
|
37
|
-
{:
|
36
|
+
_pub_key, _priv_key = session.generate_key_pair(:RSA_PKCS_KEY_PAIR_GEN,
|
37
|
+
{MODULUS_BITS: 2048, PUBLIC_EXPONENT: [65537].pack("N"), TOKEN: false},
|
38
38
|
{})
|
39
39
|
th.kill
|
40
40
|
assert_operator count, :>, 100000, "The second thread should count further concurrent to the key generation"
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryosuke Kutsuna
|
@@ -12,9 +12,9 @@ bindir: bin
|
|
12
12
|
cert_chain:
|
13
13
|
- |
|
14
14
|
-----BEGIN CERTIFICATE-----
|
15
|
-
|
15
|
+
MIIDPDCCAiSgAwIBAgIBBjANBgkqhkiG9w0BAQ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ZQ018c/kX8myjnEZA6rTr6082ESHD3BTHj
|
31
|
+
D5uWyL3krcnTOgVS0jv7qSuxDjlvpHqvN1BNaw64Gf5TpqRDNM5r+hXhD8U339Ot
|
32
|
+
lrxBVhTTtOOm6AE6oziYmw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yard
|
38
38
|
requirement: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - "
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '0.6'
|
43
43
|
type: :development
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - "
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0.6'
|
50
50
|
- !ruby/object:Gem::Dependency
|
@@ -107,30 +107,36 @@ dependencies:
|
|
107
107
|
name: rdoc
|
108
108
|
requirement: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - "
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '4.0'
|
113
|
+
- - "<"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '7'
|
113
116
|
type: :development
|
114
117
|
prerelease: false
|
115
118
|
version_requirements: !ruby/object:Gem::Requirement
|
116
119
|
requirements:
|
117
|
-
- - "
|
120
|
+
- - ">="
|
118
121
|
- !ruby/object:Gem::Version
|
119
122
|
version: '4.0'
|
123
|
+
- - "<"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '7'
|
120
126
|
- !ruby/object:Gem::Dependency
|
121
127
|
name: hoe
|
122
128
|
requirement: !ruby/object:Gem::Requirement
|
123
129
|
requirements:
|
124
130
|
- - "~>"
|
125
131
|
- !ruby/object:Gem::Version
|
126
|
-
version: '3.
|
132
|
+
version: '3.20'
|
127
133
|
type: :development
|
128
134
|
prerelease: false
|
129
135
|
version_requirements: !ruby/object:Gem::Requirement
|
130
136
|
requirements:
|
131
137
|
- - "~>"
|
132
138
|
- !ruby/object:Gem::Version
|
133
|
-
version: '3.
|
139
|
+
version: '3.20'
|
134
140
|
description: 'This module allows Ruby programs to interface with "RSA Security Inc.
|
135
141
|
PKCS #11 Cryptographic Token Interface (Cryptoki)".'
|
136
142
|
email:
|
@@ -149,8 +155,10 @@ extra_rdoc_files:
|
|
149
155
|
- pkcs11_protect_server/README_PROTECT_SERVER.rdoc
|
150
156
|
- ext/pk11.c
|
151
157
|
files:
|
158
|
+
- ".appveyor.yml"
|
152
159
|
- ".autotest"
|
153
160
|
- ".gemtest"
|
161
|
+
- ".gitignore"
|
154
162
|
- ".travis.yml"
|
155
163
|
- ".yardopts"
|
156
164
|
- Gemfile
|
@@ -158,7 +166,6 @@ files:
|
|
158
166
|
- MIT-LICENSE
|
159
167
|
- README.rdoc
|
160
168
|
- Rakefile
|
161
|
-
- appveyor.yml
|
162
169
|
- ext/extconf.rb
|
163
170
|
- ext/generate_constants.rb
|
164
171
|
- ext/generate_structs.rb
|
@@ -207,7 +214,8 @@ files:
|
|
207
214
|
homepage: http://github.com/larskanis/pkcs11
|
208
215
|
licenses:
|
209
216
|
- MIT
|
210
|
-
metadata:
|
217
|
+
metadata:
|
218
|
+
homepage_uri: http://github.com/larskanis/pkcs11
|
211
219
|
post_install_message:
|
212
220
|
rdoc_options:
|
213
221
|
- "--main"
|
@@ -218,15 +226,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
218
226
|
requirements:
|
219
227
|
- - ">="
|
220
228
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
229
|
+
version: 2.2.0
|
222
230
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
231
|
requirements:
|
224
232
|
- - ">="
|
225
233
|
- !ruby/object:Gem::Version
|
226
234
|
version: '0'
|
227
235
|
requirements: []
|
228
|
-
|
229
|
-
rubygems_version: 2.7.3
|
236
|
+
rubygems_version: 3.0.3
|
230
237
|
signing_key:
|
231
238
|
specification_version: 4
|
232
239
|
summary: PKCS#11 binding for Ruby
|
metadata.gz.sig
CHANGED
Binary file
|
data/appveyor.yml
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
install:
|
2
|
-
- SET PATH=C:/Ruby%ruby_version%/bin;%PATH%
|
3
|
-
- SET PATH=C:/MinGW/msys/1.0/bin;%PATH%
|
4
|
-
- SET RAKEOPT=-rdevkit
|
5
|
-
- ruby --version
|
6
|
-
- gem --version
|
7
|
-
- bundle install
|
8
|
-
|
9
|
-
# When running ruby-x86, we make use of the softokn3.dll that is part of the
|
10
|
-
# pre-installed firefox. The test helper will find it automatically.
|
11
|
-
# When running ruby-x64, we equally need a 64 bit softokn3.dll to test against.
|
12
|
-
# However it is not part of any installed software on appveyor, nor is it
|
13
|
-
# officially released as a windows binary, so we download and install a 64 bit
|
14
|
-
# firefox version and use it's softokn3.dll.
|
15
|
-
- ps: |
|
16
|
-
if ($env:isx64 -eq "1")
|
17
|
-
{
|
18
|
-
$(new-object net.webclient).DownloadFile('http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/40.0b4/win64/en-US/Firefox%20Setup%2040.0b4.exe', 'C:/firefox-setup.exe')
|
19
|
-
cmd /c "C:/firefox-setup.exe" -ms
|
20
|
-
$env:SOFTOKN_PATH = 'C:/Program Files/Mozilla Firefox/softokn3.dll'
|
21
|
-
$env:PATH = 'C:/Program Files/Mozilla Firefox;' + $env:PATH
|
22
|
-
}
|
23
|
-
|
24
|
-
build: off
|
25
|
-
|
26
|
-
test_script:
|
27
|
-
- bundle exec rake compile test gem
|
28
|
-
|
29
|
-
environment:
|
30
|
-
matrix:
|
31
|
-
- ruby_version: "24"
|
32
|
-
RUBY_DLL_PATH: "C:/Program Files (x86)/Mozilla Firefox"
|
33
|
-
- ruby_version: "24-x64"
|
34
|
-
RUBY_DLL_PATH: "C:/Program Files/Mozilla Firefox"
|
35
|
-
isx64: "1"
|
36
|
-
- ruby_version: "200"
|
37
|
-
#- ruby_version: "200-x64"
|
38
|
-
#- ruby_version: "21"
|
39
|
-
#- ruby_version: "21-x64"
|
40
|
-
- ruby_version: "22"
|
41
|
-
- ruby_version: "23-x64"
|
42
|
-
isx64: "1"
|