rbnacl 4.0.0 → 4.0.1
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/CHANGES.md +8 -1
- data/README.md +1 -1
- data/lib/rbnacl.rb +2 -2
- data/lib/rbnacl/aead/{aead.rb → base.rb} +2 -2
- data/lib/rbnacl/aead/chacha20poly1305_ietf.rb +1 -1
- data/lib/rbnacl/aead/{chacha20poly1305.rb → chacha20poly1305_legacy.rb} +1 -1
- data/lib/rbnacl/version.rb +1 -1
- data/spec/rbnacl/aead/chacha20poly1305_ietf_spec.rb +6 -8
- data/spec/rbnacl/aead/chacha20poly1305_legacy_spec.rb +12 -0
- data/spec/shared/aead.rb +8 -6
- metadata +6 -6
- data/spec/rbnacl/aead/chacha20poly1305_orig_spec.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ad004cd262c6ed52566b6a3a957d8880e468038
|
4
|
+
data.tar.gz: 807e63c3416eb1329c105f34be304f0ec0fd3d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 576e8ff0844842e967a529c052e89b3c58bfe0b914d890ec69f78f388a6f15162de6605a5cc67bea1ea0a24d58fcc37c03929054b0752d7d0d3fc65cb4c7239e
|
7
|
+
data.tar.gz: e0d8b0ffd5a309dee7dd43c1d279c523afd0c3ab497b077d7e3c4e56f3d33c6e1145164ae2ec4dff7e09c108234a52f179f5eb3d066c09fa063b66322221431a
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
+
4.0.1 (2016-12-04)
|
2
|
+
------------------
|
3
|
+
|
4
|
+
* [#148](https://github.com/cryptosphere/rbnacl/pull/148)
|
5
|
+
Last minute changes to the ChaCha20Poly1305 API.
|
6
|
+
([@tarcieri])
|
7
|
+
|
1
8
|
4.0.0 (2016-12-04)
|
2
|
-
|
9
|
+
------------------
|
3
10
|
|
4
11
|
* [#141](https://github.com/cryptosphere/rbnacl/pull/141)
|
5
12
|
Add wrappers for ChaCha20Poly1305 AEAD ciphers.
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
[](https://coveralls.io/r/cryptosphere/rbnacl)
|
7
7
|
[](https://github.com/cryptosphere/rbnacl/blob/master/LICENSE.txt)
|
8
8
|
|
9
|
-
_NOTE: This is the 4.x **
|
9
|
+
_NOTE: This is the 4.x **stable** branch of RbNaCl. For the 3.x **legacy**
|
10
10
|
branch, please see:_
|
11
11
|
|
12
12
|
https://github.com/cryptosphere/rbnacl/tree/3-x-stable
|
data/lib/rbnacl.rb
CHANGED
@@ -12,7 +12,7 @@ require "rbnacl/random"
|
|
12
12
|
require "rbnacl/simple_box"
|
13
13
|
require "rbnacl/test_vectors"
|
14
14
|
require "rbnacl/init"
|
15
|
-
require "rbnacl/aead/
|
15
|
+
require "rbnacl/aead/base"
|
16
16
|
|
17
17
|
# NaCl/libsodium for Ruby
|
18
18
|
module RbNaCl
|
@@ -79,7 +79,7 @@ module RbNaCl
|
|
79
79
|
require "rbnacl/hmac/sha512"
|
80
80
|
|
81
81
|
# AEAD: ChaCha20-Poly1305
|
82
|
-
require "rbnacl/aead/
|
82
|
+
require "rbnacl/aead/chacha20poly1305_legacy"
|
83
83
|
require "rbnacl/aead/chacha20poly1305_ietf"
|
84
84
|
|
85
85
|
#
|
@@ -3,14 +3,14 @@
|
|
3
3
|
|
4
4
|
module RbNaCl
|
5
5
|
module AEAD
|
6
|
-
# Authenticated Encryption with Additional Data
|
6
|
+
# Abstract base class for Authenticated Encryption with Additional Data
|
7
7
|
#
|
8
8
|
# This construction encrypts a message, and computes an authentication
|
9
9
|
# tag for the encrypted message and some optional additional data
|
10
10
|
#
|
11
11
|
# RbNaCl provides wrappers for both ChaCha20-Poly1305 AEAD implementations
|
12
12
|
# in libsodium: the original, and the IETF version.
|
13
|
-
class
|
13
|
+
class Base
|
14
14
|
# Number of bytes in a valid key
|
15
15
|
KEYBYTES = 0
|
16
16
|
|
@@ -5,7 +5,7 @@ module RbNaCl
|
|
5
5
|
module AEAD
|
6
6
|
# This class contains wrappers for the IETF implementation of
|
7
7
|
# Authenticated Encryption with Additional Data using ChaCha20-Poly1305
|
8
|
-
class
|
8
|
+
class ChaCha20Poly1305IETF < RbNaCl::AEAD::Base
|
9
9
|
extend Sodium
|
10
10
|
if Sodium::Version.supported_version?("1.0.9")
|
11
11
|
sodium_type :aead
|
@@ -5,7 +5,7 @@ module RbNaCl
|
|
5
5
|
module AEAD
|
6
6
|
# This class contains wrappers for the original libsodium implementation of
|
7
7
|
# Authenticated Encryption with Additional Data using ChaCha20-Poly1305
|
8
|
-
class
|
8
|
+
class ChaCha20Poly1305Legacy < RbNaCl::AEAD::Base
|
9
9
|
extend Sodium
|
10
10
|
|
11
11
|
sodium_type :aead
|
data/lib/rbnacl/version.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
# encoding: binary
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
RSpec.describe RbNaCl::AEAD::
|
4
|
+
RSpec.describe RbNaCl::AEAD::ChaCha20Poly1305IETF do
|
5
5
|
if RbNaCl::Sodium::Version.supported_version?("1.0.9")
|
6
6
|
include_examples "aead" do
|
7
|
-
let(:key)
|
8
|
-
let(:message)
|
9
|
-
let(:nonce)
|
10
|
-
let(:ad)
|
11
|
-
let(:ciphertext) {vector :aead_chacha20poly1305_ietf_ciphertext}
|
12
|
-
|
13
|
-
let(:aead) { RbNaCl::AEAD::Chacha20Poly1305IETF.new(key) }
|
7
|
+
let(:key) { vector :aead_chacha20poly1305_ietf_key }
|
8
|
+
let(:message) { vector :aead_chacha20poly1305_ietf_message }
|
9
|
+
let(:nonce) { vector :aead_chacha20poly1305_ietf_nonce }
|
10
|
+
let(:ad) { vector :aead_chacha20poly1305_ietf_ad }
|
11
|
+
let(:ciphertext) { vector :aead_chacha20poly1305_ietf_ciphertext }
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# encoding: binary
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
RSpec.describe RbNaCl::AEAD::ChaCha20Poly1305Legacy do
|
5
|
+
include_examples "aead" do
|
6
|
+
let(:key) { vector :aead_chacha20poly1305_orig_key }
|
7
|
+
let(:message) { vector :aead_chacha20poly1305_orig_message }
|
8
|
+
let(:nonce) { vector :aead_chacha20poly1305_orig_nonce }
|
9
|
+
let(:ad) { vector :aead_chacha20poly1305_orig_ad }
|
10
|
+
let(:ciphertext) { vector :aead_chacha20poly1305_orig_ciphertext }
|
11
|
+
end
|
12
|
+
end
|
data/spec/shared/aead.rb
CHANGED
@@ -2,13 +2,15 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
RSpec.shared_examples "aead" do
|
5
|
-
let(:corrupt_ciphertext) { ciphertext.succ}
|
6
|
-
let(:trunc_ciphertext)
|
7
|
-
let(:invalid_nonce)
|
5
|
+
let(:corrupt_ciphertext) { ciphertext.succ }
|
6
|
+
let(:trunc_ciphertext) { ciphertext[0, 20] }
|
7
|
+
let(:invalid_nonce) { nonce[0, nonce.bytesize/2] } # too short!
|
8
8
|
let(:invalid_nonce_long) { nonce + nonce } # too long!
|
9
|
-
let(:nonce_error_regex) {
|
10
|
-
let(:corrupt_ad)
|
11
|
-
let(:trunc_ad)
|
9
|
+
let(:nonce_error_regex) { %r{Nonce.*(Expected #{aead.nonce_bytes})} }
|
10
|
+
let(:corrupt_ad) { ad.succ }
|
11
|
+
let(:trunc_ad) { ad[0, ad.bytesize/2] }
|
12
|
+
|
13
|
+
let(:aead) { described_class.new(key) }
|
12
14
|
|
13
15
|
context "new" do
|
14
16
|
it "accepts strings" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbnacl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-12-
|
12
|
+
date: 2016-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -66,9 +66,9 @@ files:
|
|
66
66
|
- images/hash.png
|
67
67
|
- images/logo.png
|
68
68
|
- lib/rbnacl.rb
|
69
|
-
- lib/rbnacl/aead/
|
70
|
-
- lib/rbnacl/aead/chacha20poly1305.rb
|
69
|
+
- lib/rbnacl/aead/base.rb
|
71
70
|
- lib/rbnacl/aead/chacha20poly1305_ietf.rb
|
71
|
+
- lib/rbnacl/aead/chacha20poly1305_legacy.rb
|
72
72
|
- lib/rbnacl/auth.rb
|
73
73
|
- lib/rbnacl/boxes/curve25519xsalsa20poly1305.rb
|
74
74
|
- lib/rbnacl/boxes/curve25519xsalsa20poly1305/private_key.rb
|
@@ -102,7 +102,7 @@ files:
|
|
102
102
|
- lib/rbnacl/version.rb
|
103
103
|
- rbnacl.gemspec
|
104
104
|
- spec/rbnacl/aead/chacha20poly1305_ietf_spec.rb
|
105
|
-
- spec/rbnacl/aead/
|
105
|
+
- spec/rbnacl/aead/chacha20poly1305_legacy_spec.rb
|
106
106
|
- spec/rbnacl/authenticators/poly1305_spec.rb
|
107
107
|
- spec/rbnacl/boxes/curve25519xsalsa20poly1305/private_key_spec.rb
|
108
108
|
- spec/rbnacl/boxes/curve25519xsalsa20poly1305/public_key_spec.rb
|
@@ -155,7 +155,7 @@ specification_version: 4
|
|
155
155
|
summary: Ruby binding to the Networking and Cryptography (NaCl) library
|
156
156
|
test_files:
|
157
157
|
- spec/rbnacl/aead/chacha20poly1305_ietf_spec.rb
|
158
|
-
- spec/rbnacl/aead/
|
158
|
+
- spec/rbnacl/aead/chacha20poly1305_legacy_spec.rb
|
159
159
|
- spec/rbnacl/authenticators/poly1305_spec.rb
|
160
160
|
- spec/rbnacl/boxes/curve25519xsalsa20poly1305/private_key_spec.rb
|
161
161
|
- spec/rbnacl/boxes/curve25519xsalsa20poly1305/public_key_spec.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# encoding: binary
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
RSpec.describe RbNaCl::AEAD::Chacha20Poly1305 do
|
5
|
-
include_examples "aead" do
|
6
|
-
let(:key) {vector :aead_chacha20poly1305_orig_key}
|
7
|
-
let(:message) {vector :aead_chacha20poly1305_orig_message}
|
8
|
-
let(:nonce) {vector :aead_chacha20poly1305_orig_nonce}
|
9
|
-
let(:ad) {vector :aead_chacha20poly1305_orig_ad}
|
10
|
-
let(:ciphertext) {vector :aead_chacha20poly1305_orig_ciphertext}
|
11
|
-
|
12
|
-
let(:aead) { RbNaCl::AEAD::Chacha20Poly1305.new(key) }
|
13
|
-
end
|
14
|
-
end
|