rbnacl 3.1.2 → 3.2.0
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/.rubocop.yml +27 -0
- data/.travis.yml +4 -3
- data/CHANGES.md +5 -0
- data/Gemfile +8 -3
- data/Guardfile +1 -1
- data/README.md +5 -6
- data/Rakefile +3 -2
- data/lib/rbnacl.rb +1 -1
- data/lib/rbnacl/auth.rb +21 -8
- data/lib/rbnacl/boxes/curve25519xsalsa20poly1305.rb +17 -13
- data/lib/rbnacl/boxes/curve25519xsalsa20poly1305/private_key.rb +68 -65
- data/lib/rbnacl/boxes/curve25519xsalsa20poly1305/public_key.rb +49 -47
- data/lib/rbnacl/group_elements/curve25519.rb +14 -8
- data/lib/rbnacl/hash.rb +2 -2
- data/lib/rbnacl/hash/blake2b.rb +13 -13
- data/lib/rbnacl/hash/sha256.rb +5 -5
- data/lib/rbnacl/hash/sha512.rb +5 -5
- data/lib/rbnacl/hmac/sha256.rb +12 -11
- data/lib/rbnacl/hmac/sha512256.rb +11 -10
- data/lib/rbnacl/init.rb +1 -1
- data/lib/rbnacl/key_comparator.rb +3 -3
- data/lib/rbnacl/one_time_auths/poly1305.rb +4 -4
- data/lib/rbnacl/password_hash/scrypt.rb +10 -11
- data/lib/rbnacl/random.rb +2 -2
- data/lib/rbnacl/secret_boxes/xsalsa20poly1305.rb +28 -14
- data/lib/rbnacl/self_test.rb +17 -37
- data/lib/rbnacl/serializable.rb +9 -4
- data/lib/rbnacl/signatures/ed25519.rb +1 -0
- data/lib/rbnacl/signatures/ed25519/signing_key.rb +17 -9
- data/lib/rbnacl/signatures/ed25519/verify_key.rb +17 -6
- data/lib/rbnacl/simple_box.rb +6 -3
- data/lib/rbnacl/sodium.rb +6 -7
- data/lib/rbnacl/sodium/version.rb +3 -2
- data/lib/rbnacl/test_vectors.rb +57 -55
- data/lib/rbnacl/util.rb +12 -11
- data/lib/rbnacl/version.rb +3 -1
- data/rbnacl.gemspec +6 -8
- data/spec/rbnacl/authenticators/poly1305_spec.rb +1 -1
- data/spec/rbnacl/boxes/curve25519xsalsa20poly1305/private_key_spec.rb +1 -1
- data/spec/rbnacl/boxes/curve25519xsalsa20poly1305/public_key_spec.rb +1 -1
- data/spec/rbnacl/boxes/curve25519xsalsa20poly1305_spec.rb +2 -2
- data/spec/rbnacl/group_element_spec.rb +1 -1
- data/spec/rbnacl/hash/blake2b_spec.rb +1 -1
- data/spec/rbnacl/hash_spec.rb +1 -1
- data/spec/rbnacl/hmac/sha256_spec.rb +1 -1
- data/spec/rbnacl/hmac/sha512256_spec.rb +1 -1
- data/spec/rbnacl/password_hash/scrypt_spec.rb +3 -3
- data/spec/rbnacl/secret_box_spec.rb +3 -3
- data/spec/rbnacl/signatures/ed25519/signing_key_spec.rb +2 -2
- data/spec/rbnacl/signatures/ed25519/verify_key_spec.rb +12 -7
- data/spec/rbnacl/simple_box_spec.rb +2 -2
- data/spec/rbnacl/util_spec.rb +28 -29
- data/spec/shared/authenticator.rb +12 -12
- data/spec/shared/box.rb +2 -4
- data/spec/spec_helper.rb +11 -18
- data/tasks/rspec.rake +2 -2
- data/tasks/rubocop.rake +1 -1
- metadata +4 -5
- data/lib/rbnacl/rake_tasks.rb +0 -57
- data/tasks/ci.rake +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d579b906e40df02d066ed657b294a03258e973c1
|
4
|
+
data.tar.gz: efa52b89d6fa69c64e353bba805b54da1e4cd75e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc23cabab38ee76841891e5f8ea39c864e2d3053ba70b2b27bce1a4f4699a9260ae20dba5134ecc5eb0264b4d177aae56938aaba8cf94ce20831cf99b3147f81
|
7
|
+
data.tar.gz: c5a70483933ff229e6ef2732d94032a95762c82e37c4fab8d02e551e2b4fc55db1e8706f67ee964d21ccd3f9a40bdc7454473891a1d982bd6479fef24b85e47f
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#
|
2
|
+
# Style
|
3
|
+
#
|
4
|
+
|
5
|
+
# TODO: turn this down
|
6
|
+
LineLength:
|
7
|
+
Max: 150
|
8
|
+
|
9
|
+
Style/StringLiterals:
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Style/SingleSpaceBeforeFirstArg:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Style/GlobalVars:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
#
|
19
|
+
# Metrics
|
20
|
+
#
|
21
|
+
|
22
|
+
Metrics/MethodLength:
|
23
|
+
CountComments: false
|
24
|
+
Max: 25
|
25
|
+
|
26
|
+
Metrics/AbcSize:
|
27
|
+
Max: 20
|
data/.travis.yml
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
script:
|
1
|
+
script: bundle exec rake ci
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 1.9.3
|
5
4
|
- 2.0.0
|
6
|
-
- 2.1.
|
5
|
+
- 2.1.4
|
6
|
+
- 2.2.2
|
7
7
|
- ruby-head
|
8
8
|
- jruby
|
9
9
|
- jruby-head
|
10
10
|
- rbx-2
|
11
11
|
|
12
12
|
matrix:
|
13
|
+
fast_finish: true
|
13
14
|
allow_failures:
|
14
15
|
- rvm: ruby-head
|
15
16
|
- rvm: jruby-head
|
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in rbnacl.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
group :development do
|
7
|
-
gem
|
7
|
+
gem "guard-rspec"
|
8
8
|
end
|
9
9
|
|
10
10
|
group :test do
|
11
|
-
gem
|
11
|
+
gem "coveralls", require: false
|
12
|
+
gem "rbnacl-libsodium"
|
13
|
+
end
|
14
|
+
|
15
|
+
group :development, :test do
|
16
|
+
gem "rubocop"
|
12
17
|
end
|
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|

