ffi-libsodium 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/crypto/box.rb +4 -5
- data/lib/crypto/secret_box.rb +4 -5
- data/lib/sodium/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a6a2df052bb5ae7911a6a64e73ac841dcc3dd4b
|
4
|
+
data.tar.gz: ffedb95aafff7017b363bad6bc1da3fd7ee5437b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d63913ef97e34ed10a3a341ca1da67a54d0fbdc797f1c56495591b10b145811d97c480def4a471c9fba29ec2bca34bf78c4e88363cac0cb89592534074c759
|
7
|
+
data.tar.gz: d4ce9e3f910a6c1690bff8ce0c9f428824caeb517e90622cbe36847737c2119f73d668af15367ce54a95af6211bc8cbbcde0fd30b2c26b3166a6d97970d2208e
|
data/lib/crypto/box.rb
CHANGED
@@ -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.
|
145
|
+
ciphertext.force_encoding(encoding)
|
145
146
|
else
|
146
|
-
ciphertext
|
147
|
+
ciphertext
|
147
148
|
end
|
148
|
-
|
149
|
-
ciphertext
|
150
149
|
else
|
151
150
|
raise Sodium::CryptoError, "Message forged", caller
|
152
151
|
end
|
data/lib/crypto/secret_box.rb
CHANGED
@@ -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.
|
90
|
+
ciphertext.force_encoding(encoding)
|
90
91
|
else
|
91
|
-
ciphertext
|
92
|
+
ciphertext
|
92
93
|
end
|
93
|
-
|
94
|
-
ciphertext
|
95
94
|
else
|
96
95
|
raise Sodium::CryptoError, "Message forged", caller
|
97
96
|
end
|
data/lib/sodium/version.rb
CHANGED