reversible_cryptography 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 0a1bc771be00aef60470442376155e0cec258ec1
4
- data.tar.gz: 8c48415de0490c13fe08d360c51a63859d8d5753
3
+ metadata.gz: 7cf705c97fa1a7cadab65c8e9284cadfbff63752
4
+ data.tar.gz: 58a7ecb70dee65625fa853a56ec18deb0405332b
5
5
  SHA512:
6
- metadata.gz: 05e39700d448039ad725609669d14e4fb45cf499023bf3353fb8fa31a58e37b1d174afd45879830f69317a83c70646135d72b36695acd5ca4032e1ede22773ea
7
- data.tar.gz: d86f76c63aa4f308baa28b3e3459d59686d21fe010abe378992c59d312655648dc22da928bd5d8b472ce03a186cb0d647c69d1e79cc0cae1dd129c1e48fefcc8
6
+ metadata.gz: 18e1dadffd3a182f6ae8f1264fb4b4b4a021ccaf362b9a148c64eff2363994e7949e2bcdcbe86a940dc41283ffc447b460bbf617922ec4b9a2bdfbfb67df507a
7
+ data.tar.gz: d3bf71b3e13cbea75222ec3b6adbc5dafd752c44d6eaba9253d5847b0a48a9a0cb25eef963808342831dede33f708f317a2d624f2df6da25784083312e825e91
data/README.md CHANGED
@@ -35,6 +35,7 @@ $ reversible_cryptography
35
35
 
36
36
  Commands:
37
37
  reversible_cryptography decrypt [TEXT] # Decrypt text or file
38
+ reversible_cryptography edit FILE # Edit encrypted file
38
39
  reversible_cryptography encrypt [TEXT] # Encrypt text or file
39
40
  reversible_cryptography help [COMMAND] # Describe available commands or one specific command
40
41
  ```
@@ -75,6 +76,16 @@ cat decrypted.txt
75
76
  this is secret!
76
77
  ```
77
78
 
79
+ #### Edit sample
80
+ ```shell
81
+ cat encrypted.txt
82
+ md5:f5b013aca1b774be3d3b5f09f76e6cc8:salt:228-129-190-248-134-146-102-97:aes-256-cfb:u+lhtAdW6Re8br0qePqzig==
83
+
84
+ reversible_cryptography edit encrypted.txt --password=pass --editor=vim
85
+
86
+ # modify encrypted.txt
87
+ ```
88
+
78
89
  ## Development
79
90
 
80
91
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -42,5 +42,27 @@ module ReversibleCryptography
42
42
  puts plain_text
43
43
  end
44
44
  end
45
+
46
+ desc "edit FILE", "Edit encrypted file"
47
+ option :password, type: :string, aliases: [:p]
48
+ option :editor, type: :string, aliases: [:e]
49
+ def edit(encrypted_file)
50
+ password = options[:password]
51
+ password ||= ask("Input password:", echo: false).tap { puts }
52
+ editor_command = options[:editor] || ENV['EDITOR']
53
+
54
+ Tempfile.open('decrypted_text') do |fp|
55
+ decrypted_text = ReversibleCryptography::Message.decrypt(File.read(encrypted_file), password)
56
+ fp.write(decrypted_text)
57
+ fp.close
58
+
59
+ system("#{editor_command} #{fp.path}")
60
+ encrypted_text = ReversibleCryptography::Message.encrypt(File.read(fp.path), password)
61
+
62
+ File.open(encrypted_file, "wb") do |f|
63
+ f.write(encrypted_text)
64
+ end
65
+ end
66
+ end
45
67
  end
46
68
  end
@@ -1,3 +1,3 @@
1
1
  module ReversibleCryptography
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reversible_cryptography
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takumi MIURA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-05-09 00:00:00.000000000 Z
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.4.5
110
+ rubygems_version: 2.5.1
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: A Símplifìed reversible encryption solution