eth 0.4.5 → 0.4.6

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: db681a04d032e6f5fc0b19b80a25669320bab4d8
4
- data.tar.gz: 857cc5096068957845b303f52b52395dfc04de7f
3
+ metadata.gz: 0c5f0d8fb53ed83ac74dbcb8d22159f0345adcec
4
+ data.tar.gz: 6903709ca948490f7060ecef87dd1e213fda1c08
5
5
  SHA512:
6
- metadata.gz: e90c62afa17c4b32bca70b794bd8e71fb197d238461b1b970e901cc74d06c43be8253770936a5afd4f82907759dfb6ab5901ab3da5fa9f9f1b3c16ac557a7648
7
- data.tar.gz: '0528a1f59dd00444ad06734863de6f0a271f5c1b351eb3579b3e12343bb48a5bc1d78a94cabede50680d638b55282e0e0c18f8c6d51b39b344c44ed19075e40c'
6
+ metadata.gz: b4558847999d40a3bde43a4704767bf66afc7a32d719c87f2ee75008879bd73d598225de09980bd0087143b415ef21bc76ed83fd41c192a6a0ba797ad4ac848a
7
+ data.tar.gz: 111d01b2f8cf20d3a25bfcb9f098b1e643892dfe0d45a90c17d49a477ebca1259a13f775d3d22eaeeb8354aad6246ed5c543dae3b379bbb25fa6f6a42fdc435f
@@ -4,7 +4,20 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
- ## [Unreleased]
7
+ ## [0.4.6]
8
+
9
+ ### Added
10
+ - Support scrypt private key decryption
11
+
12
+ ## [0.4.5]
13
+
14
+ ### Changed
15
+ - Further improve Open SSL configurability
16
+
17
+ ## [0.4.4]
18
+
19
+ ### Changed
20
+ - Support old versions of SSL to help avoid preious breaking changes
8
21
 
9
22
  ## [0.4.3]
10
23
 
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency 'ffi', '~> 1.0'
24
24
  spec.add_dependency 'money-tree', '~> 0.9'
25
25
  spec.add_dependency 'rlp', '~> 0.7.3'
26
+ spec.add_dependency 'scrypt', '~> 3.0.5'
26
27
 
27
28
  spec.add_development_dependency 'bundler', '~> 1.12'
28
29
  spec.add_development_dependency 'pry', '~> 0.1'
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'scrypt'
2
3
 
3
4
  class Eth::Key::Decrypter
4
5
  include Eth::Utils
@@ -24,7 +25,15 @@ class Eth::Key::Decrypter
24
25
  attr_reader :data, :key, :password
25
26
 
26
27
  def derive_key(password)
27
- @key = OpenSSL::PKCS5.pbkdf2_hmac(password, salt, iterations, key_length, digest)
28
+ case kdf
29
+ when 'pbkdf2'
30
+ @key = OpenSSL::PKCS5.pbkdf2_hmac(password, salt, iterations, key_length, digest)
31
+ when 'scrypt'
32
+ # OpenSSL 1.1 inclues OpenSSL::KDF.scrypt, but it is not available usually, otherwise we could do: OpenSSL::KDF.scrypt(password, salt: salt, N: n, r: r, p: p, length: key_length)
33
+ @key = SCrypt::Engine.scrypt(password, salt, n, r, p, key_length)
34
+ else
35
+ raise "Unsupported key derivation function: #{kdf}!"
36
+ end
28
37
  end
29
38
 
30
39
  def check_macs
@@ -72,8 +81,24 @@ class Eth::Key::Decrypter
72
81
  crypto_data['kdfparams']['c'].to_i
73
82
  end
74
83
 
84
+ def kdf
85
+ crypto_data['kdf']
86
+ end
87
+
75
88
  def key_length
76
- 32
89
+ crypto_data['kdfparams']['dklen'].to_i
90
+ end
91
+
92
+ def n
93
+ crypto_data['kdfparams']['n'].to_i
94
+ end
95
+
96
+ def r
97
+ crypto_data['kdfparams']['r'].to_i
98
+ end
99
+
100
+ def p
101
+ crypto_data['kdfparams']['p'].to_i
77
102
  end
78
103
 
79
104
  def digest
@@ -83,5 +108,6 @@ class Eth::Key::Decrypter
83
108
  def digest_name
84
109
  "sha256"
85
110
  end
111
+
86
112
 
87
113
  end
@@ -1,3 +1,3 @@
1
1
  module Eth
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Ellis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-11 00:00:00.000000000 Z
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: digest-sha3
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.7.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: scrypt
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 3.0.5
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.5
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement