rbnacl 7.0.0 → 7.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18e5a4efebf3a289cd699ebce7b08ad598411c112d15c35e72c1436ca4d93d6f
4
- data.tar.gz: 0f26ed2371c60ea5a2bda37a31b0a9d501fd9813be84613b002c2d051ad9b97c
3
+ metadata.gz: 6bc276dfd0153342775c925fc59964d2df76248c1c16f89d07d802ca841b6bc5
4
+ data.tar.gz: 6ffdb056f41764d542a024ea0e268e0ddf3b71debba7e424c8a12a5eee5c442d
5
5
  SHA512:
6
- metadata.gz: 16de9db7bff675c9ffdede714661bcafa19fe5c9998ea8c8eb40e252297578f98eaf095c1672b98a7c08248900001917b2ccb32bc3987728ec9d32fedca4d29b
7
- data.tar.gz: db529680fbb1b998520754bfee5530d7da2f732c4edfb8407df6284cb423d9816257c26e8a934a07aa8b712dd72e6d211f61d433c4e5b36ee639ecfbe4018ada
6
+ metadata.gz: 6a9a738528fdebf377fa0076b9ec20f2d073e8f214e18f0e9b0f607d67d9b355247577671d4c642d4caa3e6f7edd0e82799a80cefa0baa4947c5d207c3c76c48
7
+ data.tar.gz: cd6509dae23175b83f8ced49f70eff8616f7a555feb10de17f5f386823d378c8909a89b41decd4c7fb6e2d4119dd2a31a13701b1c12bdc1278702da86f3a89bb
data/.travis.yml CHANGED
@@ -1,21 +1,13 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
 
4
- before_install:
5
- - sudo add-apt-repository -y ppa:chris-lea/libsodium
6
- - sudo apt-get update -q
7
- - sudo apt-get install libsodium-dev
8
- - gem update --system
9
- - gem --version
10
- - gem install bundler -v 1.17.1
11
- - bundle --version
4
+ before_install: sudo apt-get install libsodium18
12
5
 
13
6
  rvm:
14
- - jruby-9.1.15.0
15
- - 2.3
16
- - 2.4
7
+ - jruby-9.2.8.0
17
8
  - 2.5
18
9
  - 2.6
10
+ - 2.7
19
11
 
20
12
  matrix:
21
13
  fast_finish: true
