ffi-libsodium 0.3.2 → 0.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d30d2756247274875e470ab61e090288114cb2d
4
- data.tar.gz: 7d7edba752748cac108b93b446a2ce9e8a2ada35
3
+ metadata.gz: 9a6a2df052bb5ae7911a6a64e73ac841dcc3dd4b
4
+ data.tar.gz: ffedb95aafff7017b363bad6bc1da3fd7ee5437b
5
5
  SHA512:
6
- metadata.gz: abe3e18a46e2bd3a83fe093a56d6529df2ac856e4df9fc1521c46246bfd90ab6b3d6d6f8f3fcd000e6d4b6c1975e46eacd4acae3bd79b0cc46d11970002813c4
7
- data.tar.gz: f6ebd40cd8971e20625ed634eca8d90129079a7f971d5d0c3c2d87e4c3ee206a546e397ba8934bf51291343970a1052ba1961e7c0026527547435db231c08234
6
+ metadata.gz: e3d63913ef97e34ed10a3a341ca1da67a54d0fbdc797f1c56495591b10b145811d97c480def4a471c9fba29ec2bca34bf78c4e88363cac0cb89592534074c759
7
+ data.tar.gz: d4ce9e3f910a6c1690bff8ce0c9f428824caeb517e90622cbe36847737c2119f73d668af15367ce54a95af6211bc8cbbcde0fd30b2c26b3166a6d97970d2208e
@@ -125,7 +125,7 @@ module Crypto
125
125
  secret_key.readonly if secret_key.is_a?(Sodium::SecretBuffer)
126
126
  crypto_box_easy(message, message, message_len, nonce, public_key, secret_key)
127
127
 
128
- message
128
+ message.force_encoding(Encoding::ASCII_8BIT)
129
129
  ensure
130
130
  secret_key.noaccess if secret_key.is_a?(Sodium::SecretBuffer)
131
131
  end
@@ -140,13 +140,12 @@ module Crypto
140
140
 
141
141
  secret_key.readonly if secret_key.is_a?(Sodium::SecretBuffer)
142
142
  if crypto_box_open_easy(ciphertext, ciphertext, ciphertext_len, nonce, public_key, secret_key) == 0
143
+ ciphertext.slice!(message_len..-1)
143
144
  if encoding
144
- ciphertext.slice!(message_len..-1).force_encoding(encoding)
145
+ ciphertext.force_encoding(encoding)
145
146
  else
146
- ciphertext.slice!(message_len..-1)
147
+ ciphertext
147
148
  end
148
-
149
- ciphertext
150
149
  else
151
150
  raise Sodium::CryptoError, "Message forged", caller
152
151
  end
@@ -71,7 +71,7 @@ module Crypto
71
71
  key.readonly if key.is_a?(Sodium::SecretBuffer)
72
72
  crypto_secretbox_easy(message, message, message_len, nonce, key)
73
73
 
74
- message
74
+ message.force_encoding(Encoding::ASCII_8BIT)
75
75
  ensure
76
76
  key.noaccess if key.is_a?(Sodium::SecretBuffer)
77
77
  end
@@ -85,13 +85,12 @@ module Crypto
85
85
 
86
86
  key.readonly if key.is_a?(Sodium::SecretBuffer)
87
87
  if crypto_secretbox_open_easy(ciphertext, ciphertext, ciphertext_len, nonce, key) == 0
88
+ ciphertext.slice!(message_len..-1)
88
89
  if encoding
89
- ciphertext.slice!(message_len..-1).force_encoding(encoding)
90
+ ciphertext.force_encoding(encoding)
90
91
  else
91
- ciphertext.slice!(message_len..-1)
92
+ ciphertext
92
93
  end
93
-
94
- ciphertext
95
94
  else
96
95
  raise Sodium::CryptoError, "Message forged", caller
97
96
  end
@@ -1,3 +1,3 @@
1
1
  module Sodium
2
- VERSION = Gem::Version.new('0.3.2')
2
+ VERSION = Gem::Version.new('0.3.3')
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-libsodium
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Beskow