naoki 1.0.23 → 1.0.24

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm --create ruby-1.9.2-p180@naoki
1
+ rvm --create ruby-1.9.2-p290@naoki
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  # Create a DataSecure connection for encrypting/decrypting documents.
2
4
  # All operations performed on an instance share the same session/connection.
3
5
  # NB: this class is not thread-safe. Create an instance for each thread.
@@ -94,7 +96,7 @@ module Naoki
94
96
  @session_pointer.get_pointer(0),
95
97
  @cipherspec_pointer.get_pointer(0),
96
98
  I_T_Operation_Encrypt,
97
- plain_text.length,
99
+ plain_text.bytesize,
98
100
  transform_data_length_pointer)
99
101
  end
100
102
  end
@@ -102,16 +104,17 @@ module Naoki
102
104
 
103
105
  def decrypt(text)
104
106
  return dummy_decrypt(text) unless live?
105
- transform(I_T_Operation_Decrypt, text) do |transform_data_length_pointer|
107
+ decrypted_text = transform(I_T_Operation_Decrypt, text) do |transform_data_length_pointer|
106
108
  check do
107
109
  I_C_CalculateOutputSizeForKey(
108
110
  @session_pointer.get_pointer(0),
109
111
  @cipherspec_pointer.get_pointer(0),
110
112
  I_T_Operation_Decrypt,
111
- text.length,
113
+ text.bytesize,
112
114
  transform_data_length_pointer)
113
115
  end
114
116
  end
117
+ decrypted_text.ascii_only? ? decrypted_text : decrypted_text.force_encoding("UTF-8")
115
118
  end
116
119
 
117
120
  private
@@ -157,7 +160,7 @@ module Naoki
157
160
  @options['initialization_vector'],
158
161
  @options['initialization_vector'].length,
159
162
  text,
160
- text.length,
163
+ text.bytesize,
161
164
  transform_data,
162
165
  transform_data_length_pointer
163
166
  ) }
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "naoki"
3
- s.version = "1.0.23"
3
+ s.version = "1.0.24"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.homepage = ""
6
6
  s.summary = "C bindings for SafeNet DataSecure ICAPI"
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'helper'
2
4
  require 'stringio'
3
5
 
@@ -25,6 +27,13 @@ class TestDataSecure < MiniTest::Unit::TestCase
25
27
  end
26
28
  end
27
29
 
30
+ def test_unicode
31
+ expected = "zézéz"
32
+ encrypted_data = @data_secure.encrypt(expected)
33
+ decrypted_data = @data_secure.decrypt(encrypted_data)
34
+ assert(expected == decrypted_data || "decrypted string" == decrypted_data)
35
+ end
36
+
28
37
  private
29
38
 
30
39
  def encrypt_and_decrypt(size, unencrypted)
metadata CHANGED
@@ -1,39 +1,35 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: naoki
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.24
4
5
  prerelease:
5
- version: 1.0.23
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Chris Apolzon
9
9
  - Liron Yahdav
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
-
14
- date: 2011-07-18 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+ date: 2012-03-01 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
17
16
  name: ffi
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &70226713560360 !ruby/object:Gem::Requirement
20
18
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
25
23
  type: :runtime
26
- version_requirements: *id001
24
+ prerelease: false
25
+ version_requirements: *70226713560360
27
26
  description: C bindings for SafeNet DataSecure ICAPI
28
- email:
27
+ email:
29
28
  - apolzon@gmail.com
30
29
  executables: []
31
-
32
30
  extensions: []
33
-
34
31
  extra_rdoc_files: []
35
-
36
- files:
32
+ files:
37
33
  - .gitignore
38
34
  - .rvmrc
39
35
  - Gemfile
@@ -49,32 +45,28 @@ files:
49
45
  - test/helper.rb
50
46
  - test/test_data_secure.rb
51
47
  - validate_config.rb
52
- homepage: ""
48
+ homepage: ''
53
49
  licenses: []
54
-
55
50
  post_install_message:
56
51
  rdoc_options: []
57
-
58
- require_paths:
52
+ require_paths:
59
53
  - lib
60
- required_ruby_version: !ruby/object:Gem::Requirement
54
+ required_ruby_version: !ruby/object:Gem::Requirement
61
55
  none: false
62
- requirements:
63
- - - ">="
64
- - !ruby/object:Gem::Version
65
- version: "0"
66
- required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
61
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
72
66
  requirements: []
73
-
74
67
  rubyforge_project:
75
- rubygems_version: 1.7.2
68
+ rubygems_version: 1.8.15
76
69
  signing_key:
77
70
  specification_version: 3
78
71
  summary: C bindings for SafeNet DataSecure ICAPI
79
72
  test_files: []
80
-