pkcs11_protect_server 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 522d3eac328976ee69a25e82dd99c0b04c3fafe8d209a5438ae3f878d2d42046
4
- data.tar.gz: 273f1c5a641c89c1642112b0d2b7774ad48904d4756459e74a2cb2137d15abe2
3
+ metadata.gz: 7a5fe3b3e7e2b4371955d63d571b32a889cb5cc4ded9c5f4407c7e248a77e373
4
+ data.tar.gz: 152bcff476fe55a9a288eff56341d1013492d2aad40b48283d6629ca06bb2bb2
5
5
  SHA512:
6
- metadata.gz: c16c1f0721b8222046fb06c823bed3fbaf44f950acf98c2b8a66f4fb50b97285aad74654d8c7a2324070908b2ab47ab69ff1b8f27974f66d0b0f6c052620368e
7
- data.tar.gz: 7fe7d7e91630d35368965022f3c4f23abf5225b50a1f9147de2fb27b65030835d227598c22d8a113decefff94743f213223f25dc214c64fa27ecb4259cb0e71a
6
+ metadata.gz: 260fdae7245c78b951906b3e586e64cbf038540f15833c376c49f1fa3f895fa51169aa30b63c1e7e2fafa8feb5701a68056362553cb0cec1ddddbf791130b168
7
+ data.tar.gz: da7604086b3b6145add4f76290c016bc959a8a18ed4f9dbdbbd82a60d589998271f1654d68f5fba780b3958a4d05cfa5fc37c912f6b4adba19ddae4f2aecb887
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- 1�dã���Xg8ZѲ�y QgH�ϡ���@��%0�xw��w��d�� ��#BBw}�c���D���\4���~)U،��.�X�Bo$ƪ��
2
- T9��ו�nO�M�:KXoaS�\�����:�`c
1
+ Х�S��i���:@7��J1ی�gL�N:���U��Ö��*���&Ɔ�XI5DSI�3Z�V<�֣�ZB]*��l�����U���IVi��/�A1��Yhk$���aj]����!�{���A%���8#��.0D��vEK��3�ĭ�Vx��Y�z}c*�f�rð��J1�SPڗ�/>�F0j<or֭�8�J�m����x�~ c
@@ -1,8 +1,8 @@
1
1
  = PKCS #11/Ruby Interface for Safenet Protect Server HSM
2
2
 
3
- * Homepage: http://github.com/larskanis/pkcs11
4
- * API documentation: http://pkcs11.rubyforge.org/pkcs11/
5
- * Safenet[http://www.safenet-inc.com] - Protect Server HSM
3
+ home :: http://github.com/larskanis/pkcs11
4
+ API documentation: http://pkcs11.rubyforge.org/pkcs11/
5
+ Safenet Protect Server HSM : http://www.safenet-inc.com
6
6
 
7
7
  This ruby gem is an add-on to ruby-pkcs11[http://github.com/larskanis/pkcs11] .
8
8
  It allowes to use Protect Server specific extensions, which are beyond the PKCS#11 standard.
data/Rakefile CHANGED
@@ -32,10 +32,9 @@ end
32
32
  hoe = Hoe.spec 'pkcs11_protect_server' do
33
33
  developer('Lars Kanis', 'kanis@comcard.de')
34
34
  extra_deps << ['pkcs11', "= #{pkcs11_version}"]
35
- extra_dev_deps << ['yard', '>= 0.6']
36
- extra_dev_deps << ['rake-compiler', '>= 0.7']
35
+ extra_dev_deps << ['yard', '~> 0.6']
36
+ extra_dev_deps << ['rake-compiler', '~> 0.7']
37
37
 
38
- self.urls = ['http://github.com/larskanis/pkcs11']
39
38
  self.summary = 'Safenet-ProtectServer extensions for PKCS#11-Ruby'
40
39
  self.description = 'This module allows Ruby programs to use vendor extensions for Safenet Protect Server.'
41
40
  self.version = pkcs11_version
@@ -46,7 +45,7 @@ hoe = Hoe.spec 'pkcs11_protect_server' do
46
45
  spec_extras[:extensions] = 'ext/extconf.rb'
47
46
  spec_extras[:files] = File.read_utf("Manifest.txt").split(/\r?\n\r?/)
48
47
  spec_extras[:files] += GENERATED_FILES
49
- spec_extras[:has_rdoc] = 'yard'
48
+ spec_extras[:required_ruby_version] = '>= 2.2.0'
50
49
  end
51
50
 
52
51
  Rake::ExtensionTask.new('pkcs11_protect_server_ext', hoe.spec) do |ext|
@@ -59,7 +58,7 @@ end
59
58
 
60
59
  def copy_from_base_task(filename)
61
60
  file File.join('ext', filename) => File.join(RUBY_PKCS11_EXT_DIR, filename) do |t|
62
- cp t.prerequisites.first, t.name, :verbose=>true
61
+ cp t.prerequisites.first, t.name, verbose: true
63
62
  end
64
63
  end
65
64
 
@@ -79,6 +78,6 @@ file 'ext/pk11s_const_def.inc' => 'ext/generate_constants.rb' do
79
78
  end
80
79
  file 'ext/pk11s.c' => ['ext/pk11s_struct_def.inc', 'ext/pk11s_struct_impl.inc', 'ext/pk11s_const_def.inc']
81
80
 
82
- task :doc_files => 'ext/pk11s_struct.doc'
81
+ task doc_files: 'ext/pk11s_struct.doc'
83
82
 
84
83
  # vim: syntax=ruby
@@ -19,10 +19,10 @@ pkcs11_num2ulong(VALUE val)
19
19
  }
20
20
 
21
21
  static VALUE
22
- get_string(VALUE obj, off_t offset, size_t size)
22
+ get_string(VALUE obj, off_t offset, size_t size, rb_encoding *enc)
23
23
  {
24
24
  char *ptr = (char*)DATA_PTR(obj);
25
- return rb_str_new(ptr+offset, size);
25
+ return rb_enc_str_new(ptr+offset, size, enc);
26
26
  }
27
27
 
28
28
  static VALUE
@@ -86,7 +86,7 @@ set_ulong_ptr(VALUE obj, VALUE value, const char *name, off_t offset)
86
86
  *ptr = NULL_PTR;
87
87
  return value;
88
88
  }
89
- new_obj = Data_Make_Struct(rb_cInteger, CK_ULONG, 0, free, *ptr);
89
+ new_obj = Data_Make_Struct(rb_cData, CK_ULONG, 0, -1, *ptr);
90
90
  rb_iv_set(obj, name, new_obj);
91
91
  **ptr = NUM2ULONG(value);
92
92
  return value;
@@ -126,12 +126,12 @@ set_bool(VALUE obj, VALUE value, off_t offset)
126
126
  }
127
127
 
128
128
  static VALUE
129
- get_string_ptr(VALUE obj, const char *name, off_t offset)
129
+ get_string_ptr(VALUE obj, const char *name, off_t offset, rb_encoding *enc)
130
130
  {
131
131
  char *ptr = (char*)DATA_PTR(obj);
132
132
  char *p = *(char**)(ptr+offset);
133
133
  if (!p) return Qnil;
134
- return rb_str_new2(p);
134
+ return rb_enc_str_new_cstr(p, enc);
135
135
  }
136
136
 
137
137
  static VALUE
@@ -151,14 +151,14 @@ set_string_ptr(VALUE obj, VALUE value, const char *name, off_t offset)
151
151
  }
152
152
 
153
153
  static VALUE
154
- get_string_ptr_len(VALUE obj, const char *name, off_t offset, off_t offset_len)
154
+ get_string_ptr_len(VALUE obj, const char *name, off_t offset, off_t offset_len, rb_encoding *enc)
155
155
  {
156
156
  unsigned long l;
157
157
  char *ptr = (char*)DATA_PTR(obj);
158
158
  char *p = *(char**)(ptr+offset);
159
159
  if (!p) return Qnil;
160
160
  l = *(unsigned long*)(ptr+offset_len);
161
- return rb_str_new(p, l);
161
+ return rb_enc_str_new(p, l, enc);
162
162
  }
163
163
 
164
164
  static VALUE
@@ -290,9 +290,9 @@ static VALUE c##s;\
290
290
  static VALUE a##s##_members;\
291
291
  PKCS11_IMPLEMENT_ALLOCATOR(s);
292
292
 
293
- #define PKCS11_IMPLEMENT_STRING_ACCESSOR(s, f) \
293
+ #define PKCS11_IMPLEMENT_STRING_ACCESSOR(s, f, enco) \
294
294
  static VALUE c##s##_get_##f(VALUE o){ \
295
- return get_string(o, OFFSET_OF(s, f), SIZE_OF(s, f)); \
295
+ return get_string(o, OFFSET_OF(s, f), SIZE_OF(s, f), rb_##enco##_encoding()); \
296
296
  } \
297
297
  static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
298
298
  return set_string(o, v, OFFSET_OF(s, f), SIZE_OF(s, f)); \
@@ -338,17 +338,17 @@ static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
338
338
  return set_bool(o, v, OFFSET_OF(s, f)); \
339
339
  }
340
340
 
341
- #define PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(s, f) \
341
+ #define PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(s, f, enco) \
342
342
  static VALUE c##s##_get_##f(VALUE o){ \
343
- return get_string_ptr(o, #f, OFFSET_OF(s, f)); \
343
+ return get_string_ptr(o, #f, OFFSET_OF(s, f), rb_##enco##_encoding()); \
344
344
  } \
345
345
  static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
346
346
  return set_string_ptr(o, v, #f, OFFSET_OF(s, f)); \
347
347
  }
348
348
 
349
- #define PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(s, f, l) \
349
+ #define PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(s, f, l, enco) \
350
350
  static VALUE c##s##_get_##f(VALUE o){ \
351
- return get_string_ptr_len(o, #f, OFFSET_OF(s, f), OFFSET_OF(s, l)); \
351
+ return get_string_ptr_len(o, #f, OFFSET_OF(s, f), OFFSET_OF(s, l), rb_##enco##_encoding()); \
352
352
  } \
353
353
  static VALUE c##s##_set_##f(VALUE o, VALUE v){ \
354
354
  return set_string_ptr_len(o, v, #f, OFFSET_OF(s, f), OFFSET_OF(s, l)); \
@@ -1,6 +1,6 @@
1
1
  #ifndef RUBY_PK11_VERSION_H
2
2
  #define RUBY_PK11_VERSION_H
3
3
 
4
- static const char *VERSION = "0.2.7";
4
+ static const char *VERSION = "0.3.0";
5
5
 
6
6
  #endif
@@ -1,4 +1,5 @@
1
1
  #include <ruby.h>
2
+ #include <ruby/encoding.h>
2
3
 
3
4
  #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
4
5
  #define _WINDOWS
@@ -5,9 +5,9 @@ SIZEOF_STRUCT=Integer
5
5
  def to_s; end
6
6
  # @return [Array<String>] Attributes of this struct
7
7
  def members; end
8
- # @return [String] accessor for iv (max 8 bytes)
8
+ # @return [ASCII8BIT-String] accessor for iv (max 8 bytes)
9
9
  attr_accessor :iv
10
- # @return [String] accessor for data (max 8 bytes)
10
+ # @return [ASCII8BIT-String] accessor for data (max 8 bytes)
11
11
  attr_accessor :data
12
12
  end
13
13
  class PKCS11::ProtectServer::CK_DES2_CBC_PARAMS < PKCS11::ProtectServer::CStruct
@@ -17,9 +17,9 @@ SIZEOF_STRUCT=Integer
17
17
  def to_s; end
18
18
  # @return [Array<String>] Attributes of this struct
19
19
  def members; end
20
- # @return [String] accessor for iv (max 8 bytes)
20
+ # @return [ASCII8BIT-String] accessor for iv (max 8 bytes)
21
21
  attr_accessor :iv
22
- # @return [String] accessor for data (max 16 bytes)
22
+ # @return [ASCII8BIT-String] accessor for data (max 16 bytes)
23
23
  attr_accessor :data
24
24
  end
25
25
  class PKCS11::ProtectServer::CK_DES3_CBC_PARAMS < PKCS11::ProtectServer::CStruct
@@ -29,9 +29,9 @@ SIZEOF_STRUCT=Integer
29
29
  def to_s; end
30
30
  # @return [Array<String>] Attributes of this struct
31
31
  def members; end
32
- # @return [String] accessor for iv (max 8 bytes)
32
+ # @return [ASCII8BIT-String] accessor for iv (max 8 bytes)
33
33
  attr_accessor :iv
34
- # @return [String] accessor for data (max 24 bytes)
34
+ # @return [ASCII8BIT-String] accessor for data (max 24 bytes)
35
35
  attr_accessor :data
36
36
  end
37
37
  class PKCS11::ProtectServer::CK_TIMESTAMP_PARAMS < PKCS11::ProtectServer::CStruct
@@ -115,7 +115,7 @@ SIZEOF_STRUCT=Integer
115
115
  def to_s; end
116
116
  # @return [Array<String>] Attributes of this struct
117
117
  def members; end
118
- # @return [String, nil] accessor for prompt
118
+ # @return [USASCII-String, nil] accessor for prompt
119
119
  attr_accessor :prompt
120
120
  # @return [Boolean] Bool value
121
121
  attr_accessor :bMaskInput
@@ -129,7 +129,7 @@ SIZEOF_STRUCT=Integer
129
129
  def to_s; end
130
130
  # @return [Array<String>] Attributes of this struct
131
131
  def members; end
132
- # @return [String] accessor for peerId (max 16 bytes)
132
+ # @return [USASCII-String] accessor for peerId (max 16 bytes)
133
133
  attr_accessor :peerId
134
134
  end
135
135
  class PKCS11::ProtectServer::CK_SECRET_SHARE_PARAMS < PKCS11::ProtectServer::CStruct
@@ -151,9 +151,9 @@ SIZEOF_STRUCT=Integer
151
151
  def to_s; end
152
152
  # @return [Array<String>] Attributes of this struct
153
153
  def members; end
154
- # @return [String, nil] accessor for passwordAuthSafe and passwordAuthSafeLen
154
+ # @return [USASCII-String, nil] accessor for passwordAuthSafe and passwordAuthSafeLen
155
155
  attr_accessor :passwordAuthSafe
156
- # @return [String, nil] accessor for passwordHMAC and passwordHMACLen
156
+ # @return [USASCII-String, nil] accessor for passwordHMAC and passwordHMACLen
157
157
  attr_accessor :passwordHMAC
158
158
  # @return [Integer, PKCS11::Object] Object handle (CK_ULONG)
159
159
  attr_accessor :keyCert
@@ -173,9 +173,9 @@ def to_s; end
173
173
  def members; end
174
174
  # @return [Array<PKCS11::CK_ATTRIBUTE>] accessor for certAttr and certAttrCount
175
175
  attr_accessor :certAttr
176
- # @return [String, nil] accessor for passwordAuthSafe and passwordAuthSafeLen
176
+ # @return [USASCII-String, nil] accessor for passwordAuthSafe and passwordAuthSafeLen
177
177
  attr_accessor :passwordAuthSafe
178
- # @return [String, nil] accessor for passwordHMAC and passwordHMACLen
178
+ # @return [USASCII-String, nil] accessor for passwordHMAC and passwordHMACLen
179
179
  attr_accessor :passwordHMAC
180
180
  # @return [Integer, nil] accessor for hCertCount (CK_ULONG_PTR)
181
181
  attr_accessor :hCertCount
@@ -187,9 +187,9 @@ SIZEOF_STRUCT=Integer
187
187
  def to_s; end
188
188
  # @return [Array<String>] Attributes of this struct
189
189
  def members; end
190
- # @return [String, nil] accessor for pSharedData1
190
+ # @return [ASCII8BIT-String, nil] accessor for pSharedData1
191
191
  attr_accessor :pSharedData1
192
- # @return [String, nil] accessor for pSharedData2
192
+ # @return [ASCII8BIT-String, nil] accessor for pSharedData2
193
193
  attr_accessor :pSharedData2
194
194
  # @return [Integer] accessor for kdf (CK_ULONG)
195
195
  attr_accessor :kdf
@@ -1,14 +1,14 @@
1
1
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_DES_CBC_PARAMS);
2
- PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES_CBC_PARAMS, iv);
3
- PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES_CBC_PARAMS, data);
2
+ PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES_CBC_PARAMS, iv, ascii8bit);
3
+ PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES_CBC_PARAMS, data, ascii8bit);
4
4
 
5
5
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_DES2_CBC_PARAMS);
6
- PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES2_CBC_PARAMS, iv);
7
- PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES2_CBC_PARAMS, data);
6
+ PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES2_CBC_PARAMS, iv, ascii8bit);
7
+ PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES2_CBC_PARAMS, data, ascii8bit);
8
8
 
9
9
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_DES3_CBC_PARAMS);
10
- PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES3_CBC_PARAMS, iv);
11
- PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES3_CBC_PARAMS, data);
10
+ PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES3_CBC_PARAMS, iv, ascii8bit);
11
+ PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_DES3_CBC_PARAMS, data, ascii8bit);
12
12
 
13
13
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_TIMESTAMP_PARAMS);
14
14
  PKCS11_IMPLEMENT_BOOL_ACCESSOR(CK_TIMESTAMP_PARAMS, useMilliseconds);
@@ -36,22 +36,22 @@ PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_PKCS_7_PARAMS, CK_MECH_AND_OBJECTS, encrypti
36
36
  PKCS11_IMPLEMENT_STRUCT_ACCESSOR(CK_PKCS_7_PARAMS, CK_ATTRIBUTES, extensions);
37
37
 
38
38
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_PP_LOAD_SECRET_PARAMS);
39
- PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_PP_LOAD_SECRET_PARAMS, prompt);
39
+ PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_PP_LOAD_SECRET_PARAMS, prompt, usascii);
40
40
  PKCS11_IMPLEMENT_BOOL_ACCESSOR(CK_PP_LOAD_SECRET_PARAMS, bMaskInput);
41
41
  PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PP_LOAD_SECRET_PARAMS, cConvert);
42
42
  /* unimplemented attr CK_CHAR cTimeout */
43
43
  /* unimplemented attr CK_CHAR reserved */
44
44
 
45
45
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_REPLICATE_TOKEN_PARAMS);
46
- PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_REPLICATE_TOKEN_PARAMS, peerId);
46
+ PKCS11_IMPLEMENT_STRING_ACCESSOR(CK_REPLICATE_TOKEN_PARAMS, peerId, usascii);
47
47
 
48
48
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_SECRET_SHARE_PARAMS);
49
49
  PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SECRET_SHARE_PARAMS, n);
50
50
  PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_SECRET_SHARE_PARAMS, m);
51
51
 
52
52
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_PKCS12_PBE_EXPORT_PARAMS);
53
- PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, passwordAuthSafe, passwordAuthSafeLen);
54
- PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, passwordHMAC, passwordHMACLen);
53
+ PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, passwordAuthSafe, passwordAuthSafeLen, usascii);
54
+ PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, passwordHMAC, passwordHMACLen, usascii);
55
55
  PKCS11_IMPLEMENT_HANDLE_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, keyCert);
56
56
  PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, safeBagKgMech);
57
57
  PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, safeContentKgMech);
@@ -59,14 +59,14 @@ PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_PKCS12_PBE_EXPORT_PARAMS, hmacKgMech);
59
59
 
60
60
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_PKCS12_PBE_IMPORT_PARAMS);
61
61
  PKCS11_IMPLEMENT_PKCS11_STRUCT_PTR_ARRAY_ACCESSOR(CK_PKCS12_PBE_IMPORT_PARAMS, CK_ATTRIBUTE, certAttr, certAttrCount);
62
- PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_IMPORT_PARAMS, passwordAuthSafe, passwordAuthSafeLen);
63
- PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_IMPORT_PARAMS, passwordHMAC, passwordHMACLen);
62
+ PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_IMPORT_PARAMS, passwordAuthSafe, passwordAuthSafeLen, usascii);
63
+ PKCS11_IMPLEMENT_STRING_PTR_LEN_ACCESSOR(CK_PKCS12_PBE_IMPORT_PARAMS, passwordHMAC, passwordHMACLen, usascii);
64
64
  /* unimplemented attr CK_OBJECT_HANDLE_PTR hCert */
65
65
  PKCS11_IMPLEMENT_ULONG_PTR_ACCESSOR(CK_PKCS12_PBE_IMPORT_PARAMS, hCertCount);
66
66
 
67
67
  PKCS11_IMPLEMENT_STRUCT_WITH_ALLOCATOR(CK_ECIES_PARAMS);
68
- PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECIES_PARAMS, pSharedData1);
69
- PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECIES_PARAMS, pSharedData2);
68
+ PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECIES_PARAMS, pSharedData1, ascii8bit);
69
+ PKCS11_IMPLEMENT_STRING_PTR_ACCESSOR(CK_ECIES_PARAMS, pSharedData2, ascii8bit);
70
70
  /* unimplemented attr CK_EC_DH_PRIMITIVE dhPrimitive */
71
71
  PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, kdf);
72
72
  PKCS11_IMPLEMENT_ULONG_ACCESSOR(CK_ECIES_PARAMS, ulSharedDataLen1);
@@ -1,5 +1,5 @@
1
1
  def open_ctsw
2
- PKCS11::ProtectServer::Library.new(:sw, :flags=>0)
2
+ PKCS11::ProtectServer::Library.new(:sw, flags: 0)
3
3
  end
4
4
 
5
5
  def adjust_parity(data)
@@ -12,7 +12,7 @@ class TestPkcs11ProtectServer < Minitest::Test
12
12
  assert_match( /m=3/, s.inspect, 'There should be a n value in CK_SECRET_SHARE_PARAMS')
13
13
  assert_equal ["n", "m"], s.members, 'CK_SECRET_SHARE_PARAMS should contain some attributes'
14
14
  assert_equal [2, 3], s.values, 'values of CK_SECRET_SHARE_PARAMS'
15
- assert_equal( {:n=>2, :m=>3}, s.to_hash, 'CK_SECRET_SHARE_PARAMS as hash' )
15
+ assert_equal( {n: 2, m: 3}, s.to_hash, 'CK_SECRET_SHARE_PARAMS as hash' )
16
16
  end
17
17
 
18
18
  def test_CK_PKCS12_PBE_IMPORT_PARAMS
@@ -39,12 +39,12 @@ class TestPkcs11ProtectServer < Minitest::Test
39
39
  end
40
40
 
41
41
  def test_loading
42
- pk = PKCS11::ProtectServer::Library.new(:sw, :flags=>0)
42
+ pk = PKCS11::ProtectServer::Library.new(:sw, flags: 0)
43
43
  so_path = pk.so_path
44
44
  pk.close
45
45
  assert !so_path.empty?, "Used path shouldn't be empty"
46
46
 
47
- pk = PKCS11::ProtectServer::Library.new(so_path, :flags=>0)
47
+ pk = PKCS11::ProtectServer::Library.new(so_path, flags: 0)
48
48
  pk.close
49
49
  end
50
50
 
@@ -52,7 +52,7 @@ class TestPkcs11ProtectServer < Minitest::Test
52
52
  pk = PKCS11::ProtectServer::Library.new
53
53
  pk.load_library(:sw)
54
54
  pk.C_GetFunctionList
55
- pk.C_Initialize(:flags=>0)
55
+ pk.C_Initialize(flags: 0)
56
56
  pk.info
57
57
  pk.close
58
58
  end
@@ -39,12 +39,12 @@ class TestPkcs11ProtectServerCrypt < Minitest::Test
39
39
  assert_equal CKS_RO_USER_FUNCTIONS, session.info.state, "Session should be in USER state"
40
40
 
41
41
  @secret_key = session.create_object(
42
- :CLASS=>CKO_SECRET_KEY,
43
- :KEY_TYPE=>CKK_DES2,
44
- :ENCRYPT=>true, :WRAP=>true, :DECRYPT=>true, :UNWRAP=>true, :TOKEN=>false, :DERIVE=>true,
45
- :USAGE_COUNT=>0, :EXPORTABLE=>true,
46
- :VALUE=>adjust_parity("0123456789abcdef"),
47
- :LABEL=>'test_secret_key')
42
+ CLASS: CKO_SECRET_KEY,
43
+ KEY_TYPE: CKK_DES2,
44
+ ENCRYPT: true, WRAP: true, DECRYPT: true, UNWRAP: true, TOKEN: false, DERIVE: true,
45
+ USAGE_COUNT: 0, EXPORTABLE: true,
46
+ VALUE: adjust_parity("0123456789abcdef"),
47
+ LABEL: 'test_secret_key')
48
48
  end
49
49
 
50
50
  def teardown
@@ -60,10 +60,10 @@ class TestPkcs11ProtectServerCrypt < Minitest::Test
60
60
  def test_bad_parity
61
61
  assert_raises(ProtectServer::CKR_ET_NOT_ODD_PARITY) do
62
62
  session.create_object(
63
- :CLASS=>CKO_SECRET_KEY,
64
- :KEY_TYPE=>CKK_DES2,
65
- :VALUE=>"0123456789abcdef",
66
- :LABEL=>'test_secret_key2')
63
+ CLASS: CKO_SECRET_KEY,
64
+ KEY_TYPE: CKK_DES2,
65
+ VALUE: "0123456789abcdef",
66
+ LABEL: 'test_secret_key2')
67
67
  end
68
68
  end
69
69
 
@@ -73,14 +73,14 @@ class TestPkcs11ProtectServerCrypt < Minitest::Test
73
73
  pa.iv = "2"*8
74
74
 
75
75
  new_key1 = session.derive_key( {ProtectServer::CKM_DES3_DERIVE_CBC => pa}, secret_key,
76
- :CLASS=>CKO_SECRET_KEY, :KEY_TYPE=>CKK_DES2, :ENCRYPT=>true, :DECRYPT=>true, :SENSITIVE=>false )
76
+ CLASS: CKO_SECRET_KEY, KEY_TYPE: CKK_DES2, ENCRYPT: true, DECRYPT: true, SENSITIVE: false )
77
77
  refute_equal secret_key[:VALUE], new_key1[:VALUE], 'Derived key shouldn\'t have equal key value'
78
78
 
79
- new_key2 = session.derive_key( {:DES3_DERIVE_CBC => {:data=>"1"*16, :iv=>"2"*16}}, secret_key,
80
- :CLASS=>CKO_SECRET_KEY, :KEY_TYPE=>CKK_DES2, :ENCRYPT=>true, :DECRYPT=>true, :SENSITIVE=>false )
79
+ new_key2 = session.derive_key( {DES3_DERIVE_CBC: {data: "1"*16, iv: "2"*16}}, secret_key,
80
+ CLASS: CKO_SECRET_KEY, KEY_TYPE: CKK_DES2, ENCRYPT: true, DECRYPT: true, SENSITIVE: false )
81
81
  assert_equal new_key1[:VALUE], new_key2[:VALUE], 'Both derived key should be equal'
82
82
 
83
- encrypted_key_value = session.encrypt( {:DES3_CBC => "2"*8}, secret_key, "1"*16)
83
+ encrypted_key_value = session.encrypt( {DES3_CBC: "2"*8}, secret_key, "1"*16)
84
84
  encrypted_key_value = adjust_parity(encrypted_key_value)
85
85
  assert_equal new_key1[:VALUE], encrypted_key_value, 'Encrypted data should equal derived key value'
86
86
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pkcs11_protect_server
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lars Kanis
@@ -10,9 +10,9 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDPDCCAiSgAwIBAgIBAzANBgkqhkiG9w0BAQUFADBEMQ0wCwYDVQQDDARsYXJz
13
+ MIIDPDCCAiSgAwIBAgIBBjANBgkqhkiG9w0BAQsFADBEMQ0wCwYDVQQDDARsYXJz
14
14
  MR8wHQYKCZImiZPyLGQBGRYPZ3JlaXotcmVpbnNkb3JmMRIwEAYKCZImiZPyLGQB
15
- GRYCZGUwHhcNMTcwNDA0MTgyNDE1WhcNMTgwNDA0MTgyNDE1WjBEMQ0wCwYDVQQD
15
+ GRYCZGUwHhcNMTkxMjAzMTkzNDA5WhcNMjAxMjAyMTkzNDA5WjBEMQ0wCwYDVQQD
16
16
  DARsYXJzMR8wHQYKCZImiZPyLGQBGRYPZ3JlaXotcmVpbnNkb3JmMRIwEAYKCZIm
17
17
  iZPyLGQBGRYCZGUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZb4Uv
18
18
  RFJfRu/VEWiy3psh2jinETjiuBrL0NeRFGf8H7iU9+gx/DI/FFhfHGLrDeIskrJx
@@ -21,15 +21,15 @@ cert_chain:
21
21
  P0GmVbFBrbc7Zt5h78N3UyOK0u+nvOC23BvyHXzCtcFsXCoEkt+Wwh0RFqVZdnjM
22
22
  LMO2vULHKKHDdX54K/sbVCj9pN9h1aotNzrEyo55zxn0G9PHg/G3P8nMvAXPkUTe
23
23
  brhXrfCwWRvOXA4TAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0G
24
- A1UdDgQWBBRAHK81igrXodaDj8a8/BIKsaZrETANBgkqhkiG9w0BAQUFAAOCAQEA
25
- Wbp+grpaqUH+RiXNXmi/5xBfvSYLbxWj+DZpCSnQW+DMfx46RVVko3b7BtKDs2zs
26
- EtKM6r6s7VbllPgcYUzaP92uzPqCw8FncvqG0+B+Nd4C2jKzPxAQyzYXv/3bQhv1
27
- sXAzEqLQqKx5V63eBDh1TPvPTEMfJwmjcdcbvMwFSt5EcUkT63W13ZJXX23JYp1K
28
- KRW+N1WIYz8RSBNaQIP2v5Inb9vUA+jPUOcdyLHoi205lyZ28hE4lcnh9Zs02aHs
29
- Ao8FZozVJz8xVEuYNJsL2k70w0FiwXwoWyvKyekgPBvYNUj4JGDMtBBayJTOpDs7
30
- 3EVmCm5IRuqZ1UcDFouQ9w==
24
+ A1UdDgQWBBRAHK81igrXodaDj8a8/BIKsaZrETANBgkqhkiG9w0BAQsFAAOCAQEA
25
+ XDITkfRngYnc7MnDMd1XRSZqZKPvPFIk/ByhD4T5mHDAmOVV9Q4csAF9wAnYqLVG
26
+ XqetRpK47O55NHN7zG2RbE7ospqgNU4ToXM2KCZuGoGuV75RBf6kk498kcPuFBPq
27
+ FWzBIlr9Nat2NjwmEAvVf2UrmKl7rEDCQTkYCe9H5qkWtbneBASIfbVaw14yhosQ
28
+ 0fP+rf/XkPrhjfYMBd258JnTy32boRZQ018c/kX8myjnEZA6rTr6082ESHD3BTHj
29
+ D5uWyL3krcnTOgVS0jv7qSuxDjlvpHqvN1BNaw64Gf5TpqRDNM5r+hXhD8U339Ot
30
+ lrxBVhTTtOOm6AE6oziYmw==
31
31
  -----END CERTIFICATE-----
32
- date: 2018-01-05 00:00:00.000000000 Z
32
+ date: 2019-12-05 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: pkcs11
@@ -37,70 +37,76 @@ dependencies:
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.2.7
40
+ version: 0.3.0
41
41
  type: :runtime
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.7
47
+ version: 0.3.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: yard
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.6'
55
55
  type: :development
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0.6'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: rake-compiler
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.7'
69
69
  type: :development
70
70
  prerelease: false
71
71
  version_requirements: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0.7'
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: rdoc
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '4.0'
83
+ - - "<"
84
+ - !ruby/object:Gem::Version
85
+ version: '7'
83
86
  type: :development
84
87
  prerelease: false
85
88
  version_requirements: !ruby/object:Gem::Requirement
86
89
  requirements:
87
- - - "~>"
90
+ - - ">="
88
91
  - !ruby/object:Gem::Version
89
92
  version: '4.0'
93
+ - - "<"
94
+ - !ruby/object:Gem::Version
95
+ version: '7'
90
96
  - !ruby/object:Gem::Dependency
91
97
  name: hoe
92
98
  requirement: !ruby/object:Gem::Requirement
93
99
  requirements:
94
100
  - - "~>"
95
101
  - !ruby/object:Gem::Version
96
- version: '3.16'
102
+ version: '3.20'
97
103
  type: :development
98
104
  prerelease: false
99
105
  version_requirements: !ruby/object:Gem::Requirement
100
106
  requirements:
101
107
  - - "~>"
102
108
  - !ruby/object:Gem::Version
103
- version: '3.16'
109
+ version: '3.20'
104
110
  description: This module allows Ruby programs to use vendor extensions for Safenet
105
111
  Protect Server.
106
112
  email:
@@ -137,7 +143,8 @@ files:
137
143
  homepage: http://github.com/larskanis/pkcs11
138
144
  licenses:
139
145
  - MIT
140
- metadata: {}
146
+ metadata:
147
+ homepage_uri: http://github.com/larskanis/pkcs11
141
148
  post_install_message:
142
149
  rdoc_options:
143
150
  - "--main"
@@ -148,15 +155,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
148
155
  requirements:
149
156
  - - ">="
150
157
  - !ruby/object:Gem::Version
151
- version: '0'
158
+ version: 2.2.0
152
159
  required_rubygems_version: !ruby/object:Gem::Requirement
153
160
  requirements:
154
161
  - - ">="
155
162
  - !ruby/object:Gem::Version
156
163
  version: '0'
157
164
  requirements: []
158
- rubyforge_project:
159
- rubygems_version: 2.7.3
165
+ rubygems_version: 3.0.3
160
166
  signing_key:
161
167
  specification_version: 4
162
168
  summary: Safenet-ProtectServer extensions for PKCS#11-Ruby
metadata.gz.sig CHANGED
Binary file