data/CHANGES.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [7.1.1] (2020-01-27)
2
+
3
+ - Test on Ruby 2.7 ([#208])
4
+ - Add project metadata to the gemspec ([#207])
5
+ - Resolve FFI deprecation warning ([#206])
6
+
7
+ ## [7.1.0] (2019-09-07)
8
+
9
+ - Attached signature API ([#197], [#202])
10
+ - Fix the `generichash` state definition ([#200])
11
+
1
12
  ## [7.0.0] (2019-05-23)
2
13
 
3
14
  - Drop support for Ruby 2.2 ([#194])
@@ -105,25 +116,33 @@
105
116
 
106
117
  - Initial release
107
118
 
108
- [7.0.0]: https://github.com/crypto-rb/rbnacl/pull/195
109
- [#194]: https://github.com/crypto-rb/rbnacl/pull/194
110
- [6.0.1]: https://github.com/crypto-rb/rbnacl/pull/191
111
- [#189]: https://github.com/crypto-rb/rbnacl/pull/189
112
- [#186]: https://github.com/crypto-rb/rbnacl/pull/186
113
- [#184]: https://github.com/crypto-rb/rbnacl/pull/184
114
- [6.0.0]: https://github.com/crypto-rb/rbnacl/pull/182
115
- [#180]: https://github.com/crypto-rb/rbnacl/pull/180
116
- [#176]: https://github.com/crypto-rb/rbnacl/pull/176
117
- [#174]: https://github.com/crypto-rb/rbnacl/pull/174
118
- [#172]: https://github.com/crypto-rb/rbnacl/pull/172
119
- [#166]: https://github.com/crypto-rb/rbnacl/pull/166
120
- [#159]: https://github.com/crypto-rb/rbnacl/pull/159
121
- [#157]: https://github.com/crypto-rb/rbnacl/pull/157
122
- [#148]: https://github.com/crypto-rb/rbnacl/pull/148
123
- [#143]: https://github.com/crypto-rb/rbnacl/pull/143
124
- [#142]: https://github.com/crypto-rb/rbnacl/pull/142
125
- [#141]: https://github.com/crypto-rb/rbnacl/pull/141
126
- [#137]: https://github.com/crypto-rb/rbnacl/pull/137
127
- [#135]: https://github.com/crypto-rb/rbnacl/pull/135
128
- [#128]: https://github.com/crypto-rb/rbnacl/pull/128
129
- [#105]: https://github.com/crypto-rb/rbnacl/pull/105
119
+ [7.1.1]: https://github.com/RubyCrypto/rbnacl/pull/210
120
+ [#208]: https://github.com/RubyCrypto/rbnacl/pull/208
121
+ [#207]: https://github.com/RubyCrypto/rbnacl/pull/207
122
+ [#206]: https://github.com/RubyCrypto/rbnacl/pull/206
123
+ [7.1.0]: https://github.com/RubyCrypto/rbnacl/pull/203
124
+ [#202]: https://github.com/RubyCrypto/rbnacl/pull/202
125
+ [#200]: https://github.com/RubyCrypto/rbnacl/pull/200
126
+ [#197]: https://github.com/RubyCrypto/rbnacl/pull/197
127
+ [7.0.0]: https://github.com/RubyCrypto/rbnacl/pull/195
128
+ [#194]: https://github.com/RubyCrypto/rbnacl/pull/194
129
+ [6.0.1]: https://github.com/RubyCrypto/rbnacl/pull/191
130
+ [#189]: https://github.com/RubyCrypto/rbnacl/pull/189
131
+ [#186]: https://github.com/RubyCrypto/rbnacl/pull/186
132
+ [#184]: https://github.com/RubyCrypto/rbnacl/pull/184
133
+ [6.0.0]: https://github.com/RubyCrypto/rbnacl/pull/182
134
+ [#180]: https://github.com/RubyCrypto/rbnacl/pull/180
135
+ [#176]: https://github.com/RubyCrypto/rbnacl/pull/176
136
+ [#174]: https://github.com/RubyCrypto/rbnacl/pull/174
137
+ [#172]: https://github.com/RubyCrypto/rbnacl/pull/172
138
+ [#166]: https://github.com/RubyCrypto/rbnacl/pull/166
139
+ [#159]: https://github.com/RubyCrypto/rbnacl/pull/159
140
+ [#157]: https://github.com/RubyCrypto/rbnacl/pull/157
141
+ [#148]: https://github.com/RubyCrypto/rbnacl/pull/148
142
+ [#143]: https://github.com/RubyCrypto/rbnacl/pull/143
143
+ [#142]: https://github.com/RubyCrypto/rbnacl/pull/142
144
+ [#141]: https://github.com/RubyCrypto/rbnacl/pull/141
145
+ [#137]: https://github.com/RubyCrypto/rbnacl/pull/137
146
+ [#135]: https://github.com/RubyCrypto/rbnacl/pull/135
147
+ [#128]: https://github.com/RubyCrypto/rbnacl/pull/128
148
+ [#105]: https://github.com/RubyCrypto/rbnacl/pull/105
data/README.md CHANGED
@@ -1,17 +1,16 @@
1
- ![RbNaCl](https://raw.github.com/crypto-rb/rbnacl/master/images/logo.png)
1
+ ![RbNaCl](https://raw.github.com/RubyCrypto/rbnacl/master/images/logo.png)
2
2
  ======
3
3
  [![Gem Version](https://badge.fury.io/rb/rbnacl.svg)](http://badge.fury.io/rb/rbnacl)
4
- [![Build Status](https://travis-ci.org/crypto-rb/rbnacl.svg?branch=master)](https://travis-ci.org/crypto-rb/rbnacl)
5
- [![Code Climate](https://codeclimate.com/github/crypto-rb/rbnacl.svg)](https://codeclimate.com/github/crypto-rb/rbnacl)
6
- [![Coverage Status](https://coveralls.io/repos/crypto-rb/rbnacl/badge.svg?branch=master)](https://coveralls.io/r/crypto-rb/rbnacl)
7
- [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/crypto-rb/rbnacl/blob/master/LICENSE.txt)
8
- [![Gitter Chat](https://badges.gitter.im/badge.svg)](https://gitter.im/crypto-rb/Lobby)
4
+ [![Build Status](https://travis-ci.org/RubyCrypto/rbnacl.svg?branch=master)](https://travis-ci.org/RubyCrypto/rbnacl)
5
+ [![Code Climate](https://codeclimate.com/github/RubyCrypto/rbnacl.svg)](https://codeclimate.com/github/RubyCrypto/rbnacl)
6
+ [![Coverage Status](https://coveralls.io/repos/RubyCrypto/rbnacl/badge.svg?branch=master)](https://coveralls.io/r/RubyCrypto/rbnacl)
7
+ [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/RubyCrypto/rbnacl/blob/master/LICENSE.txt)
9
8
 
10
- Ruby binding for [libsodium], a fork of the [Networking and Cryptography][nacl]
9
+ Ruby binding for [libsodium], a fork of the [Networking and Cryptography][NaCl]
11
10
  library.
12
11
 
13
12
  [libsodium]: https://libsodium.org
14
- [nacl]: http://nacl.cr.yp.to/
13
+ [NaCl]: http://nacl.cr.yp.to/
15
14
 
16
15
  ## Why libsodium/NaCl?
17
16
 
@@ -41,17 +40,6 @@ is extremely fast with comparatively small cryptographic keys.
41
40
 
42
41
  [Yes.](http://news.ycombinator.com/item?id=3067434)
43
42
 
44
- ## Help and Discussion
45
-
46
- Have questions? Want to suggest a feature or change? Join a discussion group:
47
-
48
- * [Crypto.rb Gitter]: web-based chat about Ruby crypto projects including **RbNaCl**.
49
- * [Crypto.rb Google Group]: join via web or email ([crypto-rb+subscribe@googlegroups.com])
50
-
51
- [Crypto.rb Gitter]: https://gitter.im/crypto-rb/Lobby
52
- [Crypto.rb Google Group]: https://groups.google.com/forum/#!forum/crypto-rb
53
- [crypto-rb+subscribe@googlegroups.com]: mailto:crypto-rb+subscribe@googlegroups.com?subject=subscribe
54
-
55
43
  ## Supported platforms
56
44
 
57
45
  You can use RbNaCl on platforms libsodium is supported (see below).
@@ -59,19 +47,18 @@ You can use RbNaCl on platforms libsodium is supported (see below).
59
47
  This library aims to support and is [tested against][travis] the following Ruby
60
48
  versions:
61
49
 
62
- * Ruby 2.3
63
- * Ruby 2.4
64
50
  * Ruby 2.5
65
51
  * Ruby 2.6
66
- * JRuby 9.1
52
+ * Ruby 2.7
53
+ * JRuby 9.2
67
54
 
68
55
  If something doesn't work on one of these versions, it's a bug.
69
56
 
70
- [travis]: http://travis-ci.org/crypto-rb/rbnacl
57
+ [travis]: http://travis-ci.org/RubyCrypto/rbnacl
71
58
 
72
59
  ## Installation
73
60
 
74
- Note: [Windows installation instructions are available](https://github.com/crypto-rb/rbnacl/wiki/Installing-libsodium#windows).
61
+ Note: [Windows installation instructions are available](https://github.com/RubyCrypto/rbnacl/wiki/Installing-libsodium#windows).
75
62
 
76
63
  ### libsodium
77
64
 
@@ -137,13 +124,13 @@ information.
137
124
 
138
125
  [YARD API documentation][yard] is also available.
139
126
 
140
- [wiki]: https://github.com/crypto-rb/rbnacl/wiki
141
- [simplebox]: https://github.com/crypto-rb/rbnacl/wiki/SimpleBox
142
- [secretkey]: https://github.com/crypto-rb/rbnacl/wiki/Secret-Key-Encryption
143
- [publickey]: https://github.com/crypto-rb/rbnacl/wiki/Public-Key-Encryption
144
- [signatures]: https://github.com/crypto-rb/rbnacl/wiki/Digital-Signatures
145
- [macs]: https://github.com/crypto-rb/rbnacl/wiki/HMAC
146
- [hashes]: https://github.com/crypto-rb/rbnacl/wiki/Hash-Functions
127
+ [wiki]: https://github.com/RubyCrypto/rbnacl/wiki
128
+ [simplebox]: https://github.com/RubyCrypto/rbnacl/wiki/SimpleBox
129
+ [secretkey]: https://github.com/RubyCrypto/rbnacl/wiki/Secret-Key-Encryption
130
+ [publickey]: https://github.com/RubyCrypto/rbnacl/wiki/Public-Key-Encryption
131
+ [signatures]: https://github.com/RubyCrypto/rbnacl/wiki/Digital-Signatures
132
+ [macs]: https://github.com/RubyCrypto/rbnacl/wiki/HMAC
133
+ [hashes]: https://github.com/RubyCrypto/rbnacl/wiki/Hash-Functions
147
134
  [yard]: http://www.rubydoc.info/gems/rbnacl
148
135
 
149
136
  ## Learn More
@@ -196,4 +183,4 @@ Sure, here you go:
196
183
  Copyright (c) 2012-2018 Tony Arcieri, Jonathan Stott. Distributed under the MIT License.
197
184
  See [LICENSE.txt] for further details.
198
185
 
199
- [LICENSE.txt]: https://github.com/crypto-rb/rbnacl/blob/master/LICENSE.txt
186
+ [LICENSE.txt]: https://github.com/RubyCrypto/rbnacl/blob/master/LICENSE.txt
@@ -170,14 +170,9 @@ module RbNaCl
170
170
  end
171
171
 
172
172
  # The crypto_generichash_blake2b_state struct representation
173
- # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_generichash_blake2b.h#L23
173
+ # ref: jedisct1/libsodium/blob/c87df74c7b5969f4/src/libsodium/include/sodium/crypto_generichash_blake2b.h#L23-L25
174
174
  class State < FFI::Struct
175
- layout :h, [:uint64, 8],
176
- :t, [:uint64, 2],
177
- :f, [:uint64, 2],
178
- :buf, [:uint8, 2 * 128],
179
- :buflen, :size_t,
180
- :last_node, :uint8
175
+ layout :opaque, [:uint8, 384]
181
176
  end
182
177
  end
183
178
  end
@@ -89,21 +89,21 @@ module RbNaCl
89
89
  compute_authenticator(correct, message)
90
90
  Util.verify32(correct, authenticator)
91
91
  end
92
- end
93
92
 
94
- # The crypto_auth_hmacsha256_state struct representation
95
- # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h
96
- class SHA256State < FFI::Struct
97
- layout :state, [:uint32, 8],
98
- :count, :uint64,
99
- :buf, [:uint8, 64]
100
- end
93
+ # The crypto_auth_hmacsha256_state struct representation
94
+ # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha256.h
95
+ class SHA256State < FFI::Struct
96
+ layout :state, [:uint32, 8],
97
+ :count, :uint64,
98
+ :buf, [:uint8, 64]
99
+ end
101
100
 
102
- # The crypto_hash_sha256_state struct representation
103
- # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h
104
- class State < FFI::Struct
105
- layout :ictx, SHA256State,
106
- :octx, SHA256State
101
+ # The crypto_hash_sha256_state struct representation
102
+ # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_hash_sha256.h
103
+ class State < FFI::Struct
104
+ layout :ictx, SHA256State,
105
+ :octx, SHA256State
106
+ end
107
107
  end
108
108
  end
109
109
  end
@@ -89,21 +89,21 @@ module RbNaCl
89
89
  compute_authenticator(correct, message)
90
90
  Util.verify64(correct, authenticator)
91
91
  end
92
- end
93
92
 
94
- # The crypto_auth_hmacsha512_state struct representation
95
- # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h
96
- class SHA512State < FFI::Struct
97
- layout :state, [:uint64, 8],
98
- :count, [:uint64, 2],
99
- :buf, [:uint8, 128]
100
- end
93
+ # The crypto_auth_hmacsha512_state struct representation
94
+ # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512.h
95
+ class SHA512State < FFI::Struct
96
+ layout :state, [:uint64, 8],
97
+ :count, [:uint64, 2],
98
+ :buf, [:uint8, 128]
99
+ end
101
100
 
102
- # The crypto_hash_sha512_state struct representation
103
- # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h
104
- class State < FFI::Struct
105
- layout :ictx, SHA512State,
106
- :octx, SHA512State
101
+ # The crypto_hash_sha512_state struct representation
102
+ # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h
103
+ class State < FFI::Struct
104
+ layout :ictx, SHA512State,
105
+ :octx, SHA512State
106
+ end
107
107
  end
108
108
  end
109
109
  end
@@ -87,21 +87,21 @@ module RbNaCl
87
87
  compute_authenticator(correct, message)
88
88
  Util.verify32(correct, authenticator)
89
89
  end
90
- end
91
90
 
92
- # The crypto_auth_hmacsha512256_state struct representation
93
- # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h
94
- class SHA512256State < FFI::Struct
95
- layout :state, [:uint64, 8],
96
- :count, [:uint64, 2],
97
- :buf, [:uint8, 128]
98
- end
91
+ # The crypto_auth_hmacsha512256_state struct representation
92
+ # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_auth_hmacsha512256.h
93
+ class SHA512256State < FFI::Struct
94
+ layout :state, [:uint64, 8],
95
+ :count, [:uint64, 2],
96
+ :buf, [:uint8, 128]
97
+ end
99
98
 
100
- # The crypto_hash_sha512_state struct representation
101
- # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h
102
- class State < FFI::Struct
103
- layout :ictx, SHA512256State,
104
- :octx, SHA512256State
99
+ # The crypto_hash_sha512_state struct representation
100
+ # ref: jedisct1/libsodium/src/libsodium/include/sodium/crypto_hash_sha512.h
101
+ class State < FFI::Struct
102
+ layout :ictx, SHA512256State,
103
+ :octx, SHA512256State
104
+ end
105
105
  end
106
106
  end
107
107
  end
@@ -73,12 +73,19 @@ module RbNaCl
73
73
  #
74
74
  # @return [String] Signature as bytes
75
75
  def sign(message)
76
+ sign_attached(message)[0, signature_bytes]
77
+ end
78
+
79
+ # Sign a message using this key, attaching the signature to the message
80
+ #
81
+ # @param message [String] Message to be signed by this key
82
+ #
83
+ # @return [String] Signature and the message as bytes
84
+ def sign_attached(message)
76
85
  buffer = Util.prepend_zeros(signature_bytes, message)
77
86
  buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)
78
-
79
87
  self.class.sign_ed25519(buffer, buffer_len, message, message.bytesize, @signing_key)
80
-
81
- buffer[0, signature_bytes]
88
+ buffer
82
89
  end
83
90
 
84
91
  # Return the raw seed value of this key
@@ -47,12 +47,26 @@ module RbNaCl
47
47
  def verify(signature, message)
48
48
  signature = signature.to_str
49
49
  Util.check_length(signature, signature_bytes, "signature")
50
+ verify_attached(signature + message)
51
+ end
52
+
53
+ # Verify a signature for a given signed message
54
+ #
55
+ # Raises if the signature is invalid.
56
+ #
57
+ # @param signed_message [String] Message combined with signature to be authenticated
58
+ #
59
+ # @raise [BadSignatureError] if the signature check fails
60
+ #
61
+ # @return [Boolean] was the signature authentic?
62
+ def verify_attached(signed_message)
63
+ raise LengthError, "Signed message can not be nil" if signed_message.nil?
64
+ raise LengthError, "Signed message can not be shorter than a signature" if signed_message.bytesize <= signature_bytes
50
65
 
51
- sig_and_msg = signature + message
52
- buffer = Util.zeros(sig_and_msg.bytesize)
66
+ buffer = Util.zeros(signed_message.bytesize)
53
67
  buffer_len = Util.zeros(FFI::Type::LONG_LONG.size)
54
68
 
55
- success = self.class.sign_ed25519_open(buffer, buffer_len, sig_and_msg, sig_and_msg.bytesize, @key)
69
+ success = self.class.sign_ed25519_open(buffer, buffer_len, signed_message, signed_message.bytesize, @key)
56
70
  raise(BadSignatureError, "signature was forged/corrupt") unless success
57
71
 
58
72
  true
@@ -4,5 +4,5 @@
4
4
  # NaCl/libsodium for Ruby
5
5
  module RbNaCl
6
6
  # The library's version
7
- VERSION = "7.0.0"
7
+ VERSION = "7.1.1"
8
8
  end
data/lib/rbnacl.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  if defined?(RBNACL_LIBSODIUM_GEM_LIB_PATH)
5
5
  raise "rbnacl-libsodium is not supported by rbnacl 6.0+. "\
6
6
  "Please remove it as a dependency and install libsodium using your system package manager. "\
7
- "See https://github.com/crypto-rb/rbnacl#installation"
7
+ "See https://github.com/RubyCrypto/rbnacl#installation"
8
8
  end
9
9
 
10
10
  require "rbnacl/version"
data/rbnacl.gemspec CHANGED
@@ -9,21 +9,25 @@ Gem::Specification.new do |spec|
9
9
  spec.version = RbNaCl::VERSION
10
10
  spec.authors = ["Tony Arcieri", "Jonathan Stott"]
11
11
  spec.email = ["bascule@gmail.com", "jonathan.stott@gmail.com"]
12
- spec.homepage = "https://github.com/crypto-rb/rbnacl"
12
+ spec.homepage = "https://github.com/RubyCrypto/rbnacl"
13
13
  spec.licenses = ["MIT"]
14
14
  spec.summary = "Ruby binding to the libsodium/NaCl cryptography library"
15
15
  spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
16
16
  The Networking and Cryptography (NaCl) library provides a high-level toolkit for building
17
17
  cryptographic systems and protocols
18
18
  DESCRIPTION
19
+ spec.metadata = {
20
+ "bug_tracker_uri" => "#{spec.homepage}/issues",
21
+ "changelog_uri" => "#{spec.homepage}/blob/master/CHANGES.md",
22
+ "documentation_uri" => "https://www.rubydoc.info/gems/#{spec.name}/#{spec.version}",
23
+ "source_code_uri" => "#{spec.homepage}/tree/v#{spec.version}",
24
+ "wiki_uri" => "#{spec.homepage}/wiki"
25
+ }
19
26
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
20
27
  spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
21
28
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
29
  spec.require_paths = ["lib"]
23
-
24
30
  spec.required_ruby_version = ">= 2.3.0"
25
-
26
31
  spec.add_runtime_dependency "ffi"
27
-
28
32
  spec.add_development_dependency "bundler"
29
33
  end
@@ -17,6 +17,11 @@ RSpec.describe RbNaCl::SigningKey do
17
17
  expect(subject.sign(message)).to eq signature
18
18
  end
19
19
 
20
+ it "signs messages, full version" do
21
+ expect(subject.sign_attached(message)[0, RbNaCl::SigningKey.signature_bytes]).to eq signature
22
+ expect(subject.sign_attached(message)[RbNaCl::SigningKey.signature_bytes, message.length]).to eq message
23
+ end
24
+
20
25
  it "serializes to bytes" do
21
26
  expect(subject.to_bytes).to eq signing_key
22
27
  end
@@ -20,14 +20,30 @@ RSpec.describe RbNaCl::VerifyKey do
20
20
  expect(subject.verify(signature, message)).to eq true
21
21
  end
22
22
 
23
+ it "verifies correct signatures, full version" do
24
+ expect(subject.verify_attached(signature + message)).to eq true
25
+ end
26
+
23
27
  it "raises when asked to verify a bad signature" do
24
28
  expect { subject.verify(bad_signature, message) }.to raise_exception RbNaCl::BadSignatureError
25
29
  end
26
30
 
31
+ it "raises when asked to verify a bad signature, full version" do
32
+ expect { subject.verify_attached(bad_signature + message) }.to raise_exception RbNaCl::BadSignatureError
33
+ end
34
+
27
35
  it "raises when asked to verify a short signature" do
28
36
  expect { subject.verify(bad_signature[0, 63], message) }.to raise_exception RbNaCl::LengthError
29
37
  end
30
38
 
39
+ it "raises when asked to verify a nil signed message" do
40
+ expect { subject.verify_attached(nil) }.to raise_exception RbNaCl::LengthError
41
+ end
42
+
43
+ it "raises when asked to verify too short signed message" do
44
+ expect { subject.verify_attached(signature) }.to raise_exception RbNaCl::LengthError
45
+ end
46
+
31
47
  it "serializes to bytes" do
32
48
  expect(subject.to_bytes).to eq verify_key
33
49
  end
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: 7.0.0
4
+ version: 7.1.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: 2019-05-23 00:00:00.000000000 Z
12
+ date: 2020-01-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -135,10 +135,15 @@ files:
135
135
  - spec/spec_helper.rb
136
136
  - tasks/rspec.rake
137
137
  - tasks/rubocop.rake
138
- homepage: https://github.com/crypto-rb/rbnacl
138
+ homepage: https://github.com/RubyCrypto/rbnacl
139
139
  licenses:
140
140
  - MIT
141
- metadata: {}
141
+ metadata:
142
+ bug_tracker_uri: https://github.com/RubyCrypto/rbnacl/issues
143
+ changelog_uri: https://github.com/RubyCrypto/rbnacl/blob/master/CHANGES.md
144
+ documentation_uri: https://www.rubydoc.info/gems/rbnacl/7.1.1
145
+ source_code_uri: https://github.com/RubyCrypto/rbnacl/tree/v7.1.1
146
+ wiki_uri: https://github.com/RubyCrypto/rbnacl/wiki
142
147
  post_install_message:
143
148
  rdoc_options: []
144
149
  require_paths:
@@ -154,8 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
159
  - !ruby/object:Gem::Version
155
160
  version: '0'
156
161
  requirements: []
157
- rubyforge_project:
158
- rubygems_version: 2.7.4
162
+ rubygems_version: 3.0.3
159
163
  signing_key:
160
164
  specification_version: 4
161
165
  summary: Ruby binding to the libsodium/NaCl cryptography library