rbnacl 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4868c75138fed2d13cc2c2e101961e5149a2f950
4
- data.tar.gz: 9b2bc9e35ff45cf67715ae49a86f3667dff2609a
3
+ metadata.gz: 6e38c7e8385a6216940cb6463b7735efb3bd44b8
4
+ data.tar.gz: f399bf5adae36466df158d6a5384ef87d6ab77d5
5
5
  SHA512:
6
- metadata.gz: 6667126547e0562e40b3d653b998058a4cc2f4dab18063d636285ca957d5b3c500eac93966946bcf9989bcad24c312208edbb856b34d53391d6ce7d2eec97932
7
- data.tar.gz: 4e2d2f6ac34fa25972361afa81e8d0ae1c08f6b344e3fba43cdba92790daf1b00c824b564f4c5a3a64070fb2b7a6f9698e546ede8ec9088295a43355528958cd
6
+ metadata.gz: 50b1a9ced0b13cceb527796a276200619448b99dd3156497e97378177537d9f4cb2ad8b08accd169684d2c9277cdf125d23d07dc0a0113acea025a6f3ebe5d37
7
+ data.tar.gz: 1a1d82499b6b8f0d354fa0d54e018ba98b4dad94ed78a8e8f06efe0f9935296611c83fcaedffbf51cd50a787d80631c48aec3761746ab87d44f443e3ffb9a5a1
data/.rspec CHANGED
@@ -1,4 +1,5 @@
1
1
  --color
2
2
  --format documentation
3
3
  --backtrace
4
- --default_path spec
4
+ --order random
5
+ --warnings
@@ -3,15 +3,18 @@ script: "LD_LIBRARY_PATH=lib bundle exec rake ci"
3
3
  rvm:
4
4
  - 1.9.3
5
5
  - 2.0.0
6
+ - 2.1.0
6
7
  - ruby-head
7
8
  - jruby
8
9
  - jruby-head
9
- - rbx-19mode
10
+ - rbx
11
+ - rbx-head
10
12
 
11
13
  matrix:
12
14
  allow_failures:
13
15
  - rvm: ruby-head
14
16
  - rvm: jruby-head
17
+ - rvm: rbx-head
15
18
 
16
19
  notifications:
17
20
  irc: "irc.freenode.org#cryptosphere"
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ 3.0.0 (2014-04-22)
2
+ ------------------
3
+ * Rename RandomNonceBox to SimpleBox (backwards compatibility preserved)
4
+ * Reverse documented order of SimpleBox/RandomNonceBox initialize parameters.
5
+ Technically backwards compatible, but confusing.
6
+ * Ensure all strings are ASCII-8BIT/BINARY encoding prior to use
7
+
1
8
  2.0.0 (2013-11-07)
2
9
  ------------------
3
10
  * Add encrypt/decrypt aliases for Crypto::RandomNonceBox
data/README.md CHANGED
@@ -214,41 +214,6 @@ Sure, here you go:
214
214
 
