ffi-libsodium 0.0.6 → 0.0.7
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
- data/lib/crypto/aead/chacha20_poly1305.rb +2 -2
- data/lib/crypto/sign.rb +4 -2
- 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: 809b5a363af975be25d1bece0bf14d70fffacd36
|
4
|
+
data.tar.gz: 52789ce07fa6173a7eb8f7602ededd02dc74f720
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ac72f615ac5b7eda4407b28588321aa74d2274a1dcac5455986cb68511c8d786451ad01fdbe5160a8ad06a8762d95043646ec87b45a4b809f16efc0e11c6a4
|
7
|
+
data.tar.gz: bdd464b328937b41f9f2f5f9300fd734758462f96310ae4fa84c906343a277e54ecc76c0835519d8cedecc08184c490182434d93abf4660c9bb1cf746582b3fa
|
@@ -44,7 +44,7 @@ module Crypto
|
|
44
44
|
check_length(nonce, NPUBBYTES, :Nonce)
|
45
45
|
check_length(key, KEYBYTES, :SecretKey)
|
46
46
|
|
47
|
-
ciphertext =
|
47
|
+
ciphertext = Sodium::Buffer.new(:uchar, message_len + ABYTES)
|
48
48
|
key.readonly if key.is_a?(Sodium::SecretBuffer)
|
49
49
|
crypto_aead_chacha20poly1305_encrypt(ciphertext, nil, message, message_len, additional_data, additional_data_len, nil, nonce, key)
|
50
50
|
key.noaccess if key.is_a?(Sodium::SecretBuffer)
|
@@ -60,7 +60,7 @@ module Crypto
|
|
60
60
|
check_length(nonce, NPUBBYTES, :Nonce)
|
61
61
|
check_length(key, KEYBYTES, :SecretKey)
|
62
62
|
|
63
|
-
decrypted =
|
63
|
+
decrypted = Sodium::Buffer.new(:uchar, ciphertext_len - ABYTES)
|
64
64
|
key.readonly if key.is_a?(Sodium::SecretBuffer)
|
65
65
|
rc = crypto_aead_chacha20poly1305_decrypt(decrypted, nil, nil, ciphertext, ciphertext_len, additional_data, additional_data_len, nonce, key)
|
66
66
|
key.noaccess if key.is_a?(Sodium::SecretBuffer)
|
data/lib/crypto/sign.rb
CHANGED
@@ -34,7 +34,6 @@ module Crypto
|
|
34
34
|
def keypair
|
35
35
|
public_key = Sodium::Buffer.new(:uchar, PUBLICKEYBYTES)
|
36
36
|
secret_key = Sodium::Buffer.new(:uchar, SECRETKEYBYTES)
|
37
|
-
|
38
37
|
crypto_sign_keypair(public_key, secret_key)
|
39
38
|
|
40
39
|
[public_key, secret_key]
|
@@ -45,8 +44,9 @@ module Crypto
|
|
45
44
|
|
46
45
|
public_key = Sodium::Buffer.new(:uchar, PUBLICKEYBYTES)
|
47
46
|
secret_key = Sodium::Buffer.new(:uchar, SECRETKEYBYTES)
|
48
|
-
|
47
|
+
seed.readonly if seed.is_a?(Sodium::SecretBuffer)
|
49
48
|
crypto_sign_seed_keypair(public_key, secret_key, seed)
|
49
|
+
seed.noaccess if seed.is_a?(Sodium::SecretBuffer)
|
50
50
|
|
51
51
|
[public_key, secret_key]
|
52
52
|
end
|
@@ -65,7 +65,9 @@ module Crypto
|
|
65
65
|
|
66
66
|
public_key = Sodium::Buffer.new(:uchar, PUBLICKEYBYTES)
|
67
67
|
secret_key = Sodium::SecretBuffer.new(:uchar, SECRETKEYBYTES)
|
68
|
+
seed.readonly if seed.is_a?(Sodium::SecretBuffer)
|
68
69
|
crypto_sign_seed_keypair(public_key, secret_key, seed)
|
70
|
+
seed.noaccess if seed.is_a?(Sodium::SecretBuffer)
|
69
71
|
secret_key.noaccess
|
70
72
|
|
71
73
|
[public_key, secret_key]
|
data/lib/sodium/version.rb
CHANGED