ncypher 1.1.0 → 1.2.0

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
  SHA256:
3
- metadata.gz: 4f5677085002a6face9c3bd0fc903a133083a78ef690e960fc24c8386e8061b8
4
- data.tar.gz: 3e834ad55b6e82f468a386b8bb1b882dff6867b45c0890ed1d232b9c7c82ada5
3
+ metadata.gz: 868bcb19ae0d6aea28005adc399f21ca2dd461663ff9cbaf8e7a3a767734052b
4
+ data.tar.gz: 830d632e5fc2f119e6768ae7e115c2cfccdac0fa017379241ef6397c418923d1
5
5
  SHA512:
6
- metadata.gz: 9ac7263205dc795be80d00b3f6afc8e61bd27fb184b06adf041e9d11e79a789a25c15d803c8e1dcb351a32a797b41858893a338be66eb55ce8cff02f68c0a094
7
- data.tar.gz: c33dded92dd324931b7d945c27473065687a1009a584db95fa4b7c79aaf77eb8f33e8429dc2f8a17c446d3d9203d73a2c69c093d41eb77f99b935736ddb863b5
6
+ metadata.gz: f8525b09eebde943e697c665c813ab6814eb867fddef0bd7f0e864c3aa0d293a7c55da4ba2557793246f23a70642fc7229a949be3b2514530670789358a0be11
7
+ data.tar.gz: ddff860755ae08603db392033d72583766e34efaa758f0044be4e0e0deab29afea9f669833dd2cc73f96c01029de8854aead7b576147a98cd1280cc2e0e70517
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  # Ncypher
5
5
 
6
- Ncypher is a gem to help you to encrypt your credentials in your ruby apps in a safe manner.
6
+ Ncypher is a gem to help you to encrypt your credentials in your projects in a safe manner.
7
7
 
8
8
  ## Upgrade from versions before 1.0
9
9
  Versions before 1.0 were using rbnacl-libsodium gem which is now deprecated.
@@ -40,8 +40,8 @@ You can also set the env variable `NCYPHER_KEY` to that generated key (i.e `expo
40
40
 
41
41
  To encrypt a new password (or anything else), ncypher supports stdin. So you can do:
42
42
  ```
43
- $> cat secret_file | ncypher encrypt > secret_file.encrypted
44
- $> cat secret_file.encrypted | ncypher decrypt > secret_file
43
+ $> ncypher encrypt < secret_file > secret_file.encrypted
44
+ $> ncypher decrypt < secret_file.encrypted > secret_file
45
45
  $> ncypher encrypt
46
46
  mypassword
47
47
  <CTRL+D>
@@ -69,7 +69,7 @@ p4$$w0rd
69
69
 
70
70
  :)
71
71
 
72
- And Ncypher::Ncypher.decrypt will magically use your key in `.ncypher_key` to decrypt that password at runtime.
72
+ And if you are using ruby, Ncypher::Ncypher.decrypt will magically use your key in `.ncypher_key` to decrypt that password at runtime.
73
73
  Now you can directy put in your .yaml files:
74
74
  ```
75
75
  defaults: &defaults
@@ -94,8 +94,14 @@ $> ncypher derive_key p4$$w0rd > .ncypher_key
94
94
  SALT: WKCAkJcS65nx3lA/w1BmBw==
95
95
  ```
96
96
 
97
- Then you have the ncypher\_key in .ncypher\_key. Be sure to save the salt if you want to be able to derive back the exact same key in the future.
97
+ Then you have the ncypher\_key in .ncypher\_key. Be sure to save the salt if you want to be able to derive back the exact same key in the future.
98
+ The derive_key command also listen to stdin so for safety you can instead do:
98
99
 
100
+ ```
101
+ $> ncypher derive_key > .ncypher_key
102
+ ```
103
+
104
+ And enter your password then CTRL+D.
99
105
 
100
106
  ## Contributing
101
107
 
@@ -7,8 +7,6 @@ rescue NameError
7
7
  require "bundler/setup"
8
8
  end
9
9
 
10
- SUB_COMMANDS = %w(generate_key encrypt decrypt)
11
-
12
10
  if ARGV.empty?
13
11
  STDERR.puts "Ncypher a credential encryption tool"
14
12
  STDERR.puts "usage: ncypher generate_key"
@@ -24,7 +22,7 @@ case cmd
24
22
  when "generate_key"
25
23
  puts Ncypher::Ncypher.new.generate_key
26
24
  when "derive_key"
27
- password = ARGV.shift
25
+ password = (ARGV.shift || STDIN.read)
28
26
  unless password
29
27
  abort "ncypher derive_key <password> [salt]"
30
28
  end
@@ -20,7 +20,8 @@ module Ncypher
20
20
  end
21
21
 
22
22
  def generate_key
23
- generated_key = RbNaCl::Random.random_bytes(RbNaCl::SecretBox.key_bytes)
23
+ digest_size = 32 # RbNaCl::SecretBox.key_bytes
24
+ generated_key = RbNaCl::Random.random_bytes(digest_size)
24
25
  Base64.strict_encode64(generated_key)
25
26
  end
26
27
 
@@ -1,3 +1,3 @@
1
1
  module Ncypher
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.license = 'WTFPL'
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 2.0"
23
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rake", "~> 12.3.3"
24
24
  spec.add_development_dependency "minitest", "~> 5.0"
25
25
 
26
26
  spec.add_dependency 'rbnacl', '~> 7.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncypher
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hagege
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-15 00:00:00.000000000 Z
11
+ date: 2021-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement