ed25519 1.1.0-jruby → 1.2.0-jruby
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +10 -0
- data/README.md +1 -1
- data/lib/ed25519.rb +7 -0
- data/lib/ed25519/signing_key.rb +14 -2
- data/lib/ed25519/verify_key.rb +1 -1
- data/lib/ed25519/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76ca0515a8683246d8e7fbc1c07146be0e54a792
|
4
|
+
data.tar.gz: 86b5e56ebbaa380f439d950e8766c7f04d06b7eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15e69cdf0fe054a0e141110244751cb35c0f35de1ae77255e74ecbdfb1a13db0454865683f3ec9f60d5bc60b5f3c7467808a04768762175feb081123eba86215
|
7
|
+
data.tar.gz: eef82ce281c07cba960ff9e49323c54fcb3fd5da313110256a7b838cafd628567c47ae29a25d172e05771232a323a9570bd42b9f9c0d1c98975fb79e79098253
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# [1.2.0] (2017-12-15)
|
2
|
+
|
3
|
+
[1.2.0]: https://github.com/cryptosphere/x25519/compare/v1.1.0...v1.2.0
|
4
|
+
|
5
|
+
* [#13](https://github.com/cryptosphere/ed25519/pull/13)
|
6
|
+
Add `Ed25519::SigningKey.from_keypair`
|
7
|
+
|
8
|
+
* [#12](https://github.com/cryptosphere/ed25519/pull/12)
|
9
|
+
Add `Ed25519.validate_key_bytes` method
|
10
|
+
|
1
11
|
# [1.1.0] (2017-12-13)
|
2
12
|
|
3
13
|
[1.1.0]: https://github.com/cryptosphere/x25519/compare/v1.0.0...v1.1.0
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
[build-image]: https://travis-ci.org/cryptosphere/ed25519.svg?branch=master
|
6
6
|
[build-link]: https://travis-ci.org/cryptosphere/ed25519
|
7
7
|
[docs-image]: https://img.shields.io/badge/yard-docs-blue.svg
|
8
|
-
[docs-link]: http://www.rubydoc.info/gems/ed25519
|
8
|
+
[docs-link]: http://www.rubydoc.info/gems/ed25519/1.2.0
|
9
9
|
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg
|
10
10
|
[license-link]: https://github.com/cryptosphere/ed25519/blob/master/LICENSE
|
11
11
|
|
data/lib/ed25519.rb
CHANGED
@@ -35,6 +35,13 @@ module Ed25519
|
|
35
35
|
self.provider = Ed25519::Provider::Ref10
|
36
36
|
end
|
37
37
|
|
38
|
+
# Ensure a serialized key meets the requirements
|
39
|
+
def validate_key_bytes(key_bytes)
|
40
|
+
raise TypeError, "expected String, got #{key_bytes.class}" unless key_bytes.is_a?(String)
|
41
|
+
return true if key_bytes.bytesize == KEY_SIZE
|
42
|
+
raise ArgumentError, "expected #{KEY_SIZE}-byte String, got #{key_bytes.bytesize}"
|
43
|
+
end
|
44
|
+
|
38
45
|
# Perform a self-test to ensure the selected provider is working
|
39
46
|
def self_test
|
40
47
|
signature_key = Ed25519::SigningKey.new("A" * 32)
|
data/lib/ed25519/signing_key.rb
CHANGED
@@ -12,13 +12,25 @@ module Ed25519
|
|
12
12
|
new SecureRandom.random_bytes(Ed25519::KEY_SIZE)
|
13
13
|
end
|
14
14
|
|
15
|
+
# Create a SigningKey from a 64-byte Ed25519 keypair (i.e. public + private)
|
16
|
+
#
|
17
|
+
# @param keypair [String] 64-byte keypair value containing both seed + public key
|
18
|
+
def self.from_keypair(keypair)
|
19
|
+
raise TypeError, "expected String, got #{keypair.class}" unless keypair.is_a?(String)
|
20
|
+
raise ArgumentError, "expected 64-byte String, got #{keypair.bytesize}" unless keypair.bytesize == 64
|
21
|
+
|
22
|
+
new(keypair[0, KEY_SIZE]).tap do |key|
|
23
|
+
raise ArgumentError, "corrupt keypair" unless keypair[KEY_SIZE, KEY_SIZE] == key.verify_key.to_bytes
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
15
27
|
# Create a new Ed25519::SigningKey from the given seed value
|
16
28
|
#
|
17
29
|
# @param seed [String] 32-byte seed value from which the key should be derived
|
18
30
|
def initialize(seed)
|
19
|
-
|
20
|
-
@seed = seed
|
31
|
+
Ed25519.validate_key_bytes(seed)
|
21
32
|
|
33
|
+
@seed = seed
|
22
34
|
@keypair = Ed25519.provider.create_keypair(seed)
|
23
35
|
@verify_key = VerifyKey.new(@keypair[32, 32])
|
24
36
|
end
|
data/lib/ed25519/verify_key.rb
CHANGED
data/lib/ed25519/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ed25519
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: jruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|