215
215
  ![Checkmarked Lock](http://i.imgur.com/dwA0Ffi.png)
216
216
 
217
- ### Is it full of NSA backdoors?
218
-
219
- ![No NIST](http://i.imgur.com/HSxeAmp.png)
220
-
221
- The design of RbNaCl's primitives is completely free from NIST (and by
222
- association, NSA) influence, with the following minor exceptions:
223
-
224
- * The Poly1305 MAC, used for authenticating integrity of ciphertexts, uses AES
225
- as a replaceable component
226
- * The Ed25519 digital signature algorithm uses SHA-512 for both key derivation
227
- and computing message digests
228
- * APIs are provided to certain NIST hash functions, including SHA-256, SHA-512,
229
- and their associated HMAC counterparts
230
-
231
- Otherwise, all of the algorithms in NaCl were designed by Dan Bernstein and his
232
- collaborators.
233
-
234
- The design choices in NaCl, particularly in regard to the Curve25519
235
- Diffie-Hellman function, emphasize security (whereas [NIST curves emphasize
236
- "performance" at the cost of security][nist-security-dangers]), and "magic
237
- constants" in NaCl are picked by theorems designed to maximize security.
238
- The same cannot be said of NIST curves, where the specific origins of certain
239
- constants are not described by the standards and may be subject to malicious
240
- influence by the NSA.
241
-
242
- It is the opinion of this library's authors that Dan Bernstein is unlikely to be
243
- subject to NSA influence (although we have no way of actually knowing this).
244
-
245
- Dan Bernstein's designs have been well-scrutinized both as part of the [ESTREAM
246
- Project](https://en.wikipedia.org/wiki/ESTREAM) and the cryptographic community
247
- as a whole. And despite the emphasis on higher security, NaCl's primitives are
248
- faster across-the-board than most implementations of the NIST standards.
249
-
250
- [nist-security-dangers]: http://www.hyperelliptic.org/tanja/vortraege/20130531.pdf
251
-
252
217
  ## Contributing
253
218
 
254
219
  * Fork this repository on Github
@@ -257,5 +222,5 @@ faster across-the-board than most implementations of the NIST standards.
257
222
 
258
223
  ## License
259
224
 
260
- Copyright (c) 2013 Jonathan Stott, Tony Arcieri.
225
+ Copyright (c) 2012-14 Jonathan Stott, Tony Arcieri.
261
226
  Distributed under the MIT License. See LICENSE.txt for further details.
data/Rakefile CHANGED
@@ -2,4 +2,4 @@ require "bundler/gem_tasks"
2
2
  Dir[File.expand_path("../tasks/**/*.rake", __FILE__)].each { |task| load task }
3
3
  require File.expand_path("../lib/rbnacl/rake_tasks", __FILE__)
4
4
 
5
- task :default => :spec
5
+ task :default => %w(spec rubocop)
@@ -7,7 +7,7 @@ require "rbnacl/key_comparator"
7
7
  require "rbnacl/auth"
8
8
  require "rbnacl/util"
9
9
  require "rbnacl/random"
10
- require "rbnacl/random_nonce_box"
10
+ require "rbnacl/simple_box"
11
11
  require "rbnacl/test_vectors"
12
12
  require "rbnacl/init"
13
13
 
@@ -51,7 +51,7 @@ module RbNaCl
51
51
  #
52
52
  # @param [#to_str] message the message to authenticate
53
53
  #
54
- # @return [String] The authenticator in the requested encoding (default raw)
54
+ # @return [String] the authenticator as raw bytes
55
55
  def auth(message)
56
56
  authenticator = Util.zeros(tag_bytes)
57
57
  message = message.to_str
@@ -92,12 +92,11 @@ module RbNaCl
92
92
  #
93
93
  # @param public_key [String,RbNaCl::PublicKey] The public key to encrypt to
94
94
  # @param private_key [String,RbNaCl::PrivateKey] The private key to encrypt with
95
- # @param encoding [Symbol] Parse keys from the given encoding
96
95
  #
97
96
  # @raise [RbNaCl::LengthError] on invalid keys
98
97
  #
99
98
  # @return [RbNaCl::Box] The new Box, ready to use
100
- def initialize(public_key, private_key, encoding = :raw)
99
+ def initialize(public_key, private_key)
101
100
  @public_key = PublicKey === public_key ? public_key : PublicKey.new(public_key)
102
101
  @private_key = PrivateKey === private_key ? private_key : PrivateKey.new(private_key)
103
102
  raise IncorrectPrimitiveError unless @public_key.primitive == primitive && @private_key.primitive == primitive
@@ -34,7 +34,6 @@ module RbNaCl
34
34
  # PublicKey
35
35
  #
36
36
  # @param private_key [String] The private key
37
- # @param key_encoding [Symbol] The encoding of the key
38
37
  #
39
38
  # @raise [TypeError] If the key is nil
40
39
  # @raise [RbNaCl::LengthError] If the key is not valid after decoding.
@@ -54,7 +54,7 @@ module RbNaCl
54
54
  # @param [String] integer value to multiply with this Point (32-bytes)
55
55
  #
56
56
  # @return [RbNaCl::Point] result as a Point object
57
- def mult(integer, encoding = :raw)
57
+ def mult(integer)
58
58
  integer = integer.to_str
59
59
  Util.check_length(integer, SCALARBYTES, "integer")
60
60
 
@@ -57,7 +57,6 @@ module RbNaCl
57
57
  #
58
58
  # @return [String] The blake2b hash as raw bytes (Or encoded as per the second argument)
59
59
  def self.blake2b(data, options = {})
60
- key = options[:key]
61
60
  Blake2b.new(options).digest(data)
62
61
  end
63
62
  end
@@ -46,7 +46,6 @@ module RbNaCl
46
46
  passed = false
47
47
  corrupt_ct = ciphertext.dup
48
48
  corrupt_ct[23] = ' '
49
- corrupt_ct
50
49
  box.decrypt(nonce, corrupt_ct)
51
50
  rescue CryptoError
52
51
  passed = true
@@ -27,7 +27,7 @@ module RbNaCl
27
27
  # * The confidentiality of your messages is assured with this strategy, but
28
28
  # there is no protection against messages being reordered and replayed by an
29
29
  # active adversary.
30
- class RandomNonceBox
30
+ class SimpleBox
31
31
  extend Forwardable
32
32
  def_delegators :@box, :nonce_bytes, :primitive
33
33
 
@@ -57,12 +57,12 @@ module RbNaCl
57
57
  # This is a convenience method. It takes a pair of keys and instantiates a
58
58
  # Box under the hood, then returns the new RandomNonceBox.
59
59
  #
60
- # @param private_key [PrivateKey, String] The RbNaCl private key, as class or string
61
60
  # @param public_key [PublicKey, String] The RbNaCl public key, as class or string
61
+ # @param private_key [PrivateKey, String] The RbNaCl private key, as class or string
62
62
  #
63
63
  # @return [RandomNonceBox] Ready for use
64
- def self.from_keypair(private_key, public_key)
65
- new(Box.new(private_key, public_key))
64
+ def self.from_keypair(public_key, private_key)
65
+ new(Box.new(public_key, private_key))
66
66
  end
67
67
 
68
68
  # Encrypts the message with a random nonce
@@ -102,8 +102,11 @@ module RbNaCl
102
102
  end
103
103
 
104
104
  def extract_nonce(bytes)
105
- nonce = bytes.slice!(0, nonce_bytes)
106
- [nonce, bytes]
105
+ nonce = bytes.slice(0, nonce_bytes)
106
+ [nonce, bytes.slice(nonce_bytes..-1)]
107
107
  end
108
108
  end
109
+
110
+ # Backwards compatibility with the old RandomNonceBox name
111
+ RandomNonceBox = SimpleBox
109
112
  end
@@ -87,6 +87,9 @@ module RbNaCl
87
87
  end
88
88
 
89
89
  string = string.to_str
90
+ unless string.encoding == Encoding::BINARY
91
+ raise EncodingError, "strings must use BINARY encoding (got #{string.encoding})"
92
+ end
90
93
  check_length(string, length, description)
91
94
 
92
95
  string
@@ -1,5 +1,5 @@
1
1
  # encoding: binary
2
2
  module RbNaCl
3
3
  # The library's version
4
- VERSION = "2.0.0"
4
+ VERSION = "3.0.0"
5
5
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |gem|
11
11
  gem.description = "Ruby binding to the Networking and Cryptography (NaCl) library"
12
12
  gem.summary = "The Networking and Cryptography (NaCl) library provides a high-level toolkit for building cryptographic systems and protocols"
13
13
  gem.homepage = "https://github.com/cryptosphere/rbnacl"
14
- gem.licenses = ["MIT"]
14
+ gem.licenses = ['MIT']
15
15
 
16
16
  gem.files = `git ls-files`.split($/)
17
17
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
 
27
27
  gem.add_development_dependency "rake"
28
28
  gem.add_development_dependency "rspec", ">= 2.14"
29
+ gem.add_development_dependency "rubocop"
29
30
 
30
- gem.signing_key = "../.sekretz/gem-private_key.pem"
31
31
  gem.cert_chain = ["bascule.cert"]
32
32
  end
@@ -0,0 +1,58 @@
1
+ # encoding: binary
2
+ require 'spec_helper'
3
+
4
+ describe RbNaCl::SimpleBox do
5
+ let(:secret_key) { vector :secret_key }
6
+ let(:secret_box) { RbNaCl::SecretBox.new(secret_key) }
7
+ let(:alicepk) { vector :alice_public }
8
+ let(:alicesk) { vector :alice_private }
9
+ let(:bobpk) { vector :bob_public }
10
+ let(:bobsk) { vector :bob_private }
11
+
12
+ context "instantiation" do
13
+ it "can be instantiated from an already existing box" do
14
+ expect { described_class.new(secret_box) }.not_to raise_error
15
+ end
16
+
17
+ it "can be instantiated from a secret key" do
18
+ described_class.from_secret_key(secret_key).should be_a described_class
19
+ end
20
+
21
+ it "raises TypeError when given a nil secret key" do
22
+ expect { described_class.from_secret_key(nil) }.to raise_error(TypeError)
23
+ end
24
+
25
+ it "can be instantiated from a key-pair" do
26
+ described_class.from_keypair(alicepk, bobsk).should be_a described_class
27
+ end
28
+
29
+ it "raises TypeError when given nil secret keys in the pair" do
30
+ expect { described_class.from_keypair(nil, bobsk) }.to raise_error(TypeError)
31
+ expect { described_class.from_keypair(alicepk, nil) }.to raise_error(TypeError)
32
+ end
33
+ end
34
+
35
+ context "cryptography" do
36
+ let(:nonce) { vector :box_nonce }
37
+ let(:message) { vector :box_message }
38
+ let(:ciphertext) { vector :box_ciphertext }
39
+ let(:alice) { described_class.from_keypair(bobpk, alicesk) }
40
+ let(:bob) { described_class.from_keypair(alicepk, bobsk) }
41
+
42
+ describe "bob" do
43
+ it "decrypts a message from alice" do
44
+ alices_ciphertext = alice.encrypt(message)
45
+ bob.decrypt(alices_ciphertext).should eql message
46
+ end
47
+
48
+ it "decrypts own message" do
49
+ bobs_ciphertext = bob.encrypt(message)
50
+ bob.decrypt(bobs_ciphertext).should eql message
51
+ end
52
+
53
+ it "decrypts a message with a 'random' nonce" do
54
+ bob.decrypt(nonce+ciphertext).should eql message
55
+ end
56
+ end
57
+ end
58
+ end
@@ -118,6 +118,16 @@ describe RbNaCl::Util do
118
118
  end
119
119
  end
120
120
 
121
+ context "check_string" do
122
+ it "raises EncodingError when given strings with non-BINARY encoding" do
123
+ string = "foobar"
124
+ string.force_encoding('UTF-8')
125
+ expect do
126
+ RbNaCl::Util.check_string(string, string.bytesize, "encoding test")
127
+ end.to raise_error(EncodingError)
128
+ end
129
+ end
130
+
121
131
  context "hex encoding" do
122
132
  let (:bytes) { [0xDE,0xAD,0xBE,0xEF].pack('c*') }
123
133
  let (:hex) { "deadbeef" }
@@ -1,7 +1,5 @@
1
1
  # encoding: binary
2
2
 
3
- require 'spec_helper'
4
-
5
3
  shared_examples "box" do
6
4
  let(:nonce) { vector :box_nonce }
7
5
  let(:invalid_nonce) { nonce[0,12] } # too short!
@@ -0,0 +1,3 @@
1
+ require 'rubocop/rake_task'
2
+
3
+ Rubocop::RakeTask.new
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: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
@@ -9,72 +9,65 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain:
12
- - |
13
- -----BEGIN CERTIFICATE-----
14
- MIIDbDCCAlSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MRAwDgYDVQQDDAdiYXNj
15
- dWxlMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNjb20w
16
- HhcNMTMwMzA4MDYwNzA1WhcNMTQwMzA4MDYwNzA1WjA+MRAwDgYDVQQDDAdiYXNj
17
- dWxlMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNjb20w
18
- ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC8S9Y1eahE5w/b0P1jVbO4
19
- nZbGwJGnGUTPPujZZfCXdkJu1pa8MvsU+pzgm051/yy9bWUp5eMTIjP9Qg+v92gK
20
- bfjiUoVwAqISW7zD98gbXwdOgcbCjPFfdP7XmAlxbmq0/T+kYXVngfYo737SukWz
21
- /3LLzfmtzBAZipJhTL3EAvlD2O2n2m/JARtxUwHjohd5199BBrSgbjKBXrbZ159F
22
- rJzDZef9SLCeXbVL218C4Z4Yf3QvOAvlkBQbYZmD0jnivAvXaoylZnCgIpGUnEiA
23
- C3raBW2/zMeKZC7dxygqezxwKiA/u4rxeCK3XDwYlRkF35UtAyIbIJYGODJL4MR9
24
- AgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRP3DGA
25
- NBCsdSMAHGzKpylnYy90ejAcBgNVHREEFTATgRFiYXNjdWxlQGdtYWlsLmNvbTAc
26
- BgNVHRIEFTATgRFiYXNjdWxlQGdtYWlsLmNvbTANBgkqhkiG9w0BAQUFAAOCAQEA
27
- NhP3rks+x49coXHS0vPPxXb7V0HDnuYP5R+pN1+T2Z7D4qwJKjEF4EC8mQYtwcNe
28
- Qquz1t9Uxtr7i3QqjnwhNKlIVig1nikNF+FnApjYs4mwAtMHn77WOwx8wkn7ykej
29
- 7sF7dRE+BLgpJ88/ycnA6zsEiSQVcIMDVpiYUqUBx+MDNnq5jw5dI0Kct8vBirNA
30
- QiZB6YQD1raVKUTpRubo4i0SnGpbMSxMy+YreqwNQiWG9iWCbp0JJWaOPSYTeQHe
31
- 3L/NVZQttSvxjd+WF6mA9yeCjpomboQMP36GRIZ30SoOVPMGvZ/+QpW52QU7mJW5
32
- GzWyf92p0uscgUZVTYixjg==
33
- -----END CERTIFICATE-----
34
- date: 2013-11-07 00:00:00.000000000 Z
12
+ - bascule.cert
13
+ date: 2014-04-23 00:00:00.000000000 Z
35
14
  dependencies:
36
15
  - !ruby/object:Gem::Dependency
37
16
  name: ffi
38
17
  requirement: !ruby/object:Gem::Requirement
39
18
  requirements:
40
- - - '>='
19
+ - - ">="
41
20
  - !ruby/object:Gem::Version
42
21
  version: '0'
43
22
  type: :runtime
44
23
  prerelease: false
45
24
  version_requirements: !ruby/object:Gem::Requirement
46
25
  requirements:
47
- - - '>='
26
+ - - ">="
48
27
  - !ruby/object:Gem::Version
49
28
  version: '0'
50
29
  - !ruby/object:Gem::Dependency
51
30
  name: rake
52
31
  requirement: !ruby/object:Gem::Requirement
53
32
  requirements:
54
- - - '>='
33
+ - - ">="
55
34
  - !ruby/object:Gem::Version
56
35
  version: '0'
57
36
  type: :development
58
37
  prerelease: false
59
38
  version_requirements: !ruby/object:Gem::Requirement
60
39
  requirements:
61
- - - '>='
40
+ - - ">="
62
41
  - !ruby/object:Gem::Version
63
42
  version: '0'
64
43
  - !ruby/object:Gem::Dependency
65
44
  name: rspec
66
45
  requirement: !ruby/object:Gem::Requirement
67
46
  requirements:
68
- - - '>='
47
+ - - ">="
69
48
  - !ruby/object:Gem::Version
70
49
  version: '2.14'
71
50
  type: :development
72
51
  prerelease: false
73
52
  version_requirements: !ruby/object:Gem::Requirement
74
53
  requirements:
75
- - - '>='
54
+ - - ">="
76
55
  - !ruby/object:Gem::Version
77
56
  version: '2.14'
57
+ - !ruby/object:Gem::Dependency
58
+ name: rubocop
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
78
71
  description: Ruby binding to the Networking and Cryptography (NaCl) library
79
72
  email:
80
73
  - tony.arcieri@gmail.com
@@ -83,11 +76,11 @@ executables: []
83
76
  extensions: []
84
77
  extra_rdoc_files: []
85
78
  files:
86
- - .coveralls.yml
87
- - .gitignore
88
- - .rspec
89
- - .travis.yml
90
- - .yardopts
79
+ - ".coveralls.yml"
80
+ - ".gitignore"
81
+ - ".rspec"
82
+ - ".travis.yml"
83
+ - ".yardopts"
91
84
  - CHANGES.md
92
85
  - Gemfile
93
86
  - Guardfile
@@ -116,13 +109,13 @@ files:
116
109
  - lib/rbnacl/one_time_auths/poly1305.rb
117
110
  - lib/rbnacl/rake_tasks.rb
118
111
  - lib/rbnacl/random.rb
119
- - lib/rbnacl/random_nonce_box.rb
120
112
  - lib/rbnacl/secret_boxes/xsalsa20poly1305.rb
121
113
  - lib/rbnacl/self_test.rb
122
114
  - lib/rbnacl/serializable.rb
123
115
  - lib/rbnacl/signatures/ed25519.rb
124
116
  - lib/rbnacl/signatures/ed25519/signing_key.rb
125
117
  - lib/rbnacl/signatures/ed25519/verify_key.rb
118
+ - lib/rbnacl/simple_box.rb
126
119
  - lib/rbnacl/sodium.rb
127
120
  - lib/rbnacl/sodium/version.rb
128
121
  - lib/rbnacl/test_vectors.rb
@@ -139,11 +132,11 @@ files:
139
132
  - spec/rbnacl/hash_spec.rb
140
133
  - spec/rbnacl/hmac/sha256_spec.rb
141
134
  - spec/rbnacl/hmac/sha512256_spec.rb
142
- - spec/rbnacl/random_nonce_box_spec.rb
143
135
  - spec/rbnacl/random_spec.rb
144
136
  - spec/rbnacl/secret_box_spec.rb
145
137
  - spec/rbnacl/signatures/ed25519/signing_key_spec.rb
146
138
  - spec/rbnacl/signatures/ed25519/verify_key_spec.rb
139
+ - spec/rbnacl/simple_box_spec.rb
147
140
  - spec/rbnacl/util_spec.rb
148
141
  - spec/shared/authenticator.rb
149
142
  - spec/shared/box.rb
@@ -152,6 +145,7 @@ files:
152
145
  - spec/spec_helper.rb
153
146
  - tasks/ci.rake
154
147
  - tasks/rspec.rake
148
+ - tasks/rubocop.rake
155
149
  homepage: https://github.com/cryptosphere/rbnacl
156
150
  licenses:
157
151
  - MIT
@@ -162,17 +156,17 @@ require_paths:
162
156
  - lib
163
157
  required_ruby_version: !ruby/object:Gem::Requirement
164
158
  requirements:
165
- - - '>='
159
+ - - ">="
166
160
  - !ruby/object:Gem::Version
167
161
  version: '0'
168
162
  required_rubygems_version: !ruby/object:Gem::Requirement
169
163
  requirements:
170
- - - '>='
164
+ - - ">="
171
165
  - !ruby/object:Gem::Version
172
166
  version: '0'
173
167
  requirements: []
174
168
  rubyforge_project:
175
- rubygems_version: 2.0.2
169
+ rubygems_version: 2.2.0
176
170
  signing_key:
177
171
  specification_version: 4
178
172
  summary: The Networking and Cryptography (NaCl) library provides a high-level toolkit
@@ -187,11 +181,11 @@ test_files:
187
181
  - spec/rbnacl/hash_spec.rb
188
182
  - spec/rbnacl/hmac/sha256_spec.rb
189
183
  - spec/rbnacl/hmac/sha512256_spec.rb
190
- - spec/rbnacl/random_nonce_box_spec.rb
191
184
  - spec/rbnacl/random_spec.rb
192
185
  - spec/rbnacl/secret_box_spec.rb
193
186
  - spec/rbnacl/signatures/ed25519/signing_key_spec.rb
194
187
  - spec/rbnacl/signatures/ed25519/verify_key_spec.rb
188
+ - spec/rbnacl/simple_box_spec.rb
195
189
  - spec/rbnacl/util_spec.rb
196
190
  - spec/shared/authenticator.rb
197
191
  - spec/shared/box.rb
Binary file
data.tar.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- ��aA�˥�P�$��9�~��b+;�w[!,�fƬ@Iս��a]s8�R�Fu�X|�K��va�a���! œ8���"��aŶ�K��kp�_�HĊ؜�?^n�e���b
2
- �I��,*����00�?=���@]�w$K6g�L)F�G��e�>u�`�W:�Z�x�ʖ��@���!Cf�q'�^���Ȏ�mX�@|�C���%��kߑr��3���Q�O��(fUw�*��vr�R��z�_ƒ<�K��o
@@ -1,49 +0,0 @@
1
- # encoding: binary
2
- require 'spec_helper'
3
-
4
- describe RbNaCl::RandomNonceBox do
5
- let(:secret_key) { vector :secret_key }
6
- let(:secret_box) { RbNaCl::SecretBox.new(secret_key) }
7
- let(:alicepk) { vector :alice_public }
8
- let(:bobsk) { vector :bob_private }
9
-
10
- context "instantiation" do
11
- it "can be instantiated from an already existing box" do
12
- expect { RbNaCl::RandomNonceBox.new(secret_box) }.not_to raise_error
13
- end
14
-
15
- it "can be instantiated from a secret key" do
16
- RbNaCl::RandomNonceBox.from_secret_key(secret_key).should be_a RbNaCl::RandomNonceBox
17
- end
18
-
19
- it "raises TypeError when given a nil secret key" do
20
- expect { RbNaCl::RandomNonceBox.from_secret_key(nil) }.to raise_error(TypeError)
21
- end
22
-
23
- it "can be instantiated from a key-pair" do
24
- RbNaCl::RandomNonceBox.from_keypair(alicepk, bobsk).should be_a RbNaCl::RandomNonceBox
25
- end
26
-
27
- it "raises TypeError when given nil secret keys in the pair" do
28
- expect { RbNaCl::RandomNonceBox.from_keypair(nil, bobsk) }.to raise_error(TypeError)
29
- expect { RbNaCl::RandomNonceBox.from_keypair(alicepk, nil) }.to raise_error(TypeError)
30
- end
31
- end
32
-
33
- context "cryptography" do
34
- let(:nonce) { vector :box_nonce }
35
- let(:message) { vector :box_message }
36
- let(:ciphertext) { vector :box_ciphertext }
37
- let(:random_box) { RbNaCl::RandomNonceBox.from_keypair(alicepk, bobsk) }
38
- let(:enciphered_message) { random_box.box(message) }
39
- let(:enciphered_message_hex) { random_box.box(message) }
40
-
41
- it "descrypts a message with a 'random' nonce" do
42
- random_box.open(nonce+ciphertext).should eql message
43
- end
44
-
45
- it "can successfully round-trip a message" do
46
- random_box.open(enciphered_message).should eql message
47
- end
48
- end
49
- end
metadata.gz.sig DELETED
@@ -1,2 +0,0 @@
1
- �. �r_Q���; �|��A�;e�(�zX#�u?���ݛ�Zܻ�@c�ךk�����ɛ�ID>����ߣg�J����4
2
- %Wh���h�o�ҟ�����,�W�,��˥�{�tw{#�B؄k\