hrr_rb_ssh-ed25519 0.4.0.pre2 → 0.4.0.pre3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8f8f27834eaf0442266dbfb7316a883ad2817ecd8179fe9a3305e33b1d2dc36
|
4
|
+
data.tar.gz: 66d4d0e6c6b931bb519d080e8f940ff077645efa5958f9722f8a7b9ce31b7a69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7864678d6b56c3ffb2fa394d30a283961f781486b2c14646724d5059c467cbade1b0d3ab965e41c1d9a6809606b5d00f817844b5bd864aac5076bdf62e419bc1
|
7
|
+
data.tar.gz: aeecab19c96889503f262cd4b523c9cff46869805246dca4355c7fc13013cb5ec26a2b3fd81a04d004df78603dd375236d137b44470be5453c800cdaa565fd44
|
@@ -21,12 +21,12 @@ module HrrRbSsh
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def new_by_key_str key_str
|
24
|
-
@publickey = PKey.new
|
24
|
+
@publickey = PKey.new key_str, logger: logger
|
25
25
|
end
|
26
26
|
|
27
27
|
def new_by_public_key_blob public_key_blob
|
28
|
-
public_key_blob_h = PublicKeyBlob.decode
|
29
|
-
@publickey = PKey.new
|
28
|
+
public_key_blob_h = PublicKeyBlob.decode public_key_blob, logger: logger
|
29
|
+
@publickey = PKey.new logger: logger
|
30
30
|
@publickey.set_public_key(public_key_blob_h[:key])
|
31
31
|
end
|
32
32
|
|
@@ -39,7 +39,7 @@ module HrrRbSsh
|
|
39
39
|
:'public key algorithm name' => self.class::NAME,
|
40
40
|
:'key' => @publickey.public_key.key_str,
|
41
41
|
}
|
42
|
-
PublicKeyBlob.encode
|
42
|
+
PublicKeyBlob.encode public_key_blob_h, logger: logger
|
43
43
|
end
|
44
44
|
|
45
45
|
def sign signature_blob
|
@@ -47,11 +47,11 @@ module HrrRbSsh
|
|
47
47
|
:'public key algorithm name' => self.class::NAME,
|
48
48
|
:'signature blob' => @publickey.sign(signature_blob),
|
49
49
|
}
|
50
|
-
Signature.encode signature_h
|
50
|
+
Signature.encode signature_h, logger: logger
|
51
51
|
end
|
52
52
|
|
53
53
|
def verify signature, signature_blob
|
54
|
-
signature_h = Signature.decode signature
|
54
|
+
signature_h = Signature.decode signature, logger: logger
|
55
55
|
signature_h[:'public key algorithm name'] == self.class::NAME && @publickey.public_key.verify(signature_h[:'signature blob'], signature_blob)
|
56
56
|
end
|
57
57
|
end
|
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'stringio'
|
5
5
|
require 'base64'
|
6
6
|
require 'ed25519'
|
7
|
+
require 'hrr_rb_ssh/loggable'
|
7
8
|
|
8
9
|
module HrrRbSsh
|
9
10
|
module Algorithm
|
@@ -13,7 +14,10 @@ module HrrRbSsh
|
|
13
14
|
class Error < ::StandardError
|
14
15
|
end
|
15
16
|
|
16
|
-
|
17
|
+
include Loggable
|
18
|
+
|
19
|
+
def initialize arg=nil, logger: nil
|
20
|
+
self.logger = logger
|
17
21
|
case arg
|
18
22
|
when ::Ed25519::SigningKey, ::Ed25519::VerifyKey
|
19
23
|
@key = arg
|
@@ -46,8 +50,8 @@ module HrrRbSsh
|
|
46
50
|
decoded_key_str = Base64.decode64(key_str[begin_marker.size...-end_marker.size])
|
47
51
|
raise Error unless decoded_key_str[0,14] == magic
|
48
52
|
|
49
|
-
private_key_h = OpenSSHPrivateKey.decode decoded_key_str[15..-1]
|
50
|
-
private_key_content_h = OpenSSHPrivateKeyContent.decode private_key_h[:'content']
|
53
|
+
private_key_h = OpenSSHPrivateKey.decode decoded_key_str[15..-1], logger: logger
|
54
|
+
private_key_content_h = OpenSSHPrivateKeyContent.decode private_key_h[:'content'], logger: logger
|
51
55
|
key_pair = private_key_content_h[:'key pair']
|
52
56
|
|
53
57
|
::Ed25519::SigningKey.new(key_pair[0,32])
|