|
2
2
|
======
|
3
|
-
[](http://badge.fury.io/rb/rbnacl)
|
4
|
+
[](https://travis-ci.org/cryptosphere/rbnacl)
|
5
|
+
[](https://codeclimate.com/github/cryptosphere/rbnacl)
|
6
|
+
[](https://coveralls.io/r/cryptosphere/rbnacl)
|
7
7
|
|
8
8
|
A Ruby binding to the state-of-the-art [Networking and Cryptography][nacl]
|
9
9
|
library by [Daniel J. Bernstein][djb]. This is **NOT** Google Native Client.
|
@@ -55,8 +55,7 @@ For more information on NaCl's goals, see Dan Bernstein's presentation
|
|
55
55
|
You can use RbNaCl anywhere you can get libsodium installed (see below).
|
56
56
|
RbNaCl is continuously integration tested on the following Ruby VMs:
|
57
57
|
|
58
|
-
* MRI 2.0, 2.1
|
59
|
-
* MRI 1.9 (YARV)
|
58
|
+
* MRI 2.0, 2.1, 2.2
|
60
59
|
* JRuby 1.7 (in both 1.8/1.9 mode)
|
61
60
|
* Rubinius HEAD (in both 1.8/1.9 mode)
|
62
61
|
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
|
2
3
|
Dir[File.expand_path("../tasks/**/*.rake", __FILE__)].each { |task| load task }
|
3
|
-
require File.expand_path("../lib/rbnacl/rake_tasks", __FILE__)
|
4
4
|
|
5
|
-
task :
|
5
|
+
task default: %w(spec rubocop)
|
6
|
+
task ci: %w(spec rubocop)
|
data/lib/rbnacl.rb
CHANGED
@@ -11,6 +11,7 @@ require "rbnacl/simple_box"
|
|
11
11
|
require "rbnacl/test_vectors"
|
12
12
|
require "rbnacl/init"
|
13
13
|
|
14
|
+
# NaCl/libsodium for Ruby
|
14
15
|
module RbNaCl
|
15
16
|
# Oh no, something went wrong!
|
16
17
|
#
|
@@ -37,7 +38,6 @@ module RbNaCl
|
|
37
38
|
# The authenticator was forged or otherwise corrupt
|
38
39
|
class BadAuthenticatorError < CryptoError; end
|
39
40
|
|
40
|
-
|
41
41
|
# Public Key Encryption (Box): Curve25519XSalsa20Poly1305
|
42
42
|
require "rbnacl/boxes/curve25519xsalsa20poly1305"
|
43
43
|
require "rbnacl/boxes/curve25519xsalsa20poly1305/private_key"
|
data/lib/rbnacl/auth.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# encoding: binary
|
2
2
|
module RbNaCl
|
3
|
-
|
4
3
|
# Secret Key Authenticators
|
5
4
|
#
|
6
5
|
# These provide a means of verifying the integrity of a message, but only
|
@@ -71,7 +70,7 @@ module RbNaCl
|
|
71
70
|
def verify(authenticator, message)
|
72
71
|
auth = authenticator.to_s
|
73
72
|
Util.check_length(auth, tag_bytes, "Provided authenticator")
|
74
|
-
verify_message(auth, message) ||
|
73
|
+
verify_message(auth, message) || fail(BadAuthenticatorError, "Invalid authenticator provided, message is corrupt")
|
75
74
|
end
|
76
75
|
|
77
76
|
# The crypto primitive for this authenticator instance
|
@@ -84,25 +83,39 @@ module RbNaCl
|
|
84
83
|
# The number of key bytes for this Auth class
|
85
84
|
#
|
86
85
|
# @return [Integer] number of key bytes
|
87
|
-
def self.key_bytes
|
86
|
+
def self.key_bytes
|
87
|
+
self::KEYBYTES
|
88
|
+
end
|
88
89
|
|
89
90
|
# The number of key bytes for this Auth instance
|
90
91
|
#
|
91
92
|
# @return [Integer] number of key bytes
|
92
|
-
def key_bytes
|
93
|
+
def key_bytes
|
94
|
+
self.class.key_bytes
|
95
|
+
end
|
93
96
|
|
94
97
|
# The number bytes in the tag or authenticator from this Auth class
|
95
98
|
#
|
96
99
|
# @return [Integer] number of tag bytes
|
97
|
-
def self.tag_bytes
|
100
|
+
def self.tag_bytes
|
101
|
+
self::BYTES
|
102
|
+
end
|
98
103
|
|
99
104
|
# The number of bytes in the tag or authenticator for this Auth instance
|
100
105
|
#
|
101
106
|
# @return [Integer] number of tag bytes
|
102
|
-
def tag_bytes
|
107
|
+
def tag_bytes
|
108
|
+
self.class.tag_bytes
|
109
|
+
end
|
103
110
|
|
104
111
|
private
|
105
|
-
|
106
|
-
def
|
112
|
+
|
113
|
+
def compute_authenticator(_authenticator, _message)
|
114
|
+
fail NotImplementedError
|
115
|
+
end
|
116
|
+
|
117
|
+
def verify_message(_authenticator, _message)
|
118
|
+
fail NotImplementedError
|
119
|
+
end
|
107
120
|
end
|
108
121
|
end
|
@@ -80,7 +80,7 @@ module RbNaCl
|
|
80
80
|
sodium_function :box_curve25519xsalsa20poly1305_open_afternm,
|
81
81
|
:crypto_box_curve25519xsalsa20poly1305_open_afternm,
|
82
82
|
[:pointer, :pointer, :ulong_long, :pointer, :pointer]
|
83
|
-
|
83
|
+
|
84
84
|
sodium_function :box_curve25519xsalsa20poly1305_afternm,
|
85
85
|
:crypto_box_curve25519xsalsa20poly1305_afternm,
|
86
86
|
[:pointer, :pointer, :ulong_long, :pointer, :pointer]
|
@@ -97,9 +97,9 @@ module RbNaCl
|
|
97
97
|
#
|
98
98
|
# @return [RbNaCl::Box] The new Box, ready to use
|
99
99
|
def initialize(public_key, private_key)
|
100
|
-
@public_key = PublicKey
|
101
|
-
@private_key = PrivateKey
|
102
|
-
|
100
|
+
@public_key = public_key.is_a?(PublicKey) ? public_key : PublicKey.new(public_key)
|
101
|
+
@private_key = private_key.is_a?(PrivateKey) ? private_key : PrivateKey.new(private_key)
|
102
|
+
fail IncorrectPrimitiveError unless @public_key.primitive == primitive && @private_key.primitive == primitive
|
103
103
|
end
|
104
104
|
|
105
105
|
# Encrypts a message
|
@@ -121,10 +121,10 @@ module RbNaCl
|
|
121
121
|
msg = Util.prepend_zeros(ZEROBYTES, message)
|
122
122
|
ct = Util.zeros(msg.bytesize)
|
123
123
|
|
124
|
-
self.class.box_curve25519xsalsa20poly1305_afternm(ct, msg, msg.bytesize, nonce, beforenm) ||
|
124
|
+
self.class.box_curve25519xsalsa20poly1305_afternm(ct, msg, msg.bytesize, nonce, beforenm) || fail(CryptoError, "Encryption failed")
|
125
125
|
Util.remove_zeros(BOXZEROBYTES, ct)
|
126
126
|
end
|
127
|
-
|
127
|
+
alias_method :encrypt, :box
|
128
128
|
|
129
129
|
# Decrypts a ciphertext
|
130
130
|
#
|
@@ -145,10 +145,12 @@ module RbNaCl
|
|
145
145
|
ct = Util.prepend_zeros(BOXZEROBYTES, ciphertext)
|
146
146
|
message = Util.zeros(ct.bytesize)
|
147
147
|
|
148
|
-
self.class.box_curve25519xsalsa20poly1305_open_afternm(message, ct, ct.bytesize, nonce, beforenm)
|
148
|
+
success = self.class.box_curve25519xsalsa20poly1305_open_afternm(message, ct, ct.bytesize, nonce, beforenm)
|
149
|
+
fail CryptoError, "Decryption failed. Ciphertext failed verification." unless success
|
150
|
+
|
149
151
|
Util.remove_zeros(ZEROBYTES, message)
|
150
152
|
end
|
151
|
-
|
153
|
+
alias_method :decrypt, :open
|
152
154
|
|
153
155
|
# The crypto primitive for the box class
|
154
156
|
#
|
@@ -172,12 +174,14 @@ module RbNaCl
|
|
172
174
|
end
|
173
175
|
|
174
176
|
private
|
177
|
+
|
175
178
|
def beforenm
|
176
|
-
@
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
179
|
+
@_key ||= begin
|
180
|
+
key = Util.zeros(BEFORENMBYTES)
|
181
|
+
success = self.class.box_curve25519xsalsa20poly1305_beforenm(key, @public_key.to_s, @private_key.to_s)
|
182
|
+
fail CryptoError, "Failed to derive shared key" unless success
|
183
|
+
key
|
184
|
+
end
|
181
185
|
end
|
182
186
|
end
|
183
187
|
end
|
@@ -1,79 +1,82 @@
|
|
1
1
|
# encoding: binary
|
2
2
|
|
3
3
|
module RbNaCl
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
module Boxes
|
5
|
+
class Curve25519XSalsa20Poly1305
|
6
|
+
# RbNaCl::Box private key. Keep it safe
|
7
|
+
#
|
8
|
+
# This class generates and stores NaCL private keys, as well as providing a
|
9
|
+
# reference to the public key associated with this private key, if that's
|
10
|
+
# provided.
|
11
|
+
#
|
12
|
+
# Note that the documentation for NaCl refers to this as a secret key, but in
|
13
|
+
# this library its a private key, to avoid confusing the issue with the
|
14
|
+
# SecretBox, which does symmetric encryption.
|
15
|
+
class PrivateKey
|
16
|
+
include KeyComparator
|
17
|
+
include Serializable
|
14
18
|
|
15
|
-
|
16
|
-
include Serializable
|
17
|
-
|
18
|
-
extend Sodium
|
19
|
+
extend Sodium
|
19
20
|
|
20
|
-
|
21
|
-
|
21
|
+
sodium_type :box
|
22
|
+
sodium_primitive :curve25519xsalsa20poly1305
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
sodium_function :box_curve25519xsalsa20poly1305_keypair,
|
25
|
+
:crypto_box_curve25519xsalsa20poly1305_keypair,
|
26
|
+
[:pointer, :pointer]
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
# The size of the key, in bytes
|
29
|
+
BYTES = Boxes::Curve25519XSalsa20Poly1305::PRIVATEKEYBYTES
|
29
30
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
31
|
+
# Initializes a new PrivateKey for key operations.
|
32
|
+
#
|
33
|
+
# Takes the (optionally encoded) private key bytes. This class can then be
|
34
|
+
# used for various key operations, including deriving the corresponding
|
35
|
+
# PublicKey
|
36
|
+
#
|
37
|
+
# @param private_key [String] The private key
|
38
|
+
#
|
39
|
+
# @raise [TypeError] If the key is nil
|
40
|
+
# @raise [RbNaCl::LengthError] If the key is not valid after decoding.
|
41
|
+
#
|
42
|
+
# @return A new PrivateKey
|
43
|
+
def initialize(private_key)
|
44
|
+
@private_key = Util.check_string(private_key, BYTES, "Private key")
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
# Generates a new keypair
|
48
|
+
#
|
49
|
+
# @raise [RbNaCl::CryptoError] if key generation fails, due to insufficient randomness.
|
50
|
+
#
|
51
|
+
# @return [RbNaCl::PrivateKey] A new private key, with the associated public key also set.
|
52
|
+
def self.generate
|
53
|
+
pk = Util.zeros(Boxes::Curve25519XSalsa20Poly1305::PUBLICKEYBYTES)
|
54
|
+
sk = Util.zeros(Boxes::Curve25519XSalsa20Poly1305::PRIVATEKEYBYTES)
|
55
|
+
box_curve25519xsalsa20poly1305_keypair(pk, sk) || fail(CryptoError, "Failed to generate a key pair")
|
56
|
+
new(sk)
|
57
|
+
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
59
|
+
# The raw bytes of the key
|
60
|
+
#
|
61
|
+
# @return [String] the raw bytes.
|
62
|
+
def to_bytes
|
63
|
+
@private_key
|
64
|
+
end
|
64
65
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
66
|
+
# the public key associated with this private key
|
67
|
+
#
|
68
|
+
# @return [PublicKey] the key
|
69
|
+
def public_key
|
70
|
+
@public_key ||= PublicKey.new GroupElements::Curve25519.base.mult(to_bytes)
|
71
|
+
end
|
72
|
+
|
73
|
+
# The crypto primitive this PrivateKey is to be used for.
|
74
|
+
#
|
75
|
+
# @return [Symbol] The primitive
|
76
|
+
def primitive
|
77
|
+
self.class.primitive
|
78
|
+
end
|
79
|
+
end
|
77
80
|
end
|
78
81
|
end
|
79
82
|
end
|
@@ -1,53 +1,55 @@
|
|
1
1
|
# encoding: binary
|
2
2
|
|
3
3
|
module RbNaCl
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
4
|
+
module Boxes
|
5
|
+
class Curve25519XSalsa20Poly1305
|
6
|
+
# RbNaCl::Box public key. Send it (securely!) to your friends.
|
7
|
+
#
|
8
|
+
# This class stores the NaCL public key, and provides some convenience
|
9
|
+
# functions for working with it.
|
10
|
+
class PublicKey
|
11
|
+
include KeyComparator
|
12
|
+
include Serializable
|
13
|
+
|
14
|
+
# The size of the key, in bytes
|
15
|
+
BYTES = Boxes::Curve25519XSalsa20Poly1305::PUBLICKEYBYTES
|
16
|
+
|
17
|
+
# Initializes a new PublicKey for key operations.
|
18
|
+
#
|
19
|
+
# Takes the (optionally encoded) public key bytes. This can be shared with
|
20
|
+
# many people and used to establish key pairs with their private key, for
|
21
|
+
# the exchanging of messages using a RbNaCl::Box
|
22
|
+
#
|
23
|
+
# @param public_key [String] The public key
|
24
|
+
#
|
25
|
+
# @raise [RbNaCl::LengthError] If the key is not valid after decoding.
|
26
|
+
#
|
27
|
+
# @return A new PublicKey
|
28
|
+
def initialize(public_key)
|
29
|
+
@public_key = Util.check_string(public_key, BYTES, "Public key")
|
30
|
+
end
|
31
|
+
|
32
|
+
# The raw bytes of the key
|
33
|
+
#
|
34
|
+
# @return [String] the raw bytes.
|
35
|
+
def to_bytes
|
36
|
+
@public_key
|
37
|
+
end
|
38
|
+
|
39
|
+
# The crypto primitive the PublicKey class is to be used for
|
40
|
+
#
|
41
|
+
# @return [Symbol] The primitive
|
42
|
+
def self.primitive
|
43
|
+
:curve25519xsalsa20poly1305
|
44
|
+
end
|
45
|
+
|
46
|
+
# The crypto primitive this PublicKey is to be used for.
|
47
|
+
#
|
48
|
+
# @return [Symbol] The primitive
|
49
|
+
def primitive
|
50
|
+
self.class.primitive
|
51
|
+
end
|
52
|
+
end
|
50
53
|
end
|
51
54
|
end
|
52
|
-
|
53
55
|
end
|